|
1
|
|
|
<?php |
|
2
|
|
|
declare(strict_types=1); |
|
3
|
|
|
|
|
4
|
|
|
namespace MerchantSafeUnipay\SDK\Action; |
|
5
|
|
|
|
|
6
|
|
|
use MerchantSafeUnipay; |
|
7
|
|
|
|
|
8
|
|
|
final class FinancialTransactions extends ActionAbstract implements ActionInterface |
|
9
|
|
|
{ |
|
10
|
|
|
static private $saleKeys = [ |
|
11
|
|
|
'AMOUNT', 'BILLTOADDRESSLINE', 'BILLTOCITY', 'BILLTOCOUNTRY', 'BILLTOPOSTALCODE', 'CAMPAIGNS', 'CARDCVV', |
|
12
|
|
|
'CARDEXPIRY', 'CARDHOLDERPORT', 'CARDPAN', 'CARDSAVENAME', 'CARDTOKEN', 'CURRENCY', 'CUSTOMER', 'CUSTOMEREMAIL', |
|
13
|
|
|
'CUSTOMERIP', 'CUSTOMERNAME', 'CUSTOMERPHONE', 'CUSTOMERUSERAGENT', 'DEALERCODE', 'EXTRA', 'FORGROUP', |
|
14
|
|
|
'INSTALLMENTS', 'ISREFUNDABLE', 'MERCHANTPAYMENTID', 'NAMEONCARD', 'PAYMENTSYSTEM', 'POINTS', 'SAVECARD', |
|
15
|
|
|
'SHIPTOADDRESSLINE', 'SHIPTOCITY', 'SHIPTOCOUNTRY', 'SHIPTOPOSTALCODE', 'THREATMETRIXSESSIONID', |
|
16
|
|
|
'TMXSESSIONQUERYINPUT', |
|
17
|
|
|
]; |
|
18
|
|
|
static private $preAuthKeys = [ |
|
19
|
|
|
'AMOUNT', 'BILLTOADDRESSLINE', 'BILLTOCITY', 'BILLTOCOUNTRY', 'BILLTOPOSTALCODE', 'CARDCVV', 'CARDEXPIRY', |
|
20
|
|
|
'CARDHOLDERPORT', 'CARDPAN', 'CARDSAVENAME', 'CARDTOKEN', 'CURRENCY', 'CUSTOMER', 'CUSTOMEREMAIL', 'CUSTOMERIP', |
|
21
|
|
|
'CUSTOMERNAME', 'CUSTOMERPHONE', 'CUSTOMERUSERAGENT', 'DEALERCODE', 'EXTRA', 'FORGROUP', 'INSTALLMENTS', |
|
22
|
|
|
'ISREFUNDABLE', 'MERCHANTPAYMENTID', 'NAMEONCARD', 'PAYMENTSYSTEM', 'SAVECARD', 'SHIPTOADDRESSLINE', |
|
23
|
|
|
'SHIPTOCITY', 'SHIPTOCOUNTRY', 'SHIPTOPOSTALCODE', 'THREATMETRIXSESSIONID', 'TMXSESSIONQUERYINPUT', |
|
24
|
|
|
]; |
|
25
|
|
|
static private $postAuthKeys = [ |
|
26
|
|
|
'MERCHANTPAYMENTID', 'PGTRANID', 'AMOUNT' |
|
27
|
|
|
]; |
|
28
|
|
|
static private $voidKeys = [ |
|
29
|
|
|
'MERCHANTPAYMENTID', 'PGTRANID', |
|
30
|
|
|
]; |
|
31
|
|
|
static private $refundKeys = [ |
|
32
|
|
|
'AMOUNT', 'PGTRANID', 'CURRENCY', 'MERCHANTPAYMENTID', 'SUBSTATUS' |
|
33
|
|
|
]; |
|
34
|
|
|
public function sale($args) |
|
35
|
|
|
{ |
|
36
|
|
|
$this->action = 'SALE'; |
|
37
|
|
|
$args = MerchantSafeUnipay\filter(self::$saleKeys, $args); |
|
38
|
|
|
$this->queryParameters = array_merge($this->merchantParams, $args); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function preAuth($args) |
|
42
|
|
|
{ |
|
43
|
|
|
$this->action = 'PREAUTH'; |
|
44
|
|
|
$args = MerchantSafeUnipay\filter(self::$preAuthKeys, $args); |
|
45
|
|
|
$this->queryParameters = array_merge($this->merchantParams, $args); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function postAuth($args) |
|
49
|
|
|
{ |
|
50
|
|
|
$this->action = 'POSTAUTH'; |
|
51
|
|
|
$args = MerchantSafeUnipay\filter(self::$postAuthKeys, $args); |
|
52
|
|
|
$this->queryParameters = array_merge($this->merchantParams, $args); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function void($args) |
|
56
|
|
|
{ |
|
57
|
|
|
$this->action = 'VOID'; |
|
58
|
|
|
$args = MerchantSafeUnipay\filter(self::$voidKeys, $args); |
|
59
|
|
|
$this->queryParameters = array_merge($this->merchantParams, $args); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public function refund($args) |
|
63
|
|
|
{ |
|
64
|
|
|
$this->action = 'REFUND'; |
|
65
|
|
|
$args = MerchantSafeUnipay\filter(self::$refundKeys, $args); |
|
66
|
|
|
$this->queryParameters = array_merge($this->merchantParams, $args); |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|