Skip to content

Commit

Permalink
PIWOO-330 fix typo in variable subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaymo committed Feb 21, 2024
1 parent 44735ce commit 3b6a982
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/Payment/MollieObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions src/Subscription/MollieSubscriptionGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 3b6a982

Please sign in to comment.