1 | <?php |
||
10 | class DpsPxPost extends EcommercePayment |
||
|
|||
11 | { |
||
12 | |||
13 | /** |
||
14 | * set the required privacy link as you see fit... |
||
15 | * also see: https://www.paymentexpress.com/About/Artwork_Downloads |
||
16 | * also see: https://www.paymentexpress.com/About/About_DPS/Privacy_Policy |
||
17 | * @var String |
||
18 | */ |
||
19 | private static $dps_logo_and_link = ' |
||
20 | <div id="PXPostPrivacy"> |
||
21 | <a href="https://www.paymentexpress.com/About/About_DPS/Privacy_Policy"> |
||
22 | <img src="https://www.paymentexpress.com/DPS/media/theme/pxlogostackedreg.png" alt="Payment Processor" width="50%" height="50%" /> |
||
23 | </a> |
||
24 | <span> |
||
25 | <a href="https://www.paymentexpress.com/About/About_DPS/Privacy_Policy"> |
||
26 | Payment processing provided by DPS (view Privacy Policy) |
||
27 | </a> |
||
28 | </span> |
||
29 | </div> |
||
30 | '; |
||
31 | |||
32 | /** |
||
33 | * we use yes / no as this is more reliable than a boolean value |
||
34 | * for configs |
||
35 | * @var String |
||
36 | */ |
||
37 | private static $is_test = "yes"; |
||
38 | |||
39 | /** |
||
40 | * we use yes / no as this is more reliable than a boolean value |
||
41 | * for configs |
||
42 | * @var boolean |
||
43 | */ |
||
44 | private static $is_live = "no"; |
||
45 | |||
46 | /** |
||
47 | * |
||
48 | * @var string |
||
49 | */ |
||
50 | private static $username = ""; |
||
51 | |||
52 | /** |
||
53 | * |
||
54 | * @var string |
||
55 | */ |
||
56 | private static $password = ""; |
||
57 | |||
58 | /** |
||
59 | * type: purchase / Authorisation / refund ... |
||
60 | * @var string |
||
61 | */ |
||
62 | private static $type = "Purchase"; |
||
63 | |||
64 | /** |
||
65 | * Incomplete (default): Payment created but nothing confirmed as successful |
||
66 | * Success: Payment successful |
||
67 | * Failure: Payment failed during process |
||
68 | * Pending: Payment awaiting receipt/bank transfer etc |
||
69 | */ |
||
70 | private static $db = array( |
||
71 | "CardNumber" => "Varchar(64)", |
||
72 | "NameOnCard" => "Varchar(40)", |
||
73 | "ExpiryDate" => "Varchar(4)", |
||
74 | "CVVNumber" => "Varchar(3)", |
||
75 | "Request" => "Text", |
||
76 | "Response" => "Text" |
||
77 | ); |
||
78 | |||
79 | private static $casting = array( |
||
80 | "RequestDetails" => "HTMLText", |
||
81 | "ResponseDetails" => "HTMLText" |
||
82 | ); |
||
83 | |||
84 | public function getCMSFields() |
||
91 | |||
92 | /** |
||
93 | * Return the payment form fields that should |
||
94 | * be shown on the checkout order form for the |
||
95 | * payment type. Example: for {@link DPSPayment}, |
||
96 | * this would be a set of fields to enter your |
||
97 | * credit card details. |
||
98 | * |
||
99 | * @return FieldList |
||
100 | */ |
||
101 | public function getPaymentFormFields() |
||
111 | |||
112 | /** |
||
113 | * Define what fields defined in {@link Order->getPaymentFormFields()} |
||
114 | * should be required. |
||
115 | * |
||
116 | * @see DPSPayment->getPaymentFormRequirements() for an example on how |
||
117 | * this is implemented. |
||
118 | * |
||
119 | * @return array |
||
120 | */ |
||
121 | public function getPaymentFormRequirements() |
||
126 | |||
127 | /** |
||
128 | * returns true if all the data is correct. |
||
129 | * |
||
130 | * @param array $data The form request data - see OrderForm |
||
131 | * @param OrderForm $form The form object submitted on |
||
132 | * |
||
133 | * @return Boolean |
||
134 | */ |
||
135 | public function validatePayment($data, $form) |
||
140 | |||
141 | /** |
||
142 | * Perform payment processing for the type of |
||
143 | * payment. For example, if this was a credit card |
||
144 | * payment type, you would perform the data send |
||
145 | * off to the payment gateway on this function for |
||
146 | * your payment subclass. |
||
147 | * |
||
148 | * This is used by {@link OrderForm} when it is |
||
149 | * submitted. |
||
150 | * |
||
151 | * @param array $data The form request data - see OrderForm |
||
152 | * @param OrderForm $form The form object submitted on |
||
153 | * |
||
154 | * @return EcommercePayment_Result |
||
155 | */ |
||
156 | public function processPayment($data, $form) |
||
224 | |||
225 | |||
226 | /** |
||
227 | * are you running in test mode? |
||
228 | * |
||
229 | * @return Boolean |
||
230 | */ |
||
231 | protected function isTest() |
||
241 | |||
242 | public function getRequestDetails() |
||
246 | |||
247 | public function getResponseDetails() |
||
251 | } |
||
252 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.