diff --git a/src/Payment/MollieObject.php b/src/Payment/MollieObject.php index 0f362bcf2..9a69a834a 100644 --- a/src/Payment/MollieObject.php +++ b/src/Payment/MollieObject.php @@ -588,13 +588,13 @@ protected function addMandateIdMetaToFirstPaymentSubscriptionOrder( $subscription->update_meta_data('_mollie_payment_id', $payment->id); $subscription->set_payment_method('mollie_wc_gateway_' . $payment->method); $subscription->save(); - $subcriptionParentOrder = $subscription->get_parent(); - if ($subcriptionParentOrder) { - $subcriptionParentOrder->update_meta_data( + $subscriptionParentOrder = $subscription->get_parent(); + if ($subscriptionParentOrder) { + $subscriptionParentOrder->update_meta_data( '_mollie_mandate_id', $payment->mandateId ); - $subcriptionParentOrder->save(); + $subscriptionParentOrder->save(); } } } diff --git a/src/Subscription/MollieSubscriptionGateway.php b/src/Subscription/MollieSubscriptionGateway.php index 25fd2d545..f62a6e839 100644 --- a/src/Subscription/MollieSubscriptionGateway.php +++ b/src/Subscription/MollieSubscriptionGateway.php @@ -235,15 +235,15 @@ public function scheduled_subscription_payment($renewal_total, WC_Order $renewal $subscriptions = wcs_get_subscriptions_for_renewal_order($renewal_order->get_id()); $subscription = array_pop($subscriptions); // Just need one valid subscription $subscription_mollie_payment_id = $subscription->get_meta('_mollie_payment_id'); - $subcriptionParentOrder = $subscription->get_parent(); - $mandateId = !empty($subcriptionParentOrder) ? $subcriptionParentOrder->get_meta('_mollie_mandate_id') : null; + $subscriptionParentOrder = $subscription->get_parent(); + $mandateId = !empty($subscriptionParentOrder) ? $subscriptionParentOrder->get_meta('_mollie_mandate_id') : null; if (! empty($subscription_mollie_payment_id) && ! empty($subscription)) { $customer_id = $this->restore_mollie_customer_id_and_mandate($customer_id, $subscription_mollie_payment_id, $subscription); } // Get all data for the renewal payment - $initialPaymentUsedOrderAPI = $this->initialPaymentUsedOrderAPI($subcriptionParentOrder); + $initialPaymentUsedOrderAPI = $this->initialPaymentUsedOrderAPI($subscriptionParentOrder); $data = $this->subscriptionObject->getRecurringPaymentRequestData($renewal_order, $customer_id, $initialPaymentUsedOrderAPI); // Allow filtering the renewal payment data @@ -301,14 +301,14 @@ public function scheduled_subscription_payment($renewal_total, WC_Order $renewal (property_exists($payment, 'mandateId') && $payment->mandateId !== null) && $payment->mandateId !== $mandateId - && !empty($subcriptionParentOrder) + && !empty($subscriptionParentOrder) ) { $this->logger->debug("{$this->id}: updating to mandate {$payment->mandateId}"); - $subcriptionParentOrder->update_meta_data( + $subscriptionParentOrder->update_meta_data( '_mollie_mandate_id', $payment->mandateId ); - $subcriptionParentOrder->save(); + $subscriptionParentOrder->save(); $mandateId = $payment->mandateId; } } else { @@ -722,15 +722,15 @@ public function is_available(): bool } /** - * @param $subcriptionParentOrder + * @param $subscriptionParentOrder * @return bool */ - protected function initialPaymentUsedOrderAPI($subcriptionParentOrder): bool + protected function initialPaymentUsedOrderAPI($subscriptionParentOrder): bool { - if (!$subcriptionParentOrder) { + if (!$subscriptionParentOrder) { return false; } - $orderIdMeta = $subcriptionParentOrder->get_meta('_mollie_order_id'); + $orderIdMeta = $subscriptionParentOrder->get_meta('_mollie_order_id'); $parentOrderMeta = $orderIdMeta ?: PaymentService::PAYMENT_METHOD_TYPE_PAYMENT; diff --git a/tests/php/Functional/Subscription/MollieSubscriptionTest.php b/tests/php/Functional/Subscription/MollieSubscriptionTest.php index ae2c43e91..d792bfa8b 100644 --- a/tests/php/Functional/Subscription/MollieSubscriptionTest.php +++ b/tests/php/Functional/Subscription/MollieSubscriptionTest.php @@ -38,7 +38,7 @@ public function __construct($name = null, array $data = [], $dataName = '') * THEN THE ORDER NOTES ARE CREATED * @test */ - public function renewSubcriptionPaymentTest() + public function renewSubscriptionPaymentTest() { $gatewayName = 'mollie_wc_gateway_ideal'; $renewalOrder = $this->wcOrder();