Skip to content

Commit

Permalink
Fix namespace on build payment method
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaymo committed Sep 19, 2024
1 parent d87b83e commit a56e39e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Gateway/GatewayModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ public function in3FieldsMandatoryPayForOrder($order)
* @param PaymentFieldsService $paymentFieldsService
* @param Surcharge $surchargeService
* @param array $paymentMethods
* @return PaymentMethodI
* @return PaymentMethodI | array
*/
public function buildPaymentMethod(
string $id,
Expand All @@ -700,10 +700,14 @@ public function buildPaymentMethod(
PaymentFieldsService $paymentFieldsService,
Surcharge $surchargeService,
array $apiMethod
): PaymentMethodI {
$scopedPrefix = array_shift(explode('\\', __NAMESPACE__));
) {
$namespaceParts = explode('\\', __NAMESPACE__);
if (!(count($namespaceParts) >= 2)) {
return [];
}
$scopedPrefix = $namespaceParts[0] . '\\' . $namespaceParts[1];
$transformedId = ucfirst($id);
$paymentMethodClassName = $scopedPrefix . '\\Mollie\\WooCommerce\\PaymentMethods\\' . $transformedId;
$paymentMethodClassName = $scopedPrefix . '\Mollie\WooCommerce\PaymentMethods\\' . $transformedId;
$paymentMethod = new $paymentMethodClassName(
$iconFactory,
$settingsHelper,
Expand Down

0 comments on commit a56e39e

Please sign in to comment.