Skip to content

Commit b3f72ca

Browse files
committed
Approved uapm orders are OK (no error), but not yet completed. Completion will be done via webhook.
1 parent f527b74 commit b3f72ca

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/Model/Order.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,7 @@ public function finalizeOrderAfterExternalPayment(string $payPalOrderId, bool $f
188188
$isPaypalApplePay ||
189189
$isUAPM
190190
) {
191-
if (
192-
$this->isPayPalOrderCompleted($payPalApiOrder) ||
193-
($isUAPM && $this->isPayPalOrderApproved($payPalApiOrder))
194-
) {
191+
if ($this->isPayPalOrderCompleted($payPalApiOrder)) {
195192
$this->markOrderPaid();
196193
$transactionId = $this->extractTransactionId($payPalApiOrder);
197194
$this->setTransId($transactionId);
@@ -202,6 +199,17 @@ public function finalizeOrderAfterExternalPayment(string $payPalOrderId, bool $f
202199
PayPalApiOrder::STATUS_COMPLETED,
203200
$transactionId
204201
);
202+
} elseif ($isUAPM && $this->isPayPalOrderApproved($payPalApiOrder)) {
203+
$this->markOrderPaymentNotFinished();
204+
$transactionId = $this->extractTransactionId($payPalApiOrder);
205+
//prepare capture tracking
206+
$this->paymentService->trackPayPalOrder(
207+
$this->getId(),
208+
$payPalOrderId,
209+
$paymentsId,
210+
PayPalApiOrder::STATUS_APPROVED,
211+
$transactionId
212+
);
205213
} else {
206214
throw PayPalException::cannotFinalizeOrderAfterExternalPayment($payPalOrderId, $paymentsId);
207215
}

0 commit comments

Comments
 (0)