From 2e423bdde08a232f78450720072fab3697f23d3f Mon Sep 17 00:00:00 2001 From: TheCartpenter Date: Wed, 29 May 2024 10:41:43 -0400 Subject: [PATCH] Upgraded PayPal Checkout to v3.1.1 release --- .../controller/extension/payment/paypal.php | 564 +++++---- .../en-gb/extension/payment/paypal.php | 666 +++++----- .../admin/model/extension/payment/paypal.php | 58 +- .../controller/extension/payment/paypal.php | 1088 ++++++++--------- .../extension/payment/paypal_applepay.php | 22 +- .../extension/payment/paypal_googlepay.php | 22 +- .../extension/payment/paypal_paylater.php | 22 +- .../controller/extension/recurring/paypal.php | 2 +- .../model/extension/payment/paypal.php | 76 +- .../extension/payment/paypal_applepay.php | 6 +- .../extension/payment/paypal_googlepay.php | 6 +- .../extension/payment/paypal_paylater.php | 6 +- .../catalog/view/javascript/paypal/paypal.js | 21 +- upload/system/config/paypal.php | 895 +++++++------- upload/system/library/paypal/paypal.php | 32 +- 15 files changed, 1736 insertions(+), 1750 deletions(-) diff --git a/upload/admin/controller/extension/payment/paypal.php b/upload/admin/controller/extension/payment/paypal.php index 70857bcc0..de714b764 100644 --- a/upload/admin/controller/extension/payment/paypal.php +++ b/upload/admin/controller/extension/payment/paypal.php @@ -1,6 +1,6 @@ $cache_data['shared_id'], 'environment' => $environment, 'partner_attribution_id' => $config_setting['partner'][$environment]['partner_attribution_id'] - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'authorization_code', 'code' => $cache_data['authorization_code'], 'code_verifier' => $cache_data['seller_nonce'] - ]; + ); $paypal->setAccessToken($token_info); @@ -63,19 +63,19 @@ public function index() { $secret = $result['client_secret']; } - $paypal_info = [ + $paypal_info = array( 'partner_id' => $config_setting['partner'][$environment]['partner_id'], 'client_id' => $client_id, 'secret' => $secret, 'environment' => $environment, 'partner_attribution_id' => $config_setting['partner'][$environment]['partner_attribution_id'] - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); @@ -84,20 +84,20 @@ public function index() { $webhook_token = sha1(uniqid(mt_rand(), 1)); $cron_token = sha1(uniqid(mt_rand(), 1)); - $webhook_info = [ + $webhook_info = array( 'url' => $catalog . 'index.php?route=extension/payment/paypal&webhook_token=' . $webhook_token, - 'event_types' => [ - ['name' => 'PAYMENT.AUTHORIZATION.CREATED'], - ['name' => 'PAYMENT.AUTHORIZATION.VOIDED'], - ['name' => 'PAYMENT.CAPTURE.COMPLETED'], - ['name' => 'PAYMENT.CAPTURE.DENIED'], - ['name' => 'PAYMENT.CAPTURE.PENDING'], - ['name' => 'PAYMENT.CAPTURE.REFUNDED'], - ['name' => 'PAYMENT.CAPTURE.REVERSED'], - ['name' => 'CHECKOUT.ORDER.COMPLETED'], - ['name' => 'VAULT.PAYMENT-TOKEN.CREATED'] - ] - ]; + 'event_types' => array( + array('name' => 'PAYMENT.AUTHORIZATION.CREATED'), + array('name' => 'PAYMENT.AUTHORIZATION.VOIDED'), + array('name' => 'PAYMENT.CAPTURE.COMPLETED'), + array('name' => 'PAYMENT.CAPTURE.DENIED'), + array('name' => 'PAYMENT.CAPTURE.PENDING'), + array('name' => 'PAYMENT.CAPTURE.REFUNDED'), + array('name' => 'PAYMENT.CAPTURE.REVERSED'), + array('name' => 'CHECKOUT.ORDER.COMPLETED'), + array('name' => 'VAULT.PAYMENT-TOKEN.CREATED') + ) + ); $result = $paypal->createWebhook($webhook_info); @@ -108,8 +108,8 @@ public function index() { } if ($paypal->hasErrors()) { - $error_messages = []; - + $error_messages = array(); + $errors = $paypal->getErrors(); foreach ($errors as $error) { @@ -193,22 +193,22 @@ public function auth() { $this->document->setTitle($this->language->get('heading_title_main')); - $data['breadcrumbs'] = []; + $data['breadcrumbs'] = array(); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_extensions'), 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title_main'), 'href' => $this->url->link('extension/payment/paypal', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true); $data['partner_url'] = str_replace('&', '%26', $this->url->link('extension/payment/paypal', 'user_token=' . $this->session->data['user_token'], true)); @@ -234,16 +234,16 @@ public function auth() { $data['seller_nonce'] = $this->token(50); - $data['configure_url'] = [ - 'production' => [ + $data['configure_url'] = array( + 'production' => array( 'ppcp' => 'https://www.paypal.com/bizsignup/partner/entry?partnerId=' . $data['setting']['partner']['production']['partner_id'] . '&partnerClientId=' . $data['setting']['partner']['production']['client_id'] . '&features=PAYMENT,REFUND,ACCESS_MERCHANT_INFORMATION,VAULT,BILLING_AGREEMENT&product=PPCP,ADVANCED_VAULTING&capabilities=PAYPAL_WALLET_VAULTING_ADVANCED&integrationType=FO&returnToPartnerUrl=' . $data['partner_url'] . '&displayMode=minibrowser&sellerNonce=' . $data['seller_nonce'], 'express_checkout' => 'https://www.paypal.com/bizsignup/partner/entry?partnerId=' . $data['setting']['partner']['production']['partner_id'] . '&partnerClientId=' . $data['setting']['partner']['production']['client_id'] . '&features=PAYMENT,REFUND,ACCESS_MERCHANT_INFORMATION,VAULT,BILLING_AGREEMENT&product=EXPRESS_CHECKOUT,ADVANCED_VAULTING&capabilities=PAYPAL_WALLET_VAULTING_ADVANCED&integrationType=FO&returnToPartnerUrl=' . $data['partner_url'] . '&displayMode=minibrowser&sellerNonce=' . $data['seller_nonce'] - ], - 'sandbox' => [ + ), + 'sandbox' => array( 'ppcp' => 'https://www.sandbox.paypal.com/bizsignup/partner/entry?partnerId=' . $data['setting']['partner']['sandbox']['partner_id'] . '&partnerClientId=' . $data['setting']['partner']['sandbox']['client_id'] . '&features=PAYMENT,REFUND,ACCESS_MERCHANT_INFORMATION,VAULT,BILLING_AGREEMENT&product=PPCP,ADVANCED_VAULTING&capabilities=PAYPAL_WALLET_VAULTING_ADVANCED&integrationType=FO&returnToPartnerUrl=' . $data['partner_url'] . '&displayMode=minibrowser&sellerNonce=' . $data['seller_nonce'], 'express_checkout' => 'https://www.sandbox.paypal.com/bizsignup/partner/entry?partnerId=' . $data['setting']['partner']['sandbox']['partner_id'] . '&partnerClientId=' . $data['setting']['partner']['sandbox']['client_id'] . '&features=PAYMENT,REFUND,ACCESS_MERCHANT_INFORMATION,VAULT,BILLING_AGREEMENT&product=EXPRESS_CHECKOUT,ADVANCED_VAULTING&capabilities=PAYPAL_WALLET_VAULTING_ADVANCED&integrationType=FO&returnToPartnerUrl=' . $data['partner_url'] . '&displayMode=minibrowser&sellerNonce=' . $data['seller_nonce'] - ] - ]; + ) + ); $data['text_checkout_express'] = sprintf($this->language->get('text_checkout_express'), $data['configure_url'][$data['environment']]['express_checkout']); $data['text_support'] = sprintf($this->language->get('text_support'), $this->request->server['HTTP_HOST']); @@ -292,22 +292,22 @@ public function dashboard() { $this->document->setTitle($this->language->get('heading_title_main')); - $data['breadcrumbs'] = []; + $data['breadcrumbs'] = array(); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_extensions'), 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title_main'), 'href' => $this->url->link('extension/payment/paypal', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); $data['href_dashboard'] = $this->url->link('extension/payment/paypal/dashboard', 'user_token=' . $this->session->data['user_token'], true); $data['href_general'] = $this->url->link('extension/payment/paypal/general', 'user_token=' . $this->session->data['user_token'], true); @@ -423,22 +423,22 @@ public function general() { $this->document->setTitle($this->language->get('heading_title_main')); - $data['breadcrumbs'] = []; + $data['breadcrumbs'] = array(); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_extensions'), 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title_main'), 'href' => $this->url->link('extension/payment/paypal', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); // Action $data['href_dashboard'] = $this->url->link('extension/payment/paypal/dashboard', 'user_token=' . $this->session->data['user_token'], true); @@ -544,22 +544,22 @@ public function button() { $this->document->setTitle($this->language->get('heading_title_main')); - $data['breadcrumbs'] = []; + $data['breadcrumbs'] = array(); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_extensions'), 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title_main'), 'href' => $this->url->link('extension/payment/paypal', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); // Action $data['href_dashboard'] = $this->url->link('extension/payment/paypal/dashboard', 'user_token=' . $this->session->data['user_token'], true); @@ -611,25 +611,25 @@ public function button() { if ($data['client_id'] && $data['secret']) { require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'client_id' => $data['client_id'], 'secret' => $data['secret'], 'environment' => $data['environment'], 'partner_attribution_id' => $data['setting']['partner'][$data['environment']]['partner_attribution_id'] - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); $data['client_token'] = $paypal->getClientToken(); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -696,22 +696,22 @@ public function googlepay_button() { $this->document->setTitle($this->language->get('heading_title_main')); - $data['breadcrumbs'] = []; + $data['breadcrumbs'] = array(); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_extensions'), 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title_main'), 'href' => $this->url->link('extension/payment/paypal', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); // Action $data['href_dashboard'] = $this->url->link('extension/payment/paypal/dashboard', 'user_token=' . $this->session->data['user_token'], true); @@ -763,25 +763,25 @@ public function googlepay_button() { if ($data['client_id'] && $data['secret']) { require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'client_id' => $data['client_id'], 'secret' => $data['secret'], 'environment' => $data['environment'], 'partner_attribution_id' => $data['setting']['partner'][$data['environment']]['partner_attribution_id'] - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); $data['client_token'] = $paypal->getClientToken(); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -848,22 +848,22 @@ public function applepay_button() { $this->document->setTitle($this->language->get('heading_title_main')); - $data['breadcrumbs'] = []; + $data['breadcrumbs'] = array(); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_extensions'), 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title_main'), 'href' => $this->url->link('extension/payment/paypal', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); // Action $data['href_dashboard'] = $this->url->link('extension/payment/paypal/dashboard', 'user_token=' . $this->session->data['user_token'], true); @@ -917,25 +917,25 @@ public function applepay_button() { if ($data['client_id'] && $data['secret']) { require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'client_id' => $data['client_id'], 'secret' => $data['secret'], 'environment' => $data['environment'], 'partner_attribution_id' => $data['setting']['partner'][$data['environment']]['partner_attribution_id'] - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); $data['client_token'] = $paypal->getClientToken(); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -1002,22 +1002,22 @@ public function card() { $this->document->setTitle($this->language->get('heading_title_main')); - $data['breadcrumbs'] = []; + $data['breadcrumbs'] = array(); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_extensions'), 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title_main'), 'href' => $this->url->link('extension/payment/paypal', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); // Action $data['href_dashboard'] = $this->url->link('extension/payment/paypal/dashboard', 'user_token=' . $this->session->data['user_token'], true); @@ -1069,25 +1069,25 @@ public function card() { if ($data['client_id'] && $data['secret']) { require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'client_id' => $data['client_id'], 'secret' => $data['secret'], 'environment' => $data['environment'], 'partner_attribution_id' => $data['setting']['partner'][$data['environment']]['partner_attribution_id'] - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); $data['client_token'] = $paypal->getClientToken(); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -1154,22 +1154,22 @@ public function message_configurator() { $this->document->setTitle($this->language->get('heading_title_main')); - $data['breadcrumbs'] = []; + $data['breadcrumbs'] = array(); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_extensions'), 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title_main'), 'href' => $this->url->link('extension/payment/paypal', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); // Action $data['href_dashboard'] = $this->url->link('extension/payment/paypal/dashboard', 'user_token=' . $this->session->data['user_token'], true); @@ -1222,25 +1222,25 @@ public function message_configurator() { if ($data['client_id'] && $data['secret']) { require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'client_id' => $data['client_id'], 'secret' => $data['secret'], 'environment' => $data['environment'], 'partner_attribution_id' => $data['setting']['partner'][$data['environment']]['partner_attribution_id'] - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); $data['client_token'] = $paypal->getClientToken(); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -1306,22 +1306,22 @@ public function message_setting() { $this->document->setTitle($this->language->get('heading_title_main')); - $data['breadcrumbs'] = []; + $data['breadcrumbs'] = array(); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_extensions'), 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title_main'), 'href' => $this->url->link('extension/payment/paypal', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); // Action $data['href_dashboard'] = $this->url->link('extension/payment/paypal/dashboard', 'user_token=' . $this->session->data['user_token'], true); @@ -1382,25 +1382,25 @@ public function message_setting() { if ($data['client_id'] && $data['secret']) { require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'client_id' => $data['client_id'], 'secret' => $data['secret'], 'environment' => $data['environment'], 'partner_attribution_id' => $data['setting']['partner'][$data['environment']]['partner_attribution_id'] - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); $data['client_token'] = $paypal->getClientToken(); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -1462,22 +1462,22 @@ public function order_status() { $this->document->setTitle($this->language->get('heading_title_main')); - $data['breadcrumbs'] = []; + $data['breadcrumbs'] = array(); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_extensions'), 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title_main'), 'href' => $this->url->link('extension/payment/paypal', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); // Action $data['href_dashboard'] = $this->url->link('extension/payment/paypal/dashboard', 'user_token=' . $this->session->data['user_token'], true); @@ -1554,22 +1554,22 @@ public function contact() { $this->document->setTitle($this->language->get('heading_title_main')); - $data['breadcrumbs'] = []; + $data['breadcrumbs'] = array(); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_extensions'), 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title_main'), 'href' => $this->url->link('extension/payment/paypal', 'user_token=' . $this->session->data['user_token'], true) - ]; + ); // Action $data['href_dashboard'] = $this->url->link('extension/payment/paypal/dashboard', 'user_token=' . $this->session->data['user_token'], true); @@ -1636,8 +1636,6 @@ public function contact() { public function save() { $this->load->language('extension/payment/paypal'); - - $json = []; $this->load->model('setting/setting'); @@ -1648,19 +1646,17 @@ public function save() { $this->model_setting_setting->editSetting('payment_paypal', $setting); - $json['success'] = $this->language->get('success_save'); + $data['success'] = $this->language->get('success_save'); } - $json['error'] = $this->error; + $data['error'] = $this->error; $this->response->addHeader('Content-Type: application/json'); - $this->response->setOutput(json_encode($json)); + $this->response->setOutput(json_encode($data)); } public function connect() { $this->load->language('extension/payment/paypal'); - - $json = []; if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) { $server = HTTPS_SERVER; @@ -1685,19 +1681,19 @@ public function connect() { require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $config_setting['partner'][$environment]['partner_id'], 'client_id' => $client_id, 'secret' => $secret, 'environment' => $environment, 'partner_attribution_id' => $config_setting['partner'][$environment]['partner_attribution_id'] - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $result = $paypal->setAccessToken($token_info); @@ -1707,20 +1703,20 @@ public function connect() { $webhook_token = sha1(uniqid(mt_rand(), 1)); $cron_token = sha1(uniqid(mt_rand(), 1)); - $webhook_info = [ + $webhook_info = array( 'url' => $catalog . 'index.php?route=extension/payment/paypal&webhook_token=' . $webhook_token, - 'event_types' => [ - ['name' => 'PAYMENT.AUTHORIZATION.CREATED'], - ['name' => 'PAYMENT.AUTHORIZATION.VOIDED'], - ['name' => 'PAYMENT.CAPTURE.COMPLETED'], - ['name' => 'PAYMENT.CAPTURE.DENIED'], - ['name' => 'PAYMENT.CAPTURE.PENDING'], - ['name' => 'PAYMENT.CAPTURE.REFUNDED'], - ['name' => 'PAYMENT.CAPTURE.REVERSED'], - ['name' => 'CHECKOUT.ORDER.COMPLETED'], - ['name' => 'VAULT.PAYMENT-TOKEN.CREATED'] - ] - ]; + 'event_types' => array( + array('name' => 'PAYMENT.AUTHORIZATION.CREATED'), + array('name' => 'PAYMENT.AUTHORIZATION.VOIDED'), + array('name' => 'PAYMENT.CAPTURE.COMPLETED'), + array('name' => 'PAYMENT.CAPTURE.DENIED'), + array('name' => 'PAYMENT.CAPTURE.PENDING'), + array('name' => 'PAYMENT.CAPTURE.REFUNDED'), + array('name' => 'PAYMENT.CAPTURE.REVERSED'), + array('name' => 'CHECKOUT.ORDER.COMPLETED'), + array('name' => 'VAULT.PAYMENT-TOKEN.CREATED') + ) + ); $result = $paypal->createWebhook($webhook_info); @@ -1731,7 +1727,7 @@ public function connect() { } if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -1799,15 +1795,13 @@ public function connect() { $this->error['warning'] = $this->language->get('error_connect'); } - $json['error'] = $this->error; + $data['error'] = $this->error; $this->response->addHeader('Content-Type: application/json'); - $this->response->setOutput(json_encode($json)); + $this->response->setOutput(json_encode($data)); } public function disconnect() { - $json = []; - $this->load->model('setting/setting'); $setting = $this->model_setting_setting->getSetting('payment_paypal'); @@ -1819,15 +1813,13 @@ public function disconnect() { $this->model_setting_setting->editSetting('payment_paypal', $setting); - $json['error'] = $this->error; + $data['error'] = $this->error; $this->response->addHeader('Content-Type: application/json'); - $this->response->setOutput(json_encode($json)); + $this->response->setOutput(json_encode($data)); } public function callback() { - $json = []; - if (isset($this->request->post['environment']) && isset($this->request->post['authorization_code']) && isset($this->request->post['shared_id']) && isset($this->request->post['seller_nonce'])) { $cache_data['environment'] = $this->request->post['environment']; $cache_data['authorization_code'] = $this->request->post['authorization_code']; @@ -1837,27 +1829,27 @@ public function callback() { $this->cache->set('paypal', $cache_data, 30); } - $json['error'] = $this->error; + $data['error'] = $this->error; $this->response->addHeader('Content-Type: application/json'); - $this->response->setOutput(json_encode($json)); + $this->response->setOutput(json_encode($data)); } public function getSaleAnalytics() { $this->load->language('extension/payment/paypal'); - $json = []; + $data = array(); $this->load->model('extension/payment/paypal'); - $json['all_sale'] = []; - $json['paypal_sale'] = []; - $json['xaxis'] = []; + $data['all_sale'] = array(); + $data['paypal_sale'] = array(); + $data['xaxis'] = array(); - $json['all_sale']['label'] = $this->language->get('text_all_sales'); - $json['paypal_sale']['label'] = $this->language->get('text_paypal_sales'); - $json['all_sale']['data'] = []; - $json['paypal_sale']['data'] = []; + $data['all_sale']['label'] = $this->language->get('text_all_sales'); + $data['paypal_sale']['label'] = $this->language->get('text_paypal_sales'); + $data['all_sale']['data'] = array(); + $data['paypal_sale']['data'] = array(); if (isset($this->request->get['range'])) { $range = $this->request->get['range']; @@ -1871,12 +1863,12 @@ public function getSaleAnalytics() { $results = $this->model_extension_payment_paypal->getTotalSalesByDay(); foreach ($results as $key => $value) { - $json['all_sale']['data'][] = [$key, $value['total']]; - $json['paypal_sale']['data'][] = [$key, $value['paypal_total']]; + $data['all_sale']['data'][] = array($key, $value['total']); + $data['paypal_sale']['data'][] = array($key, $value['paypal_total']); } for ($i = 0; $i < 24; $i++) { - $json['xaxis'][] = [$i, $i]; + $data['xaxis'][] = array($i, $i); } break; @@ -1884,8 +1876,8 @@ public function getSaleAnalytics() { $results = $this->model_extension_payment_paypal->getTotalSalesByWeek(); foreach ($results as $key => $value) { - $json['all_sale']['data'][] = [$key, $value['total']]; - $json['paypal_sale']['data'][] = [$key, $value['paypal_total']]; + $data['all_sale']['data'][] = array($key, $value['total']); + $data['paypal_sale']['data'][] = array($key, $value['paypal_total']); } $date_start = strtotime('-' . date('w') . ' days'); @@ -1893,7 +1885,7 @@ public function getSaleAnalytics() { for ($i = 0; $i < 7; $i++) { $date = date('Y-m-d', $date_start + ($i * 86400)); - $json['xaxis'][] = [date('w', strtotime($date)), date('D', strtotime($date))]; + $data['xaxis'][] = array(date('w', strtotime($date)), date('D', strtotime($date))); } break; @@ -1901,14 +1893,14 @@ public function getSaleAnalytics() { $results = $this->model_extension_payment_paypal->getTotalSalesByMonth(); foreach ($results as $key => $value) { - $json['all_sale']['data'][] = [$key, $value['total']]; - $json['paypal_sale']['data'][] = [$key, $value['paypal_total']]; + $data['all_sale']['data'][] = array($key, $value['total']); + $data['paypal_sale']['data'][] = array($key, $value['paypal_total']); } for ($i = 1; $i <= date('t'); $i++) { $date = date('Y') . '-' . date('m') . '-' . $i; - $json['xaxis'][] = [date('j', strtotime($date)), date('d', strtotime($date))]; + $data['xaxis'][] = array(date('j', strtotime($date)), date('d', strtotime($date))); } break; @@ -1916,19 +1908,19 @@ public function getSaleAnalytics() { $results = $this->model_extension_payment_paypal->getTotalSalesByYear(); foreach ($results as $key => $value) { - $json['all_sale']['data'][] = [$key, $value['total']]; - $json['paypal_sale']['data'][] = [$key, $value['paypal_total']]; + $data['all_sale']['data'][] = array($key, $value['total']); + $data['paypal_sale']['data'][] = array($key, $value['paypal_total']); } for ($i = 1; $i <= 12; $i++) { - $json['xaxis'][] = [$i, date('M', mktime(0, 0, 0, $i))]; + $data['xaxis'][] = array($i, date('M', mktime(0, 0, 0, $i))); } break; } $this->response->addHeader('Content-Type: application/json'); - $this->response->setOutput(json_encode($json)); + $this->response->setOutput(json_encode($data)); } public function downloadAssociationFile() { @@ -2122,11 +2114,11 @@ public function order_info_before($route, &$data) { $content = $this->getPaymentDetails((int)$this->request->get['order_id']); if ($content) { - $data['tabs'][] = [ + $data['tabs'][] = array( 'code' => 'paypal', 'title' => $this->language->get('heading_title_main'), 'content' => $content - ]; + ); } } } @@ -2214,26 +2206,26 @@ private function getPaymentDetails($order_id) { require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $partner_id, 'client_id' => $client_id, 'secret' => $secret, 'environment' => $environment, 'partner_attribution_id' => $partner_attribution_id - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); $paypal_order_info = $paypal->getOrder($data['paypal_order_id']); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -2331,7 +2323,7 @@ private function getPaymentDetails($order_id) { $this->model_extension_payment_paypal->addOrderHistory($setting['general']['order_history_token'], $order_id, $order_status_id); } - $paypal_order_data = []; + $paypal_order_data = array(); $paypal_order_data['order_id'] = $order_id; $paypal_order_data['transaction_status'] = $transaction_status; @@ -2396,34 +2388,34 @@ public function capturePayment() { require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $partner_id, 'client_id' => $client_id, 'secret' => $secret, 'environment' => $environment, 'partner_attribution_id' => $partner_attribution_id - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); - $transaction_info = [ - 'amount' => [ + $transaction_info = array( + 'amount' => array( 'value' => number_format($capture_amount, $decimal_place, '.', ''), 'currency_code' => $currency_code - ], + ), 'final_capture' => $final_capture - ]; + ); $result = $paypal->setPaymentCapture($transaction_id, $transaction_info); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -2460,7 +2452,7 @@ public function capturePayment() { $this->model_extension_payment_paypal->addOrderHistory($setting['general']['order_history_token'], $order_id, $order_status_id); } - $paypal_order_data = []; + $paypal_order_data = array(); $paypal_order_data['order_id'] = $order_id; $paypal_order_data['transaction_id'] = $transaction_id; @@ -2512,33 +2504,33 @@ public function reauthorizePayment() { require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $partner_id, 'client_id' => $client_id, 'secret' => $secret, 'environment' => $environment, 'partner_attribution_id' => $partner_attribution_id - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); - $transaction_info = [ + $transaction_info = array( 'amount' => array( 'value' => number_format($reauthorize_amount, $decimal_place, '.', ''), 'currency_code' => $currency_code ) - ]; + ); $result = $paypal->setPaymentReauthorize($transaction_id, $transaction_info); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -2563,11 +2555,11 @@ public function reauthorizePayment() { $transaction_id = $result['id']; $transaction_status = 'created'; - $paypal_order_data = [ + $paypal_order_data = array( 'order_id' => $order_id, 'transaction_id' => $transaction_id, 'transaction_status' => $transaction_status - ]; + ); $this->model_extension_payment_paypal->editPayPalOrder($paypal_order_data); @@ -2611,26 +2603,26 @@ public function voidPayment() { require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $partner_id, 'client_id' => $client_id, 'secret' => $secret, 'environment' => $environment, 'partner_attribution_id' => $partner_attribution_id - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); $result = $paypal->setPaymentVoid($transaction_id); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -2654,10 +2646,10 @@ public function voidPayment() { if (!$this->error) { $transaction_status = 'voided'; - $paypal_order_data = [ + $paypal_order_data = array( 'order_id' => $order_id, 'transaction_status' => $transaction_status - ]; + ); $this->model_extension_payment_paypal->editPayPalOrder($paypal_order_data); @@ -2710,25 +2702,25 @@ public function refundPayment() { require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $partner_id, 'client_id' => $client_id, 'secret' => $secret, 'environment' => $environment, 'partner_attribution_id' => $partner_attribution_id - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); $paypal_order_info = $paypal->getOrder($paypal_order_info['paypal_order_id']); - $capture_refund_amount = []; + $capture_refund_amount = array(); $available_refund_amount = 0; $final_capture_amount = 0; @@ -2776,12 +2768,12 @@ public function refundPayment() { } if ($refund_amount > $available_refund_amount) { - $transaction_info = [ - 'amount' => [ + $transaction_info = array( + 'amount' => array( 'value' => number_format($refund_amount, $decimal_place, '.', ''), 'currency_code' => $currency_code - ] - ]; + ) + ); $result = $paypal->setPaymentRefund($transaction_id, $transaction_info); } else { @@ -2794,12 +2786,12 @@ public function refundPayment() { $final_capture_first_amount = $final_capture_amount * 0.5; } - $transaction_info = [ - 'amount' => [ + $transaction_info = array( + 'amount' => array( 'value' => number_format($final_capture_first_amount * 0.5, $decimal_place, '.', ''), 'currency_code' => $currency_code - ] - ]; + ) + ); $result = $paypal->setPaymentRefund($transaction_id, $transaction_info); @@ -2811,23 +2803,23 @@ public function refundPayment() { if ($refund_amount > 0) { if (($capture['status'] == 'COMPLETED')) { if ($refund_amount <= $capture['amount']['value']) { - $transaction_info = [ - 'amount' => [ + $transaction_info = array( + 'amount' => array( 'value' => number_format($refund_amount, $decimal_place, '.', ''), 'currency_code' => $currency_code - ] - ]; + ) + ); $result = $paypal->setPaymentRefund($capture['id'], $transaction_info); $refund_amount = 0; } else { - $transaction_info = [ - 'amount' => [ + $transaction_info = array( + 'amount' => array( 'value' => number_format($capture['amount']['value'], $decimal_place, '.', ''), 'currency_code' => $currency_code - ] - ]; + ) + ); $result = $paypal->setPaymentRefund($capture['id'], $transaction_info); @@ -2838,23 +2830,23 @@ public function refundPayment() { if ($capture['status'] == 'PARTIALLY_REFUNDED') { if (!empty($capture_refund_amount[$capture['id']])) { if ($refund_amount <= ($capture['amount']['value'] - $capture_refund_amount[$capture['id']])) { - $transaction_info = [ - 'amount' => [ + $transaction_info = array( + 'amount' => array( 'value' => number_format($refund_amount, $decimal_place, '.', ''), 'currency_code' => $currency_code - ] - ]; + ) + ); $result = $paypal->setPaymentRefund($capture['id'], $transaction_info); $refund_amount = 0; } else { - $transaction_info = [ - 'amount' => [ + $transaction_info = array( + 'amount' => array( 'value' => number_format($capture['amount']['value'] - $capture_refund_amount[$capture['id']], $decimal_place, '.', ''), 'currency_code' => $currency_code - ] - ]; + ) + ); $result = $paypal->setPaymentRefund($capture['id'], $transaction_info); @@ -2869,7 +2861,7 @@ public function refundPayment() { } if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -2905,7 +2897,7 @@ public function refundPayment() { $this->model_extension_payment_paypal->addOrderHistory($setting['general']['order_history_token'], $order_id, $order_status_id); } - $paypal_order_data = []; + $paypal_order_data = array(); $paypal_order_data['order_id'] = $order_id; $paypal_order_data['transaction_status'] = $transaction_status; @@ -2926,7 +2918,7 @@ public function refundPayment() { public function autocompleteCarrier() { $this->load->model('extension/payment/paypal'); - $json = []; + $data = array(); if (!empty($this->request->post['filter_country_code']) && !empty($this->request->post['filter_carrier_name'])) { $filter_country_code = $this->request->post['filter_country_code']; @@ -2937,7 +2929,7 @@ public function autocompleteCarrier() { $config_carrier = $_config->get('paypal_carrier'); - $carriers = []; + $carriers = array(); if (!empty($config_carrier[$filter_country_code])) { $carriers = $config_carrier[$filter_country_code]; @@ -2947,21 +2939,19 @@ public function autocompleteCarrier() { foreach ($carriers as $carrier_name => $carrier_code) { if (strpos(strtolower($carrier_name), strtolower($filter_carrier_name)) !== false) { - $json[] = [ + $data[] = array( 'name' => $carrier_name, 'code' => $carrier_code - ]; + ); } } } $this->response->addHeader('Content-Type: application/json'); - $this->response->setOutput(json_encode($json)); + $this->response->setOutput(json_encode($data)); } public function createTracker() { - $json = []; - if ($this->config->get('payment_paypal_status') && !empty($this->request->post['order_id']) && !empty($this->request->post['country_code']) && isset($this->request->post['tracking_number']) && isset($this->request->post['carrier_name'])) { $this->load->language('extension/payment/paypal'); @@ -2983,7 +2973,7 @@ public function createTracker() { $config_carrier = $_config->get('paypal_carrier'); - $carriers = []; + $carriers = array(); if (!empty($config_carrier[$country_code])) { $carriers = $config_carrier[$country_code]; @@ -3013,23 +3003,23 @@ public function createTracker() { require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $partner_id, 'client_id' => $client_id, 'secret' => $secret, 'environment' => $environment, 'partner_attribution_id' => $partner_attribution_id - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); - $tracker_info = []; + $tracker_info = array(); $tracker_info['capture_id'] = $transaction_id; $tracker_info['tracking_number'] = $tracking_number; @@ -3043,7 +3033,7 @@ public function createTracker() { $result = $paypal->createOrderTracker($paypal_order_id, $tracker_info); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -3065,11 +3055,11 @@ public function createTracker() { } if (isset($result['id']) && isset($result['status']) && !$this->error) { - $paypal_order_data = [ + $paypal_order_data = array( 'order_id' => $order_id, 'tracking_number' => $tracking_number, 'carrier_name' => $carrier_name - ]; + ); $this->model_extension_payment_paypal->editPayPalOrder($paypal_order_data); @@ -3085,15 +3075,15 @@ public function createTracker() { } } - $json['success'] = $this->language->get('success_create_tracker'); + $data['success'] = $this->language->get('success_create_tracker'); } } } - $json['error'] = $this->error; + $data['error'] = $this->error; $this->response->addHeader('Content-Type: application/json'); - $this->response->setOutput(json_encode($json)); + $this->response->setOutput(json_encode($data)); } public function cancelTracker() { @@ -3127,34 +3117,34 @@ public function cancelTracker() { require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $partner_id, 'client_id' => $client_id, 'secret' => $secret, 'environment' => $environment, 'partner_attribution_id' => $partner_attribution_id - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); - $tracker_info = []; + $tracker_info = array(); - $tracker_info[] = [ + $tracker_info[] = array( 'op' => 'replace', 'path' => '/status', 'value' => 'CANCELLED' - ]; + ); $result = $paypal->updateOrderTracker($paypal_order_id, $transaction_id . '-' . $tracking_number, $tracker_info); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -3176,11 +3166,11 @@ public function cancelTracker() { } if (!$this->error) { - $paypal_order_data = [ + $paypal_order_data = array( 'order_id' => $order_id, 'tracking_number' => '', 'carrier_name' => '' - ]; + ); $this->model_extension_payment_paypal->editPayPalOrder($paypal_order_data); diff --git a/upload/admin/language/en-gb/extension/payment/paypal.php b/upload/admin/language/en-gb/extension/payment/paypal.php index 6778502b1..376519c28 100644 --- a/upload/admin/language/en-gb/extension/payment/paypal.php +++ b/upload/admin/language/en-gb/extension/payment/paypal.php @@ -1,347 +1,347 @@ PayPal Checkout Integration (Highly Recommended)'; -$_['heading_title_main'] = 'PayPal Checkout Integration'; +$_['heading_title'] = 'PayPal Checkout Integration (Highly Recommended)'; +$_['heading_title_main'] = 'PayPal Checkout Integration'; // Text -$_['text_paypal'] = 'PayPal Checkout Integration (Highly Recommended)'; -$_['text_extensions'] = 'Extensions'; -$_['text_edit'] = 'Edit PayPal'; -$_['text_welcome'] = 'PayPal Checkout lets you offer PayPal, Venmo (US only), Pay Later options, debit & credit cards, plus local payment methods — all designed to help you maximize conversion.'; -$_['text_checkout_express'] = 'If your country is not available in the list when going through the PayPal onboarding experience please click here.'; -$_['text_support'] = 'If you face any issue during the onboarding process, please try other browser (e.g. Chrome) or clear your browser cache. If it doesn\'t help, please contact our support team.'; -$_['text_version'] = 'New PayPal Checkout Integration version available. You can download it here!'; -$_['text_tab_dashboard'] = 'Back to the dashboard'; -$_['text_tab_general'] = 'General'; -$_['text_tab_button'] = 'Buttons'; -$_['text_tab_googlepay_button'] = 'Google Pay'; -$_['text_tab_applepay_button'] = 'Apple Pay'; -$_['text_tab_card'] = 'Advanced Cards'; -$_['text_tab_message_configurator'] = 'Pay Later Messaging'; -$_['text_tab_message_setting'] = 'Pay Later Messaging advanced'; -$_['text_tab_order_status'] = 'Order Statuses'; -$_['text_tab_contact'] = 'Contact PayPal'; -$_['text_all_sales'] = 'All Sales'; -$_['text_paypal_sales'] = 'PayPal Sales'; -$_['text_panel_statistic'] = 'Statistic'; -$_['text_panel_sale_analytics'] = 'Sales Analytics'; -$_['text_statistic_title'] = 'The platform that grows with you'; -$_['text_statistic_description'] = 'The platform has 416 million customers'; -$_['text_button_settings'] = 'Button settings'; -$_['text_googlepay_button_settings'] = 'Google Pay Button settings'; -$_['text_applepay_button_settings'] = 'Apple Pay Button settings'; -$_['text_card_settings'] = 'Card settings'; -$_['text_message_settings'] = 'Message settings'; -$_['text_day'] = 'Today'; -$_['text_week'] = 'Week'; -$_['text_month'] = 'Month'; -$_['text_year'] = 'Year'; -$_['text_on'] = 'On'; -$_['text_off'] = 'Off'; -$_['text_checkout'] = 'Checkout'; -$_['text_cart'] = 'Cart'; -$_['text_product'] = 'Product'; -$_['text_home'] = 'Home'; -$_['text_automatic'] = 'Automatic'; -$_['text_manual'] = 'Manual'; -$_['text_sandbox'] = 'Sandbox'; -$_['text_production'] = 'Production'; -$_['text_sandbox'] = 'Sandbox'; -$_['text_multi_button'] = 'Multi Button'; -$_['text_one_button'] = 'One Button'; -$_['text_authorization'] = 'Authorization'; -$_['text_sale'] = 'Sale'; -$_['text_connect'] = 'Your seller account has been connected.
Merchant ID = %s
Client ID = %s
Secret = %s
Webhook ID = %s
Environment = %s
If you would like to connect another account, please, disconnect.'; -$_['text_applepay_alert'] = 'You need to verify any domain names in your environment that will show an Apple Pay button.

If Apple hasn’t verified a domain, they will reject any payments from that domain. The Apple Pay payment method won’t work if the domain isn’t registered.'; -$_['text_applepay_step_1'] = 'Download and host live domain association file
1. Download the domain association file for your live environment.
2. Host the file on your production site at /.well-known/apple-developer-merchantid-domain-association.'; -$_['text_applepay_step_2'] = 'Register your live domain
1. Go to the Payment Methods page on your PayPal account.
2. Register all high-level domains such as business.example.com, and subdomains such as checkout.business.example.com, that show the Apple Pay button.'; -$_['text_message_alert_uk'] = 'Turn browsers into buyers with Pay in 3.¹ Help increase sales while giving your customers flexible payments and more buying power. With Pay in 3, customers can pay over time in three interest-free payments while you get paid in full, up front on purchases — at no additional cost.'; -$_['text_message_footnote_uk'] = '¹Pay in 3 availability is subject to merchant status, sector and integration. Consumer eligibility is subject to status and approval. See product terms for more details.'; -$_['text_message_alert_us'] = 'Help increase your sales with our built-in Pay Later options. With PayPal Pay Later, your business can offer Pay in 4 and Pay Monthly¹ — two valuable ways for your customers to make a purchase and pay for it over time while you get paid in full, up front. Both are included at no additional cost to your business.'; -$_['text_message_footnote_us'] = '¹About Pay in 4: Loans to California residents are made or arranged pursuant to a California Financing Law License. PayPal, Inc. is a Georgia Installment Lender Licensee, NMLS #910457. Rhode Island Small Loan Lender Licensee.
Pay Monthly is subject to consumer credit approval. 9.99-29.99% APR based on the customer’s creditworthiness. PayPal, Inc.: RI Loan Broker Licensee. The lender for Pay Monthly is WebBank.'; -$_['text_currency_aud'] = 'Australian Dollar'; -$_['text_currency_brl'] = 'Brazilian Real'; -$_['text_currency_cad'] = 'Canadian Dollar'; -$_['text_currency_czk'] = 'Czech Krone'; -$_['text_currency_dkk'] = 'Danish Krone'; -$_['text_currency_eur'] = 'Euro'; -$_['text_currency_hkd'] = 'Hong Kong Dollar'; -$_['text_currency_huf'] = 'Hungarian Forint'; -$_['text_currency_inr'] = 'Indian Rupee'; -$_['text_currency_ils'] = 'Israeli New Shekel'; -$_['text_currency_jpy'] = 'Japanese Yen'; -$_['text_currency_myr'] = 'Malaysian Ringgit'; -$_['text_currency_mxn'] = 'Mexican Peso'; -$_['text_currency_twd'] = 'New Taiwan Dollar'; -$_['text_currency_nzd'] = 'New Zealand Dollar'; -$_['text_currency_nok'] = 'Norwegian Krone'; -$_['text_currency_php'] = 'Philippine peso'; -$_['text_currency_pln'] = 'Polish Zloty'; -$_['text_currency_gbp'] = 'Pound Sterling'; -$_['text_currency_rub'] = 'Russian Ruble'; -$_['text_currency_sgd'] = 'Singapore Dollar'; -$_['text_currency_sek'] = 'Swedish Krone'; -$_['text_currency_chf'] = 'Swiss Frank'; -$_['text_currency_thb'] = 'Thai Baht'; -$_['text_currency_usd'] = 'US Dollar'; -$_['text_completed_status'] = 'Completed Status'; -$_['text_denied_status'] = 'Denied Status'; -$_['text_failed_status'] = 'Failed Status'; -$_['text_pending_status'] = 'Pending Status'; -$_['text_partially_captured_status'] = 'Partially Captured Status'; -$_['text_partially_refunded_status'] = 'Partially Refunded Status'; -$_['text_refunded_status'] = 'Refunded Status'; -$_['text_reversed_status'] = 'Reversed Status'; -$_['text_voided_status'] = 'Voided Status'; -$_['text_shipped_status'] = 'Shipped Status'; -$_['text_insert_prepend'] = 'Insert Into Begin'; -$_['text_insert_append'] = 'Insert Into End'; -$_['text_insert_before'] = 'Insert Before'; -$_['text_insert_after'] = 'Insert After'; -$_['text_align_left'] = 'Align Left'; -$_['text_align_center'] = 'Align Center'; -$_['text_align_right'] = 'Align Right'; -$_['text_small'] = 'Small'; -$_['text_medium'] = 'Medium'; -$_['text_large'] = 'Large'; -$_['text_responsive'] = 'Responsive'; -$_['text_gold'] = 'Gold'; -$_['text_blue'] = 'Blue'; -$_['text_silver'] = 'Silver'; -$_['text_white'] = 'White'; -$_['text_white_outline'] = 'White Outline'; -$_['text_black'] = 'Black'; -$_['text_pill'] = 'Pill'; -$_['text_rect'] = 'Rect'; -$_['text_checkout'] = 'Checkout'; -$_['text_pay'] = 'Pay'; -$_['text_buy_now'] = 'Buy Now'; -$_['text_pay_pal'] = 'PayPal'; -$_['text_installment'] = 'Installment'; -$_['text_buy'] = 'Buy'; -$_['text_donate'] = 'Donate'; -$_['text_plain'] = 'Plain'; -$_['text_check_out'] = 'Check out'; -$_['text_card'] = 'Credit or debit cards'; -$_['text_credit'] = 'PayPal Credit'; -$_['text_bancontact'] = 'Bancontact'; -$_['text_blik'] = 'BLIK'; -$_['text_eps'] = 'Eps'; -$_['text_giropay'] = 'Giropay'; -$_['text_ideal'] = 'iDEAL'; -$_['text_mercadopago'] = 'Mercado Pago'; -$_['text_mybank'] = 'MyBank'; -$_['text_p24'] = 'Przelewy24'; -$_['text_sepa'] = 'SEPA-Lastschrift'; -$_['text_venmo'] = 'Venmo'; -$_['text_paylater'] = 'Pay Later'; -$_['text_auto'] = 'Auto'; -$_['text_text'] = 'Text Message'; -$_['text_flex'] = 'Flexible Banner'; -$_['text_accept'] = 'Accept'; -$_['text_decline'] = 'Decline'; -$_['text_sca_when_required'] = 'SCA When Required'; -$_['text_sca_always'] = 'SCA Always'; -$_['text_recommended'] = '(recommended)'; -$_['text_3ds_failed_authentication'] = 'Failed authentication.'; -$_['text_3ds_rejected_authentication'] = 'Rejected authentication.'; -$_['text_3ds_attempted_authentication'] = 'Attempted authentication.'; -$_['text_3ds_unable_authentication'] = 'Unable to complete authentication.'; -$_['text_3ds_challenge_authentication'] = 'Challenge required for authentication.'; -$_['text_3ds_card_ineligible'] = 'Card type and issuing bank are not ready to complete a 3D Secure authentication.'; -$_['text_3ds_system_unavailable'] = 'System is unavailable at the time of the request.'; -$_['text_3ds_system_bypassed'] = 'System has bypassed authentication.'; -$_['text_payment_method_paypal'] = 'PayPal (Pay with PayPal, Card)'; -$_['text_payment_method_paypal_paylater'] = 'Buy Now Pay Later with PayPal'; -$_['text_payment_method_cod'] = 'Cash On Delivery'; -$_['text_contact_book'] = 'Book a contact with PayPal'; -$_['text_contact_form'] = 'Fill out the form to request a call back from a PayPal sales expert'; -$_['text_contact_business'] = 'Business Information'; -$_['text_contact_product'] = 'Product Interest'; -$_['text_none'] = ' --- None --- '; -$_['text_bt_dcc'] = 'Credit Card/Debit Card Processing'; -$_['text_express_checkout'] = 'PayPal Button'; -$_['text_credit_installments'] = 'PayPal Credit'; -$_['text_point_of_sale'] = 'PayPal InStore'; -$_['text_invoicing_api'] = 'Invoicing'; -$_['text_paypal_working_capital'] = 'Working Capital/Bsuiness Loans'; -$_['text_risk_servicing'] = 'Risk Servicing'; -$_['text_paypal_here'] = 'Subscriptions'; -$_['text_payouts'] = 'Payouts'; -$_['text_marketing_solutions'] = 'Marketing Solutions'; -$_['text_confirm'] = 'Are you sure?'; -$_['text_menu_desktops'] = 'Desktops'; -$_['text_menu_laptops'] = 'Laptops'; -$_['text_menu_components'] = 'Components'; -$_['text_menu_tablets'] = 'Tablets'; -$_['text_menu_software'] = 'Software'; -$_['text_menu_cameras'] = 'Cameras'; -$_['text_product_name'] = 'Product Name'; -$_['text_product_price'] = '$33.00'; -$_['text_product_manufacturer'] = 'Brand: DLX-sd'; -$_['text_product_model'] = 'Product Code: product 11'; -$_['text_product_stock'] = 'Availability: In Stock'; -$_['text_cart_product_image'] = 'Image'; -$_['text_cart_product_name'] = 'Product Name'; -$_['text_cart_product_model'] = 'Model'; -$_['text_cart_product_quantity'] = 'Quantity'; -$_['text_cart_product_price'] = 'Unit Price'; -$_['text_cart_product_total'] = 'Total'; -$_['text_cart_product_name_value'] = 'Phone'; -$_['text_cart_product_model_value'] = 'product 11'; -$_['text_cart_product_quantity_value'] = '1'; -$_['text_cart_product_price_value'] = '$33.00'; -$_['text_cart_product_total_value'] = '$33.00'; -$_['text_cart_sub_total'] = 'Sub-Total:'; -$_['text_cart_total'] = 'Total:'; -$_['text_step_coupon'] = 'Use Coupon Code'; -$_['text_step_shipping'] = 'Estimate Shipping & Taxes'; -$_['text_step_payment_method'] = 'Step 5: Payment Method'; -$_['text_step_confirm_order'] = 'Step 6: Confirm Order'; -$_['text_payment_information'] = 'Payment Information'; -$_['text_transaction_id'] = 'Transaction ID'; -$_['text_transaction_description'] = 'Transaction Description'; -$_['text_transaction_created'] = 'Payment authorization was created.'; -$_['text_transaction_voided'] = 'Payment authorization was voided.'; -$_['text_transaction_partially_captured'] = 'Payment authorization was partially captured.'; -$_['text_transaction_completed'] = 'Payment capture was completed.'; -$_['text_transaction_declined'] = 'Payment capture was declined.'; -$_['text_transaction_pending'] = 'The state of a payment capture was changed to pending.'; -$_['text_transaction_refunded'] = 'A merchant refunded the payment capture.'; -$_['text_transaction_partially_refunded'] = 'A merchant partially refunded the payment capture.'; -$_['text_transaction_reversed'] = 'PayPal reversed the payment capture.'; -$_['text_transaction_action'] = 'Action'; -$_['text_final_capture'] = 'Final Capture'; -$_['text_tracker_information'] = 'Tracking Information'; -$_['text_tracking_number'] = 'Tracking Number'; -$_['text_carrier_name'] = 'Carrier'; -$_['text_tracker_action'] = 'Action'; -$_['text_loading'] = 'Loading...'; +$_['text_paypal'] = 'PayPal Checkout Integration (Highly Recommended)'; +$_['text_extensions'] = 'Extensions'; +$_['text_edit'] = 'Edit PayPal'; +$_['text_welcome'] = 'PayPal Checkout lets you offer PayPal, Venmo (US only), Pay Later options, debit & credit cards, plus local payment methods — all designed to help you maximize conversion.'; +$_['text_checkout_express'] = 'If your country is not available in the list when going through the PayPal onboarding experience please click here.'; +$_['text_support'] = 'If you face any issue during the onboarding process, please try other browser (e.g. Chrome) or clear your browser cache. If it doesn\'t help, please contact our support team.'; +$_['text_version'] = 'New PayPal Checkout Integration version available. You can download it here!'; +$_['text_tab_dashboard'] = 'Back to the dashboard'; +$_['text_tab_general'] = 'General'; +$_['text_tab_button'] = 'Buttons'; +$_['text_tab_googlepay_button'] = 'Google Pay'; +$_['text_tab_applepay_button'] = 'Apple Pay'; +$_['text_tab_card'] = 'Advanced Cards'; +$_['text_tab_message_configurator'] = 'Pay Later Messaging'; +$_['text_tab_message_setting'] = 'Pay Later Messaging advanced'; +$_['text_tab_order_status'] = 'Order Statuses'; +$_['text_tab_contact'] = 'Contact PayPal'; +$_['text_all_sales'] = 'All Sales'; +$_['text_paypal_sales'] = 'PayPal Sales'; +$_['text_panel_statistic'] = 'Statistic'; +$_['text_panel_sale_analytics'] = 'Sales Analytics'; +$_['text_statistic_title'] = 'The platform that grows with you'; +$_['text_statistic_description'] = 'The platform has 416 million customers'; +$_['text_button_settings'] = 'Button settings'; +$_['text_googlepay_button_settings'] = 'Google Pay Button settings'; +$_['text_applepay_button_settings'] = 'Apple Pay Button settings'; +$_['text_card_settings'] = 'Card settings'; +$_['text_message_settings'] = 'Message settings'; +$_['text_day'] = 'Today'; +$_['text_week'] = 'Week'; +$_['text_month'] = 'Month'; +$_['text_year'] = 'Year'; +$_['text_on'] = 'On'; +$_['text_off'] = 'Off'; +$_['text_checkout'] = 'Checkout'; +$_['text_cart'] = 'Cart'; +$_['text_product'] = 'Product'; +$_['text_home'] = 'Home'; +$_['text_automatic'] = 'Automatic'; +$_['text_manual'] = 'Manual'; +$_['text_sandbox'] = 'Sandbox'; +$_['text_production'] = 'Production'; +$_['text_sandbox'] = 'Sandbox'; +$_['text_multi_button'] = 'Multi Button'; +$_['text_one_button'] = 'One Button'; +$_['text_authorization'] = 'Authorization'; +$_['text_sale'] = 'Sale'; +$_['text_connect'] = 'Your seller account has been connected.
Merchant ID = %s
Client ID = %s
Secret = %s
Webhook ID = %s
Environment = %s
If you would like to connect another account, please, disconnect.'; +$_['text_applepay_alert'] = 'You need to verify any domain names in your environment that will show an Apple Pay button.

If Apple hasn’t verified a domain, they will reject any payments from that domain. The Apple Pay payment method won’t work if the domain isn’t registered.'; +$_['text_applepay_step_1'] = 'Download and host live domain association file
1. Download the domain association file for your live environment.
2. Host the file on your production site at /.well-known/apple-developer-merchantid-domain-association.'; +$_['text_applepay_step_2'] = 'Register your live domain
1. Go to the Payment Methods page on your PayPal account.
2. Register all high-level domains such as business.example.com, and subdomains such as checkout.business.example.com, that show the Apple Pay button.'; +$_['text_message_alert_uk'] = 'Turn browsers into buyers with Pay in 3.¹ Help increase sales while giving your customers flexible payments and more buying power. With Pay in 3, customers can pay over time in three interest-free payments while you get paid in full, up front on purchases — at no additional cost.'; +$_['text_message_footnote_uk'] = '¹Pay in 3 availability is subject to merchant status, sector and integration. Consumer eligibility is subject to status and approval. See product terms for more details.'; +$_['text_message_alert_us'] = 'Help increase your sales with our built-in Pay Later options. With PayPal Pay Later, your business can offer Pay in 4 and Pay Monthly¹ — two valuable ways for your customers to make a purchase and pay for it over time while you get paid in full, up front. Both are included at no additional cost to your business.'; +$_['text_message_footnote_us'] = '¹About Pay in 4: Loans to California residents are made or arranged pursuant to a California Financing Law License. PayPal, Inc. is a Georgia Installment Lender Licensee, NMLS #910457. Rhode Island Small Loan Lender Licensee.
Pay Monthly is subject to consumer credit approval. 9.99-29.99% APR based on the customer’s creditworthiness. PayPal, Inc.: RI Loan Broker Licensee. The lender for Pay Monthly is WebBank.'; +$_['text_currency_aud'] = 'Australian Dollar'; +$_['text_currency_brl'] = 'Brazilian Real'; +$_['text_currency_cad'] = 'Canadian Dollar'; +$_['text_currency_czk'] = 'Czech Krone'; +$_['text_currency_dkk'] = 'Danish Krone'; +$_['text_currency_eur'] = 'Euro'; +$_['text_currency_hkd'] = 'Hong Kong Dollar'; +$_['text_currency_huf'] = 'Hungarian Forint'; +$_['text_currency_inr'] = 'Indian Rupee'; +$_['text_currency_ils'] = 'Israeli New Shekel'; +$_['text_currency_jpy'] = 'Japanese Yen'; +$_['text_currency_myr'] = 'Malaysian Ringgit'; +$_['text_currency_mxn'] = 'Mexican Peso'; +$_['text_currency_twd'] = 'New Taiwan Dollar'; +$_['text_currency_nzd'] = 'New Zealand Dollar'; +$_['text_currency_nok'] = 'Norwegian Krone'; +$_['text_currency_php'] = 'Philippine peso'; +$_['text_currency_pln'] = 'Polish Zloty'; +$_['text_currency_gbp'] = 'Pound Sterling'; +$_['text_currency_rub'] = 'Russian Ruble'; +$_['text_currency_sgd'] = 'Singapore Dollar'; +$_['text_currency_sek'] = 'Swedish Krone'; +$_['text_currency_chf'] = 'Swiss Frank'; +$_['text_currency_thb'] = 'Thai Baht'; +$_['text_currency_usd'] = 'US Dollar'; +$_['text_completed_status'] = 'Completed Status'; +$_['text_denied_status'] = 'Denied Status'; +$_['text_failed_status'] = 'Failed Status'; +$_['text_pending_status'] = 'Pending Status'; +$_['text_partially_captured_status'] = 'Partially Captured Status'; +$_['text_partially_refunded_status'] = 'Partially Refunded Status'; +$_['text_refunded_status'] = 'Refunded Status'; +$_['text_reversed_status'] = 'Reversed Status'; +$_['text_voided_status'] = 'Voided Status'; +$_['text_shipped_status'] = 'Shipped Status'; +$_['text_insert_prepend'] = 'Insert Into Begin'; +$_['text_insert_append'] = 'Insert Into End'; +$_['text_insert_before'] = 'Insert Before'; +$_['text_insert_after'] = 'Insert After'; +$_['text_align_left'] = 'Align Left'; +$_['text_align_center'] = 'Align Center'; +$_['text_align_right'] = 'Align Right'; +$_['text_small'] = 'Small'; +$_['text_medium'] = 'Medium'; +$_['text_large'] = 'Large'; +$_['text_responsive'] = 'Responsive'; +$_['text_gold'] = 'Gold'; +$_['text_blue'] = 'Blue'; +$_['text_silver'] = 'Silver'; +$_['text_white'] = 'White'; +$_['text_white_outline'] = 'White Outline'; +$_['text_black'] = 'Black'; +$_['text_pill'] = 'Pill'; +$_['text_rect'] = 'Rect'; +$_['text_checkout'] = 'Checkout'; +$_['text_pay'] = 'Pay'; +$_['text_buy_now'] = 'Buy Now'; +$_['text_pay_pal'] = 'PayPal'; +$_['text_installment'] = 'Installment'; +$_['text_buy'] = 'Buy'; +$_['text_donate'] = 'Donate'; +$_['text_plain'] = 'Plain'; +$_['text_check_out'] = 'Check out'; +$_['text_card'] = 'Credit or debit cards'; +$_['text_credit'] = 'PayPal Credit'; +$_['text_bancontact'] = 'Bancontact'; +$_['text_blik'] = 'BLIK'; +$_['text_eps'] = 'Eps'; +$_['text_giropay'] = 'Giropay'; +$_['text_ideal'] = 'iDEAL'; +$_['text_mercadopago'] = 'Mercado Pago'; +$_['text_mybank'] = 'MyBank'; +$_['text_p24'] = 'Przelewy24'; +$_['text_sepa'] = 'SEPA-Lastschrift'; +$_['text_venmo'] = 'Venmo'; +$_['text_paylater'] = 'Pay Later'; +$_['text_auto'] = 'Auto'; +$_['text_text'] = 'Text Message'; +$_['text_flex'] = 'Flexible Banner'; +$_['text_accept'] = 'Accept'; +$_['text_decline'] = 'Decline'; +$_['text_sca_when_required'] = 'SCA When Required'; +$_['text_sca_always'] = 'SCA Always'; +$_['text_recommended'] = '(recommended)'; +$_['text_3ds_failed_authentication'] = 'Failed authentication.'; +$_['text_3ds_rejected_authentication'] = 'Rejected authentication.'; +$_['text_3ds_attempted_authentication'] = 'Attempted authentication.'; +$_['text_3ds_unable_authentication'] = 'Unable to complete authentication.'; +$_['text_3ds_challenge_authentication'] = 'Challenge required for authentication.'; +$_['text_3ds_card_ineligible'] = 'Card type and issuing bank are not ready to complete a 3D Secure authentication.'; +$_['text_3ds_system_unavailable'] = 'System is unavailable at the time of the request.'; +$_['text_3ds_system_bypassed'] = 'System has bypassed authentication.'; +$_['text_payment_method_paypal'] = 'PayPal (Pay with PayPal, Card)'; +$_['text_payment_method_paypal_paylater'] = 'Buy Now Pay Later with PayPal'; +$_['text_payment_method_cod'] = 'Cash On Delivery'; +$_['text_contact_book'] = 'Book a contact with PayPal'; +$_['text_contact_form'] = 'Fill out the form to request a call back from a PayPal sales expert'; +$_['text_contact_business'] = 'Business Information'; +$_['text_contact_product'] = 'Product Interest'; +$_['text_none'] = ' --- None --- '; +$_['text_bt_dcc'] = 'Credit Card/Debit Card Processing'; +$_['text_express_checkout'] = 'PayPal Button'; +$_['text_credit_installments'] = 'PayPal Credit'; +$_['text_point_of_sale'] = 'PayPal InStore'; +$_['text_invoicing_api'] = 'Invoicing'; +$_['text_paypal_working_capital'] = 'Working Capital/Bsuiness Loans'; +$_['text_risk_servicing'] = 'Risk Servicing'; +$_['text_paypal_here'] = 'Subscriptions'; +$_['text_payouts'] = 'Payouts'; +$_['text_marketing_solutions'] = 'Marketing Solutions'; +$_['text_confirm'] = 'Are you sure?'; +$_['text_menu_desktops'] = 'Desktops'; +$_['text_menu_laptops'] = 'Laptops'; +$_['text_menu_components'] = 'Components'; +$_['text_menu_tablets'] = 'Tablets'; +$_['text_menu_software'] = 'Software'; +$_['text_menu_cameras'] = 'Cameras'; +$_['text_product_name'] = 'Product Name'; +$_['text_product_price'] = '$33.00'; +$_['text_product_manufacturer'] = 'Brand: DLX-sd'; +$_['text_product_model'] = 'Product Code: product 11'; +$_['text_product_stock'] = 'Availability: In Stock'; +$_['text_cart_product_image'] = 'Image'; +$_['text_cart_product_name'] = 'Product Name'; +$_['text_cart_product_model'] = 'Model'; +$_['text_cart_product_quantity'] = 'Quantity'; +$_['text_cart_product_price'] = 'Unit Price'; +$_['text_cart_product_total'] = 'Total'; +$_['text_cart_product_name_value'] = 'Phone'; +$_['text_cart_product_model_value'] = 'product 11'; +$_['text_cart_product_quantity_value'] = '1'; +$_['text_cart_product_price_value'] = '$33.00'; +$_['text_cart_product_total_value'] = '$33.00'; +$_['text_cart_sub_total'] = 'Sub-Total:'; +$_['text_cart_total'] = 'Total:'; +$_['text_step_coupon'] = 'Use Coupon Code'; +$_['text_step_shipping'] = 'Estimate Shipping & Taxes'; +$_['text_step_payment_method'] = 'Step 5: Payment Method'; +$_['text_step_confirm_order'] = 'Step 6: Confirm Order'; +$_['text_payment_information'] = 'Payment Information'; +$_['text_transaction_id'] = 'Transaction ID'; +$_['text_transaction_description'] = 'Transaction Description'; +$_['text_transaction_created'] = 'Payment authorization was created.'; +$_['text_transaction_voided'] = 'Payment authorization was voided.'; +$_['text_transaction_partially_captured'] = 'Payment authorization was partially captured.'; +$_['text_transaction_completed'] = 'Payment capture was completed.'; +$_['text_transaction_declined'] = 'Payment capture was declined.'; +$_['text_transaction_pending'] = 'The state of a payment capture was changed to pending.'; +$_['text_transaction_refunded'] = 'A merchant refunded the payment capture.'; +$_['text_transaction_partially_refunded'] = 'A merchant partially refunded the payment capture.'; +$_['text_transaction_reversed'] = 'PayPal reversed the payment capture.'; +$_['text_transaction_action'] = 'Action'; +$_['text_final_capture'] = 'Final Capture'; +$_['text_tracker_information'] = 'Tracking Information'; +$_['text_tracking_number'] = 'Tracking Number'; +$_['text_carrier_name'] = 'Carrier'; +$_['text_tracker_action'] = 'Action'; +$_['text_loading'] = 'Loading...'; // Entry -$_['entry_connect'] = 'Connect'; -$_['entry_authorization_type'] = 'Authorization Type'; -$_['entry_environment'] = 'Environment'; -$_['entry_merchant_id'] = 'Merchant ID'; -$_['entry_client_id'] = 'Client ID'; -$_['entry_client_secret'] = 'Secret'; -$_['entry_status'] = 'Status'; -$_['entry_vault_status'] = 'Vault Status'; -$_['entry_debug'] = 'Debug Logging'; -$_['entry_sale_analytics_range'] = 'Sales Analytics Range'; -$_['entry_checkout_mode'] = 'Checkout Mode'; -$_['entry_checkout_route'] = 'Checkout Route'; -$_['entry_transaction_method'] = 'Settlement Method'; -$_['entry_total'] = 'Total'; -$_['entry_geo_zone'] = 'Geo Zone'; -$_['entry_sort_order'] = 'Sort Order'; -$_['entry_country_code'] = 'Country'; -$_['entry_currency_code'] = 'Currency'; -$_['entry_currency_value'] = 'Currency Value'; -$_['entry_card_currency_code'] = 'Card Currency'; -$_['entry_card_currency_value'] = 'Card Currency Value'; -$_['entry_cron_url'] = 'Cron URL'; -$_['entry_button_insert_tag'] = 'Button Insert Tag'; -$_['entry_button_insert_type'] = 'Button Insert Type'; -$_['entry_button_align'] = 'Button Align'; -$_['entry_button_size'] = 'Button Size'; -$_['entry_button_color'] = 'Button Color'; -$_['entry_button_shape'] = 'Button Shape'; -$_['entry_button_label'] = 'Button Label'; -$_['entry_button_tagline'] = 'Button Tagline'; -$_['entry_googlepay_button_insert_tag'] = 'Button Insert Tag'; -$_['entry_googlepay_button_insert_type'] = 'Button Insert Type'; -$_['entry_googlepay_button_align'] = 'Button Align'; -$_['entry_googlepay_button_size'] = 'Button Size'; -$_['entry_googlepay_button_color'] = 'Button Color'; -$_['entry_googlepay_button_shape'] = 'Button Shape'; -$_['entry_googlepay_button_type'] = 'Button Type'; -$_['entry_applepay_button_insert_tag'] = 'Button Insert Tag'; -$_['entry_applepay_button_insert_type'] = 'Button Insert Type'; -$_['entry_applepay_button_align'] = 'Button Align'; -$_['entry_applepay_button_size'] = 'Button Size'; -$_['entry_applepay_button_color'] = 'Button Color'; -$_['entry_applepay_button_shape'] = 'Button Shape'; -$_['entry_applepay_button_type'] = 'Button Type'; -$_['entry_card_align'] = 'Card Align'; -$_['entry_card_size'] = 'Card Size'; -$_['entry_card_secure_method'] = 'Card 3D Secure Method'; -$_['entry_card_secure_scenario'] = 'Card 3D Secure Scenarios'; -$_['entry_card_number'] = 'Card Number'; -$_['entry_expiration_date'] = 'Expiration Date'; -$_['entry_cvv'] = 'CVV'; -$_['entry_message_insert_tag'] = 'Message Insert Tag'; -$_['entry_message_insert_type'] = 'Message Insert Type'; -$_['entry_contact_company'] = 'Company'; -$_['entry_contact_first_name'] = 'First Name'; -$_['entry_contact_last_name'] = 'Last Name'; -$_['entry_contact_email'] = 'E-mail'; -$_['entry_contact_url'] = 'Website'; -$_['entry_contact_sales'] = 'Annual Online Sales'; -$_['entry_contact_phone'] = 'Telephone'; -$_['entry_contact_country'] = 'Country'; -$_['entry_contact_notes'] = 'Tell us more about your needs'; -$_['entry_contact_merchant'] = 'Completed on Behalf of Merchant'; -$_['entry_contact_merchant_name'] = 'Completed by'; -$_['entry_contact_product'] = 'Target Product'; -$_['entry_contact_send'] = 'Submit Form'; +$_['entry_connect'] = 'Connect'; +$_['entry_authorization_type'] = 'Authorization Type'; +$_['entry_environment'] = 'Environment'; +$_['entry_merchant_id'] = 'Merchant ID'; +$_['entry_client_id'] = 'Client ID'; +$_['entry_client_secret'] = 'Secret'; +$_['entry_status'] = 'Status'; +$_['entry_vault_status'] = 'Vault Status'; +$_['entry_debug'] = 'Debug Logging'; +$_['entry_sale_analytics_range'] = 'Sales Analytics Range'; +$_['entry_checkout_mode'] = 'Checkout Mode'; +$_['entry_checkout_route'] = 'Checkout Route'; +$_['entry_transaction_method'] = 'Settlement Method'; +$_['entry_total'] = 'Total'; +$_['entry_geo_zone'] = 'Geo Zone'; +$_['entry_sort_order'] = 'Sort Order'; +$_['entry_country_code'] = 'Country'; +$_['entry_currency_code'] = 'Currency'; +$_['entry_currency_value'] = 'Currency Value'; +$_['entry_card_currency_code'] = 'Card Currency'; +$_['entry_card_currency_value'] = 'Card Currency Value'; +$_['entry_cron_url'] = 'Cron URL'; +$_['entry_button_insert_tag'] = 'Button Insert Tag'; +$_['entry_button_insert_type'] = 'Button Insert Type'; +$_['entry_button_align'] = 'Button Align'; +$_['entry_button_size'] = 'Button Size'; +$_['entry_button_color'] = 'Button Color'; +$_['entry_button_shape'] = 'Button Shape'; +$_['entry_button_label'] = 'Button Label'; +$_['entry_button_tagline'] = 'Button Tagline'; +$_['entry_googlepay_button_insert_tag'] = 'Button Insert Tag'; +$_['entry_googlepay_button_insert_type'] = 'Button Insert Type'; +$_['entry_googlepay_button_align'] = 'Button Align'; +$_['entry_googlepay_button_size'] = 'Button Size'; +$_['entry_googlepay_button_color'] = 'Button Color'; +$_['entry_googlepay_button_shape'] = 'Button Shape'; +$_['entry_googlepay_button_type'] = 'Button Type'; +$_['entry_applepay_button_insert_tag'] = 'Button Insert Tag'; +$_['entry_applepay_button_insert_type'] = 'Button Insert Type'; +$_['entry_applepay_button_align'] = 'Button Align'; +$_['entry_applepay_button_size'] = 'Button Size'; +$_['entry_applepay_button_color'] = 'Button Color'; +$_['entry_applepay_button_shape'] = 'Button Shape'; +$_['entry_applepay_button_type'] = 'Button Type'; +$_['entry_card_align'] = 'Card Align'; +$_['entry_card_size'] = 'Card Size'; +$_['entry_card_secure_method'] = 'Card 3D Secure Method'; +$_['entry_card_secure_scenario'] = 'Card 3D Secure Scenarios'; +$_['entry_card_number'] = 'Card Number'; +$_['entry_expiration_date'] = 'Expiration Date'; +$_['entry_cvv'] = 'CVV'; +$_['entry_message_insert_tag'] = 'Message Insert Tag'; +$_['entry_message_insert_type'] = 'Message Insert Type'; +$_['entry_contact_company'] = 'Company'; +$_['entry_contact_first_name'] = 'First Name'; +$_['entry_contact_last_name'] = 'Last Name'; +$_['entry_contact_email'] = 'E-mail'; +$_['entry_contact_url'] = 'Website'; +$_['entry_contact_sales'] = 'Annual Online Sales'; +$_['entry_contact_phone'] = 'Telephone'; +$_['entry_contact_country'] = 'Country'; +$_['entry_contact_notes'] = 'Tell us more about your needs'; +$_['entry_contact_merchant'] = 'Completed on Behalf of Merchant'; +$_['entry_contact_merchant_name'] = 'Completed by'; +$_['entry_contact_product'] = 'Target Product'; +$_['entry_contact_send'] = 'Submit Form'; // Help -$_['help_status'] = 'Enable/Disable extension.'; -$_['help_vault_status'] = 'Vault allows merchant to securely save buyer’s payment method for future transactions. Vault substitutes the sensitive payment data with non-sensitive payment token and allows merchant to use the payment Token for future purchases.'; -$_['help_button_status'] = 'When activated PayPal will display personalized Smart Buttons avalible to your customers based on their location.'; -$_['help_googlepay_button_status'] = 'PayPal verifies if you are eligible for Google Pay payment and will display this option on the checkout step if available.'; -$_['help_applepay_button_status'] = 'PayPal verifies if you are eligible for Apple Pay payment and will display this option on the checkout step if available.'; -$_['help_card_status'] = 'PayPal verifies if you are eligible for advanced card payment and will display this option on the checkout step if available.'; -$_['help_checkout_mode'] = 'If your checkout is incompatible with this payment, then we advise you to set the \'One Button\' mode.'; -$_['help_checkout_route'] = 'If your checkout has its own route, different from OpenCart\'s (checkout/checkout), then enter it here.'; -$_['help_total'] = 'The checkout total the order must reach before this payment method becomes active.'; -$_['help_country_code'] = 'Select the default country for PayPal.'; -$_['help_currency_code'] = 'Select the default currency for PayPal.'; -$_['help_currency_value'] = 'Set to 1.00000 if this is your default currency.'; -$_['help_card_currency_code'] = 'Select the default currency for PayPal Card.'; -$_['help_card_currency_value'] = 'Set to 1.00000 if this is your default currency.'; -$_['help_cron_url'] = 'Set a cron to call this URL. This integration is typically used for subscription/recurring product purchase.'; -$_['help_card_secure_method'] = '3D Secure enables you to authenticate card holders through card issuers. \'SCA Always\' method trigger 3D Secure for every transaction, regardless of SCA requirements. \'SCA When Required\' method returns a 3D Secure contingency when it is a mandate in the region where you operate.'; -$_['help_card_secure_scenario'] = '3D Secure authentication is perfomed only if the card is enrolled for the service. In scenarios where the 3D Secure authentication has not been successful, you have the option to complete the payment at your own risk, meaning that you -the merchant- will be liable in case of a chargeback.'; +$_['help_status'] = 'Enable/Disable extension.'; +$_['help_vault_status'] = 'Vault allows merchant to securely save buyer’s payment method for future transactions. Vault substitutes the sensitive payment data with non-sensitive payment token and allows merchant to use the payment Token for future purchases.'; +$_['help_button_status'] = 'When activated PayPal will display personalized Smart Buttons avalible to your customers based on their location.'; +$_['help_googlepay_button_status'] = 'PayPal verifies if you are eligible for Google Pay payment and will display this option on the checkout step if available.'; +$_['help_applepay_button_status'] = 'PayPal verifies if you are eligible for Apple Pay payment and will display this option on the checkout step if available.'; +$_['help_card_status'] = 'PayPal verifies if you are eligible for advanced card payment and will display this option on the checkout step if available.'; +$_['help_checkout_mode'] = 'If your checkout is incompatible with this payment, then we advise you to set the \'One Button\' mode.'; +$_['help_checkout_route'] = 'If your checkout has its own route, different from OpenCart\'s (checkout/checkout), then enter it here.'; +$_['help_total'] = 'The checkout total the order must reach before this payment method becomes active.'; +$_['help_country_code'] = 'Select the default country for PayPal.'; +$_['help_currency_code'] = 'Select the default currency for PayPal.'; +$_['help_currency_value'] = 'Set to 1.00000 if this is your default currency.'; +$_['help_card_currency_code'] = 'Select the default currency for PayPal Card.'; +$_['help_card_currency_value'] = 'Set to 1.00000 if this is your default currency.'; +$_['help_cron_url'] = 'Set a cron to call this URL. This integration is typically used for subscription/recurring product purchase.'; +$_['help_card_secure_method'] = '3D Secure enables you to authenticate card holders through card issuers. \'SCA Always\' method trigger 3D Secure for every transaction, regardless of SCA requirements. \'SCA When Required\' method returns a 3D Secure contingency when it is a mandate in the region where you operate.'; +$_['help_card_secure_scenario'] = '3D Secure authentication is perfomed only if the card is enrolled for the service. In scenarios where the 3D Secure authentication has not been successful, you have the option to complete the payment at your own risk, meaning that you -the merchant- will be liable in case of a chargeback.'; // Button -$_['button_connect'] = 'Connect'; -$_['button_disconnect'] = 'Disconnect'; -$_['button_all_settings'] = 'All Settings'; -$_['button_view'] = 'View'; -$_['button_copy_url'] = 'Copy URL to clipboard'; -$_['button_download'] = 'Download'; -$_['button_download_host'] = 'Download and host'; -$_['button_send'] = 'Submit'; -$_['button_cart'] = 'Add to cart'; -$_['button_checkout'] = 'Checkout'; -$_['button_pay'] = 'Pay with Card'; -$_['button_capture_payment'] = 'Capture'; -$_['button_reauthorize_payment'] = 'Reauthorize'; -$_['button_void_payment'] = 'Void'; -$_['button_refund_payment'] = 'Refund'; -$_['button_create_tracker'] = 'Add Tracking Information'; -$_['button_cancel_tracker'] = 'Cancel Tracking Information'; -$_['button_enable_recurring'] = 'Enable Recurring'; -$_['button_disable_recurring'] = 'Disable Recurring'; +$_['button_connect'] = 'Connect'; +$_['button_disconnect'] = 'Disconnect'; +$_['button_all_settings'] = 'All Settings'; +$_['button_view'] = 'View'; +$_['button_copy_url'] = 'Copy URL to clipboard'; +$_['button_download'] = 'Download'; +$_['button_download_host'] = 'Download and host'; +$_['button_send'] = 'Submit'; +$_['button_cart'] = 'Add to cart'; +$_['button_checkout'] = 'Checkout'; +$_['button_pay'] = 'Pay with Card'; +$_['button_capture_payment'] = 'Capture'; +$_['button_reauthorize_payment'] = 'Reauthorize'; +$_['button_void_payment'] = 'Void'; +$_['button_refund_payment'] = 'Refund'; +$_['button_create_tracker'] = 'Add Tracking Information'; +$_['button_cancel_tracker'] = 'Cancel Tracking Information'; +$_['button_enable_recurring'] = 'Enable Recurring'; +$_['button_disable_recurring'] = 'Disable Recurring'; // Success -$_['success_save'] = 'Success: You have modified PayPal!'; -$_['success_send'] = 'Success: Your contact details have been successfully sent to paypal!'; -$_['success_download_host'] = 'Success: Association file has been successfully uploaded and hosted!'; -$_['success_agree'] = 'Success: Deactivation was successful!'; -$_['success_capture_payment'] = 'Success: Payment capture was completed.'; -$_['success_reauthorize_payment'] = 'Success: Payment authorization was reauthorized.'; -$_['success_void_payment'] = 'Success: Payment authorization was voided.'; -$_['success_refund_payment'] = 'Success: Payment capture was refunded.'; -$_['success_create_tracker'] = 'Success: Tracking information has been added successfully.'; -$_['success_cancel_tracker'] = 'Success: Tracking information has been cancelled successfully.'; -$_['success_enable_recurring'] = 'Success: Recurring payment was enabled.'; -$_['success_disable_recurring'] = 'Success: Recurring payment was disabled.'; +$_['success_save'] = 'Success: You have modified PayPal!'; +$_['success_send'] = 'Success: Your contact details have been successfully sent to paypal!'; +$_['success_download_host'] = 'Success: Association file has been successfully uploaded and hosted!'; +$_['success_agree'] = 'Success: Deactivation was successful!'; +$_['success_capture_payment'] = 'Success: Payment capture was completed.'; +$_['success_reauthorize_payment'] = 'Success: Payment authorization was reauthorized.'; +$_['success_void_payment'] = 'Success: Payment authorization was voided.'; +$_['success_refund_payment'] = 'Success: Payment capture was refunded.'; +$_['success_create_tracker'] = 'Success: Tracking information has been added successfully.'; +$_['success_cancel_tracker'] = 'Success: Tracking information has been cancelled successfully.'; +$_['success_enable_recurring'] = 'Success: Recurring payment was enabled.'; +$_['success_disable_recurring'] = 'Success: Recurring payment was disabled.'; // Error -$_['error_permission'] = 'Warning: You do not have permission to modify payment PayPal!'; -$_['error_connect'] = 'Warning: Client ID or Secret is incorrect!'; -$_['error_timeout'] = 'Sorry, PayPal is currently busy. Please try again later!'; -$_['error_agree'] = 'We discovered that a few countries under sanctions are featured on your website. Please click the button to deactivate them (Cuba, Iran, Syria, North Korea, Crimea, Donetsk, and Lugansk regions of Ukraine).

'; \ No newline at end of file +$_['error_permission'] = 'Warning: You do not have permission to modify payment PayPal!'; +$_['error_connect'] = 'Warning: Client ID or Secret is incorrect!'; +$_['error_timeout'] = 'Sorry, PayPal is currently busy. Please try again later!'; +$_['error_agree'] = 'We discovered that a few countries under sanctions are featured on your website. Please click the button to deactivate them (Cuba, Iran, Syria, North Korea, Crimea, Donetsk, and Lugansk regions of Ukraine).

'; \ No newline at end of file diff --git a/upload/admin/model/extension/payment/paypal.php b/upload/admin/model/extension/payment/paypal.php index 1b57d26f7..9505caa21 100644 --- a/upload/admin/model/extension/payment/paypal.php +++ b/upload/admin/model/extension/payment/paypal.php @@ -2,7 +2,7 @@ class ModelExtensionPaymentPayPal extends Model { public function getTotalSales() { - $implode = []; + $implode = array(); foreach ($this->config->get('config_complete_status') as $order_status_id) { $implode[] = "'" . (int)$order_status_id . "'"; @@ -14,126 +14,126 @@ public function getTotalSales() { } public function getTotalSalesByDay() { - $implode = []; + $implode = array(); foreach ($this->config->get('config_complete_status') as $order_status_id) { $implode[] = "'" . (int)$order_status_id . "'"; } - $sale_data = []; + $sale_data = array(); for ($i = 0; $i < 24; $i++) { - $sale_data[$i] = [ + $sale_data[$i] = array( 'hour' => $i, 'total' => 0, 'paypal_total' => 0 - ]; + ); } $query = $this->db->query("SELECT SUM(total) AS total, SUM(IF (payment_code = 'paypal', total, 0)) AS paypal_total, HOUR(date_added) AS hour FROM `" . DB_PREFIX . "order` WHERE order_status_id IN(" . implode(',', $implode) . ") AND DATE(date_added) = DATE(NOW()) GROUP BY HOUR(date_added) ORDER BY date_added ASC"); foreach ($query->rows as $result) { - $sale_data[$result['hour']] = [ + $sale_data[$result['hour']] = array( 'hour' => $result['hour'], 'total' => $result['total'], 'paypal_total' => $result['paypal_total'] - ]; + ); } return $sale_data; } public function getTotalSalesByWeek() { - $implode = []; + $implode = array(); foreach ($this->config->get('config_complete_status') as $order_status_id) { $implode[] = "'" . (int)$order_status_id . "'"; } - $sale_data = []; + $sale_data = array(); $date_start = strtotime('-' . date('w') . ' days'); for ($i = 0; $i < 7; $i++) { $date = date('Y-m-d', $date_start + ($i * 86400)); - $sale_data[date('w', strtotime($date))] = [ + $sale_data[date('w', strtotime($date))] = array( 'day' => date('D', strtotime($date)), 'total' => 0, 'paypal_total' => 0 - ]; + ); } $query = $this->db->query("SELECT SUM(total) AS total, SUM(IF (payment_code = 'paypal', total, 0)) AS paypal_total, date_added FROM `" . DB_PREFIX . "order` WHERE order_status_id IN(" . implode(',', $implode) . ") AND DATE(date_added) >= DATE('" . $this->db->escape(date('Y-m-d', $date_start)) . "') GROUP BY DAYNAME(date_added)"); foreach ($query->rows as $result) { - $sale_data[date('w', strtotime($result['date_added']))] = [ + $sale_data[date('w', strtotime($result['date_added']))] = array( 'day' => date('D', strtotime($result['date_added'])), 'total' => $result['total'], 'paypal_total' => $result['paypal_total'] - ]; + ); } return $sale_data; } public function getTotalSalesByMonth() { - $implode = []; + $implode = array(); foreach ($this->config->get('config_complete_status') as $order_status_id) { $implode[] = "'" . (int)$order_status_id . "'"; } - $sale_data = []; + $sale_data = array(); for ($i = 1; $i <= date('t'); $i++) { $date = date('Y') . '-' . date('m') . '-' . $i; - $sale_data[date('j', strtotime($date))] = [ + $sale_data[date('j', strtotime($date))] = array( 'day' => date('d', strtotime($date)), 'total' => 0, 'paypal_total' => 0 - ]; + ); } $query = $this->db->query("SELECT SUM(total) AS total, SUM(IF (payment_code = 'paypal', total, 0)) AS paypal_total, date_added FROM `" . DB_PREFIX . "order` WHERE order_status_id IN(" . implode(',', $implode) . ") AND DATE(date_added) >= '" . $this->db->escape(date('Y') . '-' . date('m') . '-1') . "' GROUP BY DATE(date_added)"); foreach ($query->rows as $result) { - $sale_data[date('j', strtotime($result['date_added']))] = [ + $sale_data[date('j', strtotime($result['date_added']))] = array( 'day' => date('d', strtotime($result['date_added'])), 'total' => $result['total'], 'paypal_total' => $result['paypal_total'] - ]; + ); } return $sale_data; } public function getTotalSalesByYear() { - $implode = []; + $implode = array(); foreach ($this->config->get('config_complete_status') as $order_status_id) { $implode[] = "'" . (int)$order_status_id . "'"; } - $sale_data = []; + $sale_data = array(); for ($i = 1; $i <= 12; $i++) { - $sale_data[$i] = [ + $sale_data[$i] = array( 'month' => date('M', mktime(0, 0, 0, $i)), 'total' => 0, 'paypal_total' => 0 - ]; + ); } $query = $this->db->query("SELECT SUM(total) AS total, SUM(IF (payment_code = 'paypal', total, 0)) AS paypal_total, date_added FROM `" . DB_PREFIX . "order` WHERE order_status_id IN(" . implode(',', $implode) . ") AND YEAR(date_added) = YEAR(NOW()) GROUP BY MONTH(date_added)"); foreach ($query->rows as $result) { - $sale_data[date('n', strtotime($result['date_added']))] = [ + $sale_data[date('n', strtotime($result['date_added']))] = array( 'month' => date('M', strtotime($result['date_added'])), 'total' => $result['total'], 'paypal_total' => $result['paypal_total'] - ]; + ); } return $sale_data; @@ -152,7 +152,7 @@ public function deletePayPalCustomerTokens($customer_id) { public function editPayPalOrder($data) { $sql = "UPDATE `" . DB_PREFIX . "paypal_checkout_integration_order` SET"; - $implode = []; + $implode = array(); if (!empty($data['paypal_order_id'])) { $implode[] = "`paypal_order_id` = '" . $this->db->escape($data['paypal_order_id']) . "'"; @@ -233,7 +233,7 @@ public function getPayPalOrder($order_id) { if ($query->num_rows) { return $query->row; } else { - return []; + return array(); } } @@ -271,10 +271,10 @@ public function addOrderHistory($order_history_token, $order_id, $order_status_i $catalog = HTTP_CATALOG; } - $data = [ + $data = array( 'order_id' => $order_id, 'order_status_id' => $order_status_id - ]; + ); $curl = curl_init(); diff --git a/upload/catalog/controller/extension/payment/paypal.php b/upload/catalog/controller/extension/payment/paypal.php index 4f745eb30..520dcd0be 100644 --- a/upload/catalog/controller/extension/payment/paypal.php +++ b/upload/catalog/controller/extension/payment/paypal.php @@ -1,6 +1,6 @@ $data['partner_id'], 'client_id' => $data['client_id'], 'secret' => $data['secret'], 'environment' => $data['environment'], 'partner_attribution_id' => $data['partner_attribution_id'] - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); $data['client_token'] = $paypal->getClientToken(); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -135,26 +135,26 @@ public function modal() { require_once DIR_SYSTEM .'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $data['partner_id'], 'client_id' => $data['client_id'], 'secret' => $data['secret'], 'environment' => $data['environment'], 'partner_attribution_id' => $data['partner_attribution_id'] - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); $data['client_token'] = $paypal->getClientToken(); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -227,7 +227,7 @@ public function getData() { $data['decimal_place'] = $setting['currency'][$data['currency_code']]['decimal_place']; - $data['components'] = []; + $data['components'] = array(); if ($this->request->post['page_code'] == 'home') { if ($setting['message']['home']['status'] && !empty($setting['paylater_country'][$setting['general']['country_code']]) && ($data['currency_code'] == $setting['general']['currency_code'])) { @@ -279,7 +279,7 @@ public function getData() { if (isset($product['option'])) { $option = array_filter($product['option']); } else { - $option = []; + $option = array(); } $this->load->model('catalog/product'); @@ -344,8 +344,8 @@ public function getData() { $data['button_shape'] = $setting['button']['product']['shape']; $data['button_label'] = $setting['button']['product']['label']; - $data['button_enable_funding'] = []; - $data['button_disable_funding'] = []; + $data['button_enable_funding'] = array(); + $data['button_disable_funding'] = array(); foreach ($setting['button_funding'] as $button_funding) { if ($setting['button']['product']['funding'][$button_funding['code']] == 1) { @@ -424,8 +424,8 @@ public function getData() { $data['button_shape'] = $setting['button']['cart']['shape']; $data['button_label'] = $setting['button']['cart']['label']; - $data['button_enable_funding'] = []; - $data['button_disable_funding'] = []; + $data['button_enable_funding'] = array(); + $data['button_disable_funding'] = array(); foreach ($setting['button_funding'] as $button_funding) { if ($setting['button']['cart']['funding'][$button_funding['code']] == 1) { @@ -543,8 +543,8 @@ public function getData() { $data['button_shape'] = $setting['button']['checkout']['shape']; $data['button_label'] = $setting['button']['checkout']['label']; - $data['button_enable_funding'] = []; - $data['button_disable_funding'] = []; + $data['button_enable_funding'] = array(); + $data['button_disable_funding'] = array(); foreach ($setting['button_funding'] as $button_funding) { if ($setting['button']['checkout']['funding'][$button_funding['code']] == 1) { @@ -630,17 +630,17 @@ public function getData() { $data['card_size'] = $setting['card']['size']; $data['card_width'] = $setting['card_width'][$data['card_size']]; - $data['card_customer_tokens'] = []; + $data['card_customer_tokens'] = array(); if ($setting['general']['vault_status'] && $this->customer->isLogged()) { $card_customer_tokens = $this->model_extension_payment_paypal->getPayPalCustomerTokens($this->customer->getId(), 'card'); foreach ($card_customer_tokens as $card_customer_token) { - $data['card_customer_tokens'][] = [ + $data['card_customer_tokens'][] = array( 'vault_id' => $card_customer_token['vault_id'], 'card_type' => $card_customer_token['card_type'], 'card_number' => sprintf($this->language->get('text_card_number'), $card_customer_token['card_nice_type'], $card_customer_token['card_last_digits']) - ]; + ); } } } @@ -680,19 +680,19 @@ public function getData() { require_once DIR_SYSTEM .'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $data['partner_id'], 'client_id' => $data['client_id'], 'secret' => $data['secret'], 'environment' => $data['environment'], 'partner_attribution_id' => $data['partner_attribution_id'] - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials', - ]; + ); if ($setting['general']['vault_status'] && $this->customer->isLogged()) { $paypal_customer_token = $this->model_extension_payment_paypal->getPayPalCustomerMainToken($this->customer->getId(), 'paypal'); @@ -712,7 +712,7 @@ public function getData() { $data['client_token'] = $paypal->getClientToken(); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -763,7 +763,7 @@ public function createOrder() { $payment_method = 'card'; } - $errors = []; + $errors = array(); $data['paypal_order_id'] = ''; $data['url'] = ''; @@ -790,7 +790,7 @@ public function createOrder() { if (isset($product['option'])) { $option = array_filter($product['option']); } else { - $option = []; + $option = array(); } $product_options = $this->model_catalog_product->getProductOptions($product_id); @@ -810,7 +810,7 @@ public function createOrder() { $recurrings = $this->model_catalog_product->getProfiles($product_info['product_id']); if ($recurrings) { - $recurring_ids = []; + $recurring_ids = array(); foreach ($recurrings as $recurring) { $recurring_ids[] = $recurring['recurring_id']; @@ -840,7 +840,7 @@ public function createOrder() { $order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']); - $shipping_info = []; + $shipping_info = array(); if ($this->cart->hasShipping()) { $shipping_info['name']['full_name'] = $order_info['shipping_firstname']; @@ -897,23 +897,23 @@ public function createOrder() { require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $partner_id, 'client_id' => $client_id, 'secret' => $secret, 'environment' => $environment, 'partner_attribution_id' => $partner_attribution_id - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); - $item_info = []; + $item_info = array(); $item_total = 0; $tax_total = 0; @@ -923,21 +923,17 @@ public function createOrder() { foreach ($this->cart->getProducts() as $product) { $product_price = number_format($product['price'] * $currency_value, $decimal_place, '.', ''); - $product_info = []; + $product_info = array(); $product_info['name'] = $product['name']; $product_info['quantity'] = $product['quantity']; $product_info['sku'] = $product['model']; $product_info['url'] = $this->url->link('product/product', 'product_id=' . $product['product_id'], true); - - if ($product['image']) { - $product_info['image_url'] = $this->model_tool_image->resize($product['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_thumb_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_thumb_height')); - } - - $product_info['unit_amount'] = [ + + $product_info['unit_amount'] = array( 'currency_code' => $currency_code, 'value' => $product_price - ]; + ); $item_info[] = $product_info; @@ -954,15 +950,15 @@ public function createOrder() { if (!empty($this->session->data['vouchers'])) { foreach ($this->session->data['vouchers'] as $voucher) { - $voucher_info = []; + $voucher_info = array(); $voucher_info['name'] = $voucher['description']; $voucher_info['quantity'] = 1; - $voucher_info['unit_amount'] = [ + $voucher_info['unit_amount'] = array( 'currency_code' => $currency_code, 'value' => $voucher['amount'] - ]; + ); $item_info[] = $voucher_info; @@ -995,39 +991,39 @@ public function createOrder() { } } - $amount_info = []; + $amount_info = array(); $amount_info['currency_code'] = $currency_code; $amount_info['value'] = $order_total; - $amount_info['breakdown']['item_total'] = [ + $amount_info['breakdown']['item_total'] = array( 'currency_code' => $currency_code, 'value' => $item_total - ]; + ); - $amount_info['breakdown']['tax_total'] = [ + $amount_info['breakdown']['tax_total'] = array( 'currency_code' => $currency_code, 'value' => $tax_total - ]; + ); if ($page_code == 'checkout') { - $amount_info['breakdown']['shipping'] = [ + $amount_info['breakdown']['shipping'] = array( 'currency_code' => $currency_code, 'value' => $shipping_total - ]; + ); - $amount_info['breakdown']['handling'] = [ + $amount_info['breakdown']['handling'] = array( 'currency_code' => $currency_code, 'value' => $handling_total - ]; + ); - $amount_info['breakdown']['discount'] = [ + $amount_info['breakdown']['discount'] = array( 'currency_code' => $currency_code, 'value' => $discount_total - ]; + ); } - $paypal_order_info = []; + $paypal_order_info = array(); $paypal_order_info['intent'] = strtoupper($transaction_method); $paypal_order_info['purchase_units'][0]['reference_id'] = 'default'; @@ -1053,19 +1049,19 @@ public function createOrder() { if ($setting['general']['vault_status'] && ($this->customer->isLogged() || $this->cart->hasRecurringProducts())) { if ($payment_method == 'paypal') { - $paypal_customer_token = []; + $paypal_customer_token = array(); if ($this->customer->isLogged()) { $paypal_customer_token = $this->model_extension_payment_paypal->getPayPalCustomerMainToken($this->customer->getId(), $payment_method); } if (empty($paypal_customer_token['vault_id'])) { - $paypal_order_info['payment_source'][$payment_method]['attributes']['vault'] = [ + $paypal_order_info['payment_source'][$payment_method]['attributes']['vault'] = array( 'permit_multiple_payment_tokens' => 'false', 'store_in_vault' => 'ON_SUCCESS', 'usage_type' => 'MERCHANT', 'customer_type' => 'CONSUMER' - ]; + ); } } @@ -1106,7 +1102,7 @@ public function createOrder() { $result = $paypal->createOrder($paypal_order_info); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -1225,19 +1221,19 @@ public function approveOrder() { require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $partner_id, 'client_id' => $client_id, 'secret' => $secret, 'environment' => $environment, 'partner_attribution_id' => $partner_attribution_id - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); @@ -1247,7 +1243,7 @@ public function approveOrder() { $paypal_order_info = $paypal->getOrder($paypal_order_id); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -1298,7 +1294,7 @@ public function approveOrder() { $this->session->data['guest']['lastname'] = (isset($paypal_order_info['payer']['name']['surname']) ? $paypal_order_info['payer']['name']['surname'] : ''); $this->session->data['guest']['email'] = (isset($paypal_order_info['payer']['email_address']) ? $paypal_order_info['payer']['email_address'] : ''); $this->session->data['guest']['telephone'] = (isset($paypal_order_info['payer']['phone']['phone_number']['national_number']) ? $paypal_order_info['payer']['phone']['phone_number']['national_number'] : ''); - $this->session->data['guest']['custom_field'] = []; + $this->session->data['guest']['custom_field'] = array(); } if ($this->customer->isLogged() && $this->customer->getAddressId()) { @@ -1316,7 +1312,7 @@ public function approveOrder() { $this->session->data['payment_address']['address_format'] = ''; $this->session->data['payment_address']['zone'] = ''; $this->session->data['payment_address']['zone_id'] = 0; - $this->session->data['payment_address']['custom_field'] = []; + $this->session->data['payment_address']['custom_field'] = array(); if (isset($paypal_order_info['payer']['address']['country_code'])) { $country_info = $this->model_extension_payment_paypal->getCountryByCode($paypal_order_info['payer']['address']['country_code']); @@ -1351,7 +1347,7 @@ public function approveOrder() { $this->session->data['shipping_address']['address_format'] = ''; $this->session->data['shipping_address']['zone'] = ''; $this->session->data['shipping_address']['zone_id'] = 0; - $this->session->data['shipping_address']['custom_field'] = []; + $this->session->data['shipping_address']['custom_field'] = array(); if (isset($paypal_order_info['purchase_units'][0]['shipping']['address']['country_code'])) { $country_info = $this->model_extension_payment_paypal->getCountryByCode($paypal_order_info['purchase_units'][0]['shipping']['address']['country_code']); @@ -1471,413 +1467,417 @@ public function approveOrder() { } if ($payment_type == 'button') { - $this->session->data['payment_method'] = [ + $this->session->data['payment_method'] = array( 'code' => 'paypal', 'title' => $this->language->get('text_paypal_title'), 'terms' => '', 'sort_order' => $this->config->get('payment_paypal_sort_order') - ]; + ); } if ($payment_type == 'googlepay_button') { - $this->session->data['payment_method'] = [ + $this->session->data['payment_method'] = array( 'code' => 'paypal_googlepay', 'title' => $this->language->get('text_paypal_googlepay_title'), 'terms' => '', 'sort_order' => $this->config->get('payment_paypal_sort_order') - ]; + ); } if ($payment_type == 'applepay_button') { - $this->session->data['payment_method'] = [ + $this->session->data['payment_method'] = array( 'code' => 'paypal_applepay', 'title' => $this->language->get('text_paypal_applepay_title'), 'terms' => '', 'sort_order' => $this->config->get('payment_paypal_sort_order') - ]; + ); } $data['url'] = $this->url->link('extension/payment/paypal/confirmOrder', '', true); } } else { - if (!empty($this->request->post['paypal_order_id'])) { - $paypal_order_id = $this->request->post['paypal_order_id']; - } + $paypal_order_info = $this->model_extension_payment_paypal->getPayPalOrder($this->session->data['order_id']); + + if (!$paypal_order_info) { + if (!empty($this->request->post['paypal_order_id'])) { + $paypal_order_id = $this->request->post['paypal_order_id']; + } - if (($payment_type == 'card') && !empty($paypal_order_id)) { - $paypal_order_info = $paypal->getOrder($paypal_order_id); + if (($payment_type == 'card') && !empty($paypal_order_id)) { + $paypal_order_info = $paypal->getOrder($paypal_order_id); - if ($paypal->hasErrors()) { - $error_messages = []; + if ($paypal->hasErrors()) { + $error_messages = array(); - $errors = $paypal->getErrors(); + $errors = $paypal->getErrors(); - foreach ($errors as $error) { - if (isset($error['name']) && ($error['name'] == 'CURLE_OPERATION_TIMEOUTED')) { - $error['message'] = $this->language->get('error_timeout'); - } + foreach ($errors as $error) { + if (isset($error['name']) && ($error['name'] == 'CURLE_OPERATION_TIMEOUTED')) { + $error['message'] = $this->language->get('error_timeout'); + } - if (isset($error['details'][0]['description'])) { - $error_messages[] = $error['details'][0]['description']; - } elseif (isset($error['message'])) { - $error_messages[] = $error['message']; - } + if (isset($error['details'][0]['description'])) { + $error_messages[] = $error['details'][0]['description']; + } elseif (isset($error['message'])) { + $error_messages[] = $error['message']; + } - $this->model_extension_payment_paypal->log($error, $error['message']); - } + $this->model_extension_payment_paypal->log($error, $error['message']); + } - $this->error['warning'] = implode(' ', $error_messages); - } + $this->error['warning'] = implode(' ', $error_messages); + } - if (isset($paypal_order_info['payment_source']['card']) && !$this->error) { - $this->model_extension_payment_paypal->log($paypal_order_info['payment_source']['card'], 'Card'); + if (isset($paypal_order_info['payment_source']['card']) && !$this->error) { + $this->model_extension_payment_paypal->log($paypal_order_info['payment_source']['card'], 'Card'); - $liability_shift = (isset($paypal_order_info['payment_source']['card']['authentication_result']['liability_shift']) ? $paypal_order_info['payment_source']['card']['authentication_result']['liability_shift'] : ''); - $enrollment_status = (isset($paypal_order_info['payment_source']['card']['authentication_result']['three_d_secure']['enrollment_status']) ? $paypal_order_info['payment_source']['card']['authentication_result']['three_d_secure']['enrollment_status'] : ''); - $authentication_status = (isset($paypal_order_info['payment_source']['card']['authentication_result']['three_d_secure']['authentication_status']) ? $paypal_order_info['payment_source']['card']['authentication_result']['three_d_secure']['authentication_status'] : ''); + $liability_shift = (isset($paypal_order_info['payment_source']['card']['authentication_result']['liability_shift']) ? $paypal_order_info['payment_source']['card']['authentication_result']['liability_shift'] : ''); + $enrollment_status = (isset($paypal_order_info['payment_source']['card']['authentication_result']['three_d_secure']['enrollment_status']) ? $paypal_order_info['payment_source']['card']['authentication_result']['three_d_secure']['enrollment_status'] : ''); + $authentication_status = (isset($paypal_order_info['payment_source']['card']['authentication_result']['three_d_secure']['authentication_status']) ? $paypal_order_info['payment_source']['card']['authentication_result']['three_d_secure']['authentication_status'] : ''); - if ($enrollment_status == 'Y') { - if (($authentication_status == 'N') && !$setting['card']['secure_scenario']['failed_authentication']) { - $this->error['warning'] = $this->language->get($setting['card_secure_scenario']['failed_authentication']['error']); - } + if ($enrollment_status == 'Y') { + if (($authentication_status == 'N') && !$setting['card']['secure_scenario']['failed_authentication']) { + $this->error['warning'] = $this->language->get($setting['card_secure_scenario']['failed_authentication']['error']); + } - if (($authentication_status == 'R') && !$setting['card']['secure_scenario']['rejected_authentication']) { - $this->error['warning'] = $this->language->get($setting['card_secure_scenario']['rejected_authentication']['error']); - } + if (($authentication_status == 'R') && !$setting['card']['secure_scenario']['rejected_authentication']) { + $this->error['warning'] = $this->language->get($setting['card_secure_scenario']['rejected_authentication']['error']); + } - if (($authentication_status == 'A') && !$setting['card']['secure_scenario']['attempted_authentication']) { - $this->error['warning'] = $this->language->get($setting['card_secure_scenario']['attempted_authentication']['error']); - } + if (($authentication_status == 'A') && !$setting['card']['secure_scenario']['attempted_authentication']) { + $this->error['warning'] = $this->language->get($setting['card_secure_scenario']['attempted_authentication']['error']); + } - if (($authentication_status == 'U') && !$setting['card']['secure_scenario']['unable_authentication']) { - $this->error['warning'] = $this->language->get($setting['card_secure_scenario']['unable_authentication']['error']); - } + if (($authentication_status == 'U') && !$setting['card']['secure_scenario']['unable_authentication']) { + $this->error['warning'] = $this->language->get($setting['card_secure_scenario']['unable_authentication']['error']); + } - if (($authentication_status == 'C') && !$setting['card']['secure_scenario']['challenge_authentication']) { - $this->error['warning'] = $this->language->get($setting['card_secure_scenario']['challenge_authentication']['error']); + if (($authentication_status == 'C') && !$setting['card']['secure_scenario']['challenge_authentication']) { + $this->error['warning'] = $this->language->get($setting['card_secure_scenario']['challenge_authentication']['error']); + } } - } - if (($enrollment_status == 'N') && !$setting['card']['secure_scenario']['card_ineligible']) { - $this->error['warning'] = $this->language->get($setting['card_secure_scenario']['card_ineligible']['error']); - } + if (($enrollment_status == 'N') && !$setting['card']['secure_scenario']['card_ineligible']) { + $this->error['warning'] = $this->language->get($setting['card_secure_scenario']['card_ineligible']['error']); + } - if (($enrollment_status == 'U') && !$setting['card']['secure_scenario']['system_unavailable']) { - $this->error['warning'] = $this->language->get($setting['card_secure_scenario']['system_unavailable']['error']); - } + if (($enrollment_status == 'U') && !$setting['card']['secure_scenario']['system_unavailable']) { + $this->error['warning'] = $this->language->get($setting['card_secure_scenario']['system_unavailable']['error']); + } - if (($enrollment_status == 'B') && !$setting['card']['secure_scenario']['system_bypassed']) { - $this->error['warning'] = $this->language->get($setting['card_secure_scenario']['system_bypassed']['error']); + if (($enrollment_status == 'B') && !$setting['card']['secure_scenario']['system_bypassed']) { + $this->error['warning'] = $this->language->get($setting['card_secure_scenario']['system_bypassed']['error']); + } } - } - if (!empty($this->error['warning'])) { - $this->error['warning'] .= ' ' . sprintf($this->language->get('error_payment'), $this->url->link('information/contact', '', true)); + if (!empty($this->error['warning'])) { + $this->error['warning'] .= ' ' . sprintf($this->language->get('error_payment'), $this->url->link('information/contact', '', true)); + } } - } - if (!empty($paypal_order_id) && !$this->error) { - if ($transaction_method == 'authorize') { - $result = $paypal->setOrderAuthorize($paypal_order_id); - } else { - $result = $paypal->setOrderCapture($paypal_order_id); - } + if (!empty($paypal_order_id) && !$this->error) { + if ($transaction_method == 'authorize') { + $result = $paypal->setOrderAuthorize($paypal_order_id); + } else { + $result = $paypal->setOrderCapture($paypal_order_id); + } - if ($paypal->hasErrors()) { - $error_messages = []; + if ($paypal->hasErrors()) { + $error_messages = array(); - $errors = $paypal->getErrors(); + $errors = $paypal->getErrors(); - foreach ($errors as $error) { - if (isset($error['details'][0]['issue']) && ($error['details'][0]['issue'] == 'INSTRUMENT_DECLINED')) { - $data['restart'] = true; - } + foreach ($errors as $error) { + if (isset($error['details'][0]['issue']) && ($error['details'][0]['issue'] == 'INSTRUMENT_DECLINED')) { + $data['restart'] = true; + } - if (isset($error['name']) && ($error['name'] == 'CURLE_OPERATION_TIMEOUTED')) { - $error['message'] = $this->language->get('error_timeout'); - } + if (isset($error['name']) && ($error['name'] == 'CURLE_OPERATION_TIMEOUTED')) { + $error['message'] = $this->language->get('error_timeout'); + } - if (isset($error['details'][0]['description'])) { - $error_messages[] = $error['details'][0]['description']; - } elseif (isset($error['message'])) { - $error_messages[] = $error['message']; - } + if (isset($error['details'][0]['description'])) { + $error_messages[] = $error['details'][0]['description']; + } elseif (isset($error['message'])) { + $error_messages[] = $error['message']; + } - $this->model_extension_payment_paypal->log($error, $error['message']); + $this->model_extension_payment_paypal->log($error, $error['message']); + } + + $this->error['warning'] = implode(' ', $error_messages); } - $this->error['warning'] = implode(' ', $error_messages); - } - - if (!empty($this->error['warning'])) { - $this->error['warning'] .= ' ' . sprintf($this->language->get('error_payment'), $this->url->link('information/contact', '', true)); - } + if (!empty($this->error['warning'])) { + $this->error['warning'] .= ' ' . sprintf($this->language->get('error_payment'), $this->url->link('information/contact', '', true)); + } - if (!$this->error) { - $this->load->model('checkout/order'); + if (!$this->error) { + $this->load->model('checkout/order'); - $order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']); + $order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']); - if ($transaction_method == 'authorize') { - $this->model_extension_payment_paypal->log($result, 'Authorize Order'); + if ($transaction_method == 'authorize') { + $this->model_extension_payment_paypal->log($result, 'Authorize Order'); - if (isset($result['purchase_units'][0]['payments']['authorizations'][0]['status']) && isset($result['purchase_units'][0]['payments']['authorizations'][0]['seller_protection']['status'])) { - $authorization_id = $result['purchase_units'][0]['payments']['authorizations'][0]['id']; - $authorization_status = $result['purchase_units'][0]['payments']['authorizations'][0]['status']; - $seller_protection_status = $result['purchase_units'][0]['payments']['authorizations'][0]['seller_protection']['status']; - $order_status_id = 0; - $transaction_status = ''; - $payment_method = ''; - $vault_id = ''; - $vault_customer_id = ''; - $card_type = (!empty($this->request->post['card_type']) ? $this->request->post['card_type'] : ''); - $card_nice_type = (!empty($this->request->post['card_nice_type']) ? $this->request->post['card_nice_type'] : ''); - $card_last_digits = ''; - $card_expiry = ''; + if (isset($result['purchase_units'][0]['payments']['authorizations'][0]['status']) && isset($result['purchase_units'][0]['payments']['authorizations'][0]['seller_protection']['status'])) { + $authorization_id = $result['purchase_units'][0]['payments']['authorizations'][0]['id']; + $authorization_status = $result['purchase_units'][0]['payments']['authorizations'][0]['status']; + $seller_protection_status = $result['purchase_units'][0]['payments']['authorizations'][0]['seller_protection']['status']; + $order_status_id = 0; + $transaction_status = ''; + $payment_method = ''; + $vault_id = ''; + $vault_customer_id = ''; + $card_type = (!empty($this->request->post['card_type']) ? $this->request->post['card_type'] : ''); + $card_nice_type = (!empty($this->request->post['card_nice_type']) ? $this->request->post['card_nice_type'] : ''); + $card_last_digits = ''; + $card_expiry = ''; - if (!$this->cart->hasShipping()) { - $seller_protection_status = 'NOT_ELIGIBLE'; - } + if (!$this->cart->hasShipping()) { + $seller_protection_status = 'NOT_ELIGIBLE'; + } - foreach ($result['payment_source'] as $payment_source_key => $payment_source) { - $payment_method = $payment_source_key; - $vault_id = (isset($payment_source['attributes']['vault']['id']) ? $payment_source['attributes']['vault']['id'] : ''); - $vault_customer_id = (isset($payment_source['attributes']['vault']['customer']['id']) ? $payment_source['attributes']['vault']['customer']['id'] : ''); - $card_last_digits = (isset($payment_source['last_digits']) ? $payment_source['last_digits'] : ''); - $card_expiry = (isset($payment_source['expiry']) ? $payment_source['expiry'] : ''); + foreach ($result['payment_source'] as $payment_source_key => $payment_source) { + $payment_method = $payment_source_key; + $vault_id = (isset($payment_source['attributes']['vault']['id']) ? $payment_source['attributes']['vault']['id'] : ''); + $vault_customer_id = (isset($payment_source['attributes']['vault']['customer']['id']) ? $payment_source['attributes']['vault']['customer']['id'] : ''); + $card_last_digits = (isset($payment_source['last_digits']) ? $payment_source['last_digits'] : ''); + $card_expiry = (isset($payment_source['expiry']) ? $payment_source['expiry'] : ''); - break; - } + break; + } - if ($authorization_status == 'CREATED') { - $order_status_id = $setting['order_status']['pending']['id']; - $transaction_status = 'created'; - } + if ($authorization_status == 'CREATED') { + $order_status_id = $setting['order_status']['pending']['id']; + $transaction_status = 'created'; + } - if ($authorization_status == 'CAPTURED') { - $this->error['warning'] = sprintf($this->language->get('error_authorization_captured'), $this->url->link('information/contact', '', true)); - } + if ($authorization_status == 'CAPTURED') { + $this->error['warning'] = sprintf($this->language->get('error_authorization_captured'), $this->url->link('information/contact', '', true)); + } - if ($authorization_status == 'DENIED') { - $order_status_id = $setting['order_status']['denied']['id']; - $transaction_status = 'denied'; + if ($authorization_status == 'DENIED') { + $order_status_id = $setting['order_status']['denied']['id']; + $transaction_status = 'denied'; - $this->error['warning'] = $this->language->get('error_authorization_denied'); - } + $this->error['warning'] = $this->language->get('error_authorization_denied'); + } - if ($authorization_status == 'EXPIRED') { - $this->error['warning'] = sprintf($this->language->get('error_authorization_expired'), $this->url->link('information/contact', '', true)); - } + if ($authorization_status == 'EXPIRED') { + $this->error['warning'] = sprintf($this->language->get('error_authorization_expired'), $this->url->link('information/contact', '', true)); + } - if ($authorization_status == 'PENDING') { - $order_status_id = $setting['order_status']['pending']['id']; - $transaction_status = 'pending'; - } + if ($authorization_status == 'PENDING') { + $order_status_id = $setting['order_status']['pending']['id']; + $transaction_status = 'pending'; + } - if (($authorization_status == 'CREATED') || ($authorization_status == 'DENIED') || ($authorization_status == 'PENDING')) { - $message = sprintf($this->language->get('text_order_message'), $seller_protection_status); + if (($authorization_status == 'CREATED') || ($authorization_status == 'DENIED') || ($authorization_status == 'PENDING')) { + $message = sprintf($this->language->get('text_order_message'), $seller_protection_status); - $this->model_checkout_order->addOrderHistory($this->session->data['order_id'], $order_status_id, $message); - } + $this->model_checkout_order->addOrderHistory($this->session->data['order_id'], $order_status_id, $message); + } - if (($authorization_status == 'CREATED') || ($authorization_status == 'DENIED') || ($authorization_status == 'PENDING')) { - if ($payment_method == 'paypal') { - $paypal_customer_token = []; + if (($authorization_status == 'CREATED') || ($authorization_status == 'DENIED') || ($authorization_status == 'PENDING')) { + if ($payment_method == 'paypal') { + $paypal_customer_token = array(); - if ($setting['general']['vault_status'] && $this->customer->isLogged()) { - $paypal_customer_token = $this->model_extension_payment_paypal->getPayPalCustomerMainToken($this->customer->getId(), $payment_method); - } + if ($setting['general']['vault_status'] && $this->customer->isLogged()) { + $paypal_customer_token = $this->model_extension_payment_paypal->getPayPalCustomerMainToken($this->customer->getId(), $payment_method); + } - if (!empty($paypal_customer_token['vault_id'])) { - $vault_id = $paypal_customer_token['vault_id']; - $vault_customer_id = $paypal_customer_token['vault_customer_id']; + if (!empty($paypal_customer_token['vault_id'])) { + $vault_id = $paypal_customer_token['vault_id']; + $vault_customer_id = $paypal_customer_token['vault_customer_id']; + } } - } - $this->model_extension_payment_paypal->deletePayPalOrder($this->session->data['order_id']); + $this->model_extension_payment_paypal->deletePayPalOrder($this->session->data['order_id']); - $paypal_order_data = [ - 'order_id' => $this->session->data['order_id'], - 'paypal_order_id' => $paypal_order_id, - 'transaction_id' => $authorization_id, - 'transaction_status' => $transaction_status, - 'payment_method' => $payment_method, - 'vault_id' => $vault_id, - 'vault_customer_id' => $vault_customer_id, - 'card_type' => $card_type, - 'card_nice_type' => $card_nice_type, - 'card_last_digits' => $card_last_digits, - 'card_expiry' => $card_expiry, - 'total' => $order_info['total'], - 'currency_code' => $order_info['currency_code'], - 'environment' => $environment - ]; - - $this->model_extension_payment_paypal->addPayPalOrder($paypal_order_data); + $paypal_order_data = array( + 'order_id' => $this->session->data['order_id'], + 'paypal_order_id' => $paypal_order_id, + 'transaction_id' => $authorization_id, + 'transaction_status' => $transaction_status, + 'payment_method' => $payment_method, + 'vault_id' => $vault_id, + 'vault_customer_id' => $vault_customer_id, + 'card_type' => $card_type, + 'card_nice_type' => $card_nice_type, + 'card_last_digits' => $card_last_digits, + 'card_expiry' => $card_expiry, + 'total' => $order_info['total'], + 'currency_code' => $order_info['currency_code'], + 'environment' => $environment + ); + + $this->model_extension_payment_paypal->addPayPalOrder($paypal_order_data); - if ($vault_id && $this->customer->isLogged()) { - $customer_id = $this->customer->getId(); + if ($vault_id && $this->customer->isLogged()) { + $customer_id = $this->customer->getId(); - $paypal_customer_token_info = $this->model_extension_payment_paypal->getPayPalCustomerToken($customer_id, $payment_method, $vault_id); + $paypal_customer_token_info = $this->model_extension_payment_paypal->getPayPalCustomerToken($customer_id, $payment_method, $vault_id); - if (!$paypal_customer_token_info) { - $paypal_customer_token_data = [ - 'customer_id' => $customer_id, - 'payment_method' => $payment_method, - 'vault_id' => $vault_id, - 'vault_customer_id' => $vault_customer_id, - 'card_type' => $card_type, - 'card_nice_type' => $card_nice_type, - 'card_last_digits' => $card_last_digits, - 'card_expiry' => $card_expiry - ]; + if (!$paypal_customer_token_info) { + $paypal_customer_token_data = array( + 'customer_id' => $customer_id, + 'payment_method' => $payment_method, + 'vault_id' => $vault_id, + 'vault_customer_id' => $vault_customer_id, + 'card_type' => $card_type, + 'card_nice_type' => $card_nice_type, + 'card_last_digits' => $card_last_digits, + 'card_expiry' => $card_expiry + ); - $this->model_extension_payment_paypal->addPayPalCustomerToken($paypal_customer_token_data); - } + $this->model_extension_payment_paypal->addPayPalCustomerToken($paypal_customer_token_data); + } - $this->model_extension_payment_paypal->setPayPalCustomerMainToken($customer_id, $payment_method, $vault_id); + $this->model_extension_payment_paypal->setPayPalCustomerMainToken($customer_id, $payment_method, $vault_id); + } } - } - if (($authorization_status == 'CREATED') || ($authorization_status == 'PENDING')) { - $recurring_products = $this->cart->getRecurringProducts(); + if (($authorization_status == 'CREATED') || ($authorization_status == 'PENDING')) { + $recurring_products = $this->cart->getRecurringProducts(); - foreach ($recurring_products as $recurring_product) { - $this->model_extension_payment_paypal->recurringPayment($recurring_product, $order_info, $paypal_order_data); - } - } + foreach ($recurring_products as $recurring_product) { + $this->model_extension_payment_paypal->recurringPayment($recurring_product, $order_info, $paypal_order_data); + } + } - if (($authorization_status == 'CREATED') || ($authorization_status == 'PARTIALLY_CAPTURED') || ($authorization_status == 'PARTIALLY_CREATED') || ($authorization_status == 'VOIDED') || ($authorization_status == 'PENDING')) { - $data['url'] = $this->url->link('checkout/success', '', true); + if (($authorization_status == 'CREATED') || ($authorization_status == 'PARTIALLY_CAPTURED') || ($authorization_status == 'PARTIALLY_CREATED') || ($authorization_status == 'VOIDED') || ($authorization_status == 'PENDING')) { + $data['url'] = $this->url->link('checkout/success', '', true); + } } - } - } else { - $this->model_extension_payment_paypal->log($result, 'Capture Order'); + } else { + $this->model_extension_payment_paypal->log($result, 'Capture Order'); - if (isset($result['purchase_units'][0]['payments']['captures'][0]['status']) && isset($result['purchase_units'][0]['payments']['captures'][0]['seller_protection']['status'])) { - $capture_id = $result['purchase_units'][0]['payments']['captures'][0]['id']; - $capture_status = $result['purchase_units'][0]['payments']['captures'][0]['status']; - $seller_protection_status = $result['purchase_units'][0]['payments']['captures'][0]['seller_protection']['status']; - $order_status_id = 0; - $transaction_status = ''; - $payment_method = ''; - $vault_id = ''; - $vault_customer_id = ''; - $card_type = (!empty($this->request->post['card_type']) ? $this->request->post['card_type'] : ''); - $card_nice_type = (!empty($this->request->post['card_nice_type']) ? $this->request->post['card_nice_type'] : ''); - $card_last_digits = ''; - $card_expiry = ''; + if (isset($result['purchase_units'][0]['payments']['captures'][0]['status']) && isset($result['purchase_units'][0]['payments']['captures'][0]['seller_protection']['status'])) { + $capture_id = $result['purchase_units'][0]['payments']['captures'][0]['id']; + $capture_status = $result['purchase_units'][0]['payments']['captures'][0]['status']; + $seller_protection_status = $result['purchase_units'][0]['payments']['captures'][0]['seller_protection']['status']; + $order_status_id = 0; + $transaction_status = ''; + $payment_method = ''; + $vault_id = ''; + $vault_customer_id = ''; + $card_type = (!empty($this->request->post['card_type']) ? $this->request->post['card_type'] : ''); + $card_nice_type = (!empty($this->request->post['card_nice_type']) ? $this->request->post['card_nice_type'] : ''); + $card_last_digits = ''; + $card_expiry = ''; - if (!$this->cart->hasShipping()) { - $seller_protection_status = 'NOT_ELIGIBLE'; - } + if (!$this->cart->hasShipping()) { + $seller_protection_status = 'NOT_ELIGIBLE'; + } - foreach ($result['payment_source'] as $payment_source_key => $payment_source) { - $payment_method = $payment_source_key; - $vault_id = (isset($payment_source['attributes']['vault']['id']) ? $payment_source['attributes']['vault']['id'] : ''); - $vault_customer_id = (isset($payment_source['attributes']['vault']['customer']['id']) ? $payment_source['attributes']['vault']['customer']['id'] : ''); - $card_last_digits = (isset($payment_source['last_digits']) ? $payment_source['last_digits'] : ''); - $card_expiry = (isset($payment_source['expiry']) ? $payment_source['expiry'] : ''); + foreach ($result['payment_source'] as $payment_source_key => $payment_source) { + $payment_method = $payment_source_key; + $vault_id = (isset($payment_source['attributes']['vault']['id']) ? $payment_source['attributes']['vault']['id'] : ''); + $vault_customer_id = (isset($payment_source['attributes']['vault']['customer']['id']) ? $payment_source['attributes']['vault']['customer']['id'] : ''); + $card_last_digits = (isset($payment_source['last_digits']) ? $payment_source['last_digits'] : ''); + $card_expiry = (isset($payment_source['expiry']) ? $payment_source['expiry'] : ''); - break; - } + break; + } - if ($capture_status == 'COMPLETED') { - $order_status_id = $setting['order_status']['completed']['id']; - $transaction_status = 'completed'; - } + if ($capture_status == 'COMPLETED') { + $order_status_id = $setting['order_status']['completed']['id']; + $transaction_status = 'completed'; + } - if ($capture_status == 'DECLINED') { - $order_status_id = $setting['order_status']['denied']['id']; - $transaction_status = 'denied'; + if ($capture_status == 'DECLINED') { + $order_status_id = $setting['order_status']['denied']['id']; + $transaction_status = 'denied'; - $this->error['warning'] = $this->language->get('error_capture_declined'); - } + $this->error['warning'] = $this->language->get('error_capture_declined'); + } - if ($capture_status == 'FAILED') { - $this->error['warning'] = sprintf($this->language->get('error_capture_failed'), $this->url->link('information/contact', '', true)); - } + if ($capture_status == 'FAILED') { + $this->error['warning'] = sprintf($this->language->get('error_capture_failed'), $this->url->link('information/contact', '', true)); + } - if ($capture_status == 'PENDING') { - $order_status_id = $setting['order_status']['pending']['id']; - $transaction_status = 'pending'; - } + if ($capture_status == 'PENDING') { + $order_status_id = $setting['order_status']['pending']['id']; + $transaction_status = 'pending'; + } - if (($capture_status == 'COMPLETED') || ($capture_status == 'DECLINED') || ($capture_status == 'PENDING')) { - $message = sprintf($this->language->get('text_order_message'), $seller_protection_status); + if (($capture_status == 'COMPLETED') || ($capture_status == 'DECLINED') || ($capture_status == 'PENDING')) { + $message = sprintf($this->language->get('text_order_message'), $seller_protection_status); - $this->model_checkout_order->addOrderHistory($this->session->data['order_id'], $order_status_id, $message); - } + $this->model_checkout_order->addOrderHistory($this->session->data['order_id'], $order_status_id, $message); + } - if (($capture_status == 'COMPLETED') || ($capture_status == 'DECLINED') || ($capture_status == 'PENDING')) { - if ($payment_method == 'paypal') { - $paypal_customer_token = []; + if (($capture_status == 'COMPLETED') || ($capture_status == 'DECLINED') || ($capture_status == 'PENDING')) { + if ($payment_method == 'paypal') { + $paypal_customer_token = array(); - if ($setting['general']['vault_status'] && $this->customer->isLogged()) { - $paypal_customer_token = $this->model_extension_payment_paypal->getPayPalCustomerMainToken($this->customer->getId(), $payment_method); - } + if ($setting['general']['vault_status'] && $this->customer->isLogged()) { + $paypal_customer_token = $this->model_extension_payment_paypal->getPayPalCustomerMainToken($this->customer->getId(), $payment_method); + } - if (!empty($paypal_customer_token['vault_id'])) { - $vault_id = $paypal_customer_token['vault_id']; - $vault_customer_id = $paypal_customer_token['vault_customer_id']; + if (!empty($paypal_customer_token['vault_id'])) { + $vault_id = $paypal_customer_token['vault_id']; + $vault_customer_id = $paypal_customer_token['vault_customer_id']; + } } - } - $this->model_extension_payment_paypal->deletePayPalOrder($this->session->data['order_id']); + $this->model_extension_payment_paypal->deletePayPalOrder($this->session->data['order_id']); - $paypal_order_data = [ - 'order_id' => $this->session->data['order_id'], - 'paypal_order_id' => $paypal_order_id, - 'transaction_id' => $capture_id, - 'transaction_status' => $transaction_status, - 'payment_method' => $payment_method, - 'vault_id' => $vault_id, - 'vault_customer_id' => $vault_customer_id, - 'card_type' => $card_type, - 'card_nice_type' => $card_nice_type, - 'card_last_digits' => $card_last_digits, - 'card_expiry' => $card_expiry, - 'total' => $order_info['total'], - 'currency_code' => $order_info['currency_code'], - 'environment' => $environment - ]; - - $this->model_extension_payment_paypal->addPayPalOrder($paypal_order_data); + $paypal_order_data = array( + 'order_id' => $this->session->data['order_id'], + 'paypal_order_id' => $paypal_order_id, + 'transaction_id' => $capture_id, + 'transaction_status' => $transaction_status, + 'payment_method' => $payment_method, + 'vault_id' => $vault_id, + 'vault_customer_id' => $vault_customer_id, + 'card_type' => $card_type, + 'card_nice_type' => $card_nice_type, + 'card_last_digits' => $card_last_digits, + 'card_expiry' => $card_expiry, + 'total' => $order_info['total'], + 'currency_code' => $order_info['currency_code'], + 'environment' => $environment + ); + + $this->model_extension_payment_paypal->addPayPalOrder($paypal_order_data); - if ($vault_id && $this->customer->isLogged()) { - $customer_id = $this->customer->getId(); + if ($vault_id && $this->customer->isLogged()) { + $customer_id = $this->customer->getId(); - $paypal_customer_token_info = $this->model_extension_payment_paypal->getPayPalCustomerToken($customer_id, $payment_method, $vault_id); + $paypal_customer_token_info = $this->model_extension_payment_paypal->getPayPalCustomerToken($customer_id, $payment_method, $vault_id); - if (!$paypal_customer_token_info) { - $paypal_customer_token_data = [ - 'customer_id' => $customer_id, - 'payment_method' => $payment_method, - 'vault_id' => $vault_id, - 'vault_customer_id' => $vault_customer_id, - 'card_type' => $card_type, - 'card_nice_type' => $card_nice_type, - 'card_last_digits' => $card_last_digits, - 'card_expiry' => $card_expiry - ]; + if (!$paypal_customer_token_info) { + $paypal_customer_token_data = array( + 'customer_id' => $customer_id, + 'payment_method' => $payment_method, + 'vault_id' => $vault_id, + 'vault_customer_id' => $vault_customer_id, + 'card_type' => $card_type, + 'card_nice_type' => $card_nice_type, + 'card_last_digits' => $card_last_digits, + 'card_expiry' => $card_expiry + ); - $this->model_extension_payment_paypal->addPayPalCustomerToken($paypal_customer_token_data); - } + $this->model_extension_payment_paypal->addPayPalCustomerToken($paypal_customer_token_data); + } - $this->model_extension_payment_paypal->setPayPalCustomerMainToken($customer_id, $payment_method, $vault_id); + $this->model_extension_payment_paypal->setPayPalCustomerMainToken($customer_id, $payment_method, $vault_id); + } } - } - if (($capture_status == 'COMPLETED') || ($capture_status == 'PENDING')) { - $recurring_products = $this->cart->getRecurringProducts(); + if (($capture_status == 'COMPLETED') || ($capture_status == 'PENDING')) { + $recurring_products = $this->cart->getRecurringProducts(); - foreach ($recurring_products as $recurring_product) { - $this->model_extension_payment_paypal->recurringPayment($recurring_product, $order_info, $paypal_order_data); - } - } + foreach ($recurring_products as $recurring_product) { + $this->model_extension_payment_paypal->recurringPayment($recurring_product, $order_info, $paypal_order_data); + } + } - if (($capture_status == 'COMPLETED') || ($capture_status == 'PARTIALLY_REFUNDED') || ($capture_status == 'REFUNDED') || ($capture_status == 'PENDING')) { - $data['url'] = $this->url->link('checkout/success', '', true); + if (($capture_status == 'COMPLETED') || ($capture_status == 'PARTIALLY_REFUNDED') || ($capture_status == 'REFUNDED') || ($capture_status == 'PENDING')) { + $data['url'] = $this->url->link('checkout/success', '', true); + } } } } @@ -1946,22 +1946,22 @@ public function confirmOrder() { $data['heading_title'] = $this->language->get('text_paypal'); - $data['breadcrumbs'] = []; + $data['breadcrumbs'] = array(); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home', '', true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_cart'), 'href' => $this->url->link('checkout/cart', '', true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_paypal'), 'href' => $this->url->link('extension/payment/paypal/confirmOrder', '', true) - ]; + ); $points_total = 0; @@ -1983,7 +1983,7 @@ public function confirmOrder() { $this->response->redirect($this->url->link('checkout/cart', '', true)); } - $data['products'] = []; + $data['products'] = array(); $products = $this->cart->getProducts(); @@ -2006,7 +2006,7 @@ public function confirmOrder() { $image = ''; } - $option_data = []; + $option_data = array(); foreach ($product['option'] as $option) { if ($option['type'] != 'file') { @@ -2021,10 +2021,10 @@ public function confirmOrder() { } } - $option_data[] = [ + $option_data[] = array( 'name' => $option['name'], 'value' => (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value) - ]; + ); } // Display prices @@ -2041,13 +2041,13 @@ public function confirmOrder() { $recurring = ''; if ($product['recurring']) { - $frequencies = [ + $frequencies = array( 'day' => $this->language->get('text_day'), 'week' => $this->language->get('text_week'), 'semi_month' => $this->language->get('text_semi_month'), 'month' => $this->language->get('text_month'), 'year' => $this->language->get('text_year'), - ]; + ); if ($product['recurring']['trial']) { $recurring = sprintf($this->language->get('text_trial_description'), $this->currency->format($this->tax->calculate($product['recurring']['trial_price'] * $product['quantity'], $product['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']), $product['recurring']['trial_cycle'], $frequencies[$product['recurring']['trial_frequency']], $product['recurring']['trial_duration']) . ' '; @@ -2060,33 +2060,33 @@ public function confirmOrder() { } } - $data['products'][] = [ - 'cart_id' => $product['cart_id'], - 'thumb' => $image, - 'name' => $product['name'], - 'model' => $product['model'], - 'option' => $option_data, - 'recurring' => $recurring, - 'quantity' => $product['quantity'], - 'stock' => $product['stock'] ? true : !(!$this->config->get('config_stock_checkout') || $this->config->get('config_stock_warning')), - 'reward' => ($product['reward'] ? sprintf($this->language->get('text_points'), $product['reward']) : ''), - 'price' => $price, - 'total' => $total, - 'href' => $this->url->link('product/product', 'product_id=' . $product['product_id'], true) - ]; + $data['products'][] = array( + 'cart_id' => $product['cart_id'], + 'thumb' => $image, + 'name' => $product['name'], + 'model' => $product['model'], + 'option' => $option_data, + 'recurring' => $recurring, + 'quantity' => $product['quantity'], + 'stock' => $product['stock'] ? true : !(!$this->config->get('config_stock_checkout') || $this->config->get('config_stock_warning')), + 'reward' => ($product['reward'] ? sprintf($this->language->get('text_points'), $product['reward']) : ''), + 'price' => $price, + 'total' => $total, + 'href' => $this->url->link('product/product', 'product_id=' . $product['product_id'], true) + ); } // Gift Voucher - $data['vouchers'] = []; + $data['vouchers'] = array(); if (!empty($this->session->data['vouchers'])) { foreach ($this->session->data['vouchers'] as $key => $voucher) { - $data['vouchers'][] = [ + $data['vouchers'][] = array( 'key' => $key, 'description' => $voucher['description'], 'amount' => $this->currency->format($voucher['amount'], $this->session->data['currency']), 'remove' => $this->url->link('checkout/cart', 'remove=' . $key, true) - ]; + ); } } @@ -2095,11 +2095,11 @@ public function confirmOrder() { if ($this->cart->hasShipping()) { $data['has_shipping'] = true; - $data['shipping_address'] = isset($this->session->data['shipping_address']) ? $this->session->data['shipping_address'] : []; + $data['shipping_address'] = isset($this->session->data['shipping_address']) ? $this->session->data['shipping_address'] : array(); if (!empty($data['shipping_address'])) { // Shipping Methods - $quote_data = []; + $quote_data = array(); $results = $this->model_setting_extension->getExtensions('shipping'); @@ -2111,18 +2111,18 @@ public function confirmOrder() { $quote = $this->{'model_extension_shipping_' . $result['code']}->getQuote($data['shipping_address']); if ($quote) { - $quote_data[$result['code']] = [ + $quote_data[$result['code']] = array( 'title' => $quote['title'], 'quote' => $quote['quote'], 'sort_order' => $quote['sort_order'], 'error' => $quote['error'] - ]; + ); } } } if (!empty($quote_data)) { - $sort_order = []; + $sort_order = array(); foreach ($quote_data as $key => $value) { $sort_order[$key] = $value['sort_order']; @@ -2159,24 +2159,24 @@ public function confirmOrder() { $data['has_shipping'] = false; } - $data['guest'] = isset($this->session->data['guest']) ? $this->session->data['guest'] : []; - $data['payment_address'] = isset($this->session->data['payment_address']) ? $this->session->data['payment_address'] : []; + $data['guest'] = isset($this->session->data['guest']) ? $this->session->data['guest'] : array(); + $data['payment_address'] = isset($this->session->data['payment_address']) ? $this->session->data['payment_address'] : array(); // Totals - $totals = []; + $totals = array(); $taxes = $this->cart->getTaxes(); $total = 0; // Because __call can not keep var references so we put them into an array. - $total_data = [ + $total_data = array( 'totals' => &$totals, 'taxes' => &$taxes, 'total' => &$total - ]; + ); // Display prices if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { - $sort_order = []; + $sort_order = array(); $results = $this->model_setting_extension->getExtensions('total'); @@ -2195,7 +2195,7 @@ public function confirmOrder() { } } - $sort_order = []; + $sort_order = array(); foreach ($totals as $key => $value) { $sort_order[$key] = $value['sort_order']; @@ -2207,7 +2207,7 @@ public function confirmOrder() { /** * Payment methods */ - $method_data = []; + $method_data = array(); $results = $this->model_setting_extension->getExtensions('payment'); @@ -2223,7 +2223,7 @@ public function confirmOrder() { } } - $sort_order = []; + $sort_order = array(); foreach ($method_data as $key => $value) { $sort_order[$key] = $value['sort_order']; @@ -2254,20 +2254,20 @@ public function confirmOrder() { $data['custom_fields'] = $this->model_account_custom_field->getCustomFields(); // Totals - $totals = []; + $totals = array(); $taxes = $this->cart->getTaxes(); $total = 0; // Because __call can not keep var references so we put them into an array. - $total_data = [ + $total_data = array( 'totals' => &$totals, 'taxes' => &$taxes, 'total' => &$total - ]; + ); // Display prices if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { - $sort_order = []; + $sort_order = array(); $results = $this->model_setting_extension->getExtensions('total'); @@ -2286,7 +2286,7 @@ public function confirmOrder() { } } - $sort_order = []; + $sort_order = array(); foreach ($totals as $key => $value) { $sort_order[$key] = $value['sort_order']; @@ -2295,13 +2295,13 @@ public function confirmOrder() { array_multisort($sort_order, SORT_ASC, $totals); } - $data['totals'] = []; + $data['totals'] = array(); foreach ($totals as $total) { - $data['totals'][] = [ + $data['totals'][] = array( 'title' => $total['title'], 'text' => $this->currency->format($total['value'], $this->session->data['currency']), - ]; + ); } $data['action_confirm'] = $this->url->link('extension/payment/paypal/completeOrder', '', true); @@ -2376,22 +2376,22 @@ public function completeOrder() { } if (isset($this->session->data['paypal_order_id'])) { - $order_data = []; + $order_data = array(); - $totals = []; + $totals = array(); $taxes = $this->cart->getTaxes(); $total = 0; // Because __call can not keep var references so we put them into an array. - $total_data = [ + $total_data = array( 'totals' => &$totals, 'taxes' => &$taxes, 'total' => &$total - ]; + ); $this->load->model('setting/extension'); - $sort_order = []; + $sort_order = array(); $results = $this->model_setting_extension->getExtensions('total'); @@ -2410,7 +2410,7 @@ public function completeOrder() { } } - $sort_order = []; + $sort_order = array(); foreach ($totals as $key => $value) { $sort_order[$key] = $value['sort_order']; @@ -2459,7 +2459,7 @@ public function completeOrder() { $order_data['payment_country'] = $this->session->data['payment_address']['country']; $order_data['payment_country_id'] = $this->session->data['payment_address']['country_id']; $order_data['payment_address_format'] = $this->session->data['payment_address']['address_format']; - $order_data['payment_custom_field'] = (isset($this->session->data['payment_address']['custom_field']) ? $this->session->data['payment_address']['custom_field'] : []); + $order_data['payment_custom_field'] = (isset($this->session->data['payment_address']['custom_field']) ? $this->session->data['payment_address']['custom_field'] : array()); if (isset($this->session->data['payment_method']['title'])) { $order_data['payment_method'] = $this->session->data['payment_method']['title']; @@ -2486,7 +2486,7 @@ public function completeOrder() { $order_data['shipping_country'] = $this->session->data['shipping_address']['country']; $order_data['shipping_country_id'] = $this->session->data['shipping_address']['country_id']; $order_data['shipping_address_format'] = $this->session->data['shipping_address']['address_format']; - $order_data['shipping_custom_field'] = (isset($this->session->data['shipping_address']['custom_field']) ? $this->session->data['shipping_address']['custom_field'] : []); + $order_data['shipping_custom_field'] = (isset($this->session->data['shipping_address']['custom_field']) ? $this->session->data['shipping_address']['custom_field'] : array()); if (isset($this->session->data['shipping_method']['title'])) { $order_data['shipping_method'] = $this->session->data['shipping_method']['title']; @@ -2512,18 +2512,18 @@ public function completeOrder() { $order_data['shipping_country'] = ''; $order_data['shipping_country_id'] = 0; $order_data['shipping_address_format'] = ''; - $order_data['shipping_custom_field'] = []; + $order_data['shipping_custom_field'] = array(); $order_data['shipping_method'] = ''; $order_data['shipping_code'] = ''; } - $order_data['products'] = []; + $order_data['products'] = array(); foreach ($this->cart->getProducts() as $product) { - $option_data = []; + $option_data = array(); foreach ($product['option'] as $option) { - $option_data[] = [ + $option_data[] = array( 'product_option_id' => $option['product_option_id'], 'product_option_value_id' => $option['product_option_value_id'], 'option_id' => $option['option_id'], @@ -2531,10 +2531,10 @@ public function completeOrder() { 'name' => $option['name'], 'value' => $option['value'], 'type' => $option['type'] - ]; + ); } - $order_data['products'][] = [ + $order_data['products'][] = array( 'product_id' => $product['product_id'], 'name' => $product['name'], 'model' => $product['model'], @@ -2546,15 +2546,15 @@ public function completeOrder() { 'total' => $product['total'], 'tax' => $this->tax->getTax($product['price'], $product['tax_class_id']), 'reward' => $product['reward'] - ]; + ); } // Gift Voucher - $order_data['vouchers'] = []; + $order_data['vouchers'] = array(); if (!empty($this->session->data['vouchers'])) { foreach ($this->session->data['vouchers'] as $voucher) { - $order_data['vouchers'][] = [ + $order_data['vouchers'][] = array( 'description' => $voucher['description'], 'code' => token(10), 'to_name' => $voucher['to_name'], @@ -2564,7 +2564,7 @@ public function completeOrder() { 'voucher_theme_id' => $voucher['voucher_theme_id'], 'message' => $voucher['message'], 'amount' => $voucher['amount'] - ]; + ); } } @@ -2665,19 +2665,19 @@ public function completeOrder() { require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $partner_id, 'client_id' => $client_id, 'secret' => $secret, 'environment' => $environment, 'partner_attribution_id' => $partner_attribution_id - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); @@ -2686,7 +2686,7 @@ public function completeOrder() { $paypal_order_info = $paypal->getOrder($paypal_order_id); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -2711,29 +2711,29 @@ public function completeOrder() { $this->error['warning'] .= ' ' . sprintf($this->language->get('error_payment'), $this->url->link('information/contact', '', true)); } - $shipping_info_name = []; - $shipping_info_address = []; + $shipping_info_name = array(); + $shipping_info_address = array(); if ($paypal_order_info && !$this->error) { - $shipping_info_name = (isset($paypal_order_info['purchase_units'][0]['shipping']['name']) ? $paypal_order_info['purchase_units'][0]['shipping']['name'] : []); - $shipping_info_address = (isset($paypal_order_info['purchase_units'][0]['shipping']['address']) ? $paypal_order_info['purchase_units'][0]['shipping']['address'] : []); + $shipping_info_name = (isset($paypal_order_info['purchase_units'][0]['shipping']['name']) ? $paypal_order_info['purchase_units'][0]['shipping']['name'] : array()); + $shipping_info_address = (isset($paypal_order_info['purchase_units'][0]['shipping']['address']) ? $paypal_order_info['purchase_units'][0]['shipping']['address'] : array()); } - $paypal_order_info = []; + $paypal_order_info = array(); - $paypal_order_info[] = [ + $paypal_order_info[] = array( 'op' => 'add', 'path' => '/purchase_units/@reference_id==\'default\'/description', 'value' => 'Your order ' . $this->session->data['order_id'] - ]; + ); - $paypal_order_info[] = [ + $paypal_order_info[] = array( 'op' => 'add', 'path' => '/purchase_units/@reference_id==\'default\'/invoice_id', 'value' => $this->session->data['order_id'] . '_' . date('Ymd_His') - ]; + ); - $shipping_info = []; + $shipping_info = array(); if ($this->cart->hasShipping()) { $shipping_info['name']['full_name'] = (isset($this->session->data['shipping_address']['firstname']) ? $this->session->data['shipping_address']['firstname'] : ''); @@ -2755,31 +2755,31 @@ public function completeOrder() { } if ($shipping_info_name) { - $paypal_order_info[] = [ + $paypal_order_info[] = array( 'op' => 'replace', 'path' => '/purchase_units/@reference_id==\'default\'/shipping/name', 'value' => $shipping_info['name'] - ]; + ); } else { - $paypal_order_info[] = [ + $paypal_order_info[] = array( 'op' => 'add', 'path' => '/purchase_units/@reference_id==\'default\'/shipping/name', 'value' => $shipping_info['name'] - ]; + ); } if ($shipping_info_address) { - $paypal_order_info[] = [ + $paypal_order_info[] = array( 'op' => 'replace', 'path' => '/purchase_units/@reference_id==\'default\'/shipping/address', 'value' => $shipping_info['address'] - ]; + ); } else { - $paypal_order_info[] = [ + $paypal_order_info[] = array( 'op' => 'add', 'path' => '/purchase_units/@reference_id==\'default\'/shipping/address', 'value' => $shipping_info['address'] - ]; + ); } } @@ -2828,46 +2828,46 @@ public function completeOrder() { $handling_total = -$rebate; } - $amount_info = []; + $amount_info = array(); $amount_info['currency_code'] = $currency_code; $amount_info['value'] = $order_total; - $amount_info['breakdown']['item_total'] = [ + $amount_info['breakdown']['item_total'] = array( 'currency_code' => $currency_code, 'value' => $item_total - ]; + ); - $amount_info['breakdown']['tax_total'] = [ + $amount_info['breakdown']['tax_total'] = array( 'currency_code' => $currency_code, 'value' => $tax_total - ]; + ); - $amount_info['breakdown']['shipping'] = [ + $amount_info['breakdown']['shipping'] = array( 'currency_code' => $currency_code, 'value' => $shipping_total - ]; + ); - $amount_info['breakdown']['handling'] = [ + $amount_info['breakdown']['handling'] = array( 'currency_code' => $currency_code, 'value' => $handling_total - ]; + ); - $amount_info['breakdown']['discount'] = [ + $amount_info['breakdown']['discount'] = array( 'currency_code' => $currency_code, 'value' => $discount_total - ]; + ); - $paypal_order_info[] = [ + $paypal_order_info[] = array( 'op' => 'replace', 'path' => '/purchase_units/@reference_id==\'default\'/amount', 'value' => $amount_info - ]; + ); $result = $paypal->updateOrder($paypal_order_id, $paypal_order_info); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -2900,7 +2900,7 @@ public function completeOrder() { } if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -2994,7 +2994,7 @@ public function completeOrder() { if (($authorization_status == 'CREATED') || ($authorization_status == 'DENIED') || ($authorization_status == 'PENDING')) { if ($payment_method == 'paypal') { - $paypal_customer_token = []; + $paypal_customer_token = array(); if ($setting['general']['vault_status'] && $this->customer->isLogged()) { $paypal_customer_token = $this->model_extension_payment_paypal->getPayPalCustomerMainToken($this->customer->getId(), $payment_method); @@ -3008,7 +3008,7 @@ public function completeOrder() { $this->model_extension_payment_paypal->deletePayPalOrder($this->session->data['order_id']); - $paypal_order_data = [ + $paypal_order_data = array( 'order_id' => $this->session->data['order_id'], 'paypal_order_id' => $paypal_order_id, 'transaction_id' => $authorization_id, @@ -3023,7 +3023,7 @@ public function completeOrder() { 'total' => $order_data['total'], 'currency_code' => $order_data['currency_code'], 'environment' => $environment - ]; + ); $this->model_extension_payment_paypal->addPayPalOrder($paypal_order_data); @@ -3033,7 +3033,7 @@ public function completeOrder() { $paypal_customer_token_info = $this->model_extension_payment_paypal->getPayPalCustomerToken($customer_id, $payment_method, $vault_id); if (!$paypal_customer_token_info) { - $paypal_customer_token_data = [ + $paypal_customer_token_data = array( 'customer_id' => $customer_id, 'payment_method' => $payment_method, 'vault_id' => $vault_id, @@ -3042,7 +3042,7 @@ public function completeOrder() { 'card_nice_type' => $card_nice_type, 'card_last_digits' => $card_last_digits, 'card_expiry' => $card_expiry, - ]; + ); $this->model_extension_payment_paypal->addPayPalCustomerToken($paypal_customer_token_data); } @@ -3123,7 +3123,7 @@ public function completeOrder() { if (($capture_status == 'COMPLETED') || ($capture_status == 'DECLINED') || ($capture_status == 'PENDING')) { if ($payment_method == 'paypal') { - $paypal_customer_token = []; + $paypal_customer_token = array(); if ($setting['general']['vault_status'] && $this->customer->isLogged()) { $paypal_customer_token = $this->model_extension_payment_paypal->getPayPalCustomerMainToken($this->customer->getId(), $payment_method); @@ -3137,7 +3137,7 @@ public function completeOrder() { $this->model_extension_payment_paypal->deletePayPalOrder($this->session->data['order_id']); - $paypal_order_data = [ + $paypal_order_data = array( 'order_id' => $this->session->data['order_id'], 'paypal_order_id' => $paypal_order_id, 'transaction_id' => $capture_id, @@ -3152,7 +3152,7 @@ public function completeOrder() { 'total' => $order_data['total'], 'currency_code' => $order_data['currency_code'], 'environment' => $environment - ]; + ); $this->model_extension_payment_paypal->addPayPalOrder($paypal_order_data); @@ -3162,7 +3162,7 @@ public function completeOrder() { $paypal_customer_token_info = $this->model_extension_payment_paypal->getPayPalCustomerToken($customer_id, $payment_method, $vault_id); if (!$paypal_customer_token_info) { - $paypal_customer_token_data = [ + $paypal_customer_token_data = array( 'customer_id' => $customer_id, 'payment_method' => $payment_method, 'vault_id' => $vault_id, @@ -3171,7 +3171,7 @@ public function completeOrder() { 'card_nice_type' => $card_nice_type, 'card_last_digits' => $card_last_digits, 'card_expiry' => $card_expiry, - ]; + ); $this->model_extension_payment_paypal->addPayPalCustomerToken($paypal_customer_token_data); } @@ -3211,8 +3211,8 @@ public function completeOrder() { public function paymentAddress() { $this->load->language('extension/payment/paypal'); - $data['guest'] = isset($this->session->data['guest']) ? $this->session->data['guest'] : []; - $data['payment_address'] = isset($this->session->data['payment_address']) ? $this->session->data['payment_address'] : []; + $data['guest'] = isset($this->session->data['guest']) ? $this->session->data['guest'] : array(); + $data['payment_address'] = isset($this->session->data['payment_address']) ? $this->session->data['payment_address'] : array(); $this->load->model('localisation/country'); @@ -3228,7 +3228,7 @@ public function paymentAddress() { public function shippingAddress() { $this->load->language('extension/payment/paypal'); - $data['shipping_address'] = isset($this->session->data['shipping_address']) ? $this->session->data['shipping_address'] : []; + $data['shipping_address'] = isset($this->session->data['shipping_address']) ? $this->session->data['shipping_address'] : array(); $this->load->model('localisation/country'); @@ -3261,7 +3261,7 @@ public function confirmPaymentAddress() { if (isset($this->request->post['custom_field']['account'])) { $this->session->data['guest']['custom_field'] = $this->request->post['custom_field']['account']; } else { - $this->session->data['guest']['custom_field'] = []; + $this->session->data['guest']['custom_field'] = array(); } $this->session->data['payment_address']['firstname'] = $this->request->post['firstname']; @@ -3293,7 +3293,7 @@ public function confirmPaymentAddress() { if (isset($this->request->post['custom_field']['address'])) { $this->session->data['payment_address']['custom_field'] = $this->request->post['custom_field']['address']; } else { - $this->session->data['payment_address']['custom_field'] = []; + $this->session->data['payment_address']['custom_field'] = array(); } $this->load->model('localisation/zone'); @@ -3362,7 +3362,7 @@ public function confirmShippingAddress() { if (isset($this->request->post['custom_field'])) { $this->session->data['shipping_address']['custom_field'] = $this->request->post['custom_field']['address']; } else { - $this->session->data['shipping_address']['custom_field'] = []; + $this->session->data['shipping_address']['custom_field'] = array(); } $data['url'] = $this->url->link('extension/payment/paypal/confirmOrder', '', true); @@ -3403,26 +3403,26 @@ public function deleteCustomerToken() { require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $partner_id, 'client_id' => $client_id, 'secret' => $secret, 'environment' => $environment, 'partner_attribution_id' => $partner_attribution_id - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $result = $paypal->setAccessToken($token_info); $result = $paypal->deletePaymentToken($vault_id); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -3532,26 +3532,26 @@ public function callback() { require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $partner_id, 'client_id' => $client_id, 'secret' => $secret, 'environment' => $environment, 'partner_attribution_id' => $partner_attribution_id - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); $paypal_order_info = $paypal->getOrder($paypal_order_id); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -3626,7 +3626,7 @@ public function callback() { } if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -3709,7 +3709,7 @@ public function callback() { if (($authorization_status == 'CREATED') || ($authorization_status == 'DENIED') || ($authorization_status == 'PENDING')) { $this->model_extension_payment_paypal->deletePayPalOrder($this->session->data['order_id']); - $paypal_order_data = [ + $paypal_order_data = array( 'order_id' => $this->session->data['order_id'], 'paypal_order_id' => $paypal_order_id, 'transaction_id' => $authorization_id, @@ -3724,7 +3724,7 @@ public function callback() { 'total' => $order_info['total'], 'currency_code' => $order_info['currency_code'], 'environment' => $environment - ]; + ); $this->model_extension_payment_paypal->addPayPalOrder($paypal_order_data); @@ -3734,7 +3734,7 @@ public function callback() { $paypal_customer_token_info = $this->model_extension_payment_paypal->getPayPalCustomerToken($customer_id, $payment_method, $vault_id); if (!$paypal_customer_token_info) { - $paypal_customer_token_data = [ + $paypal_customer_token_data = array( 'customer_id' => $customer_id, 'payment_method' => $payment_method, 'vault_id' => $vault_id, @@ -3743,7 +3743,7 @@ public function callback() { 'card_nice_type' => $card_nice_type, 'card_last_digits' => $card_last_digits, 'card_expiry' => $card_expiry - ]; + ); $this->model_extension_payment_paypal->addPayPalCustomerToken($paypal_customer_token_data); } @@ -3810,7 +3810,7 @@ public function callback() { if (($capture_status == 'COMPLETED') || ($capture_status == 'DECLINED') || ($capture_status == 'PENDING')) { $this->model_extension_payment_paypal->deletePayPalOrder($this->session->data['order_id']); - $paypal_order_data = [ + $paypal_order_data = array( 'order_id' => $this->session->data['order_id'], 'paypal_order_id' => $paypal_order_id, 'transaction_id' => $capture_id, @@ -3825,7 +3825,7 @@ public function callback() { 'total' => $order_info['total'], 'currency_code' => $order_info['currency_code'], 'environment' => $environment - ]; + ); $this->model_extension_payment_paypal->addPayPalOrder($paypal_order_data); @@ -3835,7 +3835,7 @@ public function callback() { $paypal_customer_token_info = $this->model_extension_payment_paypal->getPayPalCustomerToken($customer_id, $payment_method, $vault_id); if (!$paypal_customer_token_info) { - $paypal_customer_token_data = [ + $paypal_customer_token_data = array( 'customer_id' => $customer_id, 'payment_method' => $payment_method, 'vault_id' => $vault_id, @@ -3844,7 +3844,7 @@ public function callback() { 'card_nice_type' => $card_nice_type, 'card_last_digits' => $card_last_digits, 'card_expiry' => $card_expiry - ]; + ); $this->model_extension_payment_paypal->addPayPalCustomerToken($paypal_customer_token_data); } @@ -3872,22 +3872,22 @@ public function callback() { $this->document->setTitle($this->language->get('text_failure_page_title')); - $data['breadcrumbs'] = []; + $data['breadcrumbs'] = array(); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home', '', true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_cart'), 'href' => $this->url->link('checkout/cart', '', true) - ]; + ); - $data['breadcrumbs'][] = [ + $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_paypal'), 'href' => $this->url->link('extension/payment/paypal/callback', '', true) - ]; + ); $data['text_title'] = $this->language->get('text_failure_page_title'); $data['text_message'] = sprintf($this->language->get('text_failure_page_message'), $this->url->link('information/contact', '', true)); @@ -3943,19 +3943,19 @@ public function webhook() { require_once DIR_SYSTEM .'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $partner_id, 'client_id' => $client_id, 'secret' => $secret, 'environment' => $environment, 'partner_attribution_id' => $partner_attribution_id - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); @@ -3964,12 +3964,12 @@ public function webhook() { while ($webhook_repeat) { $webhook_event = $paypal->getWebhookEvent($webhook_event_id); - $errors = []; + $errors = array(); $webhook_repeat = 0; if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -4054,7 +4054,7 @@ public function webhook() { if (isset($webhook_event['resource']['id']) && $transaction_status) { $transaction_id = $webhook_event['resource']['id']; - $paypal_order_data = []; + $paypal_order_data = array(); $paypal_order_data['order_id'] = $order_id; $paypal_order_data['transaction_status'] = $transaction_status; @@ -4083,13 +4083,13 @@ public function webhook() { $card_last_digits = (isset($webhook_event['resource']['payment_source']['card']['last_digits']) ? $webhook_event['resource']['payment_source']['card']['last_digits'] : ''); $card_expiry = (isset($webhook_event['resource']['payment_source']['card']['expiry']) ? $webhook_event['resource']['payment_source']['card']['expiry'] : ''); - $paypal_order_data = [ + $paypal_order_data = array( 'order_id' => $order_id, 'vault_id' => $vault_id, 'vault_customer_id' => $vault_customer_id, 'card_last_digits' => $card_last_digits, 'card_expiry' => $card_expiry - ]; + ); $this->model_extension_payment_paypal->editPayPalOrder($paypal_order_data); @@ -4101,7 +4101,7 @@ public function webhook() { $paypal_customer_token_info = $this->model_extension_payment_paypal->getPayPalCustomerToken($customer_id, $payment_method, $vault_id); if (!$paypal_customer_token_info) { - $paypal_customer_token_data = [ + $paypal_customer_token_data = array( 'customer_id' => $customer_id, 'payment_method' => $payment_method, 'vault_id' => $vault_id, @@ -4110,7 +4110,7 @@ public function webhook() { 'card_nice_type' => $card_nice_type, 'card_last_digits' => $card_last_digits, 'card_expiry' => $card_expiry - ]; + ); $this->model_extension_payment_paypal->addPayPalCustomerToken($paypal_customer_token_data); } @@ -4175,7 +4175,7 @@ public function header_before($route, &$data) { $route = 'common/home'; } - $params = []; + $params = array(); if (($route == 'common/home') && $setting['message']['home']['status']) { $params['page_code'] = 'home'; @@ -4242,31 +4242,31 @@ public function extension_get_extensions_after($route, $data, &$output) { if (!empty($setting['paylater_country'][$setting['general']['country_code']]) && ($currency_code == $setting['general']['currency_code']) && ($setting['button']['checkout']['funding']['paylater'] != 2)) { $this->config->set('payment_paypal_paylater_status', 1); - $output[] = [ + $output[] = array( 'extension_id' => 0, 'type' => 'payment', 'code' => 'paypal_paylater' - ]; + ); } if ($setting['googlepay_button']['checkout']['status']) { $this->config->set('payment_paypal_googlepay_status', 1); - $output[] = [ + $output[] = array( 'extension_id' => 0, 'type' => 'payment', 'code' => 'paypal_googlepay' - ]; + ); } if ($setting['applepay_button']['checkout']['status'] && $this->isApple()) { $this->config->set('payment_paypal_applepay_status', 1); - $output[] = [ + $output[] = array( 'extension_id' => 0, 'type' => 'payment', 'code' => 'paypal_applepay' - ]; + ); } } } @@ -4348,7 +4348,7 @@ private function validatePaymentAddress() { } // Customer Group - if (isset($this->request->post['customer_group_id']) && is_array($this->config->get('config_customer_group_display')) && in_array($this->request->post['customer_group_id'], (array)$this->config->get('config_customer_group_display'))) { + if (isset($this->request->post['customer_group_id']) && is_array($this->config->get('config_customer_group_display')) && in_array($this->request->post['customer_group_id'], $this->config->get('config_customer_group_display'))) { $customer_group_id = $this->request->post['customer_group_id']; } else { $customer_group_id = $this->config->get('config_customer_group_id'); @@ -4362,7 +4362,7 @@ private function validatePaymentAddress() { foreach ($custom_fields as $custom_field) { if ($custom_field['required'] && empty($this->request->post['custom_field'][$custom_field['location']][$custom_field['custom_field_id']])) { $this->error['custom_field' . $custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']); - } elseif (($custom_field['type'] == 'text') && !empty($custom_field['validation']) && !filter_var($this->request->post['custom_field'][$custom_field['location']][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $custom_field['validation']]])) { + } elseif (($custom_field['type'] == 'text') && !empty($custom_field['validation']) && !filter_var($this->request->post['custom_field'][$custom_field['location']][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) { $this->error['custom_field' . $custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']); } } @@ -4404,7 +4404,7 @@ private function validateShippingAddress() { } // Customer Group - if (isset($this->request->post['customer_group_id']) && is_array($this->config->get('config_customer_group_display')) && in_array($this->request->post['customer_group_id'], (array)$this->config->get('config_customer_group_display'))) { + if (isset($this->request->post['customer_group_id']) && is_array($this->config->get('config_customer_group_display')) && in_array($this->request->post['customer_group_id'], $this->config->get('config_customer_group_display'))) { $customer_group_id = $this->request->post['customer_group_id']; } else { $customer_group_id = $this->config->get('config_customer_group_id'); @@ -4419,7 +4419,7 @@ private function validateShippingAddress() { if ($custom_field['location'] == 'address') { if ($custom_field['required'] && empty($this->request->post['custom_field'][$custom_field['location']][$custom_field['custom_field_id']])) { $this->error['custom_field' . $custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']); - } elseif (($custom_field['type'] == 'text') && !empty($custom_field['validation']) && !filter_var($this->request->post['custom_field'][$custom_field['location']][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $custom_field['validation']]])) { + } elseif (($custom_field['type'] == 'text') && !empty($custom_field['validation']) && !filter_var($this->request->post['custom_field'][$custom_field['location']][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) { $this->error['custom_field' . $custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']); } } @@ -4494,7 +4494,7 @@ private function isApple() { if (!empty($this->request->server['HTTP_USER_AGENT'])) { $user_agent = strtolower($this->request->server['HTTP_USER_AGENT']); - $apple_agents = ['ipod', 'iphone', 'ipad', 'apple']; + $apple_agents = array('ipod', 'iphone', 'ipad', 'apple'); foreach ($apple_agents as $apple_agent){ if (stripos($user_agent, $apple_agent)) { @@ -4507,12 +4507,12 @@ private function isApple() { } private function unserialize($str) { - $str_data = []; + $data = array(); $str = str_replace('&', '&', $str); - parse_str($str, $str_data); + parse_str($str, $data); - return $str_data; + return $data; } } \ No newline at end of file diff --git a/upload/catalog/controller/extension/payment/paypal_applepay.php b/upload/catalog/controller/extension/payment/paypal_applepay.php index ecfb4ac2e..fb370ec64 100644 --- a/upload/catalog/controller/extension/payment/paypal_applepay.php +++ b/upload/catalog/controller/extension/payment/paypal_applepay.php @@ -1,6 +1,6 @@ load->model('extension/payment/paypal'); @@ -32,26 +32,26 @@ public function index() { require_once DIR_SYSTEM .'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $data['partner_id'], 'client_id' => $data['client_id'], 'secret' => $data['secret'], 'environment' => $data['environment'], 'partner_attribution_id' => $data['partner_attribution_id'] - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); $data['client_token'] = $paypal->getClientToken(); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -108,26 +108,26 @@ public function modal() { require_once DIR_SYSTEM .'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $data['partner_id'], 'client_id' => $data['client_id'], 'secret' => $data['secret'], 'environment' => $data['environment'], 'partner_attribution_id' => $data['partner_attribution_id'] - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); $data['client_token'] = $paypal->getClientToken(); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); diff --git a/upload/catalog/controller/extension/payment/paypal_googlepay.php b/upload/catalog/controller/extension/payment/paypal_googlepay.php index 29eef611c..6aef9a4d4 100644 --- a/upload/catalog/controller/extension/payment/paypal_googlepay.php +++ b/upload/catalog/controller/extension/payment/paypal_googlepay.php @@ -1,6 +1,6 @@ load->model('extension/payment/paypal'); @@ -32,26 +32,26 @@ public function index() { require_once DIR_SYSTEM .'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $data['partner_id'], 'client_id' => $data['client_id'], 'secret' => $data['secret'], 'environment' => $data['environment'], 'partner_attribution_id' => $data['partner_attribution_id'] - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); $data['client_token'] = $paypal->getClientToken(); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -108,26 +108,26 @@ public function modal() { require_once DIR_SYSTEM .'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $data['partner_id'], 'client_id' => $data['client_id'], 'secret' => $data['secret'], 'environment' => $data['environment'], 'partner_attribution_id' => $data['partner_attribution_id'] - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); $data['client_token'] = $paypal->getClientToken(); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); diff --git a/upload/catalog/controller/extension/payment/paypal_paylater.php b/upload/catalog/controller/extension/payment/paypal_paylater.php index 6157da322..c53a9e1e3 100644 --- a/upload/catalog/controller/extension/payment/paypal_paylater.php +++ b/upload/catalog/controller/extension/payment/paypal_paylater.php @@ -1,6 +1,6 @@ load->model('extension/payment/paypal'); @@ -32,26 +32,26 @@ public function index() { require_once DIR_SYSTEM .'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $data['partner_id'], 'client_id' => $data['client_id'], 'secret' => $data['secret'], 'environment' => $data['environment'], 'partner_attribution_id' => $data['partner_attribution_id'] - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); $data['client_token'] = $paypal->getClientToken(); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); @@ -108,26 +108,26 @@ public function modal() { require_once DIR_SYSTEM .'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $data['partner_id'], 'client_id' => $data['client_id'], 'secret' => $data['secret'], 'environment' => $data['environment'], 'partner_attribution_id' => $data['partner_attribution_id'] - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); $data['client_token'] = $paypal->getClientToken(); if ($paypal->hasErrors()) { - $error_messages = []; + $error_messages = array(); $errors = $paypal->getErrors(); diff --git a/upload/catalog/controller/extension/recurring/paypal.php b/upload/catalog/controller/extension/recurring/paypal.php index 664dfab54..7fded88a1 100644 --- a/upload/catalog/controller/extension/recurring/paypal.php +++ b/upload/catalog/controller/extension/recurring/paypal.php @@ -1,6 +1,6 @@ getAgreeStatus(); @@ -22,19 +22,19 @@ public function getMethod($address, $total) { } if ($status) { - $method_data = [ + $method_data = array( 'code' => 'paypal', 'title' => $this->language->get('text_paypal_title'), 'terms' => '', 'sort_order' => $this->config->get('payment_paypal_sort_order') - ]; + ); } } return $method_data; } - public function hasProductInCart($product_id, $option = [], $recurring_id = 0) { + public function hasProductInCart($product_id, $option = array(), $recurring_id = 0) { $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "cart WHERE api_id = '" . (isset($this->session->data['api_id']) ? (int)$this->session->data['api_id'] : 0) . "' AND customer_id = '" . (int)$this->customer->getId() . "' AND session_id = '" . $this->db->escape($this->session->getId()) . "' AND product_id = '" . (int)$product_id . "' AND recurring_id = '" . (int)$recurring_id . "' AND `option` = '" . $this->db->escape(json_encode($option)) . "'"); return $query->row['total']; @@ -55,7 +55,7 @@ public function getZoneByCode($country_id, $code) { public function addPayPalCustomerToken($data) { $sql = "INSERT INTO `" . DB_PREFIX . "paypal_checkout_integration_customer_token` SET"; - $implode = []; + $implode = array(); if (!empty($data['customer_id'])) { $implode[] = "`customer_id` = '" . (int)$data['customer_id'] . "'"; @@ -111,7 +111,7 @@ public function getPayPalCustomerMainToken($customer_id, $payment_method) { if ($query->num_rows) { return $query->row; } else { - return []; + return array(); } } @@ -121,7 +121,7 @@ public function getPayPalCustomerToken($customer_id, $payment_method, $vault_id) if ($query->num_rows) { return $query->row; } else { - return []; + return array(); } } @@ -135,14 +135,14 @@ public function getPayPalCustomerTokens($customer_id, $payment_method = '') { if ($query->num_rows) { return $query->rows; } else { - return []; + return array(); } } public function addPayPalOrder($data) { $sql = "INSERT INTO `" . DB_PREFIX . "paypal_checkout_integration_order` SET"; - $implode = []; + $implode = array(); if (!empty($data['order_id'])) { $implode[] = "`order_id` = '" . (int)$data['order_id'] . "'"; @@ -218,7 +218,7 @@ public function addPayPalOrder($data) { public function editPayPalOrder($data) { $sql = "UPDATE `" . DB_PREFIX . "paypal_checkout_integration_order` SET"; - $implode = []; + $implode = array(); if (!empty($data['paypal_order_id'])) { $implode[] = "`paypal_order_id` = '" . $this->db->escape($data['paypal_order_id']) . "'"; @@ -354,7 +354,7 @@ public function deleteOrderRecurring($order_id) { public function getOrderRecurrings() { $query = $this->db->query("SELECT `or`.`order_recurring_id` FROM `" . DB_PREFIX . "order_recurring` `or` JOIN `" . DB_PREFIX . "order` `o` USING(`order_id`) WHERE `o`.`payment_code` = 'paypal' AND `or`.`status` = '1'"); - $order_recurring_data = []; + $order_recurring_data = array(); foreach ($query->rows as $order_recurring) { $order_recurring_data[] = $this->getOrderRecurring($order_recurring['order_recurring_id']); @@ -459,35 +459,35 @@ public function recurringPayment($product_data, $order_data, $paypal_order_data) } if ($transaction_id && $transaction_status && $currency_code && $amount) { - $paypal_order_recurring_data = [ + $paypal_order_recurring_data = array( 'order_recurring_id' => $order_recurring_id, 'order_id' => $order_data['order_id'], 'trial_end' => date_format($trial_end, 'Y-m-d H:i:s'), 'subscription_end' => date_format($subscription_end, 'Y-m-d H:i:s'), 'currency_code' => $currency_code, 'amount' => $amount - ]; + ); $this->addPayPalOrderRecurring($paypal_order_recurring_data); if (($transaction_status == 'CREATED') || ($transaction_status == 'COMPLETED') || ($transaction_status == 'PENDING')) { - $order_recurring_transaction_data = [ + $order_recurring_transaction_data = array( 'order_recurring_id' => $order_recurring_id, 'reference' => $transaction_id, 'type' => '1', 'amount' => $amount - ]; + ); $this->addOrderRecurringTransaction($order_recurring_transaction_data); $this->editPayPalOrderRecurringNextPayment($order_recurring_id, date_format($next_payment, 'Y-m-d H:i:s')); } else { - $order_recurring_transaction_data = [ + $order_recurring_transaction_data = array( 'order_recurring_id' => $order_recurring_id, 'reference' => $transaction_id, 'type' => '4', 'amount' => $amount - ]; + ); $this->addOrderRecurringTransaction($order_recurring_transaction_data); } @@ -564,23 +564,23 @@ public function cronPayment() { if ($transaction_id && $transaction_status && $currency_code && $amount) { if (($transaction_status == 'CREATED') || ($transaction_status == 'COMPLETED') || ($transaction_status == 'PENDING')) { - $order_recurring_transaction_data = [ + $order_recurring_transaction_data = array( 'order_recurring_id' => $order_recurring['order_recurring_id'], 'reference' => $transaction_id, 'type' => '1', 'amount' => $amount - ]; + ); $this->addOrderRecurringTransaction($order_recurring_transaction_data); $this->editPayPalOrderRecurringNextPayment($order_recurring['order_recurring_id'], date_format($next_payment, 'Y-m-d H:i:s')); } else { - $order_recurring_transaction_data = [ + $order_recurring_transaction_data = array( 'order_recurring_id' => $order_recurring['order_recurring_id'], 'reference' => $transaction_id, 'type' => '4', 'amount' => $amount - ]; + ); $this->addOrderRecurringTransaction($order_recurring_transaction_data); } @@ -615,53 +615,53 @@ public function createPayment($order_data, $paypal_order_data, $price, $order_re require_once DIR_SYSTEM . 'library/paypal/paypal.php'; - $paypal_info = [ + $paypal_info = array( 'partner_id' => $partner_id, 'client_id' => $client_id, 'secret' => $secret, 'environment' => $environment, 'partner_attribution_id' => $partner_attribution_id - ]; + ); $paypal = new PayPal($paypal_info); - $token_info = [ + $token_info = array( 'grant_type' => 'client_credentials' - ]; + ); $paypal->setAccessToken($token_info); - $item_info = []; + $item_info = array(); $item_total = 0; $product_price = number_format($price * $currency_value, $decimal_place, '.', ''); - $item_info[] = [ + $item_info[] = array( 'name' => $recurring_name, 'quantity' => 1, - 'unit_amount' => [ + 'unit_amount' => array( 'currency_code' => $currency_code, 'value' => $product_price - ] - ]; + ) + ); $item_total += $product_price; $item_total = number_format($item_total, $decimal_place, '.', ''); $order_total = number_format($item_total, $decimal_place, '.', ''); - $amount_info = []; + $amount_info = array(); $amount_info['currency_code'] = $currency_code; $amount_info['value'] = $order_total; - $amount_info['breakdown']['item_total'] = [ + $amount_info['breakdown']['item_total'] = array( 'currency_code' => $currency_code, 'value' => $item_total - ]; + ); - $paypal_order_info = []; + $paypal_order_info = array(); $paypal_order_info['intent'] = strtoupper($transaction_method); $paypal_order_info['purchase_units'][0]['reference_id'] = 'default'; @@ -685,7 +685,7 @@ public function createPayment($order_data, $paypal_order_data, $price, $order_re $result = $paypal->createOrder($paypal_order_info); - $errors = []; + $errors = array(); if ($paypal->hasErrors()) { $errors = $paypal->getErrors(); @@ -708,9 +708,7 @@ public function createPayment($order_data, $paypal_order_data, $price, $order_re return false; } - private function calculateSchedule($frequency, \DateTime $next_payment, $cycle) { - $next_payment = clone $next_payment; - + public function calculateSchedule($frequency, $next_payment, $cycle) { if ($frequency == 'semi_month') { $day = date_format($next_payment, 'd'); $value = 15 - $day; @@ -812,7 +810,7 @@ public function update() { $this->db->query("INSERT INTO `" . DB_PREFIX . "event` SET `code` = 'paypal_customer_delete_customer', `trigger` = 'admin/model/customer/customer/deleteCustomer/before', `action` = 'extension/payment/paypal/customer_delete_customer_before', `sort_order` = '0', `status` = '1'"); if ($this->config->get('paypal_version') < '3.1.0') { - $setting = []; + $setting = array(); $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "setting` WHERE store_id = '0' AND `key` = 'payment_paypal_setting'"); diff --git a/upload/catalog/model/extension/payment/paypal_applepay.php b/upload/catalog/model/extension/payment/paypal_applepay.php index e42eb9ff8..df387171e 100644 --- a/upload/catalog/model/extension/payment/paypal_applepay.php +++ b/upload/catalog/model/extension/payment/paypal_applepay.php @@ -2,7 +2,7 @@ class ModelExtensionPaymentPayPalApplePay extends Model { public function getMethod($address, $total) { - $method_data = []; + $method_data = array(); $this->load->model('extension/payment/paypal'); @@ -24,12 +24,12 @@ public function getMethod($address, $total) { } if ($status) { - $method_data = [ + $method_data = array( 'code' => 'paypal_applepay', 'title' => $this->language->get('text_paypal_applepay_title'), 'terms' => '', 'sort_order' => $this->config->get('payment_paypal_sort_order') - ]; + ); } } diff --git a/upload/catalog/model/extension/payment/paypal_googlepay.php b/upload/catalog/model/extension/payment/paypal_googlepay.php index a07c35eb6..a1a7e91e7 100644 --- a/upload/catalog/model/extension/payment/paypal_googlepay.php +++ b/upload/catalog/model/extension/payment/paypal_googlepay.php @@ -2,7 +2,7 @@ class ModelExtensionPaymentPayPalGooglePay extends Model { public function getMethod($address, $total) { - $method_data = []; + $method_data = array(); $this->load->model('extension/payment/paypal'); @@ -24,12 +24,12 @@ public function getMethod($address, $total) { } if ($status) { - $method_data = [ + $method_data = array( 'code' => 'paypal_googlepay', 'title' => $this->language->get('text_paypal_googlepay_title'), 'terms' => '', 'sort_order' => $this->config->get('payment_paypal_sort_order') - ]; + ); } } diff --git a/upload/catalog/model/extension/payment/paypal_paylater.php b/upload/catalog/model/extension/payment/paypal_paylater.php index feaf2fa73..668e4289e 100644 --- a/upload/catalog/model/extension/payment/paypal_paylater.php +++ b/upload/catalog/model/extension/payment/paypal_paylater.php @@ -2,7 +2,7 @@ class ModelExtensionPaymentPayPalPayLater extends Model { public function getMethod($address, $total) { - $method_data = []; + $method_data = array(); $this->load->model('extension/payment/paypal'); @@ -38,12 +38,12 @@ public function getMethod($address, $total) { $message = ''; } - $method_data = [ + $method_data = array( 'code' => 'paypal_paylater', 'title' => $this->language->get('text_paypal_paylater_title') . $message, 'terms' => '', 'sort_order' => $this->config->get('payment_paypal_sort_order') - ]; + ); } } diff --git a/upload/catalog/view/javascript/paypal/paypal.js b/upload/catalog/view/javascript/paypal/paypal.js index d74b511b4..007840fcd 100644 --- a/upload/catalog/view/javascript/paypal/paypal.js +++ b/upload/catalog/view/javascript/paypal/paypal.js @@ -322,12 +322,11 @@ var PayPalAPI = (function () { if (json['url']) { location = json['url']; + } else { + paypal_card_token.removeClass('paypal-spinner'); + $('#paypal_card_tokens_container').removeClass('disabled'); } }, - complete: function() { - paypal_card_token.removeClass('paypal-spinner'); - $('#paypal_card_tokens_container').removeClass('disabled'); - }, error: function(xhr, ajaxOptions, thrownError) { console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); } @@ -356,14 +355,13 @@ var PayPalAPI = (function () { if (json['success']) { paypal_card_token.remove(); + } else { + paypal_card_token.removeClass('paypal-spinner'); + $('#paypal_card_tokens_container').removeClass('disabled'); } }, error: function(xhr, ajaxOptions, thrownError) { console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); - }, - complete: function() { - paypal_card_token.removeClass('paypal-spinner'); - $('#paypal_card_tokens_container').removeClass('disabled'); } }); } @@ -430,14 +428,13 @@ var PayPalAPI = (function () { if (json['url']) { location = json['url']; + } else { + $('#paypal_card_container').removeClass('paypal-spinner'); + $('#paypal_card_button').prop('disabled', false).button('reset'); } }, error: function(xhr, ajaxOptions, thrownError) { console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); - }, - complete: function() { - $('#paypal_card_container').removeClass('paypal-spinner'); - $('#paypal_card_button').prop('disabled', false).button('reset'); } }); }, diff --git a/upload/system/config/paypal.php b/upload/system/config/paypal.php index afd6e163a..509e6c766 100644 --- a/upload/system/config/paypal.php +++ b/upload/system/config/paypal.php @@ -1,19 +1,19 @@ '3.1.0', - 'partner' => [ - 'production' => [ +$_['paypal_setting'] = array( + 'version' => '3.1.1', + 'partner' => array( + 'production' => array( 'partner_id' => 'TY2Q25KP2PX9L', 'client_id' => 'AbjxI4a9fMnew8UOMoDFVwSh7h1aeOBaXpd2wcccAnuqecijKIylRnNguGRWDrEPrTYraBQApf_-O3_4', 'partner_attribution_id' => 'OPENCARTLIMITED_Cart_OpenCartPCP' - ], - 'sandbox' => [ + ), + 'sandbox' => array( 'partner_id' => 'EJNHWRJJNB38L', 'client_id' => 'AfeIgIr-fIcEucsVXvdq21Ufu0wAALWhgJdVF4ItUK1IZFA9I4JIRdfyJ9vWrd9oi0B6mBGtJYDrlYsG', 'partner_attribution_id' => 'OPENCARTLIMITED_Cart_OpenCartPCP' - ] - ], - 'general' => [ + ) + ), + 'general' => array( 'debug' => false, 'vault_status' => false, 'checkout_mode' => 'multi_button', @@ -29,9 +29,9 @@ 'callback_token' => '', 'webhook_token' => '', 'cron_token' => '' - ], - 'button' => [ - 'checkout' => [ + ), + 'button' => array( + 'checkout' => array( 'page_code' => 'checkout', 'page_name' => 'text_checkout', 'status' => true, @@ -40,7 +40,7 @@ 'color' => 'gold', 'shape' => 'rect', 'label' => 'paypal', - 'funding' => [ + 'funding' => array( 'paylater' => 1, 'card' => 0, 'bancontact' => 0, @@ -53,9 +53,9 @@ 'p24' => 0, 'sepa' => 0, 'venmo' => 0 - ] - ], - 'cart' => [ + ) + ), + 'cart' => array( 'page_code' => 'cart', 'page_name' => 'text_cart', 'status' => true, @@ -66,7 +66,7 @@ 'color' => 'gold', 'shape' => 'rect', 'label' => 'paypal', - 'funding' => [ + 'funding' => array( 'paylater' => 1, 'card' => 2, 'bancontact' => 2, @@ -79,9 +79,9 @@ 'p24' => 2, 'sepa' => 2, 'venmo' => 2 - ] - ], - 'product' => [ + ) + ), + 'product' => array( 'page_code' => 'product', 'page_name' => 'text_product', 'status' => true, @@ -92,7 +92,7 @@ 'color' => 'gold', 'shape' => 'rect', 'label' => 'paypal', - 'funding' => [ + 'funding' => array( 'paylater' => 1, 'card' => 2, 'bancontact' => 2, @@ -105,11 +105,11 @@ 'p24' => 2, 'sepa' => 2, 'venmo' => 2 - ] - ] - ], - 'googlepay_button' => [ - 'checkout' => [ + ) + ) + ), + 'googlepay_button' => array( + 'checkout' => array( 'page_code' => 'checkout', 'page_name' => 'text_checkout', 'status' => false, @@ -118,8 +118,8 @@ 'color' => 'black', 'shape' => 'rect', 'type' => 'buy' - ], - 'cart' => [ + ), + 'cart' => array( 'page_code' => 'cart', 'page_name' => 'text_cart', 'status' => false, @@ -130,8 +130,8 @@ 'color' => 'black', 'shape' => 'rect', 'type' => 'buy' - ], - 'product' => [ + ), + 'product' => array( 'page_code' => 'product', 'page_name' => 'text_product', 'status' => false, @@ -142,10 +142,10 @@ 'color' => 'black', 'shape' => 'rect', 'type' => 'buy' - ] - ], - 'applepay_button' => [ - 'checkout' => [ + ) + ), + 'applepay_button' => array( + 'checkout' => array( 'page_code' => 'checkout', 'page_name' => 'text_checkout', 'status' => false, @@ -154,8 +154,8 @@ 'color' => 'black', 'shape' => 'rect', 'type' => 'buy', - ], - 'cart' => [ + ), + 'cart' => array( 'page_code' => 'cart', 'page_name' => 'text_cart', 'status' => false, @@ -166,8 +166,8 @@ 'color' => 'black', 'shape' => 'rect', 'type' => 'buy', - ], - 'product' => [ + ), + 'product' => array( 'page_code' => 'product', 'page_name' => 'text_product', 'status' => false, @@ -178,14 +178,14 @@ 'color' => 'black', 'shape' => 'rect', 'type' => 'buy', - ] - ], - 'card' => [ + ) + ), + 'card' => array( 'status' => true, 'align' => 'right', 'size' => 'large', 'secure_method' => 'sca_when_required', - 'secure_scenario' => [ + 'secure_scenario' => array( 'failed_authentication' => 0, 'rejected_authentication' => 0, 'attempted_authentication' => 1, @@ -194,10 +194,10 @@ 'card_ineligible' => 1, 'system_unavailable' => 0, 'system_bypassed' => 1 - ] - ], - 'message' => [ - 'checkout' => [ + ) + ), + 'message' => array( + 'checkout' => array( 'page_code' => 'checkout', 'page_name' => 'text_checkout', 'status' => true, @@ -208,8 +208,8 @@ 'text_size' => '12', 'flex_color' => 'blue', 'flex_ratio' => '8x1' - ], - 'cart' => [ + ), + 'cart' => array( 'page_code' => 'cart', 'page_name' => 'text_cart', 'status' => true, @@ -222,8 +222,8 @@ 'text_size' => '12', 'flex_color' => 'blue', 'flex_ratio' => '8x1' - ], - 'product' => [ + ), + 'product' => array( 'page_code' => 'product', 'page_name' => 'text_product', 'status' => true, @@ -236,8 +236,8 @@ 'text_size' => '12', 'flex_color' => 'blue', 'flex_ratio' => '8x1' - ], - 'home' => [ + ), + 'home' => array( 'page_code' => 'home', 'page_name' => 'text_home', 'status' => true, @@ -250,66 +250,66 @@ 'text_size' => '12', 'flex_color' => 'blue', 'flex_ratio' => '20x1' - ] - ], - 'order_status' => [ - 'completed' => [ + ) + ), + 'order_status' => array( + 'completed' => array( 'code' => 'completed', 'name' => 'text_completed_status', 'id' => 5 - ], - 'denied' => [ + ), + 'denied' => array( 'code' => 'denied', 'name' => 'text_denied_status', 'id' => 8 - ], - 'failed' => [ + ), + 'failed' => array( 'code' => 'failed', 'name' => 'text_failed_status', 'id' => 10 - ], - 'pending' => [ + ), + 'pending' => array( 'code' => 'pending', 'name' => 'text_pending_status', 'id' => 1 - ], - 'pending' => [ + ), + 'pending' => array( 'code' => 'pending', 'name' => 'text_pending_status', 'id' => 1 - ], - 'partially_captured' => [ + ), + 'partially_captured' => array( 'code' => 'partially_captured', 'name' => 'text_partially_captured_status', 'id' => 1 - ], - 'partially_refunded' => [ + ), + 'partially_refunded' => array( 'code' => 'partially_refunded', 'name' => 'text_partially_refunded_status', 'id' => 11 - ], - 'refunded' => [ + ), + 'refunded' => array( 'code' => 'refunded', 'name' => 'text_refunded_status', 'id' => 11 - ], - 'reversed' => [ + ), + 'reversed' => array( 'code' => 'reversed', 'name' => 'text_reversed_status', 'id' => 12 - ], - 'voided' => [ + ), + 'voided' => array( 'code' => 'voided', 'name' => 'text_voided_status', 'id' => 16 - ], - 'shipped' => [ + ), + 'shipped' => array( 'code' => 'shipped', 'name' => 'text_shipped_status', 'id' => 3 - ] - ], - 'contact' => [ + ) + ), + 'contact' => array( 'oid' => '00D300000000LaY', 'retURL' => 'https://www.opencart.com/', 'Vendor_Partner_ID_VPID_MAM__c' => '0018000000LjXtY', @@ -328,763 +328,764 @@ '00N2E00000II4xP' => false, '00N2E00000II4xO' => '', '00N80000004IGsC' => '' - ], - 'sale_analytics_range' => [ - 'day' => [ + ), + 'sale_analytics_range' => array( + 'day' => array( 'code' => 'day', 'name' => 'text_day' - ], - 'week' => [ + ), + 'week' => array( 'code' => 'week', 'name' => 'text_week' - ], - 'month' => [ + ), + 'month' => array( 'code' => 'month', 'name' => 'text_month' - ], - 'year' => [ + ), + 'year' => array( 'code' => 'year', 'name' => 'text_year' - ] - ], - 'checkout_mode' => [ - 'multi_button' => [ + ) + ), + 'checkout_mode' => array( + 'multi_button' => array( 'code' => 'multi_button', 'name' => 'text_multi_button' - ], - 'one_button' => [ + ), + 'one_button' => array( 'code' => 'one_button', 'name' => 'text_one_button' - ] - ], - 'transaction_method' => [ - 'authorize' => [ + ) + ), + 'transaction_method' => array( + 'authorize' => array( 'code' => 'authorize', 'name' => 'text_authorization' - ], - 'capture' => [ + ), + 'capture' => array( 'code' => 'capture', 'name' => 'text_sale' - ] - ], - 'paylater_country' => [ - 'US' => [ + ) + ), + 'paylater_country' => array( + 'US' => array( 'code' => 'US' - ], - 'GB' => [ + ), + 'GB' => array( 'code' => 'GB' - ], - 'FR' => [ + ), + 'FR' => array( 'code' => 'FR' - ], - 'DE' => [ + ), + 'DE' => array( 'code' => 'DE' - ], - 'IT' => [ + ), + 'IT' => array( 'code' => 'IT' - ], - 'ES' => [ + ), + 'ES' => array( 'code' => 'ES' - ], - 'AU' => [ + ), + 'AU' => array( 'code' => 'AU' - ] - ], - 'currency' => [ - 'AUD' => [ + ) + ), + 'currency' => array( + 'AUD' => array( 'code' => 'AUD', 'name' => 'text_currency_aud', 'decimal_place' => 2, 'status' => true, 'card_status' => true - ], - 'BRL' => [ + ), + 'BRL' => array( 'code' => 'BRL', 'name' => 'text_currency_brl', 'decimal_place' => 2, 'status' => true, 'card_status' => false - ], - 'CAD' => [ + ), + 'CAD' => array( 'code' => 'CAD', 'name' => 'text_currency_cad', 'decimal_place' => 2, 'status' => true, 'card_status' => true - ], - 'CZK' => [ + ), + 'CZK' => array( 'code' => 'CZK', 'name' => 'text_currency_czk', 'decimal_place' => 2, 'status' => true, 'card_status' => true - ], - 'DKK' => [ + ), + 'DKK' => array( 'code' => 'DKK', 'name' => 'text_currency_dkk', 'decimal_place' => 2, 'status' => true, 'card_status' => true - ], - 'EUR' => [ + ), + 'EUR' => array( 'code' => 'EUR', 'name' => 'text_currency_eur', 'decimal_place' => 2, 'status' => true, 'card_status' => true - ], - 'HKD' => [ + ), + 'HKD' => array( 'code' => 'HKD', 'name' => 'text_currency_hkd', 'decimal_place' => 2, 'status' => true, 'card_status' => true - ], - 'HUF' => [ + ), + 'HUF' => array( 'code' => 'HUF', 'name' => 'text_currency_huf', 'decimal_place' => 0, 'status' => true, 'card_status' => true - ], - 'INR' => [ + ), + 'INR' => array( 'code' => 'INR', 'name' => 'text_currency_inr', 'decimal_place' => 2, 'status' => true, 'card_status' => false - ], - 'ILS' => [ + ), + 'ILS' => array( 'code' => 'ILS', 'name' => 'text_currency_ils', 'decimal_place' => 2, 'status' => true, 'card_status' => false - ], - 'JPY' => [ + ), + 'JPY' => array( 'code' => 'JPY', 'name' => 'text_currency_jpy', 'decimal_place' => 0, 'status' => true, 'card_status' => true - ], - 'MYR' => [ + ), + 'MYR' => array( 'code' => 'MYR', 'name' => 'text_currency_myr', 'decimal_place' => 2, 'status' => true, 'card_status' => false - ], - 'MXN' => [ + ), + 'MXN' => array( 'code' => 'MXN', 'name' => 'text_currency_mxn', 'decimal_place' => 2, 'status' => true, 'card_status' => false - ], - 'TWD' => [ + ), + 'TWD' => array( 'code' => 'TWD', 'name' => 'text_currency_twd', 'decimal_place' => 0, 'status' => true, 'card_status' => false - ], - 'NZD' => [ + ), + 'NZD' => array( 'code' => 'NZD', 'name' => 'text_currency_nzd', 'decimal_place' => 2, 'status' => true, 'card_status' => true - ], - 'NOK' => [ + ), + 'NOK' => array( 'code' => 'NOK', 'name' => 'text_currency_nok', 'decimal_place' => 2, 'status' => true, 'card_status' => true - ], - 'PHP' => [ + ), + 'PHP' => array( 'code' => 'PHP', 'name' => 'text_currency_php', 'decimal_place' => 2, 'status' => true, 'card_status' => false - ], - 'PLN' => [ + ), + 'PLN' => array( 'code' => 'PLN', 'name' => 'text_currency_pln', 'decimal_place' => 2, 'status' => true, 'card_status' => true - ], - 'GBP' => [ + ), + 'GBP' => array( 'code' => 'GBP', 'name' => 'text_currency_gbp', 'decimal_place' => 2, 'status' => true, 'card_status' => true - ], - 'RUB' => [ + ), + 'RUB' => array( 'code' => 'RUB', 'name' => 'text_currency_rub', 'decimal_place' => 2, 'status' => true, 'card_status' => false - ], - 'SGD' => [ + ), + 'SGD' => array( 'code' => 'SGD', 'name' => 'text_currency_sgd', 'decimal_place' => 2, 'status' => true, 'card_status' => true - ], - 'SEK' => [ + ), + 'SEK' => array( 'code' => 'SEK', 'name' => 'text_currency_sek', 'decimal_place' => 2, 'status' => true, 'card_status' => true - ], - 'CHF' => [ + ), + 'CHF' => array( 'code' => 'CHF', 'name' => 'text_currency_chf', 'decimal_place' => 2, 'status' => true, 'card_status' => true - ], - 'THB' => [ + ), + 'THB' => array( 'code' => 'THB', 'name' => 'text_currency_thb', 'decimal_place' => 2, 'status' => true, 'card_status' => false - ], - 'USD' => [ + ), + 'USD' => array( 'code' => 'USD', 'name' => 'text_currency_usd', 'decimal_place' => 2, 'status' => true, 'card_status' => true - ] - ], - 'button_insert_type' => [ - 'into_begin' => [ + ) + ), + 'button_insert_type' => array( + 'into_begin' => array( 'code' => 'prepend', 'name' => 'text_insert_prepend' - ], - 'into_end' => [ + ), + 'into_end' => array( 'code' => 'append', 'name' => 'text_insert_append' - ], - 'before' => [ + ), + 'before' => array( 'code' => 'before', 'name' => 'text_insert_before' - ], - 'after' => [ + ), + 'after' => array( 'code' => 'after', 'name' => 'text_insert_after' - ] - ], - 'button_align' => [ - 'left' => [ + ) + ), + 'button_align' => array( + 'left' => array( 'code' => 'left', 'name' => 'text_align_left' - ], - 'center' => [ + ), + 'center' => array( 'code' => 'center', 'name' => 'text_align_center' - ], - 'right' => [ + ), + 'right' => array( 'code' => 'right', 'name' => 'text_align_right' - ] - ], - 'button_size' => [ - 'small' => [ + ) + ), + 'button_size' => array( + 'small' => array( 'code' => 'small', 'name' => 'text_small' - ], - 'medium' => [ + ), + 'medium' => array( 'code' => 'medium', 'name' => 'text_medium' - ], - 'large' => [ + ), + 'large' => array( 'code' => 'large', 'name' => 'text_large' - ], - 'responsive' => [ + ), + 'responsive' => array( 'code' => 'responsive', 'name' => 'text_responsive' - ] - ], - 'button_color' => [ - 'gold' => [ + ) + ), + 'button_color' => array( + 'gold' => array( 'code' => 'gold', 'name' => 'text_gold' - ], - 'blue' => [ + ), + 'blue' => array( 'code' => 'blue', 'name' => 'text_blue' - ], - 'silver' => [ + ), + 'silver' => array( 'code' => 'silver', 'name' => 'text_silver' - ], - 'white' => [ + ), + 'white' => array( 'code' => 'white', 'name' => 'text_white' - ], - 'black' => [ + ), + 'black' => array( 'code' => 'black', 'name' => 'text_black' - ] - ], - 'button_shape' => [ - 'pill' => [ + ) + ), + 'button_shape' => array( + 'pill' => array( 'code' => 'pill', 'name' => 'text_pill' - ], - 'rect' => [ + ), + 'rect' => array( 'code' => 'rect', 'name' => 'text_rect' - ] - ], - 'button_label' => [ - 'checkout' => [ + ) + ), + 'button_label' => array( + 'checkout' => array( 'code' => 'checkout', 'name' => 'text_checkout' - ], - 'pay' => [ + ), + 'pay' => array( 'code' => 'pay', 'name' => 'text_pay' - ], - 'buynow' => [ + ), + 'buynow' => array( 'code' => 'buynow', 'name' => 'text_buy_now' - ], - 'paypal' => [ + ), + 'paypal' => array( 'code' => 'paypal', 'name' => 'text_pay_pal' - ], - 'installment' => [ + ), + 'installment' => array( 'code' => 'installment', 'name' => 'text_installment' - ] - ], - 'button_tagline' => [ - 'true' => [ + ) + ), + 'button_tagline' => array( + 'true' => array( 'code' => 'true', 'name' => 'text_yes' - ], - 'false' => [ + ), + 'false' => array( 'code' => 'false', 'name' => 'text_no' - ], - ], - 'button_width' => [ + ), + ), + 'button_width' => array( 'small' => '200px', 'medium' => '250px', 'large' => '350px', 'responsive' => '' - ], - 'button_funding' => [ - 'paylater' => [ + ), + 'button_funding' => array( + 'paylater' => array( 'code' => 'paylater', 'name' => 'text_paylater' - ], - 'card' => [ + ), + 'card' => array( 'code' => 'card', 'name' => 'text_card' - ], - 'bancontact' => [ + ), + 'bancontact' => array( 'code' => 'bancontact', 'name' => 'text_bancontact' - ], - 'blik' => [ + ), + 'blik' => array( 'code' => 'blik', 'name' => 'text_blik' - ], - 'eps' => [ + ), + 'eps' => array( 'code' => 'eps', 'name' => 'text_eps' - ], - 'giropay' => [ + ), + 'giropay' => array( 'code' => 'giropay', 'name' => 'text_giropay' - ], - 'ideal' => [ + ), + 'ideal' => array( 'code' => 'ideal', 'name' => 'text_ideal' - ], - 'mercadopago' => [ + ), + 'mercadopago' => array( 'code' => 'mercadopago', 'name' => 'text_mercadopago' - ], - 'mybank' => [ + ), + 'mybank' => array( 'code' => 'mybank', 'name' => 'text_mybank' - ], - 'p24' => [ + ), + 'p24' => array( 'code' => 'p24', 'name' => 'text_p24' - ], - 'sepa' => [ + ), + 'sepa' => array( 'code' => 'sepa', 'name' => 'text_sepa' - ], - 'venmo' => [ + ), + 'venmo' => array( 'code' => 'venmo', 'name' => 'text_venmo' - ] - ], - 'googlepay_button_insert_type' => [ - 'into_begin' => [ + ) + ), + 'googlepay_button_insert_type' => array( + 'into_begin' => array( 'code' => 'prepend', 'name' => 'text_insert_prepend' - ], - 'into_end' => [ + ), + 'into_end' => array( 'code' => 'append', 'name' => 'text_insert_append' - ], - 'before' => [ + ), + 'before' => array( 'code' => 'before', 'name' => 'text_insert_before' - ], - 'after' => [ + ), + 'after' => array( 'code' => 'after', 'name' => 'text_insert_after' - ] - ], - 'googlepay_button_align' => [ - 'left' => [ + ) + ), + 'googlepay_button_align' => array( + 'left' => array( 'code' => 'left', 'name' => 'text_align_left' - ], - 'center' => [ + ), + 'center' => array( 'code' => 'center', 'name' => 'text_align_center' - ], - 'right' => [ + ), + 'right' => array( 'code' => 'right', 'name' => 'text_align_right' - ] - ], - 'googlepay_button_size' => [ - 'small' => [ + ) + ), + 'googlepay_button_size' => array( + 'small' => array( 'code' => 'small', 'name' => 'text_small' - ], - 'medium' => [ + ), + 'medium' => array( 'code' => 'medium', 'name' => 'text_medium' - ], - 'large' => [ + ), + 'large' => array( 'code' => 'large', 'name' => 'text_large' - ], - 'responsive' => [ + ), + 'responsive' => array( 'code' => 'responsive', 'name' => 'text_responsive' - ] - ], - 'googlepay_button_color' => [ - 'black' => [ + ) + ), + 'googlepay_button_color' => array( + 'black' => array( 'code' => 'black', 'name' => 'text_black' - ], - 'white' => [ + ), + 'white' => array( 'code' => 'white', 'name' => 'text_white' - ] - ], - 'googlepay_button_shape' => [ - 'pill' => [ + ) + ), + 'googlepay_button_shape' => array( + 'pill' => array( 'code' => 'pill', 'name' => 'text_pill' - ], - 'rect' => [ + ), + 'rect' => array( 'code' => 'rect', 'name' => 'text_rect' - ] - ], - 'googlepay_button_type' => [ - 'buy' => [ + ) + ), + 'googlepay_button_type' => array( + 'buy' => array( 'code' => 'buy', 'name' => 'text_buy' - ], - 'donate' => [ + ), + 'donate' => array( 'code' => 'donate', 'name' => 'text_donate' - ], - 'plain' => [ + ), + 'plain' => array( 'code' => 'plain', 'name' => 'text_plain' - ], - 'pay' => [ + ), + 'pay' => array( 'code' => 'pay', 'name' => 'text_pay' - ], - 'checkout' => [ + ), + 'checkout' => array( 'code' => 'checkout', 'name' => 'text_checkout' - ] - ], - 'googlepay_button_width' => [ + ) + ), + 'googlepay_button_width' => array( 'small' => '200px', 'medium' => '250px', 'large' => '350px', 'responsive' => '' - ], - 'applepay_button_insert_type' => [ - 'into_begin' => [ + ), + 'applepay_button_insert_type' => array( + 'into_begin' => array( 'code' => 'prepend', 'name' => 'text_insert_prepend' - ], - 'into_end' => [ + ), + 'into_end' => array( 'code' => 'append', 'name' => 'text_insert_append' - ], - 'before' => [ + ), + 'before' => array( 'code' => 'before', 'name' => 'text_insert_before' - ], - 'after' => [ + ), + 'after' => array( 'code' => 'after', 'name' => 'text_insert_after' - ] - ], - 'applepay_button_align' => [ - 'left' => [ + ) + ), + 'applepay_button_align' => array( + 'left' => array( 'code' => 'left', 'name' => 'text_align_left' - ], - 'center' => [ + ), + 'center' => array( 'code' => 'center', 'name' => 'text_align_center' - ], - 'right' => [ + ), + 'right' => array( 'code' => 'right', 'name' => 'text_align_right' - ] - ], - 'applepay_button_size' => [ - 'small' => [ + ) + ), + 'applepay_button_size' => array( + 'small' => array( 'code' => 'small', 'name' => 'text_small' - ], - 'medium' => [ + ), + 'medium' => array( 'code' => 'medium', 'name' => 'text_medium' - ], - 'large' => [ + ), + 'large' => array( 'code' => 'large', 'name' => 'text_large' - ], - 'responsive' => [ + ), + 'responsive' => array( 'code' => 'responsive', 'name' => 'text_responsive' - ] - ], - 'applepay_button_color' => [ - 'black' => [ + ) + ), + 'applepay_button_color' => array( + 'black' => array( 'code' => 'black', 'name' => 'text_black' - ], - 'white' => [ + ), + 'white' => array( 'code' => 'white', 'name' => 'text_white' - ], - 'white_outline' => [ + ), + 'white_outline' => array( 'code' => 'white-outline', 'name' => 'text_white_outline' - ] - ], - 'applepay_button_shape' => [ - 'pill' => [ + ) + ), + 'applepay_button_shape' => array( + 'pill' => array( 'code' => 'pill', 'name' => 'text_pill' - ], - 'rect' => [ + ), + 'rect' => array( 'code' => 'rect', 'name' => 'text_rect' - ] - ], - 'applepay_button_type' => [ - 'buy' => [ + ) + ), + 'applepay_button_type' => array( + 'buy' => array( 'code' => 'buy', 'name' => 'text_buy' - ], - 'donate' => [ + ), + 'donate' => array( 'code' => 'donate', 'name' => 'text_donate' - ], - 'plain' => [ + ), + 'plain' => array( 'code' => 'plain', 'name' => 'text_plain' - ], - 'check-out' => [ + ), + 'check-out' => array( 'code' => 'check-out', 'name' => 'text_check_out' - ] - ], - 'applepay_button_width' => [ + ) + ), + 'applepay_button_width' => array( 'small' => '200px', 'medium' => '250px', 'large' => '350px', 'responsive' => '' - ], - 'card_align' => [ - 'left' => [ + ), + 'card_align' => array( + 'left' => array( 'code' => 'left', 'name' => 'text_align_left' - ], - 'center' => [ + ), + 'center' => array( 'code' => 'center', 'name' => 'text_align_center' - ], - 'right' => [ + ), + 'right' => array( 'code' => 'right', 'name' => 'text_align_right' - ] - ], - 'card_size' => [ - 'medium' => [ + ) + ), + 'card_size' => array( + 'medium' => array( 'code' => 'medium', 'name' => 'text_medium' - ], - 'large' => [ + ), + 'large' => array( 'code' => 'large', 'name' => 'text_large' - ], - 'responsive' => [ + ), + 'responsive' => array( 'code' => 'responsive', 'name' => 'text_responsive' - ] - ], - 'card_width' => [ + ) + ), + 'card_width' => array( 'medium' => '250px', 'large' => '350px', 'responsive' => '' - ], - 'card_secure_method' => [ - 'sca_when_required' => [ + ), + 'card_secure_method' => array( + 'sca_when_required' => array( 'code' => 'sca_when_required', 'name' => 'text_sca_when_required' - ], - 'sca_always' => [ + ), + 'sca_always' => array( 'code' => 'sca_always', 'name' => 'text_sca_always' - ] - ], - 'card_secure_scenario' => [ - 'failed_authentication' => [ + ) + ), + 'card_secure_scenario' => array( + 'failed_authentication' => array( 'code' => 'failed_authentication', 'name' => 'text_3ds_failed_authentication', 'error' => 'error_3ds_failed_authentication', 'recommended' => 0 - ], - 'rejected_authentication' => [ + ), + 'rejected_authentication' => array( 'code' => 'rejected_authentication', 'name' => 'text_3ds_rejected_authentication', 'error' => 'error_3ds_rejected_authentication', 'recommended' => 0 - ], - 'attempted_authentication' => [ + ), + 'attempted_authentication' => array( 'code' => 'attempted_authentication', 'name' => 'text_3ds_attempted_authentication', 'error' => 'error_3ds_attempted_authentication', 'recommended' => 1 - ], - 'unable_authentication' => [ + ), + 'unable_authentication' => array( 'code' => 'unable_authentication', 'name' => 'text_3ds_unable_authentication', 'error' => 'error_3ds_unable_authentication', 'recommended' => 0 - ], - 'challenge_authentication' => [ + ), + 'challenge_authentication' => array( 'code' => 'challenge_authentication', 'name' => 'text_3ds_challenge_authentication', 'error' => 'error_3ds_challenge_authentication', 'recommended' => 0 - ], - 'card_ineligible' => [ + ), + 'card_ineligible' => array( 'code' => 'card_ineligible', 'name' => 'text_3ds_card_ineligible', 'error' => 'error_3ds_card_ineligible', 'recommended' => 1 - ], - 'system_unavailable' => [ + ), + 'system_unavailable' => array( 'code' => 'system_unavailable', 'name' => 'text_3ds_system_unavailable', 'error' => 'error_3ds_system_unavailable', 'recommended' => 0 - ], - 'system_bypassed' => [ + ), + 'system_bypassed' => array( 'code' => 'system_bypassed', 'name' => 'text_3ds_system_bypassed', 'error' => 'error_3ds_system_bypassed', 'recommended' => 1 - ] - ], - 'message_insert_type' => [ - 'into_begin' => [ + ) + ), + 'message_insert_type' => array( + 'into_begin' => array( 'code' => 'prepend', 'name' => 'text_insert_prepend' - ], - 'into_end' => [ + ), + 'into_end' => array( 'code' => 'append', 'name' => 'text_insert_append' - ], - 'before' => [ + ), + 'before' => array( 'code' => 'before', 'name' => 'text_insert_before' - ], - 'after' => [ + ), + 'after' => array( 'code' => 'after', 'name' => 'text_insert_after' - ] - ], - 'contact_sales' => ['100k - 250k', '250k - 2m', '2m - 10m', '10m - 20m', '20m - 50m', '50m +'], - 'contact_product' => [ - [ + ) + ), + 'contact_sales' => array('100k - 250k', '250k - 2m', '2m - 10m', '10m - 20m', '20m - 50m', '50m +'), + 'contact_product' => array( + array( 'code' => 'BT DCC', 'name' => 'text_bt_dcc' - ], - [ - 'code' => 'Express Checkout (EC]', + ), + array( + 'code' => 'Express Checkout (EC)', 'name' => 'text_express_checkout' - ], - [ + ), + array( 'code' => 'Credit - Installments', 'name' => 'text_credit_installments' - ], - [ + ), + array( 'code' => 'Point of Sale', 'name' => 'text_point_of_sale' - ], - [ + ), + array( 'code' => 'Invoicing API', 'name' => 'text_invoicing_api' - ], - [ + ), + array( 'code' => 'PayPal Working Capital', 'name' => 'text_paypal_working_capital' - ], - [ + ), + array( 'code' => 'Risk servicing', 'name' => 'text_risk_servicing' - ], - [ + ), + array( 'code' => 'PayPal Here', 'name' => 'text_paypal_here' - ], - [ + ), + array( 'code' => 'Payouts', 'name' => 'text_payouts' - ], - [ + ), + array( 'code' => 'Marketing solutions', 'name' => 'text_marketing_solutions' - ], - ] -]; \ No newline at end of file + ), + ) +); +?> \ No newline at end of file diff --git a/upload/system/library/paypal/paypal.php b/upload/system/library/paypal/paypal.php index 8d2474ca4..e588840c9 100644 --- a/upload/system/library/paypal/paypal.php +++ b/upload/system/library/paypal/paypal.php @@ -1,17 +1,17 @@ 'https://api.sandbox.paypal.com', 'production' => 'https://api.paypal.com' - ]; + ); private $environment = 'sandbox'; private $partner_id = ''; private $client_id = ''; private $secret = ''; private $partner_attribution_id = ''; private $access_token = ''; - private $errors = []; - private $last_response = []; + private $errors = array(); + private $last_response = array(); //IN: paypal info public function __construct($paypal_info) { @@ -76,9 +76,9 @@ public function getClientToken() { public function getUserInfo() { $command = '/v1/identity/oauth2/userinfo'; - $params = [ + $params = array( 'schema' => 'paypalv1.1' - ]; + ); $result = $this->execute('GET', $command, $params); @@ -254,7 +254,7 @@ public function getPaymentToken($payment_token_id) { public function getPaymentTokens($customer_id) { $command = '/v3/vault/payment-tokens'; - $params = ['customer_id' => $customer_id]; + $params = array('customer_id' => $customer_id); $result = $this->execute('GET', $command, $params); @@ -502,11 +502,11 @@ public function getResponse() { return $this->last_response; } - private function execute($method, $command, $params = [], $json = false) { - $this->errors = []; + private function execute($method, $command, $params = array(), $json = false) { + $this->errors = array(); if ($method && $command) { - $curl_options = [ + $curl_options = array( CURLOPT_URL => $this->server[$this->environment] . $command, CURLOPT_HEADER => true, CURLOPT_RETURNTRANSFER => true, @@ -516,7 +516,7 @@ private function execute($method, $command, $params = [], $json = false) { CURLOPT_TIMEOUT => 10, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSL_VERIFYPEER => 0 - ]; + ); $curl_options[CURLOPT_HTTPHEADER][] = 'Accept-Charset: utf-8'; $curl_options[CURLOPT_HTTPHEADER][] = 'Accept: application/json'; @@ -567,7 +567,7 @@ private function execute($method, $command, $params = [], $json = false) { $curl_options[CURLOPT_INFILE] = $buffer; $curl_options[CURLOPT_INFILESIZE] = strlen($params_string); } else { - $this->errors[] = ['name' => 'FAILED_OPEN_TEMP_FILE', 'message' => 'Unable to open a temporary file']; + $this->errors[] = array('name' => 'FAILED_OPEN_TEMP_FILE', 'message' => 'Unable to open a temporary file'); } } @@ -590,7 +590,7 @@ private function execute($method, $command, $params = [], $json = false) { $constant = get_defined_constants(true); $curl_constant = preg_grep('/^CURLE_/', array_flip($constant['curl'])); - $this->errors[] = ['name' => $curl_constant[$curl_code], 'message' => curl_strerror($curl_code)]; + $this->errors[] = array('name' => $curl_constant[$curl_code], 'message' => curl_strerror($curl_code)); } $head = ''; @@ -600,13 +600,13 @@ private function execute($method, $command, $params = [], $json = false) { if (isset($parts[0]) && isset($parts[1])) { if (($parts[0] == 'HTTP/1.1 100 Continue') && isset($parts[2])) { - list($head, $body) = [$parts[1], $parts[2]]; + list($head, $body) = array($parts[1], $parts[2]); } else { - list($head, $body) = [$parts[0], $parts[1]]; + list($head, $body) = array($parts[0], $parts[1]); } } - $response_headers = []; + $response_headers = array(); $header_lines = explode("\r\n", $head); array_shift($header_lines);