Skip to content

Commit

Permalink
Fix: Provide $ordersPage->createChild() with corrected props
Browse files Browse the repository at this point in the history
Added previous exception to new Exception
  • Loading branch information
tobiasfabian committed Jul 8, 2020
1 parent 8d64d9f commit 8d4311d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/merx.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ public function initializePayment(array $data): string
'details' => [
'message' => $ex->getMessage(),
],
'previous' => $ex,
'data' => [
'exception' => $ex,
],
Expand Down Expand Up @@ -292,7 +293,9 @@ public function completePayment(array $data = []): OrderPage

kirby()->impersonate('kirby');
$ordersPage = page(option('ww.merx.ordersPage', 'orders'));
$orderPage = $ordersPage->createChild($virtualOrderPage->toArray())->publish()->changeStatus('listed');
$virtualOrderPageArray = $virtualOrderPage->toArray();
$virtualOrderPageArray['template'] = $virtualOrderPageArray['template']->name();
$orderPage = $ordersPage->createChild($virtualOrderPageArray)->publish()->changeStatus('listed');

$this->cart->delete();
kirby()->session()->remove('ww.merx.virtualOrderPage');
Expand All @@ -307,6 +310,7 @@ public function completePayment(array $data = []): OrderPage
throw new Exception([
'key' => 'merx.completePayment',
'httpCode' => 500,
'previous' => $ex,
'details' => [
'message' => $ex->getMessage(),
],
Expand Down

0 comments on commit 8d4311d

Please sign in to comment.