@@ -11,21 +11,21 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | global $customer_id, $order; |
| 14 | - if ( MODULE_PAYMENT_PAGAMASTARDE_DISCOUNT == 'True' ){ |
|
| 14 | + if (MODULE_PAYMENT_PAGAMASTARDE_DISCOUNT == 'True') { |
|
| 15 | 15 | $discount = 1; |
| 16 | - }else{ |
|
| 16 | + }else { |
|
| 17 | 17 | $discount = 0; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - if ( MODULE_PAYMENT_PAGAMASTARDE_TESTMODE == 'Test' ){ |
|
| 20 | + if (MODULE_PAYMENT_PAGAMASTARDE_TESTMODE == 'Test') { |
|
| 21 | 21 | $key = MODULE_PAYMENT_PAGAMASTARDE_TK; |
| 22 | - }else{ |
|
| 22 | + }else { |
|
| 23 | 23 | $key = MODULE_PAYMENT_PAGAMASTARDE_PK; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | $widget = ''; |
| 27 | - if ( MODULE_PAYMENT_PAGAMASTARDE_WIDGET == 'True' ) { |
|
| 28 | - $widget = '<div class="PmtSimulator" data-pmt-num-quota="4" data-pmt-style="neutral" data-pmt-type="3" data-pmt-discount="'.$discount.'" data-pmt-amount="'.(float)( $order->info['total'] ).'" data-pmt-expanded="no"></div> |
|
| 27 | + if (MODULE_PAYMENT_PAGAMASTARDE_WIDGET == 'True') { |
|
| 28 | + $widget = '<div class="PmtSimulator" data-pmt-num-quota="4" data-pmt-style="neutral" data-pmt-type="3" data-pmt-discount="'.$discount.'" data-pmt-amount="'.(float)($order->info['total']).'" data-pmt-expanded="no"></div> |
|
| 29 | 29 | <script type ="text/javascript" src ="https://cdn.pagamastarde.com/pmt-simulator/3/js/pmt-simulator.min.js"> |
| 30 | 30 | </script> |
| 31 | 31 | <script> |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | </script>'; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - define('MODULE_PAYMENT_PAGAMASTARDE_TEXT_CATALOG_TITLE', 'Finaciación con Paga+Tarde'. $widget); // Payment option title as displayed to the customer |
|
| 39 | + define('MODULE_PAYMENT_PAGAMASTARDE_TEXT_CATALOG_TITLE', 'Finaciación con Paga+Tarde'.$widget); // Payment option title as displayed to the customer |
|
| 40 | 40 | |
| 41 | 41 | define('MODULE_PAYMENT_PAGAMASTARDE_TEXT_ADMIN_TITLE', 'Paga+Tarde'); |
| 42 | 42 | |
@@ -11,21 +11,21 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | global $customer_id, $order; |
| 14 | - if ( MODULE_PAYMENT_PAGAMASTARDE_DISCOUNT == 'True' ){ |
|
| 14 | + if (MODULE_PAYMENT_PAGAMASTARDE_DISCOUNT == 'True') { |
|
| 15 | 15 | $discount = 1; |
| 16 | - }else{ |
|
| 16 | + }else { |
|
| 17 | 17 | $discount = 0; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - if ( MODULE_PAYMENT_PAGAMASTARDE_TESTMODE == 'Test' ){ |
|
| 20 | + if (MODULE_PAYMENT_PAGAMASTARDE_TESTMODE == 'Test') { |
|
| 21 | 21 | $key = MODULE_PAYMENT_PAGAMASTARDE_TK; |
| 22 | - }else{ |
|
| 22 | + }else { |
|
| 23 | 23 | $key = MODULE_PAYMENT_PAGAMASTARDE_PK; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | $widget = ''; |
| 27 | - if ( MODULE_PAYMENT_PAGAMASTARDE_WIDGET == 'True' ) { |
|
| 28 | - $widget = '<div class="PmtSimulator" data-pmt-num-quota="4" data-pmt-style="neutral" data-pmt-type="3" data-pmt-discount="'.$discount.'" data-pmt-amount="'.(float)( $order->info['total'] ).'" data-pmt-expanded="no"></div> |
|
| 27 | + if (MODULE_PAYMENT_PAGAMASTARDE_WIDGET == 'True') { |
|
| 28 | + $widget = '<div class="PmtSimulator" data-pmt-num-quota="4" data-pmt-style="neutral" data-pmt-type="3" data-pmt-discount="'.$discount.'" data-pmt-amount="'.(float)($order->info['total']).'" data-pmt-expanded="no"></div> |
|
| 29 | 29 | <script type ="text/javascript" src ="https://cdn.pagamastarde.com/pmt-simulator/3/js/pmt-simulator.min.js"> |
| 30 | 30 | </script> |
| 31 | 31 | <script> |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | </script>'; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - define('MODULE_PAYMENT_PAGAMASTARDE_TEXT_CATALOG_TITLE', 'Finaciación con Paga+Tarde'. $widget); // Payment option title as displayed to the customer |
|
| 39 | + define('MODULE_PAYMENT_PAGAMASTARDE_TEXT_CATALOG_TITLE', 'Finaciación con Paga+Tarde'.$widget); // Payment option title as displayed to the customer |
|
| 40 | 40 | |
| 41 | 41 | define('MODULE_PAYMENT_PAGAMASTARDE_TEXT_ADMIN_TITLE', 'Paga+Tarde'); |
| 42 | 42 | |
@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | class pagamastarde |
| 16 | 16 | { |
| 17 | 17 | /** |
| 18 | - * Constructor |
|
| 19 | - */ |
|
| 18 | + * Constructor |
|
| 19 | + */ |
|
| 20 | 20 | public function __construct() |
| 21 | 21 | { |
| 22 | 22 | global $order; |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | // class methods |
| 49 | 49 | /** |
| 50 | - * Calculate zone matches and flag settings to determine whether this module should display to customers or not |
|
| 51 | - */ |
|
| 50 | + * Calculate zone matches and flag settings to determine whether this module should display to customers or not |
|
| 51 | + */ |
|
| 52 | 52 | public function update_status() |
| 53 | 53 | { |
| 54 | 54 | global $order, $db; |
@@ -121,12 +121,12 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | - * Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen. |
|
| 125 | - * This sends the data to the payment gateway for processing. |
|
| 126 | - * (These are hidden fields on the checkout confirmation page) |
|
| 127 | - * |
|
| 128 | - * @return string |
|
| 129 | - */ |
|
| 124 | + * Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen. |
|
| 125 | + * This sends the data to the payment gateway for processing. |
|
| 126 | + * (These are hidden fields on the checkout confirmation page) |
|
| 127 | + * |
|
| 128 | + * @return string |
|
| 129 | + */ |
|
| 130 | 130 | public function process_button() |
| 131 | 131 | { |
| 132 | 132 | global $order; |
@@ -350,10 +350,10 @@ discard block |
||
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | /** |
| 353 | - * Post-processing activities |
|
| 354 | - * |
|
| 355 | - * @return boolean |
|
| 356 | - */ |
|
| 353 | + * Post-processing activities |
|
| 354 | + * |
|
| 355 | + * @return boolean |
|
| 356 | + */ |
|
| 357 | 357 | public function after_process() |
| 358 | 358 | { |
| 359 | 359 | global $insert_id, $order, $currencies; |
@@ -460,22 +460,22 @@ discard block |
||
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | /** |
| 463 | - * Internal list of configuration keys used for configuration of the module |
|
| 464 | - * |
|
| 465 | - * @return array |
|
| 466 | - */ |
|
| 463 | + * Internal list of configuration keys used for configuration of the module |
|
| 464 | + * |
|
| 465 | + * @return array |
|
| 466 | + */ |
|
| 467 | 467 | public function keys() |
| 468 | 468 | { |
| 469 | 469 | return array('MODULE_PAYMENT_PAGAMASTARDE_STATUS', |
| 470 | - 'MODULE_PAYMENT_PAGAMASTARDE_TK', |
|
| 471 | - 'MODULE_PAYMENT_PAGAMASTARDE_TSK', |
|
| 472 | - 'MODULE_PAYMENT_PAGAMASTARDE_PK', |
|
| 473 | - 'MODULE_PAYMENT_PAGAMASTARDE_PSK', |
|
| 474 | - 'MODULE_PAYMENT_PAGAMASTARDE_DISCOUNT', |
|
| 475 | - 'MODULE_PAYMENT_PAGAMASTARDE_WIDGET', |
|
| 476 | - 'MODULE_PAYMENT_PAGAMASTARDE_TESTMODE', |
|
| 477 | - 'MODULE_PAYMENT_PAGAMASTARDE_SORT_ORDER', |
|
| 478 | - 'MODULE_PAYMENT_PAGAMASTARDE_ZONE', |
|
| 479 | - 'MODULE_PAYMENT_PAGAMASTARDE_ORDER_STATUS_ID'); |
|
| 470 | + 'MODULE_PAYMENT_PAGAMASTARDE_TK', |
|
| 471 | + 'MODULE_PAYMENT_PAGAMASTARDE_TSK', |
|
| 472 | + 'MODULE_PAYMENT_PAGAMASTARDE_PK', |
|
| 473 | + 'MODULE_PAYMENT_PAGAMASTARDE_PSK', |
|
| 474 | + 'MODULE_PAYMENT_PAGAMASTARDE_DISCOUNT', |
|
| 475 | + 'MODULE_PAYMENT_PAGAMASTARDE_WIDGET', |
|
| 476 | + 'MODULE_PAYMENT_PAGAMASTARDE_TESTMODE', |
|
| 477 | + 'MODULE_PAYMENT_PAGAMASTARDE_SORT_ORDER', |
|
| 478 | + 'MODULE_PAYMENT_PAGAMASTARDE_ZONE', |
|
| 479 | + 'MODULE_PAYMENT_PAGAMASTARDE_ORDER_STATUS_ID'); |
|
| 480 | 480 | } |
| 481 | 481 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | $this->code = 'pagamastarde'; |
| 25 | 25 | if (strpos($_SERVER[REQUEST_URI], "checkout_payment.php") <= 0) { |
| 26 | 26 | $this->title = MODULE_PAYMENT_PAGAMASTARDE_TEXT_ADMIN_TITLE; // Payment module title in Admin |
| 27 | - } else { |
|
| 27 | + }else { |
|
| 28 | 28 | $this->title = MODULE_PAYMENT_PAGAMASTARDE_TEXT_CATALOG_TITLE; // Payment module title in Catalog |
| 29 | 29 | if ($_SESSION['currency'] != 'EUR') { |
| 30 | 30 | return false; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | global $order, $db; |
| 55 | 55 | if ($this->enabled && (int)MODULE_PAYMENT_PAGAMASTARDE_ZONE > 0 && isset($order->billing['country']['id'])) { |
| 56 | 56 | $check_flag = false; |
| 57 | - $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PAGAMASTARDE_ZONE . "' and zone_country_id = '" . (int)$order->billing['country']['id'] . "' order by zone_id"); |
|
| 57 | + $check_query = tep_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_PAGAMASTARDE_ZONE."' and zone_country_id = '".(int)$order->billing['country']['id']."' order by zone_id"); |
|
| 58 | 58 | while ($check = tep_db_fetch_array($check_query)) { |
| 59 | 59 | if ($check['zone_id'] < 1) { |
| 60 | 60 | $check_flag = true; |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | public function process_button() |
| 131 | 131 | { |
| 132 | 132 | global $order; |
| 133 | - $this->order_id = md5(serialize($order->products) .''. serialize($order->customer) .''. serialize($order->delivery)); |
|
| 133 | + $this->order_id = md5(serialize($order->products).''.serialize($order->customer).''.serialize($order->delivery)); |
|
| 134 | 134 | $_SESSION['order_id'] = $this->order_id; |
| 135 | - $sql = sprintf("insert into " . TABLE_PAGAMASTARDE . " (order_id) values ('%s')", $this->order_id); |
|
| 135 | + $sql = sprintf("insert into ".TABLE_PAGAMASTARDE." (order_id) values ('%s')", $this->order_id); |
|
| 136 | 136 | tep_db_query($sql); |
| 137 | 137 | $base_url = dirname( |
| 138 | 138 | sprintf( |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $_SERVER['REQUEST_URI'] |
| 143 | 143 | ) |
| 144 | 144 | ); |
| 145 | - $callback_url = $base_url . '/ext/modules/payment/pagamastarde/callback.php'; |
|
| 145 | + $callback_url = $base_url.'/ext/modules/payment/pagamastarde/callback.php'; |
|
| 146 | 146 | $pagamastarde_ok_url = htmlspecialchars_decode(tep_href_link(FILENAME_CHECKOUT_PROCESS, 'action=confirm', 'SSL', true, false)); |
| 147 | 147 | $pagamastarde_nok_url = trim(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL', false)); |
| 148 | 148 | $cancelled_url = trim(tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL', false)); |
@@ -150,13 +150,13 @@ discard block |
||
| 150 | 150 | $currency = $order->info['currency']; |
| 151 | 151 | if (MODULE_PAYMENT_PAGAMASTARDE_DISCOUNT == 'False') { |
| 152 | 152 | $discount = 'false'; |
| 153 | - } else { |
|
| 153 | + }else { |
|
| 154 | 154 | $discount = 'true'; |
| 155 | 155 | } |
| 156 | 156 | if (MODULE_PAYMENT_PAGAMASTARDE_TESTMODE == 'Test') { |
| 157 | 157 | $secret_key = MODULE_PAYMENT_PAGAMASTARDE_TSK; |
| 158 | 158 | $public_key = MODULE_PAYMENT_PAGAMASTARDE_TK; |
| 159 | - } else { |
|
| 159 | + }else { |
|
| 160 | 160 | $secret_key = MODULE_PAYMENT_PAGAMASTARDE_PSK; |
| 161 | 161 | $public_key = MODULE_PAYMENT_PAGAMASTARDE_PK; |
| 162 | 162 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | } |
| 217 | 217 | $billing_dob = ''; |
| 218 | 218 | if ($order->billing['firstname'] == $order->customer['firstname'] && |
| 219 | - $order->billing['lastname'] == $order->customer['lastname'] ) { |
|
| 219 | + $order->billing['lastname'] == $order->customer['lastname']) { |
|
| 220 | 220 | $billing_dob = $dob; |
| 221 | 221 | } |
| 222 | 222 | |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | 'discount[full]' => $discount, |
| 234 | 234 | 'dob' => $billing_dob, |
| 235 | 235 | |
| 236 | - 'full_name' =>$order->billing['firstname'] . ' ' . $order->billing['lastname'], |
|
| 236 | + 'full_name' =>$order->billing['firstname'].' '.$order->billing['lastname'], |
|
| 237 | 237 | 'email' => $order->customer['email_address'], |
| 238 | 238 | 'mobile_phone' => $order->customer['telephone'], |
| 239 | 239 | 'address[street]' => $order->billing['street_address'], |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | |
| 244 | 244 | 'loginCustomer[is_guest]' => $is_guest, |
| 245 | 245 | 'loginCustomer[gender]' => $gender, |
| 246 | - 'loginCustomer[full_name]' => $order->customer['firstname'] . ' ' . $order->customer['lastname'], |
|
| 246 | + 'loginCustomer[full_name]' => $order->customer['firstname'].' '.$order->customer['lastname'], |
|
| 247 | 247 | 'loginCustomer[num_orders]' => $order_count, |
| 248 | 248 | 'loginCustomer[amount_orders]' => $order_total, |
| 249 | 249 | 'loginCustomer[member_since]' => $sign_up, |
@@ -271,20 +271,20 @@ discard block |
||
| 271 | 271 | ); |
| 272 | 272 | |
| 273 | 273 | //product descirption |
| 274 | - $i=0; |
|
| 274 | + $i = 0; |
|
| 275 | 275 | if (isset($order->info['shipping_method'])) { |
| 276 | - $submit_data["items[".$i."][description]"]=$order->info['shipping_method']; |
|
| 277 | - $submit_data["items[".$i."][quantity]"]=1; |
|
| 278 | - $submit_data["items[".$i."][amount]"]=number_format($order->info['shipping_cost'], 2, '.', ''); |
|
| 279 | - $desciption[]=$order->info['shipping_method']; |
|
| 276 | + $submit_data["items[".$i."][description]"] = $order->info['shipping_method']; |
|
| 277 | + $submit_data["items[".$i."][quantity]"] = 1; |
|
| 278 | + $submit_data["items[".$i."][amount]"] = number_format($order->info['shipping_cost'], 2, '.', ''); |
|
| 279 | + $desciption[] = $order->info['shipping_method']; |
|
| 280 | 280 | $i++; |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | foreach ($order->products as $product) { |
| 284 | - $submit_data["items[".$i."][description]"]=$product['name']; |
|
| 285 | - $submit_data["items[".$i."][quantity]"]=$product['qty']; |
|
| 286 | - $submit_data["items[".$i."][amount]"]=number_format($product['final_price'] * $product['qty'], 2, '.', ''); |
|
| 287 | - $desciption[]=$product['name'] . " (".$product['qty'].")"; |
|
| 284 | + $submit_data["items[".$i."][description]"] = $product['name']; |
|
| 285 | + $submit_data["items[".$i."][quantity]"] = $product['qty']; |
|
| 286 | + $submit_data["items[".$i."][amount]"] = number_format($product['final_price'] * $product['qty'], 2, '.', ''); |
|
| 287 | + $desciption[] = $product['name']." (".$product['qty'].")"; |
|
| 288 | 288 | $i++; |
| 289 | 289 | } |
| 290 | 290 | $submit_data['description'] = implode(",", $desciption); |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | $process_button_string = "\n"; |
| 300 | 300 | foreach ($submit_data as $key => $value) { |
| 301 | - $process_button_string .= tep_draw_hidden_field($key, $value) . "\n"; |
|
| 301 | + $process_button_string .= tep_draw_hidden_field($key, $value)."\n"; |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | return $process_button_string; |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | if (MODULE_PAYMENT_PAGAMASTARDE_TESTMODE == 'Test') { |
| 317 | 317 | $secret_key = MODULE_PAYMENT_PAGAMASTARDE_TSK; |
| 318 | 318 | $public_key = MODULE_PAYMENT_PAGAMASTARDE_TK; |
| 319 | - } else { |
|
| 319 | + }else { |
|
| 320 | 320 | $secret_key = MODULE_PAYMENT_PAGAMASTARDE_PSK; |
| 321 | 321 | $public_key = MODULE_PAYMENT_PAGAMASTARDE_PK; |
| 322 | 322 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | $this->auth_code = 'paga+tarde'; |
| 344 | 344 | $this->transaction_id = $this->notification['data']['id']; |
| 345 | 345 | return; |
| 346 | - } else { |
|
| 346 | + }else { |
|
| 347 | 347 | $messageStack->add_session('checkout_payment', MODULE_PAYMENT_PAGAMASTARDE_TEXT_DECLINED_MESSAGE, 'error'); |
| 348 | 348 | tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true, false)); |
| 349 | 349 | } |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | if (MODULE_PAYMENT_PAGAMASTARDE_TESTMODE == 'Test') { |
| 367 | 367 | $secret_key = MODULE_PAYMENT_PAGAMASTARDE_TSK; |
| 368 | 368 | $public_key = MODULE_PAYMENT_PAGAMASTARDE_TK; |
| 369 | - } else { |
|
| 369 | + }else { |
|
| 370 | 370 | $secret_key = MODULE_PAYMENT_PAGAMASTARDE_PSK; |
| 371 | 371 | $public_key = MODULE_PAYMENT_PAGAMASTARDE_PK; |
| 372 | 372 | } |
@@ -389,8 +389,8 @@ discard block |
||
| 389 | 389 | } |
| 390 | 390 | //$this->notify('NOTIFY_PAYMENT_AUTHNETSIM_POSTPROCESS_HOOK'); |
| 391 | 391 | if ($notififcation_check && $this->notification['event'] == 'charge.created') { |
| 392 | - $sql = "insert into " . TABLE_ORDERS_STATUS_HISTORY . " (comments, orders_id, orders_status_id, customer_notified, date_added) values |
|
| 393 | - ('".'Paga+tarde. Transaction ID: ' .$this->notification['data']['id']."', ".$insert_id.", '".$this->order_status."', -1, now() )"; |
|
| 392 | + $sql = "insert into ".TABLE_ORDERS_STATUS_HISTORY." (comments, orders_id, orders_status_id, customer_notified, date_added) values |
|
| 393 | + ('".'Paga+tarde. Transaction ID: '.$this->notification['data']['id']."', ".$insert_id.", '".$this->order_status."', -1, now() )"; |
|
| 394 | 394 | tep_db_query($sql); |
| 395 | 395 | } |
| 396 | 396 | unset($_SESSION['order_id']); |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | public function check() |
| 406 | 406 | { |
| 407 | 407 | if (!isset($this->_check)) { |
| 408 | - $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PAGAMASTARDE_STATUS'"); |
|
| 408 | + $check_query = tep_db_query("select configuration_value from ".TABLE_CONFIGURATION." where configuration_key = 'MODULE_PAYMENT_PAGAMASTARDE_STATUS'"); |
|
| 409 | 409 | $this->_check = tep_db_num_rows($check_query); |
| 410 | 410 | } |
| 411 | 411 | $this->_check_install_pmt_table(); |
@@ -420,17 +420,17 @@ discard block |
||
| 420 | 420 | tep_redirect(tep_href_link(FILENAME_MODULES, 'set=payment&module=pagamastarde', 'NONSSL')); |
| 421 | 421 | return 'failed'; |
| 422 | 422 | } |
| 423 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Paga+Tarde Module', 'MODULE_PAYMENT_PAGAMASTARDE_STATUS', 'True', 'Do you want to accept Paga+Tarde payments?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); |
|
| 424 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('TEST Public Key', 'MODULE_PAYMENT_PAGAMASTARDE_TK', 'tk_XXXX', 'The test public key used for the Paga+Tarde service', '6', '0', now())"); |
|
| 425 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('TEST Secret Key', 'MODULE_PAYMENT_PAGAMASTARDE_TSK', 'secret', 'The test secret key used for the Paga+Tarde service', '6', '0', now())"); |
|
| 426 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('REAL Public Key', 'MODULE_PAYMENT_PAGAMASTARDE_PK', 'pk_XXXX', 'The real public key used for the Paga+Tarde service', '6', '0', now())"); |
|
| 427 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('REAL Secret Key', 'MODULE_PAYMENT_PAGAMASTARDE_PSK', 'secret', 'The real public key used for the Paga+Tarde service', '6', '0', now())"); |
|
| 428 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Discount', 'MODULE_PAYMENT_PAGAMASTARDE_DISCOUNT', 'False', 'Do you want to asume loan comissions?', '6', '3', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); |
|
| 429 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Include Widget', 'MODULE_PAYMENT_PAGAMASTARDE_WIDGET', 'False', 'Do you want to include the Paga+Tarde widget in the checkout page?', '6', '3', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); |
|
| 430 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Mode', 'MODULE_PAYMENT_PAGAMASTARDE_TESTMODE', 'Test', 'Transaction mode used for processing orders.<br><strong>Production</strong>=Live processing with real account credentials<br><strong>Test</strong>=Simulations with real account credentials', '6', '0', 'tep_cfg_select_option(array(\'Test\', \'Production\'), ', now())"); |
|
| 431 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_PAGAMASTARDE_SORT_ORDER', '0', 'Sort order of displaying payment options to the customer. Lowest is displayed first.', '6', '0', now())"); |
|
| 432 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_PAGAMASTARDE_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); |
|
| 433 | - tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_PAGAMASTARDE_ORDER_STATUS_ID', '2', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); |
|
| 423 | + tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Paga+Tarde Module', 'MODULE_PAYMENT_PAGAMASTARDE_STATUS', 'True', 'Do you want to accept Paga+Tarde payments?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); |
|
| 424 | + tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('TEST Public Key', 'MODULE_PAYMENT_PAGAMASTARDE_TK', 'tk_XXXX', 'The test public key used for the Paga+Tarde service', '6', '0', now())"); |
|
| 425 | + tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('TEST Secret Key', 'MODULE_PAYMENT_PAGAMASTARDE_TSK', 'secret', 'The test secret key used for the Paga+Tarde service', '6', '0', now())"); |
|
| 426 | + tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('REAL Public Key', 'MODULE_PAYMENT_PAGAMASTARDE_PK', 'pk_XXXX', 'The real public key used for the Paga+Tarde service', '6', '0', now())"); |
|
| 427 | + tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('REAL Secret Key', 'MODULE_PAYMENT_PAGAMASTARDE_PSK', 'secret', 'The real public key used for the Paga+Tarde service', '6', '0', now())"); |
|
| 428 | + tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Discount', 'MODULE_PAYMENT_PAGAMASTARDE_DISCOUNT', 'False', 'Do you want to asume loan comissions?', '6', '3', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); |
|
| 429 | + tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Include Widget', 'MODULE_PAYMENT_PAGAMASTARDE_WIDGET', 'False', 'Do you want to include the Paga+Tarde widget in the checkout page?', '6', '3', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); |
|
| 430 | + tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Mode', 'MODULE_PAYMENT_PAGAMASTARDE_TESTMODE', 'Test', 'Transaction mode used for processing orders.<br><strong>Production</strong>=Live processing with real account credentials<br><strong>Test</strong>=Simulations with real account credentials', '6', '0', 'tep_cfg_select_option(array(\'Test\', \'Production\'), ', now())"); |
|
| 431 | + tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_PAGAMASTARDE_SORT_ORDER', '0', 'Sort order of displaying payment options to the customer. Lowest is displayed first.', '6', '0', now())"); |
|
| 432 | + tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_PAGAMASTARDE_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); |
|
| 433 | + tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_PAGAMASTARDE_ORDER_STATUS_ID', '2', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); |
|
| 434 | 434 | |
| 435 | 435 | $this->_check_install_pmt_table(); |
| 436 | 436 | } |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | { |
| 440 | 440 | $CheckTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGAMASTARDE."'"); |
| 441 | 441 | if (tep_db_num_rows($CheckTable) <= 0) { |
| 442 | - $sql = "CREATE TABLE " . TABLE_PAGAMASTARDE . " ( |
|
| 442 | + $sql = "CREATE TABLE ".TABLE_PAGAMASTARDE." ( |
|
| 443 | 443 | `id` int(11) NOT NULL auto_increment, |
| 444 | 444 | `insert_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, |
| 445 | 445 | `order_id` varchar(150) NOT NULL, |
@@ -454,9 +454,9 @@ discard block |
||
| 454 | 454 | { |
| 455 | 455 | $CheckTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGAMASTARDE."'"); |
| 456 | 456 | if (tep_db_num_rows($CheckTable) > 0) { |
| 457 | - tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); |
|
| 457 | + tep_db_query("delete from ".TABLE_CONFIGURATION." where configuration_key in ('".implode("', '", $this->keys())."')"); |
|
| 458 | 458 | } |
| 459 | - tep_db_query("drop table " . TABLE_PAGAMASTARDE); |
|
| 459 | + tep_db_query("drop table ".TABLE_PAGAMASTARDE); |
|
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | /** |
@@ -16,24 +16,24 @@ |
||
| 16 | 16 | |
| 17 | 17 | $json = file_get_contents('php://input'); |
| 18 | 18 | $notification = json_decode($json, true); |
| 19 | -if(isset($notification['event']) && $notification['event'] != 'charge.created') { |
|
| 19 | +if (isset($notification['event']) && $notification['event'] != 'charge.created') { |
|
| 20 | 20 | die('Not processing notification'); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | -if (MODULE_PAYMENT_PAGAMASTARDE_TESTMODE == 'Test'){ |
|
| 23 | +if (MODULE_PAYMENT_PAGAMASTARDE_TESTMODE == 'Test') { |
|
| 24 | 24 | $secret_key = MODULE_PAYMENT_PAGAMASTARDE_TSK; |
| 25 | 25 | $public_key = MODULE_PAYMENT_PAGAMASTARDE_TK; |
| 26 | -} else { |
|
| 26 | +}else { |
|
| 27 | 27 | $secret_key = MODULE_PAYMENT_PAGAMASTARDE_PSK; |
| 28 | 28 | $public_key = MODULE_PAYMENT_PAGAMASTARDE_PK; |
| 29 | 29 | } |
| 30 | 30 | $signature_check = sha1($secret_key.$notification['account_id'].$notification['api_version'].$notification['event'].$notification['data']['id']); |
| 31 | -$signature_check_sha512 = hash('sha512',$pagamastarde_secret.$notification['account_id'].$notification['api_version'].$notification['event'].$notification['data']['id']); |
|
| 32 | -if ($signature_check != $notification['signature'] && $signature_check_sha512 != $notification['signature'] ){ |
|
| 33 | - die( 'Fallo en el proceso de pago. Su pedido ha sido cancelado.' ); |
|
| 31 | +$signature_check_sha512 = hash('sha512', $pagamastarde_secret.$notification['account_id'].$notification['api_version'].$notification['event'].$notification['data']['id']); |
|
| 32 | +if ($signature_check != $notification['signature'] && $signature_check_sha512 != $notification['signature']) { |
|
| 33 | + die('Fallo en el proceso de pago. Su pedido ha sido cancelado.'); |
|
| 34 | 34 | exit; |
| 35 | -} else { |
|
| 36 | - $sql ="update " . TABLE_PAGAMASTARDE . " set json = '".addslashes($json)."' where order_id = '".$notification['data']['order_id']."'"; |
|
| 35 | +}else { |
|
| 36 | + $sql = "update ".TABLE_PAGAMASTARDE." set json = '".addslashes($json)."' where order_id = '".$notification['data']['order_id']."'"; |
|
| 37 | 37 | tep_db_query($sql); |
| 38 | 38 | echo 'OK'; |
| 39 | 39 | } |