|
@ -7,7 +7,6 @@ use OFFLINE\Mall\Models\PaymentGatewaySettings; |
|
|
use OFFLINE\Mall\Models\OrderState; |
|
|
use OFFLINE\Mall\Models\OrderState; |
|
|
use OFFLINE\Mall\Models\Order; |
|
|
use OFFLINE\Mall\Models\Order; |
|
|
use Omnipay\Omnipay; |
|
|
use Omnipay\Omnipay; |
|
|
use Omnipay\Sberbank\Gateway; |
|
|
|
|
|
use Omnipay\Sberbank\Message\AbstractRequest; |
|
|
use Omnipay\Sberbank\Message\AbstractRequest; |
|
|
use Omnipay\Sberbank\Message\AbstractResponse; |
|
|
use Omnipay\Sberbank\Message\AbstractResponse; |
|
|
use Omnipay\Sberbank\Message\AuthorizeRequest; |
|
|
use Omnipay\Sberbank\Message\AuthorizeRequest; |
|
@ -38,7 +37,7 @@ class SberCheckout extends PaymentProvider |
|
|
* |
|
|
* |
|
|
* @return string |
|
|
* @return string |
|
|
*/ |
|
|
*/ |
|
|
final public function name(): string |
|
|
|
|
|
|
|
|
public function name(): string |
|
|
{ |
|
|
{ |
|
|
return Lang::get('wpstudio.sber::lang.settings.sber_checkout'); |
|
|
return Lang::get('wpstudio.sber::lang.settings.sber_checkout'); |
|
|
} |
|
|
} |
|
@ -48,7 +47,7 @@ class SberCheckout extends PaymentProvider |
|
|
* |
|
|
* |
|
|
* @return string |
|
|
* @return string |
|
|
*/ |
|
|
*/ |
|
|
final public function identifier(): string |
|
|
|
|
|
|
|
|
public function identifier(): string |
|
|
{ |
|
|
{ |
|
|
return 'sber'; |
|
|
return 'sber'; |
|
|
} |
|
|
} |
|
@ -59,7 +58,7 @@ class SberCheckout extends PaymentProvider |
|
|
* @return bool |
|
|
* @return bool |
|
|
* @throws \October\Rain\Exception\ValidationException |
|
|
* @throws \October\Rain\Exception\ValidationException |
|
|
*/ |
|
|
*/ |
|
|
final public function validate(): bool |
|
|
|
|
|
|
|
|
public function validate(): bool |
|
|
{ |
|
|
{ |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
@ -72,7 +71,7 @@ class SberCheckout extends PaymentProvider |
|
|
* |
|
|
* |
|
|
* @return PaymentResult |
|
|
* @return PaymentResult |
|
|
*/ |
|
|
*/ |
|
|
final public function process(PaymentResult $result): PaymentResult |
|
|
|
|
|
|
|
|
public function process(PaymentResult $result): PaymentResult |
|
|
{ |
|
|
{ |
|
|
$gateway = $this->getGateway(); |
|
|
$gateway = $this->getGateway(); |
|
|
|
|
|
|
|
@ -114,7 +113,7 @@ class SberCheckout extends PaymentProvider |
|
|
* @return array |
|
|
* @return array |
|
|
* |
|
|
* |
|
|
*/ |
|
|
*/ |
|
|
final public function getOrderBundle(): array |
|
|
|
|
|
|
|
|
public function getOrderBundle() |
|
|
{ |
|
|
{ |
|
|
$orderCreationDateFormatted = $this->order->created_at->format('Y-m-dTH:m:s'); |
|
|
$orderCreationDateFormatted = $this->order->created_at->format('Y-m-dTH:m:s'); |
|
|
|
|
|
|
|
@ -135,7 +134,7 @@ class SberCheckout extends PaymentProvider |
|
|
* |
|
|
* |
|
|
* @return array |
|
|
* @return array |
|
|
*/ |
|
|
*/ |
|
|
final public function getOrderCartItems(): array |
|
|
|
|
|
|
|
|
public function getOrderCartItems() |
|
|
{ |
|
|
{ |
|
|
$cartItems = []; |
|
|
$cartItems = []; |
|
|
|
|
|
|
|
@ -168,7 +167,7 @@ class SberCheckout extends PaymentProvider |
|
|
* |
|
|
* |
|
|
* @return PaymentResult |
|
|
* @return PaymentResult |
|
|
*/ |
|
|
*/ |
|
|
final public function complete(PaymentResult $result): PaymentResult |
|
|
|
|
|
|
|
|
public function complete(PaymentResult $result): PaymentResult |
|
|
{ |
|
|
{ |
|
|
$this->setOrder($result->order); |
|
|
$this->setOrder($result->order); |
|
|
|
|
|
|
|
@ -204,7 +203,7 @@ class SberCheckout extends PaymentProvider |
|
|
* |
|
|
* |
|
|
* @return \Omnipay\Common\GatewayInterface |
|
|
* @return \Omnipay\Common\GatewayInterface |
|
|
*/ |
|
|
*/ |
|
|
final protected function getGateway(): Gateway |
|
|
|
|
|
|
|
|
protected function getGateway() |
|
|
{ |
|
|
{ |
|
|
$gateway = Omnipay::create('Sberbank'); |
|
|
$gateway = Omnipay::create('Sberbank'); |
|
|
|
|
|
|
|
@ -227,7 +226,7 @@ class SberCheckout extends PaymentProvider |
|
|
* |
|
|
* |
|
|
* @return array |
|
|
* @return array |
|
|
*/ |
|
|
*/ |
|
|
final public function settings(): array |
|
|
|
|
|
|
|
|
public function settings(): array |
|
|
{ |
|
|
{ |
|
|
return [ |
|
|
return [ |
|
|
'sber_test_mode' => [ |
|
|
'sber_test_mode' => [ |
|
@ -248,6 +247,11 @@ class SberCheckout extends PaymentProvider |
|
|
'span' => 'left', |
|
|
'span' => 'left', |
|
|
'type' => 'text', |
|
|
'type' => 'text', |
|
|
], |
|
|
], |
|
|
|
|
|
'setPayedVirtualOrderAsComplete' => [ |
|
|
|
|
|
'label' => Lang::get('wpstudio.sber::lang.settings.set_payed_virtual_order_as_complete'), |
|
|
|
|
|
'span' => 'left', |
|
|
|
|
|
'type' => 'checkbox', |
|
|
|
|
|
], |
|
|
]; |
|
|
]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -259,7 +263,7 @@ class SberCheckout extends PaymentProvider |
|
|
* |
|
|
* |
|
|
* @return array |
|
|
* @return array |
|
|
*/ |
|
|
*/ |
|
|
final public function encryptedSettings(): array |
|
|
|
|
|
|
|
|
public function encryptedSettings(): array |
|
|
{ |
|
|
{ |
|
|
return ['password']; |
|
|
return ['password']; |
|
|
} |
|
|
} |
|
@ -270,7 +274,7 @@ class SberCheckout extends PaymentProvider |
|
|
* @param $orderStateFlag |
|
|
* @param $orderStateFlag |
|
|
* @return int |
|
|
* @return int |
|
|
*/ |
|
|
*/ |
|
|
final protected function getOrderStateId($orderStateFlag): int |
|
|
|
|
|
|
|
|
protected function getOrderStateId($orderStateFlag): int |
|
|
{ |
|
|
{ |
|
|
$orderStateModel = OrderState::where('flag', $orderStateFlag)->first(); |
|
|
$orderStateModel = OrderState::where('flag', $orderStateFlag)->first(); |
|
|
|
|
|
|
|
|