-
Notifications
You must be signed in to change notification settings - Fork 4
/
Charge.php
135 lines (128 loc) · 4.64 KB
/
Charge.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
namespace Dfe\IPay88;
/**
* 2017-04-10
* 2017-08-13
* The charge parameters are described in the Chapter 2.3 «Payment Request Parameter» (page 6)
* of the PDF documentation («Technical Specification v1.6.2 (for Malaysia Only)»): https://mage2.pro/t/4259
* @method Method m()
* @method Settings s()
*/
final class Charge extends \Df\PaypalClone\Charge {
/**
* 2017-08-19
* 2017-04-10 «Payment amount with two decimals and thousand symbols. Example: 1,278.99» Required, Currency.
* @see \Dfe\IPay88\Method::amountFactor()
* @see \Dfe\IPay88\Method::amountFormat()
* @override
* @see \Df\PaypalClone\Charge::k_Amount()
* @used-by \Df\PaypalClone\Charge::p()
*/
protected function k_Amount():string {return 'Amount';}
/**
* 2017-08-19
* 2017-04-10
* «Refer to Appendix I.pdf file for MYR gateway.
* Refer to Appendix II.pdf file for Multi-curency gateway.».
* Required, String, 5.
* @override
* @see \Df\PaypalClone\Charge::k_Currency()
* @used-by \Df\PaypalClone\Charge::p()
*/
protected function k_Currency():string {return 'Currency';}
/**
* 2017-08-19
* 2017-04-10 «Customer email for receiving receipt». Required, String, 100.
* @override
* @see \Df\PaypalClone\Charge::k_Email()
* @used-by \Df\PaypalClone\Charge::p()
*/
protected function k_Email():string {return 'UserEmail';}
/**
* 2017-08-19
* 2017-04-10
* «The Merchant Code provided by iPay88 and use to uniquely identify the Merchant.»
* Required, String, 20.
* @override
* @see \Df\PaypalClone\Charge::k_MerchantId()
* @used-by \Df\PaypalClone\Charge::p()
*/
protected function k_MerchantId():string {return 'MerchantCode';}
/**
* 2017-04-10
* «Unique merchant transaction number / Order ID». Required, String, 30.
* @override
* @see \Df\PaypalClone\Charge::k_RequestId()
* @used-by \Df\PaypalClone\Charge::p()
*/
protected function k_RequestId():string {return 'RefNo';}
/**
* 2017-04-10 «SHA-256 signature (refer to 3.1)». Required, String, 100.
* @override
* @see \Df\PaypalClone\Charge::k_Signature()
* @used-by \Df\PaypalClone\Charge::p()
*/
protected function k_Signature():string {return 'Signature';}
/**
* 2017-04-10
* @override
* @see \Df\PaypalClone\Charge::pCharge()
* @used-by \Df\PaypalClone\Charge::p()
* @return array(string => mixed)
*/
protected function pCharge():array {return [
# 2017-04-10 «Backend response page URL (refer to 2.7)». Required, String, 200.
'BackendURL' => $this->callback()
# 2017-04-10
# «Encoding type
# “ISO-8859-1” – English
# “UTF-8” – Unicode
# “GB2312” – Chinese Simplified
# “GD18030” – Chinese Simplified
# “BIG5” – Chinese Traditional
# ».
# Optional, String, 20.
,'Lang' => 'UTF-8'
# 2017-04-10
# «Refer to Appendix I.pdf file for MYR gateway.
# Refer to Appendix II.pdf file for Multi-curency gateway.».
# Optional, Integer.
,'PaymentId' => $this->m()->option()
# 2017-04-10 «Product description». Required, String, 100.
# 2017-09-04
# [iPay88] The maximum length of a payment's products description
# (the «ProdDesc» parameter) is 100 characters: https://mage2.pro/t/4460
,'ProdDesc' => df_chop(df_oqi_s($this->o()), 100)
# 2017-04-10 «Merchant remarks». Optional, String, 100.
# 2017-09-04
# [iPay88] The maximum length of a payment description
# (the «Remark» parameter) is 100 characters: https://mage2.pro/t/4459
,'Remark' => $this->description()
# 2017-04-10 «Payment response page». Required, String, 200.
,'ResponseURL' => $this->customerReturnRemote()
/**
* 2017-04-10
* «Signature type = “SHA256”».
* Required, String, 10.
* 2017-04-12
* Я использую алгоритм @see sha1(),
* поэтому передавать значение параметра «SignatureType» не нужно.
* Т.е. официальная документация врёт, утверждая, что этот параметр обязателен.
* SHA256 — совсем другой алгоритм.
*/
//,'SignatureType' => 'SHA256'
# 2017-04-10 «Customer contact number». Required, String, 20.
,'UserContact' => df_chop($this->customerPhone(), 0, 20) ?: 'absent'
,'UserName' => $this->customerName() # 2017-04-10 «Customer name». Required, String, 100.
];}
/**
* 2017-08-19
* 2017-09-02
* «Test transaction with amount MYR 1.00».
* The PDF documentation («Technical Specification v1.6.2 (for Malaysia Only)»), page 2: https://mage2.pro/t/4259
* @override
* @see \Df\PaypalClone\Charge::testAmountF()
* @used-by \Df\PaypalClone\Charge::p()
*/
protected function testAmountF():string {return '1.00';}
}