|
@@ -15,6 +15,7 @@ class AwxAfterpay extends Payment
|
|
|
protected $apikey;
|
|
protected $apikey;
|
|
|
protected $secret;
|
|
protected $secret;
|
|
|
protected $currentOrder;
|
|
protected $currentOrder;
|
|
|
|
|
+ protected $currentInput;
|
|
|
protected $prefix = 'QQS';
|
|
protected $prefix = 'QQS';
|
|
|
protected $tokenCacheKey = 'airwallex_klarna_token';
|
|
protected $tokenCacheKey = 'airwallex_klarna_token';
|
|
|
protected $tokenUrl = 'https://api-demo.airwallex.com/api/v1/authentication/login';
|
|
protected $tokenUrl = 'https://api-demo.airwallex.com/api/v1/authentication/login';
|
|
@@ -60,11 +61,21 @@ class AwxAfterpay extends Payment
|
|
|
{
|
|
{
|
|
|
return $this->currentOrder;
|
|
return $this->currentOrder;
|
|
|
}
|
|
}
|
|
|
|
|
+ public function setInput($input = null): self
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->currentInput = $input;
|
|
|
|
|
+ return $this;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function getInput()
|
|
|
|
|
+ {
|
|
|
|
|
+ return $this->currentInput;
|
|
|
|
|
+ }
|
|
|
public function createGatewayOrder()
|
|
public function createGatewayOrder()
|
|
|
{
|
|
{
|
|
|
- return $this->createPayment($this->getOrder(), ['merchantOrderId' => $this->getOrder()->id]);
|
|
|
|
|
|
|
+ return $this->createPayment($this->getOrder(), ['merchantOrderId' => $this->getOrder()->id], $this->currentInput);
|
|
|
}
|
|
}
|
|
|
- public function createPayment($order, $override)
|
|
|
|
|
|
|
+ public function createPayment($order, $override, $input)
|
|
|
{
|
|
{
|
|
|
$shop = $order->shipping_address;
|
|
$shop = $order->shipping_address;
|
|
|
$bill = $order->billing_address;
|
|
$bill = $order->billing_address;
|
|
@@ -79,7 +90,7 @@ class AwxAfterpay extends Payment
|
|
|
'request_id' => $this->createUuid(),
|
|
'request_id' => $this->createUuid(),
|
|
|
'amount' => $grandTotal,
|
|
'amount' => $grandTotal,
|
|
|
'descriptor' => $this->prefix,
|
|
'descriptor' => $this->prefix,
|
|
|
- 'return_url' => $this->getBaseUlr() . '/afterpay/standard/return?orderId=' . $override['merchantOrderId'],
|
|
|
|
|
|
|
+ 'return_url' => $input->paymentSuccessUrl. '?orderId=' . $override['merchantOrderId'],
|
|
|
'merchant_order_id' => $this->prefix . $override['merchantOrderId'],
|
|
'merchant_order_id' => $this->prefix . $override['merchantOrderId'],
|
|
|
'currency' => $order->order_currency_code,
|
|
'currency' => $order->order_currency_code,
|
|
|
'customer' => [
|
|
'customer' => [
|