@@ -24,19 +24,19 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @param Pronamic_WP_Pay_GatewayConfig $config |
26 | 26 | */ |
27 | - public function __construct( Pronamic_WP_Pay_GatewayConfig $config ) { |
|
28 | - parent::__construct( $config ); |
|
27 | + public function __construct(Pronamic_WP_Pay_GatewayConfig $config) { |
|
28 | + parent::__construct($config); |
|
29 | 29 | |
30 | - $this->set_method( Pronamic_WP_Pay_Gateway::METHOD_HTML_FORM ); |
|
31 | - $this->set_has_feedback( true ); |
|
32 | - $this->set_amount_minimum( 0.01 ); |
|
33 | - $this->set_slug( self::SLUG ); |
|
30 | + $this->set_method(Pronamic_WP_Pay_Gateway::METHOD_HTML_FORM); |
|
31 | + $this->set_has_feedback(true); |
|
32 | + $this->set_amount_minimum(0.01); |
|
33 | + $this->set_slug(self::SLUG); |
|
34 | 34 | |
35 | 35 | $this->client = new Pronamic_Gateways_Adyen_Adyen(); |
36 | - $this->client->set_payment_server_url( $config->getPaymentServerUrl() ); |
|
37 | - $this->client->set_skin_code( $config->get_buckaroo_skin_code() ); |
|
38 | - $this->client->set_merchant_account( $config->get_buckaroo_merchant_account() ); |
|
39 | - $this->client->set_shared_secret( $config->get_buckaroo_shared_secret() ); |
|
36 | + $this->client->set_payment_server_url($config->getPaymentServerUrl()); |
|
37 | + $this->client->set_skin_code($config->get_buckaroo_skin_code()); |
|
38 | + $this->client->set_merchant_account($config->get_buckaroo_merchant_account()); |
|
39 | + $this->client->set_shared_secret($config->get_buckaroo_shared_secret()); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | ///////////////////////////////////////////////// |
@@ -47,19 +47,19 @@ discard block |
||
47 | 47 | * @param Pronamic_Pay_Payment $payment |
48 | 48 | * @see Pronamic_WP_Pay_Gateway::start() |
49 | 49 | */ |
50 | - public function start( Pronamic_Pay_Payment $payment ) { |
|
51 | - $payment->set_transaction_id( md5( time() . $payment->get_order_id() ) ); |
|
52 | - $payment->set_action_url( $this->client->get_payment_server_url() ); |
|
50 | + public function start(Pronamic_Pay_Payment $payment) { |
|
51 | + $payment->set_transaction_id(md5(time() . $payment->get_order_id())); |
|
52 | + $payment->set_action_url($this->client->get_payment_server_url()); |
|
53 | 53 | |
54 | - $this->client->set_merchant_reference( $payment->get_order_id() ); |
|
55 | - $this->client->set_payment_amount( $payment->get_amount() ); |
|
56 | - $this->client->set_currency_code( $payment->get_currency() ); |
|
57 | - $this->client->set_ship_before_date( new DateTime( '+5 days' ) ); |
|
58 | - $this->client->set_shopper_locale( $payment->get_locale() ); |
|
59 | - $this->client->set_order_data( $payment->get_description() ); |
|
60 | - $this->client->set_session_validity( new DateTime( '+1 hour' ) ); |
|
61 | - $this->client->set_shopper_reference( $payment->get_email() ); |
|
62 | - $this->client->set_shopper_email( $payment->get_email() ); |
|
54 | + $this->client->set_merchant_reference($payment->get_order_id()); |
|
55 | + $this->client->set_payment_amount($payment->get_amount()); |
|
56 | + $this->client->set_currency_code($payment->get_currency()); |
|
57 | + $this->client->set_ship_before_date(new DateTime('+5 days')); |
|
58 | + $this->client->set_shopper_locale($payment->get_locale()); |
|
59 | + $this->client->set_order_data($payment->get_description()); |
|
60 | + $this->client->set_session_validity(new DateTime('+1 hour')); |
|
61 | + $this->client->set_shopper_reference($payment->get_email()); |
|
62 | + $this->client->set_shopper_email($payment->get_email()); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | ///////////////////////////////////////////////// |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @param string $url an URL |
45 | 45 | */ |
46 | - public function set_payment_server_url( $url ) { |
|
46 | + public function set_payment_server_url($url) { |
|
47 | 47 | $this->payment_server_url = $url; |
48 | 48 | } |
49 | 49 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | return $this->merchant_reference; |
54 | 54 | } |
55 | 55 | |
56 | - public function set_merchant_reference( $merchant_reference ) { |
|
56 | + public function set_merchant_reference($merchant_reference) { |
|
57 | 57 | $this->merchant_reference = $merchant_reference; |
58 | 58 | } |
59 | 59 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | return $this->payment_amount; |
64 | 64 | } |
65 | 65 | |
66 | - public function set_payment_amount( $payment_amount ) { |
|
66 | + public function set_payment_amount($payment_amount) { |
|
67 | 67 | $this->payment_amount = $payment_amount; |
68 | 68 | } |
69 | 69 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | return $this->currency_code; |
74 | 74 | } |
75 | 75 | |
76 | - public function set_currency_code( $currency_code ) { |
|
76 | + public function set_currency_code($currency_code) { |
|
77 | 77 | $this->currency_code = $currency_code; |
78 | 78 | } |
79 | 79 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | return $this->ship_before_date; |
84 | 84 | } |
85 | 85 | |
86 | - public function set_ship_before_date( DateTime $date ) { |
|
86 | + public function set_ship_before_date(DateTime $date) { |
|
87 | 87 | $this->ship_before_date = $date; |
88 | 88 | } |
89 | 89 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | return $this->skin_code; |
94 | 94 | } |
95 | 95 | |
96 | - public function set_skin_code( $skin_code ) { |
|
96 | + public function set_skin_code($skin_code) { |
|
97 | 97 | $this->skin_code = $skin_code; |
98 | 98 | } |
99 | 99 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | return $this->merchant_account; |
104 | 104 | } |
105 | 105 | |
106 | - public function set_merchant_account( $merchant_account ) { |
|
106 | + public function set_merchant_account($merchant_account) { |
|
107 | 107 | $this->merchant_account = $merchant_account; |
108 | 108 | } |
109 | 109 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | return $this->shopper_locale; |
114 | 114 | } |
115 | 115 | |
116 | - public function set_shopper_locale( $shopper_locale ) { |
|
116 | + public function set_shopper_locale($shopper_locale) { |
|
117 | 117 | $this->shopper_locale = $shopper_locale; |
118 | 118 | } |
119 | 119 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | return $this->order_data; |
124 | 124 | } |
125 | 125 | |
126 | - public function set_order_data( $order_data ) { |
|
126 | + public function set_order_data($order_data) { |
|
127 | 127 | $this->order_data = $order_data; |
128 | 128 | } |
129 | 129 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | return $this->session_validity; |
134 | 134 | } |
135 | 135 | |
136 | - public function set_session_validity( DateTime $session_validity = null ) { |
|
136 | + public function set_session_validity(DateTime $session_validity = null) { |
|
137 | 137 | $this->session_validity = $session_validity; |
138 | 138 | } |
139 | 139 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | return $this->shopper_email; |
144 | 144 | } |
145 | 145 | |
146 | - public function set_shopper_email( $email ) { |
|
146 | + public function set_shopper_email($email) { |
|
147 | 147 | $this->shopper_email = $email; |
148 | 148 | } |
149 | 149 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | return $this->shopper_reference; |
154 | 154 | } |
155 | 155 | |
156 | - public function set_shopper_reference( $reference ) { |
|
156 | + public function set_shopper_reference($reference) { |
|
157 | 157 | $this->shopper_reference = $reference; |
158 | 158 | } |
159 | 159 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | return $this->shared_secret; |
164 | 164 | } |
165 | 165 | |
166 | - public function set_shared_secret( $shared_secret ) { |
|
166 | + public function set_shared_secret($shared_secret) { |
|
167 | 167 | $this->shared_secret = $shared_secret; |
168 | 168 | } |
169 | 169 | |
@@ -171,20 +171,20 @@ discard block |
||
171 | 171 | |
172 | 172 | public function get_signature() { |
173 | 173 | $data = array( |
174 | - Pronamic_WP_Util::amount_to_cents( $this->get_payment_amount() ), |
|
174 | + Pronamic_WP_Util::amount_to_cents($this->get_payment_amount()), |
|
175 | 175 | $this->get_currency_code(), |
176 | - Pronamic_WP_Util::format_date( 'Y-m-d', $this->get_ship_before_date() ), |
|
176 | + Pronamic_WP_Util::format_date('Y-m-d', $this->get_ship_before_date()), |
|
177 | 177 | $this->get_merchant_reference(), |
178 | 178 | $this->get_skin_code(), |
179 | 179 | $this->get_merchant_account(), |
180 | - Pronamic_WP_Util::format_date( DATE_ATOM, $this->get_session_validity() ), |
|
180 | + Pronamic_WP_Util::format_date(DATE_ATOM, $this->get_session_validity()), |
|
181 | 181 | $this->get_shopper_email(), |
182 | 182 | $this->get_shopper_reference(), |
183 | 183 | ); |
184 | 184 | |
185 | - $data = implode( '', $data ); |
|
185 | + $data = implode('', $data); |
|
186 | 186 | |
187 | - $signature = base64_encode( hash_hmac( 'sha1', $data, $this->get_shared_secret(), true ) ); |
|
187 | + $signature = base64_encode(hash_hmac('sha1', $data, $this->get_shared_secret(), true)); |
|
188 | 188 | |
189 | 189 | return $signature; |
190 | 190 | } |
@@ -197,19 +197,19 @@ discard block |
||
197 | 197 | * @return string |
198 | 198 | */ |
199 | 199 | public function get_html_fields() { |
200 | - return Pronamic_IDeal_IDeal::htmlHiddenFields( array( |
|
200 | + return Pronamic_IDeal_IDeal::htmlHiddenFields(array( |
|
201 | 201 | Pronamic_Gateways_Adyen_Parameters::MERCHANT_REFERENCE => $this->get_merchant_reference(), |
202 | - Pronamic_Gateways_Adyen_Parameters::PAYMENT_AMOUNT => Pronamic_WP_Util::amount_to_cents( $this->get_payment_amount() ), |
|
202 | + Pronamic_Gateways_Adyen_Parameters::PAYMENT_AMOUNT => Pronamic_WP_Util::amount_to_cents($this->get_payment_amount()), |
|
203 | 203 | Pronamic_Gateways_Adyen_Parameters::CURRENCY_CODE => $this->get_currency_code(), |
204 | - Pronamic_Gateways_Adyen_Parameters::SHIP_BEFORE_DATE => Pronamic_WP_Util::format_date( 'Y-m-d', $this->get_ship_before_date() ), |
|
204 | + Pronamic_Gateways_Adyen_Parameters::SHIP_BEFORE_DATE => Pronamic_WP_Util::format_date('Y-m-d', $this->get_ship_before_date()), |
|
205 | 205 | Pronamic_Gateways_Adyen_Parameters::SKIN_CODE => $this->get_skin_code(), |
206 | 206 | Pronamic_Gateways_Adyen_Parameters::MERCHANT_ACCOUNT => $this->get_merchant_account(), |
207 | 207 | Pronamic_Gateways_Adyen_Parameters::SHOPPER_LOCALE => $this->get_shopper_locale(), |
208 | - Pronamic_Gateways_Adyen_Parameters::ORDER_DATA => base64_encode( gzencode( $this->get_order_data() ) ), |
|
209 | - Pronamic_Gateways_Adyen_Parameters::SESSION_VALIDITY => Pronamic_WP_Util::format_date( DATE_ATOM, $this->get_session_validity() ), |
|
208 | + Pronamic_Gateways_Adyen_Parameters::ORDER_DATA => base64_encode(gzencode($this->get_order_data())), |
|
209 | + Pronamic_Gateways_Adyen_Parameters::SESSION_VALIDITY => Pronamic_WP_Util::format_date(DATE_ATOM, $this->get_session_validity()), |
|
210 | 210 | Pronamic_Gateways_Adyen_Parameters::MERCHANT_SIGNATURE => $this->get_signature(), |
211 | 211 | Pronamic_Gateways_Adyen_Parameters::SHOPPER_EMAIL => $this->get_shopper_email(), |
212 | 212 | Pronamic_Gateways_Adyen_Parameters::SHOPPER_REFERENCE => $this->get_shopper_reference(), |
213 | - ) ); |
|
213 | + )); |
|
214 | 214 | } |
215 | 215 | } |