Skip to content

Commit

Permalink
Fixed setting of notification and return urls (#9)
Browse files Browse the repository at this point in the history
* Fixed setting of notfication url

* Marked old endpoint as deprecated
  • Loading branch information
piotr-stankiewicz-melements authored Apr 7, 2020
1 parent 707cc5d commit 7fa6bdd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
11 changes: 9 additions & 2 deletions upload/admin/controller/extension/payment/paynow.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ private function sendShopUrlsConfiguration()
$this->initApiClient();
$shopConfiguration = new \Paynow\Service\ShopConfiguration($this->apiClient);
$shopConfiguration->changeUrls(
$this->url->link('checkout/success', '', true),
$this->url->link('extension/payment/paynow/notifications', '', true)
$this->buildBaseUrlWithRoute('checkout/success'),
$this->buildBaseUrlWithRoute('extension/payment/paynow/notifications')
);
} catch (Paynow\Exception\PaynowException $exception) {
$this->model_extension_payment_paynow->log($exception->getMessage() . ": " . json_encode($exception->getErrors()));
Expand Down Expand Up @@ -150,4 +150,11 @@ protected function validate()

return !$this->error;
}

private function buildBaseUrlWithRoute($route)
{
$context_url = parse_url($this->url->link($route, '', true));
$base_url = new Url($context_url['scheme'] . '://' . $context_url['host'] . '/');
return $base_url->link($route);
}
}
9 changes: 8 additions & 1 deletion upload/catalog/controller/extension/payment/paynow.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private function sendPaymentData($orderInfo)
return $payment->authorize($payment_data, $idempotencyKey);
}

public function notification()
public function notifications()
{
$this->load->model("extension/payment/paynow");
$this->load->model("checkout/order");
Expand Down Expand Up @@ -125,6 +125,13 @@ public function notification()
exit;
}

/**
* @deprecated
*/
public function notification() {
$this->notifications();
}

private function updateOrderState($payment, $notificationData)
{
$orderInfo = $this->model_checkout_order->getOrder($payment["id_order"]);
Expand Down

0 comments on commit 7fa6bdd

Please sign in to comment.