When the checkout flow gets completed it doesn't create a payment until the method onNotify gets called.
This patch implements the method onReturn to create a new Payment with state New and total paid 0, so when the method onNotify it's called, the payment will be updated.

Comments

wenceslao1207 created an issue. See original summary.

wmb1207’s picture

StatusFileSize
new3.71 KB
wmb1207’s picture

Status: Active » Needs review
gerzenstl’s picture

Overall it looks good. But, there is one thing we need to verify.

On lines 140 - 143:

$orderId = $notification['data']['order_id'];

$paymentStorage = $this->entityTypeManager->getStorage('commerce_payment');
$payment        = $paymentStorage->loadByProperties(['order_id' => $order->id()]);

Either we use $orderId because $order->id() results in null
or
$order->id() needs to be replaced by another variable and $orderId isn't needed.

Please check

gerzenstl’s picture

Status: Needs review » Needs work
wmb1207’s picture

StatusFileSize
new3.71 KB

You're right, $order->id() must be replaced with $orderId. Here it's the updated patch

gerzenstl’s picture

Patch from #6 looks good.

gerzenstl’s picture

Status: Needs work » Fixed
gerzenstl’s picture

Status: Fixed » Reviewed & tested by the community
gerzenstl’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.