From ea80c7339c7cd356051f0d82f0d8551121445d7a Mon Sep 17 00:00:00 2001 From: afayadas Date: Wed, 18 Aug 2021 10:56:38 +0200 Subject: [PATCH 01/62] ref #30790 : update module version to 2.3.7 --- 202/build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/202/build.xml b/202/build.xml index 7cb37b2..08d65b4 100644 --- a/202/build.xml +++ b/202/build.xml @@ -5,7 +5,7 @@ - + From 8b670ee6e111ead34b8bf52fabe354bf9e47e7da Mon Sep 17 00:00:00 2001 From: afayadas Date: Thu, 19 Aug 2021 17:11:04 +0200 Subject: [PATCH 02/62] ref #30818 : fixing invalid webhook signature response during payment --- stripe_official.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stripe_official.php b/stripe_official.php index a571ca5..8a72583 100644 --- a/stripe_official.php +++ b/stripe_official.php @@ -1057,7 +1057,7 @@ protected function assignSmartyVars() 'alipay' => Configuration::get(self::ENABLE_ALIPAY,null, $shopGroupId, $shopId), 'oxxo' => Configuration::get(self::ENABLE_OXXO,null, $shopGroupId, $shopId), 'applepay_googlepay' => Configuration::get(self::ENABLE_APPLEPAY_GOOGLEPAY,null, $shopGroupId, $shopId), - 'url_webhhoks' => $this->context->link->getModuleLink($this->name, 'webhook', array(), true), + 'url_webhhoks' => $this->context->link->getModuleLink($this->name, 'webhook', array(), true, Configuration::get('PS_LANG_DEFAULT'), Stripe_official::getShopIdContext() ?: Configuration::get('PS_SHOP_DEFAULT')), )); } From d5b375dba95b56cff6cb4ebbb10c9a7f0d0e3711 Mon Sep 17 00:00:00 2001 From: afayadas Date: Fri, 20 Aug 2021 13:09:19 +0200 Subject: [PATCH 03/62] ref #30824 : fixing payment order error after payment accepted --- classes/actions/ValidationOrderActions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/actions/ValidationOrderActions.php b/classes/actions/ValidationOrderActions.php index 5e09534..94f7d54 100755 --- a/classes/actions/ValidationOrderActions.php +++ b/classes/actions/ValidationOrderActions.php @@ -774,7 +774,8 @@ public function chargeWebhook() 'webhook' ); } - } elseif ($this->conveyor['event_json']->type == 'charge.failed') { + } elseif ($this->conveyor['event_json']->type == 'charge.failed' + && $order->getCurrentState() != Configuration::get('PS_OS_PAYMENT')) { $order->setCurrentState(Configuration::get('PS_OS_ERROR')); } From 79a78c6bafcc8f17b4c930266a7f5086b98bf5b2 Mon Sep 17 00:00:00 2001 From: afayadas Date: Wed, 25 Aug 2021 15:53:31 +0200 Subject: [PATCH 04/62] ref #25071 : fixing partial refund bug with prestashop status order --- classes/actions/ValidationOrderActions.php | 24 +++++++++++++++++++--- controllers/front/webhook.php | 2 +- stripe_official.php | 7 ------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/classes/actions/ValidationOrderActions.php b/classes/actions/ValidationOrderActions.php index 94f7d54..c17d232 100755 --- a/classes/actions/ValidationOrderActions.php +++ b/classes/actions/ValidationOrderActions.php @@ -716,7 +716,8 @@ public function chargeWebhook() return true; } - if ($this->conveyor['events_states'][$this->conveyor['event_json']->type] == $order->getCurrentState()) { + if ($this->conveyor['event_json']->type != 'payment_intent.requires_action' + && $this->conveyor['events_states'][$this->conveyor['event_json']->type] == $order->getCurrentState()) { ProcessLoggerHandler::logInfo( 'Order status is already the good one', null, @@ -755,9 +756,26 @@ public function chargeWebhook() $order->update(); $history->addWithemail(); - } elseif ($this->conveyor['event_json']->type == 'charge.expired' - || $this->conveyor['event_json']->type == 'charge.refunded') { + } elseif ($this->conveyor['event_json']->type == 'charge.expired') { $order->setCurrentState(Configuration::get('PS_OS_CANCELED')); + } elseif ($this->conveyor['event_json']->type == 'charge.refunded') { + if ($this->conveyor['event_json']->data->object->amount_refunded !== $this->conveyor['event_json']->data->object->amount_captured) { + $order->setCurrentState(Configuration::get('PS_CHECKOUT_STATE_PARTIAL_REFUND')); + ProcessLoggerHandler::logInfo( + 'Partial refund of payment => '.$this->conveyor['event_json']->data->object->id, + null, + null, + 'webhook' + ); + } else { + $order->setCurrentState(Configuration::get('PS_OS_REFUND')); + ProcessLoggerHandler::logInfo( + 'Full refund of payment => '.$this->conveyor['event_json']->data->object->id, + null, + null, + 'webhook' + ); + } } elseif ($this->conveyor['event_json']->type == 'charge.succeeded') { $order->setCurrentState(Configuration::get('PS_OS_PAYMENT')); if ($this->conveyor['event_json']->data->object->payment_method_details->type == 'oxxo') { diff --git a/controllers/front/webhook.php b/controllers/front/webhook.php index 37ed68a..7d13af3 100755 --- a/controllers/front/webhook.php +++ b/controllers/front/webhook.php @@ -180,7 +180,7 @@ public function postProcess() 'charge.failed' => Configuration::get('PS_OS_ERROR'), 'charge.succeeded' => Configuration::get('PS_OS_PAYMENT'), 'charge.captured' => Configuration::get('PS_OS_PAYMENT'), - 'charge.refunded' => Configuration::get('PS_OS_CANCELED'), + 'charge.refunded' => Configuration::get('PS_OS_REFUND'), 'charge.dispute.created' => Configuration::get(Stripe_official::SEPA_DISPUTE) ); diff --git a/stripe_official.php b/stripe_official.php index 8a72583..efebc12 100644 --- a/stripe_official.php +++ b/stripe_official.php @@ -1216,13 +1216,6 @@ public function apiRefund($refund_id, $currency, $mode, $id_card, $amount = null $query->where('id_stripe = "'.pSQL($refund_id).'"'); $state = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query->build()); - if ($state == 2) { - /* Refund State */ - $order->setCurrentState(7); - } elseif ($state == 3) { - /* Partial Refund State */ - $order->setCurrentState(Configuration::get(self::PARTIAL_REFUND_STATE)); - } $this->success = $this->l('Refunds processed successfully'); } else { $this->errors[] = $this->l('Invalid Stripe credentials, please check your configuration.'); From e0c9468432216b22fbf7f05ce25a0f75f5319834 Mon Sep 17 00:00:00 2001 From: afayadas Date: Thu, 26 Aug 2021 12:10:51 +0200 Subject: [PATCH 05/62] ref #30600 : overhaul http response code + overhaul log info --- classes/actions/ValidationOrderActions.php | 139 ++++++++++++--------- 1 file changed, 78 insertions(+), 61 deletions(-) diff --git a/classes/actions/ValidationOrderActions.php b/classes/actions/ValidationOrderActions.php index c17d232..9f37ffd 100755 --- a/classes/actions/ValidationOrderActions.php +++ b/classes/actions/ValidationOrderActions.php @@ -50,7 +50,6 @@ public function prepareFlowNone() null, 'ValidationOrderActions - prepareFlowNone' ); - ProcessLoggerHandler::closeLogger(); if (isset($intent->charges->data[0])) { $charges = $intent->charges->data[0]; @@ -269,6 +268,16 @@ public function updatePaymentIntent() */ public function createOrder() { + if (Order::getOrderByCartId((int)$this->conveyor['id_cart'])) { + ProcessLoggerHandler::logInfo( + 'Prestashop order has been already created for this cart', + null, + null, + 'ValidationOrderActions - createOrder' + ); + return false; + } + if ($this->conveyor['status'] != 'succeeded' && $this->conveyor['status'] != 'pending' && $this->conveyor['status'] != 'requires_capture' @@ -327,7 +336,6 @@ public function createOrder() null, 'ValidationOrderActions - createOrder' ); - ProcessLoggerHandler::closeLogger(); try { if (Configuration::get('PS_GEOLOCATION_ENABLED')) { @@ -353,7 +361,6 @@ public function createOrder() null, 'ValidationOrderActions - createOrder' ); - ProcessLoggerHandler::closeLogger(); $idOrder = Order::getOrderByCartId((int)$this->conveyor['id_cart']); $order = new Order($idOrder); @@ -366,7 +373,6 @@ public function createOrder() null, 'ValidationOrderActions - createOrder' ); - ProcessLoggerHandler::closeLogger(); if ($intent->payment_method_types[0] == 'card' && Configuration::get(Stripe_official::CATCHANDAUTHORIZE) == null) { ProcessLoggerHandler::logInfo( @@ -375,12 +381,13 @@ public function createOrder() null, 'ValidationOrderActions - createOrder' ); - ProcessLoggerHandler::closeLogger(); + $currency = new Currency($order->id_currency, $this->context->language->id, $this->context->shop->id); $amount = $this->module->isZeroDecimalCurrency($currency->iso_code) ? $order->total_paid : $order->total_paid * 100; if (!$this->module->captureFunds($amount, $this->conveyor['paymentIntent'])) { + ProcessLoggerHandler::closeLogger(); return false; } @@ -390,7 +397,6 @@ public function createOrder() null, 'ValidationOrderActions - createOrder' ); - ProcessLoggerHandler::closeLogger(); } // END capture payment for card if no catch and authorize enabled @@ -623,7 +629,6 @@ public function addTentative() $orderId, 'validation' ); - ProcessLoggerHandler::closeLogger(); PrestaShopLogger::addLog( 'PaymentModule::validateOrder - Cannot save Order Payment', 3, @@ -668,76 +673,109 @@ public function chargeWebhook() { $this->context = $this->conveyor['context']; - if (isset($this->conveyor['event_json']->data->object->payment_intent)) { - $this->conveyor['IdPaymentIntent'] = $this->conveyor['event_json']->data->object->payment_intent; - } else { - $this->conveyor['IdPaymentIntent'] = $this->conveyor['event_json']->data->object->id; - } - - $id_cart = $this->conveyor['event_json']->data->object->metadata->id_cart; - + $this->conveyor['IdPaymentIntent'] = + (isset($this->conveyor['event_json']->data->object->payment_intent)) + ? $this->conveyor['event_json']->data->object->payment_intent + : $this->conveyor['IdPaymentIntent'] = $this->conveyor['event_json']->data->object->id;; ProcessLoggerHandler::logInfo( 'chargeWebhook with IdPaymentIntent => ' . $this->conveyor['IdPaymentIntent'], null, null, - 'webhook' + 'ValidationOrderActions - chargeWebhook' ); + $id_cart = $this->conveyor['event_json']->data->object->metadata->id_cart; $id_order = Order::getOrderByCartId($id_cart); + $event_type = $this->conveyor['event_json']->type; + if ($id_order == false) { - ProcessLoggerHandler::logError( - '$id_order = false', - null, - null, - 'webhook' - ); - ProcessLoggerHandler::closeLogger(); - http_response_code(400); - return false; + if (in_array($event_type, Stripe_official::$webhook_events)) { + ProcessLoggerHandler::logInfo( + 'Unknown order => '.$event_type, + null, + null, + 'ValidationOrderActions - chargeWebhook' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(200); + return true; + } else { + ProcessLoggerHandler::logError( + 'Unknown order => $id_order = false', + null, + null, + 'ValidationOrderActions - chargeWebhook' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(400); + return false; + } } + $order = new Order($id_order); ProcessLoggerHandler::logInfo( '$id_order = OK', 'Order', $id_order, - 'webhook' + 'ValidationOrderActions - chargeWebhook' ); - $order = new Order($id_order); if ($order->module != 'stripe_official') { ProcessLoggerHandler::logInfo( 'This order #'.$id_order.' was not made with stripe', null, null, - 'webhook' + 'ValidationOrderActions - chargeWebhook' ); ProcessLoggerHandler::closeLogger(); http_response_code(200); return true; } - if ($this->conveyor['event_json']->type != 'payment_intent.requires_action' - && $this->conveyor['events_states'][$this->conveyor['event_json']->type] == $order->getCurrentState()) { + if ($event_type != 'payment_intent.requires_action' + && $this->conveyor['events_states'][$event_type] == $order->getCurrentState()) { ProcessLoggerHandler::logInfo( 'Order status is already the good one', null, null, - 'webhook' + 'ValidationOrderActions - chargeWebhook' ); ProcessLoggerHandler::closeLogger(); + http_response_code(200); return true; } ProcessLoggerHandler::logInfo( - 'current charge => '.$this->conveyor['event_json']->type, + 'current charge => '.$event_type, null, null, - 'webhook' + 'ValidationOrderActions - chargeWebhook' ); - if ($this->conveyor['event_json']->type == 'charge.dispute.created') { + if ($event_type == 'charge.dispute.created') { $order->setCurrentState(Configuration::get(Stripe_official::SEPA_DISPUTE)); - } elseif ($this->conveyor['event_json']->type == 'charge.captured') { + } elseif ($event_type == 'charge.expired') { + $order->setCurrentState(Configuration::get('PS_OS_CANCELED')); + } elseif ($event_type == 'charge.failed' + && $order->getCurrentState() != Configuration::get('PS_OS_PAYMENT')) { + $order->setCurrentState(Configuration::get('PS_OS_ERROR')); + } elseif ($event_type == 'charge.succeeded') { + $order->setCurrentState(Configuration::get('PS_OS_PAYMENT')); + if ($this->conveyor['event_json']->data->object->payment_method_details->type == 'oxxo') { + $stripePayment = new StripePayment(); + $stripePayment->getStripePaymentByPaymentIntent($this->conveyor['IdPaymentIntent']); + $stripePayment->setIdStripe($this->conveyor['event_json']->data->object->id); + $stripePayment->setVoucherValidate(date("Y-m-d H:i:s")); + $stripePayment->save(); + + ProcessLoggerHandler::logInfo( + 'oxxo charge ID => '.$this->conveyor['event_json']->data->object->id, + null, + null, + 'ValidationOrderActions - chargeWebhook' + ); + } + } elseif ($event_type == 'charge.captured') { $history = new OrderHistory(); $history->id_order = (int) $order->id; $history->id_employee = 0; @@ -756,16 +794,14 @@ public function chargeWebhook() $order->update(); $history->addWithemail(); - } elseif ($this->conveyor['event_json']->type == 'charge.expired') { - $order->setCurrentState(Configuration::get('PS_OS_CANCELED')); - } elseif ($this->conveyor['event_json']->type == 'charge.refunded') { + } elseif ($event_type == 'charge.refunded') { if ($this->conveyor['event_json']->data->object->amount_refunded !== $this->conveyor['event_json']->data->object->amount_captured) { $order->setCurrentState(Configuration::get('PS_CHECKOUT_STATE_PARTIAL_REFUND')); ProcessLoggerHandler::logInfo( 'Partial refund of payment => '.$this->conveyor['event_json']->data->object->id, null, null, - 'webhook' + 'ValidationOrderActions - chargeWebhook' ); } else { $order->setCurrentState(Configuration::get('PS_OS_REFUND')); @@ -773,35 +809,16 @@ public function chargeWebhook() 'Full refund of payment => '.$this->conveyor['event_json']->data->object->id, null, null, - 'webhook' - ); - } - } elseif ($this->conveyor['event_json']->type == 'charge.succeeded') { - $order->setCurrentState(Configuration::get('PS_OS_PAYMENT')); - if ($this->conveyor['event_json']->data->object->payment_method_details->type == 'oxxo') { - $stripePayment = new StripePayment(); - $stripePayment->getStripePaymentByPaymentIntent($this->conveyor['IdPaymentIntent']); - $stripePayment->setIdStripe($this->conveyor['event_json']->data->object->id); - $stripePayment->setVoucherValidate(date("Y-m-d H:i:s")); - $stripePayment->save(); - - ProcessLoggerHandler::logInfo( - 'oxxo charge ID => '.$this->conveyor['event_json']->data->object->id, - null, - null, - 'webhook' + 'ValidationOrderActions - chargeWebhook' ); } - } elseif ($this->conveyor['event_json']->type == 'charge.failed' - && $order->getCurrentState() != Configuration::get('PS_OS_PAYMENT')) { - $order->setCurrentState(Configuration::get('PS_OS_ERROR')); } ProcessLoggerHandler::logInfo( - 'setCurrentState for '.$this->conveyor['event_json']->type, + 'setCurrentState for '.$event_type, 'Order', $id_order, - 'webhook' + 'ValidationOrderActions - chargeWebhook' ); ProcessLoggerHandler::closeLogger(); return true; From 1c820d450c2cad8a9b05257b8bc21ca1dfec5179 Mon Sep 17 00:00:00 2001 From: afayadas Date: Thu, 26 Aug 2021 17:43:40 +0200 Subject: [PATCH 06/62] ref #30879 : deleting Microsoft Pay reference in module + adding missing translations --- _dev/js/payments.js | 2 +- translations/br.php | 142 +++++++++------- translations/de.php | 144 +++++++++------- translations/es.php | 142 +++++++++------- translations/fr.php | 160 ++++++++++-------- translations/index.php | 0 translations/it.php | 142 +++++++++------- translations/nl.php | 142 +++++++++------- translations/pt.php | 142 +++++++++------- .../admin/_partials/configuration.tpl | 4 +- 10 files changed, 598 insertions(+), 422 deletions(-) mode change 100644 => 100755 translations/br.php mode change 100644 => 100755 translations/de.php mode change 100644 => 100755 translations/es.php mode change 100644 => 100755 translations/fr.php mode change 100644 => 100755 translations/index.php mode change 100644 => 100755 translations/it.php mode change 100644 => 100755 translations/nl.php mode change 100644 => 100755 translations/pt.php diff --git a/_dev/js/payments.js b/_dev/js/payments.js index 4d2905e..37fe690 100644 --- a/_dev/js/payments.js +++ b/_dev/js/payments.js @@ -262,7 +262,7 @@ $(function(){ * with Elements. * * Please note this form is not submitted when the user chooses the "Pay" button - * or Apple Pay, Google Pay, and Microsoft Pay since they provide name and + * or Apple Pay, and Google Pay since they provide name and * shipping information directly. */ $submit.click(async event => { diff --git a/translations/br.php b/translations/br.php old mode 100644 new mode 100755 index e42c546..317e1eb --- a/translations/br.php +++ b/translations/br.php @@ -20,6 +20,17 @@ $_MODULE['<{stripe_official}prestashop>stripe_official_7c716e01a03b426976692f4a7a0d80be'] = 'Comece a receber pagamentos pela Stripe hoje mesmo, diretamente de sua loja!'; $_MODULE['<{stripe_official}prestashop>stripe_official_876f23178c29dc2552c0b48bf23cd9bd'] = 'Deseja mesmo desinstalar?'; $_MODULE['<{stripe_official}prestashop>stripe_official_6341ee14cd6d47787171f68d27f1f41b'] = 'Pagamento pela Stripe'; +$_MODULE['<{stripe_official}prestashop>stripe_official_a6ee78c840497aed8a81b6164d4224e6'] = 'Você deve habilitar SSL na loja se quiser usar este módulo na produção.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_66f67e1a8f01161f2009c2ed39c3cb1e'] = 'Você atingiu o limite de 16 endpoints de webhook registrados em seu Dashboard Stripe para esta conta. Remova um deles se quiser registrar este domínio.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_69e6a2456656fcc3c9a79452ef3a7928'] = 'Sua versão TLS não é compatível. Você precisará atualizar sua integração. Por favor, verifique o FAQ se você não sabe como fazê-lo.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_47daed1af40eaa1fb3c750322137815d'] = 'A configuração do Webhook não pode ser encontrada no PrestaShop, clique no botão Salvar para corrigir o problema. Um novo webhook será criado no Stripe e, em seguida, salvo no PrestaShop.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_4684c4310f6bd9917b3c079bc38fd335'] = 'A configuração do URL do webhook está incorreta. Clique no botão Salvar para corrigir o problema. A configuração do webhook será corrigida.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_572bde45cccf4cde600e2a846cfe8085'] = 'URL do webhook atual:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_12632987bdd5031845a591acdf5faa40'] = 'URL de webhook esperado:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_2226fcd706ac6ba242dc3381636cf74b'] = 'A configuração dos eventos do webhook está incorreta, clique no botão Salvar para corrigir o problema. A configuração do webhook será corrigida.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_4047173bbb1dd67cd5e877f7736c1e86'] = 'Eventos de webhook atuais:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_78b8b4d922d4061d31e55caece729f8b'] = 'Eventos de webhook esperados:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_21e8380e65bb6a9cc714dae46e2b6dbf'] = 'A configuração do webhook não pode ser acessada, clique no botão Salvar para corrigir o problema. Um novo webhook será criado no Stripe.'; $_MODULE['<{stripe_official}prestashop>stripe_official_b32006c07b70b4db49be9fcc111b074f'] = 'As chaves estão em branco.'; $_MODULE['<{stripe_official}prestashop>stripe_official_3e5298c1c5d8c871334c4e3994481f90'] = 'A ID de pagamento Stripe não pode ficar em branco.'; $_MODULE['<{stripe_official}prestashop>stripe_official_eb804bebeffc55fb161165d50bcf74f8'] = 'ID de pagamento Stripe desconhecida.'; @@ -31,8 +42,10 @@ $_MODULE['<{stripe_official}prestashop>stripe_official_fd2bdc826d325902e451236cf6fd774e'] = 'Processando...'; $_MODULE['<{stripe_official}prestashop>stripe_official_b24ee2c7cb1734370b544eb4e6cdc2b6'] = 'Aceite os Termos de Serviço'; $_MODULE['<{stripe_official}prestashop>stripe_official_15f04500d9edaac382bb3d451c8b4198'] = 'Redirecionando...'; +$_MODULE['<{stripe_official}prestashop>stripe_official_86c7338e09e2c3ca2e458da630895e25'] = 'Nenhuma chave API foi fornecida. Entre em contato com o proprietário do site.'; $_MODULE['<{stripe_official}prestashop>stripecards_cd81f9f55969c822377f076017bb3484'] = 'Cartões'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_d3b206d196cd6be3a2764c1fb90b200f'] = 'Supprimer la sélection'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_53c6a96a3df980c3270d6ed82b6f174b'] = 'Souhaitez-vous supprimer les éléments sélectionnés ?'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_b718adec73e04ce3ec720dd11a06a308'] = 'ID'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_49ee3087348e8d44e1feda1917443987'] = 'Nom'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_4c2a8fe7eaf24721cc7a9f0175115bd4'] = 'Message'; @@ -41,48 +54,19 @@ $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_d95fc016a6eee828f434ed5f55504427'] = 'ID de l\'objet'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_44749712dbec183e983dcd78a7736c41'] = 'Date'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_2d8e32e9c23e2a7155c88028b3fbff66'] = 'Paramètres de l\'outil de consignation des processus'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_2ce895700ba5c16bede3b769128d216f'] = 'Ici, vous pouvez modifier la configuration par défaut de ce processus de logs'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_3073ef21c0b326939d5b630edd08cfb6'] = 'Désactiver l\'effacement automatique'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_434ef5977d28afa36e430439de18cbad'] = 'Si désactivé, les journaux seront automatiquement effacés après le délai'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_1607c94671fd5baf4ac06f554b118b2a'] = 'Délai d\'effacement automatique (en jours)'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_71c3e06323cd5a59436ec53afca80c57'] = 'Choisissez le nombre de jours pendant lesquels vous souhaitez conserver les journaux dans la base de données'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_c9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_dcc459e0cef1e36a18a356fbc5789b16'] = 'Effacer tout'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_729a51874fe901b092899e9e8b31c97a'] = 'Êtes-vous sûr(e) ?'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_f51c7af7c02cd3a846d87d97bfaf6b58'] = 'Tous les logs ont été effacés'; -$_MODULE['<{stripe_official}prestashop>admin_tab_order_ce7566d1d08cc094b74cf283cf9c56a5'] = 'Stripe'; -$_MODULE['<{stripe_official}prestashop>my-account-stripe-cards_a46d3e7285f76d2401202f18b0acbcbd'] = 'Meus cartões'; -$_MODULE['<{stripe_official}prestashop>admin_cart_1ab1dfd9dc24ea4729d6c032f7f0342d'] = 'Dados de pagamento'; -$_MODULE['<{stripe_official}prestashop>admin_cart_3d9c6a8d9e9bd14af99a9f4444f602a4'] = 'Data (última atualização)'; -$_MODULE['<{stripe_official}prestashop>admin_cart_24e85d1e652b3681994e9cae2cc1f35a'] = 'ID de pagamento Stripe'; -$_MODULE['<{stripe_official}prestashop>admin_cart_49ee3087348e8d44e1feda1917443987'] = 'Nome'; -$_MODULE['<{stripe_official}prestashop>admin_cart_f0aaaae189e9c7711931a65ffcd22543'] = 'Forma de pagamento'; -$_MODULE['<{stripe_official}prestashop>admin_cart_388fd2767ba1fd2296f536425d106de3'] = 'Valor pago'; -$_MODULE['<{stripe_official}prestashop>admin_cart_76f0ed934de85cc7131910b32ede7714'] = 'Reembolso'; -$_MODULE['<{stripe_official}prestashop>admin_cart_8eea62084ca7e541d918e823422bd82e'] = 'Resultado'; -$_MODULE['<{stripe_official}prestashop>admin_cart_650be61892bf690026089544abbd9d26'] = 'Modo'; -$_MODULE['<{stripe_official}prestashop>admin_cart_c985a711556e2edf5cac28dfbdb43ff0'] = 'Reembolso parcial'; -$_MODULE['<{stripe_official}prestashop>admin_cart_5706de961fb376d701be6e7762d8b09c'] = 'Aguardando'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_1e63d1811556fc2dad106dcbd4217a69'] = 'ID do pagamento'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_7133d45d85f629f4c8abe0e1b3d37942'] = 'Data do pagamento'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_f0aaaae189e9c7711931a65ffcd22543'] = 'Forma de pagamento'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_ccd51debd3d65d453679c150b99a39c0'] = 'Data da autorização'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_3f8c6ecb084eea3b83d659fab7155e86'] = 'Data da captura'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_24fe48030f7d3097d5882535b04c3fa8'] = 'Expirado'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_90cbb08c2e81b8eca5298e2533dbe3d9'] = 'Contestação de pagamento'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_9b12a0ddfdf2b10342c50ed2fe6e5c50'] = 'Confira aqui sua contestação'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_bf49f5bcf72238ecbc0659c3c0c8079f'] = 'Sem contestações'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_e2fe37d9647990819245fadb404c482e'] = 'Validação de vale'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_e2b54a61bf4e56c4a044386b2553ed77'] = 'Vale validado em:'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_2311c8c5e8f44924a3e61c78e2223049'] = 'O vale vence em:'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_9ca4bc48596557840045a7477c803657'] = 'Vous devez spécifier un nombre \"Délai d\'effacement automatique (en jours)\" valide.'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_5988c28d05527a0d0ce8ae3da1134352'] = 'Les paramètres de journal ont été mis à jour avec succès !'; $_MODULE['<{stripe_official}prestashop>main_c2cc7082a89c1ad6631a2f66af5f00c0'] = 'Conexão'; $_MODULE['<{stripe_official}prestashop>main_76f0ed934de85cc7131910b32ede7714'] = 'Reembolso'; -$_MODULE['<{stripe_official}prestashop>refund_2b660da0c521cc6bc51a188bc9f7d084'] = 'Selecione um pedido que você queira reembolsar'; -$_MODULE['<{stripe_official}prestashop>refund_24e85d1e652b3681994e9cae2cc1f35a'] = 'ID de pagamento Stripe'; -$_MODULE['<{stripe_official}prestashop>refund_991bd624dcaff354bd793e4cacbd6ea3'] = 'Localize essa ID na guia da Stripe do pedido que você deseja reembolsar. Ela começa com \"ch_\" ou \"py_\".'; -$_MODULE['<{stripe_official}prestashop>refund_c0a3c3e9b5fbd21c505e082644b2220c'] = 'Reembolso total'; -$_MODULE['<{stripe_official}prestashop>refund_77fd2b4393b379bedd30efcd5df02090'] = 'Reembolso parcial'; -$_MODULE['<{stripe_official}prestashop>refund_fe9cc1bcfa322db8ade8960ddf4bb19c'] = 'Enviamos qualquer reembolso que você faça imediatamente para o banco do cliente.'; -$_MODULE['<{stripe_official}prestashop>refund_2b9689f82101a977f16db0056493a5aa'] = 'O cliente receberá os fundos do reembolso cerca de 2 a 3 dias úteis após o início do processo de reembolso.'; -$_MODULE['<{stripe_official}prestashop>refund_6e5d08adf277f2eb21b257fe74f76ddc'] = 'Os reembolsos levam de 5 a 10 dias para aparecer no extrato do cliente.'; -$_MODULE['<{stripe_official}prestashop>refund_b2f40690858b404ed10e62bdf422c704'] = 'Valor'; -$_MODULE['<{stripe_official}prestashop>refund_f3b5fc873bba0e14e0d8d9851408b2a3'] = 'Insira o valor que deseja reembolsar'; -$_MODULE['<{stripe_official}prestashop>refund_f87db45e2887d485ca31ffae186faae9'] = 'Solicitar reembolso'; $_MODULE['<{stripe_official}prestashop>configuration_e6ad4dd232a1bb7d77852af7fc2e0538'] = '[a @href1@]Crie sua conta Stripe em 10 minutos[/a] e comece a aceitar pagamentos em cartão ou formas de pagamento locais (sem necessidade de contrato adicional/ID de comerciante de seu banco).'; $_MODULE['<{stripe_official}prestashop>configuration_ebd8fbb49032e4992eb5050893dfa1fc'] = 'Conectar com a Stripe'; $_MODULE['<{stripe_official}prestashop>configuration_650be61892bf690026089544abbd9d26'] = 'Modo'; @@ -115,7 +99,7 @@ $_MODULE['<{stripe_official}prestashop>configuration_e150eb523fd98533136e660e3e7862a0'] = 'China UnionPay'; $_MODULE['<{stripe_official}prestashop>configuration_53619d5dc16df90ad84a8958b7121aa8'] = 'JCB'; $_MODULE['<{stripe_official}prestashop>configuration_1f6176c4f26f546cd5424d53fac0f2f8'] = 'Discovers'; -$_MODULE['<{stripe_official}prestashop>configuration_5f07627108d0280b0fd45dd36e73d01f'] = 'Carteiras digitais, como Apple Pay, Google Pay e Microsoft Pay.[br]Para usar o Apple Pay, você aceita os termos de serviço da [a @href1@]Stripe[/a] e da [a @href2@]Apple[/a].'; +$_MODULE['<{stripe_official}prestashop>configuration_0e29ba92a96e3342f6e47f324a0c8857'] = 'Carteiras digitais, ou seja, Apple Pay e Google Pay. [br] Ao usar o Apple Pay, você concorda com os termos de serviço de [a@href1@] Stripe [/a] e [a@href2@] Apple [/a].'; $_MODULE['<{stripe_official}prestashop>configuration_f80b9de6d53dc9db807d2a123c149fc7'] = 'Nunca solicitar o código postal (não recomendado*).'; $_MODULE['<{stripe_official}prestashop>configuration_c99b5f040533a2516fed921947a3b7f4'] = 'Esse dado melhora as taxas de aceitação de cartões emitidos nos Estados Unidos, no Reino Unido e no Canadá.'; $_MODULE['<{stripe_official}prestashop>configuration_8cb12d0aa65678a528d4395dbf3a4138'] = 'Solicitar o nome do titular do cartão'; @@ -140,21 +124,59 @@ $_MODULE['<{stripe_official}prestashop>configuration_93cba07454f06a4a960172bbd6e2a435'] = 'Sim'; $_MODULE['<{stripe_official}prestashop>configuration_0a2c4e503e93bc3135308bb3fadbe0bd'] = 'Primeiro é preciso ativar essas formas de pagamento no [a @href2@]Stripe Dashboard[/a]'; $_MODULE['<{stripe_official}prestashop>configuration_c9cc8cce247e49bae79f15173ce97354'] = 'Salvar'; +$_MODULE['<{stripe_official}prestashop>refund_2b660da0c521cc6bc51a188bc9f7d084'] = 'Selecione um pedido que você queira reembolsar'; +$_MODULE['<{stripe_official}prestashop>refund_24e85d1e652b3681994e9cae2cc1f35a'] = 'ID de pagamento Stripe'; +$_MODULE['<{stripe_official}prestashop>refund_991bd624dcaff354bd793e4cacbd6ea3'] = 'Localize essa ID na guia da Stripe do pedido que você deseja reembolsar. Ela começa com \"ch_\" ou \"py_\".'; +$_MODULE['<{stripe_official}prestashop>refund_c0a3c3e9b5fbd21c505e082644b2220c'] = 'Reembolso total'; +$_MODULE['<{stripe_official}prestashop>refund_77fd2b4393b379bedd30efcd5df02090'] = 'Reembolso parcial'; +$_MODULE['<{stripe_official}prestashop>refund_fe9cc1bcfa322db8ade8960ddf4bb19c'] = 'Enviamos qualquer reembolso que você faça imediatamente para o banco do cliente.'; +$_MODULE['<{stripe_official}prestashop>refund_2b9689f82101a977f16db0056493a5aa'] = 'O cliente receberá os fundos do reembolso cerca de 2 a 3 dias úteis após o início do processo de reembolso.'; +$_MODULE['<{stripe_official}prestashop>refund_6e5d08adf277f2eb21b257fe74f76ddc'] = 'Os reembolsos levam de 5 a 10 dias para aparecer no extrato do cliente.'; +$_MODULE['<{stripe_official}prestashop>refund_b2f40690858b404ed10e62bdf422c704'] = 'Valor'; +$_MODULE['<{stripe_official}prestashop>refund_f3b5fc873bba0e14e0d8d9851408b2a3'] = 'Insira o valor que deseja reembolsar'; +$_MODULE['<{stripe_official}prestashop>refund_f87db45e2887d485ca31ffae186faae9'] = 'Solicitar reembolso'; +$_MODULE['<{stripe_official}prestashop>admin_tab_order_ce7566d1d08cc094b74cf283cf9c56a5'] = 'Stripe'; +$_MODULE['<{stripe_official}prestashop>my-account-stripe-cards_a46d3e7285f76d2401202f18b0acbcbd'] = 'Meus cartões'; +$_MODULE['<{stripe_official}prestashop>admin_cart_1ab1dfd9dc24ea4729d6c032f7f0342d'] = 'Dados de pagamento'; +$_MODULE['<{stripe_official}prestashop>admin_cart_3d9c6a8d9e9bd14af99a9f4444f602a4'] = 'Data (última atualização)'; +$_MODULE['<{stripe_official}prestashop>admin_cart_24e85d1e652b3681994e9cae2cc1f35a'] = 'ID de pagamento Stripe'; +$_MODULE['<{stripe_official}prestashop>admin_cart_49ee3087348e8d44e1feda1917443987'] = 'Nome'; +$_MODULE['<{stripe_official}prestashop>admin_cart_f0aaaae189e9c7711931a65ffcd22543'] = 'Forma de pagamento'; +$_MODULE['<{stripe_official}prestashop>admin_cart_388fd2767ba1fd2296f536425d106de3'] = 'Valor pago'; +$_MODULE['<{stripe_official}prestashop>admin_cart_76f0ed934de85cc7131910b32ede7714'] = 'Reembolso'; +$_MODULE['<{stripe_official}prestashop>admin_cart_8eea62084ca7e541d918e823422bd82e'] = 'Resultado'; +$_MODULE['<{stripe_official}prestashop>admin_cart_650be61892bf690026089544abbd9d26'] = 'Modo'; +$_MODULE['<{stripe_official}prestashop>admin_cart_c985a711556e2edf5cac28dfbdb43ff0'] = 'Reembolso parcial'; +$_MODULE['<{stripe_official}prestashop>admin_cart_5706de961fb376d701be6e7762d8b09c'] = 'Aguardando'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_1e63d1811556fc2dad106dcbd4217a69'] = 'ID do pagamento'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_7133d45d85f629f4c8abe0e1b3d37942'] = 'Data do pagamento'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_f0aaaae189e9c7711931a65ffcd22543'] = 'Forma de pagamento'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_ccd51debd3d65d453679c150b99a39c0'] = 'Data da autorização'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_3f8c6ecb084eea3b83d659fab7155e86'] = 'Data da captura'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_24fe48030f7d3097d5882535b04c3fa8'] = 'Expirado'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_90cbb08c2e81b8eca5298e2533dbe3d9'] = 'Contestação de pagamento'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_9b12a0ddfdf2b10342c50ed2fe6e5c50'] = 'Confira aqui sua contestação'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_bf49f5bcf72238ecbc0659c3c0c8079f'] = 'Sem contestações'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_e2fe37d9647990819245fadb404c482e'] = 'Validação de vale'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_e2b54a61bf4e56c4a044386b2553ed77'] = 'Vale validado em:'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_2311c8c5e8f44924a3e61c78e2223049'] = 'O vale vence em:'; $_MODULE['<{stripe_official}prestashop>payment_form_oxxo_49ee3087348e8d44e1feda1917443987'] = 'Nome'; $_MODULE['<{stripe_official}prestashop>payment_form_oxxo_ce8ae9da5b7cd6c3df2929543a9af92d'] = 'E-mail'; -$_MODULE['<{stripe_official}prestashop>payment_form_ideal_ac23f66a874a7808e300a15f2e94320a'] = 'Pagar com iDEAL'; -$_MODULE['<{stripe_official}prestashop>payment_form_ideal_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar agora'; $_MODULE['<{stripe_official}prestashop>stripe-cards_4e997b9d3b7152f2afeacd96ab1ef1cb'] = 'Meus cartões'; $_MODULE['<{stripe_official}prestashop>stripe-cards_a1fa27779242b4902f7ae3bdd5c6d508'] = 'Tipo'; $_MODULE['<{stripe_official}prestashop>stripe-cards_a44217022190f5734b2f72ba1e4f8a79'] = 'Número do cartão'; $_MODULE['<{stripe_official}prestashop>stripe-cards_b07cc2801693b2e722906a3db3d9c447'] = 'Validade'; $_MODULE['<{stripe_official}prestashop>stripe-cards_f2a6c498fb90ee345d997f888fce3b18'] = 'Excluir'; $_MODULE['<{stripe_official}prestashop>stripe-cards_78560f5a4e1f5716c8fb9d7cb35f56de'] = 'Você ainda não cadastrou um cartão.'; +$_MODULE['<{stripe_official}prestashop>payment_form_bancontact_d536f6cb1304cde5da44c530d3157886'] = 'Pagar com Bancontact'; $_MODULE['<{stripe_official}prestashop>payment_form_sepa_debit_28d20d5ce69c797169658d647110374b'] = 'Pagar com débito automático SEPA'; $_MODULE['<{stripe_official}prestashop>payment_form_sepa_debit_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar agora'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_9d67bee92ea535ba9c7840797966edfa'] = 'Houver um erro no seu pagamento.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Tente outra vez[/a] ou fale com o proprietário do site.'; -$_MODULE['<{stripe_official}prestashop>payment_form_bancontact_d536f6cb1304cde5da44c530d3157886'] = 'Pagar com Bancontact'; +$_MODULE['<{stripe_official}prestashop>payment_info_redirect_f3ee3ad3c8443ee27192d35a7a9d86c9'] = 'Você será redirecionado ao site do banco para finalizar o pagamento.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_3380b659ba0a8b01af98dbe7494c0706'] = 'Parabéns, seu pedido foi concluído e logo será processado.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_77031dd06e26cfdab21b078a37741bb6'] = 'A referência do pedido é [b]@target@[/b]. Você receberá um e-mail de confirmação em breve.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_2a69d95c0cc64162865573233beb3369'] = 'Veja seu vale OXXO [a @href1@]aqui[/a].'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Agradecemos a preferência.'; +$_MODULE['<{stripe_official}prestashop>payment_form_sofort_068bcd34a6ded96b1805ca0b9a6745bb'] = 'Pagar com SOFORT'; $_MODULE['<{stripe_official}prestashop>payment_form_card_f73a8b5c0b42c88867a7650fc6fde345'] = 'Antes de continuar, verifique se você aceita nossos Termos de Serviço'; $_MODULE['<{stripe_official}prestashop>payment_form_card_d9b1a32393ffc57f2ee4f07626e76d46'] = 'Clique no botão acima para pagar agora com o cartão salvo no seu dispositivo. Se preferir, preencha os dados do cartão abaixo e confirme no final da página.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_d9a3493a581e1b2900c5eb45dcb0dc02'] = 'Nome do titular do cartão'; @@ -166,28 +188,32 @@ $_MODULE['<{stripe_official}prestashop>payment_form_card_96e7de5dba463d377178948e998cdf27'] = 'Os dados do seu cartão são protegidos com os padrões de segurança PCI DSS v.3.2.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_48334cb46587c0571f12ac31e8e9364a'] = 'Os dados do seu cartão serão salvos automaticamente para a próxima compra.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar agora'; -$_MODULE['<{stripe_official}prestashop>payment_info_redirect_f3ee3ad3c8443ee27192d35a7a9d86c9'] = 'Você será redirecionado ao site do banco para finalizar o pagamento.'; -$_MODULE['<{stripe_official}prestashop>payment_form_giropay_32e26982dda43a14285657baee320523'] = 'Pagar com Giropay'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_9d67bee92ea535ba9c7840797966edfa'] = 'Houver um erro no seu pagamento.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Tente outra vez[/a] ou fale com o proprietário do site.'; -$_MODULE['<{stripe_official}prestashop>payment_form_p24_751e90522b3385322c4c34b6f73847d2'] = 'Pagar com P24'; -$_MODULE['<{stripe_official}prestashop>payment_form_fpx_74253765ffa5a6b91d758c7df4d3c871'] = 'Pagar com FPX'; -$_MODULE['<{stripe_official}prestashop>payment_form_fpx_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar agora'; -$_MODULE['<{stripe_official}prestashop>payment_form_sofort_068bcd34a6ded96b1805ca0b9a6745bb'] = 'Pagar com SOFORT'; -$_MODULE['<{stripe_official}prestashop>payment_form_save_card_6e9c53f6d39367724e9b996b3ea9ef22'] = 'Pagar no cartão:'; -$_MODULE['<{stripe_official}prestashop>payment_form_save_card_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar agora'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_3380b659ba0a8b01af98dbe7494c0706'] = 'Parabéns, seu pedido foi concluído e logo será processado.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_77031dd06e26cfdab21b078a37741bb6'] = 'A referência do pedido é [b]@target@[/b]. Você receberá um e-mail de confirmação em breve.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_2a69d95c0cc64162865573233beb3369'] = 'Veja seu vale OXXO [a @href1@]aqui[/a].'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Agradecemos a preferência.'; -$_MODULE['<{stripe_official}prestashop>payment_form_alipay_47e1e580d173b931fdfdeb6bb5f14848'] = 'Pagar com Alipay'; +$_MODULE['<{stripe_official}prestashop>payment_form_ideal_ac23f66a874a7808e300a15f2e94320a'] = 'Pagar com iDEAL'; +$_MODULE['<{stripe_official}prestashop>payment_form_ideal_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar agora'; +$_MODULE['<{stripe_official}prestashop>payment_form_eps_c446bbd08309aff37eee1e0c43b19cde'] = 'Pagar com EPS'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_a46d3e7285f76d2401202f18b0acbcbd'] = 'Meus cartões'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_a1fa27779242b4902f7ae3bdd5c6d508'] = 'Tipo'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_a44217022190f5734b2f72ba1e4f8a79'] = 'Número do cartão'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_b07cc2801693b2e722906a3db3d9c447'] = 'Validade'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_f2a6c498fb90ee345d997f888fce3b18'] = 'Excluir'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_78560f5a4e1f5716c8fb9d7cb35f56de'] = 'Você ainda não cadastrou um cartão.'; -$_MODULE['<{stripe_official}prestashop>payment_form_eps_c446bbd08309aff37eee1e0c43b19cde'] = 'Pagar com EPS'; +$_MODULE['<{stripe_official}prestashop>payment_form_p24_751e90522b3385322c4c34b6f73847d2'] = 'Pagar com P24'; +$_MODULE['<{stripe_official}prestashop>payment_form_save_card_6e9c53f6d39367724e9b996b3ea9ef22'] = 'Pagar no cartão:'; +$_MODULE['<{stripe_official}prestashop>payment_form_save_card_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar agora'; +$_MODULE['<{stripe_official}prestashop>payment_form_giropay_32e26982dda43a14285657baee320523'] = 'Pagar com Giropay'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_9d67bee92ea535ba9c7840797966edfa'] = 'Houver um erro no seu pagamento.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Tente outra vez[/a] ou fale com o proprietário do site.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_3380b659ba0a8b01af98dbe7494c0706'] = 'Félicitations, votre commande est validée et sera traitée sous peu.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_2a69d95c0cc64162865573233beb3369'] = 'Vous pouvez accéder à votre coupon OXXO [a @href1@]ici[/a].'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Merci de votre confiance.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_3380b659ba0a8b01af98dbe7494c0706'] = 'Félicitations, votre commande est validée et sera traitée sous peu.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_2a69d95c0cc64162865573233beb3369'] = 'Vous pouvez accéder à votre coupon OXXO [a @href1@]ici[/a].'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Merci de votre confiance.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_9d67bee92ea535ba9c7840797966edfa'] = 'Houver um erro no seu pagamento.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Tente outra vez[/a] ou fale com o proprietário do site.'; +$_MODULE['<{stripe_official}prestashop>payment_form_alipay_47e1e580d173b931fdfdeb6bb5f14848'] = 'Pagar com Alipay'; +$_MODULE['<{stripe_official}prestashop>payment_form_fpx_74253765ffa5a6b91d758c7df4d3c871'] = 'Pagar com FPX'; +$_MODULE['<{stripe_official}prestashop>payment_form_fpx_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar agora'; $_MODULE['<{stripe_official}prestashop>configurationactions_187b101d0358396a634514ea228616d5'] = 'Chaves de API de produção fornecidas em vez de chaves de API de teste'; $_MODULE['<{stripe_official}prestashop>configurationactions_2df5570b8a0e0c076571d1213f7f901e'] = 'Os campos de ID do cliente e chave secreta são obrigatórios'; $_MODULE['<{stripe_official}prestashop>configurationactions_5fba3565c1b6638ac41f7627066aaa58'] = 'Chaves de API de teste fornecidas em vez de chaves de API em tempo real'; diff --git a/translations/de.php b/translations/de.php old mode 100644 new mode 100755 index 68f2f59..50a8b4a --- a/translations/de.php +++ b/translations/de.php @@ -19,7 +19,18 @@ $_MODULE['<{stripe_official}prestashop>stripe_official_7349826060a4851f4835aade49af34c7'] = 'Stripe-Zahlungsmodul'; $_MODULE['<{stripe_official}prestashop>stripe_official_7c716e01a03b426976692f4a7a0d80be'] = 'Ermöglichen Sie jetzt Zahlungen mit Stripe – direkt in Ihrem Shop!'; $_MODULE['<{stripe_official}prestashop>stripe_official_876f23178c29dc2552c0b48bf23cd9bd'] = 'Sind Sie sicher, dass Sie das Modul deinstallieren möchten?'; -$_MODULE['<{stripe_official}prestashop>stripe_official_6341ee14cd6d47787171f68d27f1f41b'] = 'Payment by Stripe'; +$_MODULE['<{stripe_official}prestashop>stripe_official_6341ee14cd6d47787171f68d27f1f41b'] = 'Zahlung per Stripe'; +$_MODULE['<{stripe_official}prestashop>stripe_official_a6ee78c840497aed8a81b6164d4224e6'] = 'Sie müssen SSL im Store aktivieren, wenn Sie dieses Modul in der Produktion verwenden möchten.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_66f67e1a8f01161f2009c2ed39c3cb1e'] = 'Sie haben das Limit von 16 Webhook-Endpunkten erreicht, die in Ihrem Dashboard Stripe für dieses Konto registriert sind. Bitte entfernen Sie eine davon, wenn Sie diese Domain registrieren möchten.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_69e6a2456656fcc3c9a79452ef3a7928'] = 'Ihre TLS-Version wird nicht unterstützt. Sie müssen Ihre Integration aktualisieren. Bitte überprüfen Sie die FAQ, wenn Sie nicht wissen, wie es geht.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_47daed1af40eaa1fb3c750322137815d'] = 'Die Webhook-Konfiguration kann in PrestaShop nicht gefunden werden. Klicken Sie auf die Schaltfläche Speichern, um das Problem zu beheben. Auf Stripe wird ein neuer Webhook erstellt und dann in PrestaShop gespeichert.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_4684c4310f6bd9917b3c079bc38fd335'] = 'Die Webhook-URL-Konfiguration ist falsch. Klicken Sie auf die Schaltfläche Speichern, um das Problem zu beheben. Die Webhook-Konfiguration wird korrigiert.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_572bde45cccf4cde600e2a846cfe8085'] = 'Aktuelle Webhook-URL :'; +$_MODULE['<{stripe_official}prestashop>stripe_official_12632987bdd5031845a591acdf5faa40'] = 'Erwartete Webhook-URL :'; +$_MODULE['<{stripe_official}prestashop>stripe_official_2226fcd706ac6ba242dc3381636cf74b'] = 'Die Konfiguration der Webhook-Ereignisse ist falsch. Klicken Sie auf die Schaltfläche Speichern, um das Problem zu beheben. Die Webhook-Konfiguration wird korrigiert.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_4047173bbb1dd67cd5e877f7736c1e86'] = 'Aktuelle Webhook-Ereignisse:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_78b8b4d922d4061d31e55caece729f8b'] = 'Erwartete Webhook-Ereignisse:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_21e8380e65bb6a9cc714dae46e2b6dbf'] = 'Auf die Webhook-Konfiguration kann nicht zugegriffen werden. Klicken Sie auf die Schaltfläche Speichern, um das Problem zu beheben. Auf Stripe wird ein neuer Webhook erstellt.'; $_MODULE['<{stripe_official}prestashop>stripe_official_b32006c07b70b4db49be9fcc111b074f'] = 'Schlüssel sind leer.'; $_MODULE['<{stripe_official}prestashop>stripe_official_3e5298c1c5d8c871334c4e3994481f90'] = 'Die Stripe-Zahlungs-ID darf nicht leer sein.'; $_MODULE['<{stripe_official}prestashop>stripe_official_eb804bebeffc55fb161165d50bcf74f8'] = 'Unbekannte Stripe-Zahlungs-ID.'; @@ -31,8 +42,10 @@ $_MODULE['<{stripe_official}prestashop>stripe_official_fd2bdc826d325902e451236cf6fd774e'] = 'Wird verarbeitet …'; $_MODULE['<{stripe_official}prestashop>stripe_official_b24ee2c7cb1734370b544eb4e6cdc2b6'] = 'Akzeptieren Sie bitte die AGB'; $_MODULE['<{stripe_official}prestashop>stripe_official_15f04500d9edaac382bb3d451c8b4198'] = 'Wird weitergeleitet ...'; +$_MODULE['<{stripe_official}prestashop>stripe_official_86c7338e09e2c3ca2e458da630895e25'] = 'Es wurden keine API-Schlüssel bereitgestellt. Bitte wenden Sie sich an den Inhaber der Website.'; $_MODULE['<{stripe_official}prestashop>stripecards_cd81f9f55969c822377f076017bb3484'] = 'Karten'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_d3b206d196cd6be3a2764c1fb90b200f'] = 'Auswahl löschen'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_53c6a96a3df980c3270d6ed82b6f174b'] = 'Möchten Sie die ausgewählten Elemente löschen?'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_b718adec73e04ce3ec720dd11a06a308'] = 'ID'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_49ee3087348e8d44e1feda1917443987'] = 'Name'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_4c2a8fe7eaf24721cc7a9f0175115bd4'] = 'Nachricht'; @@ -41,48 +54,19 @@ $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_d95fc016a6eee828f434ed5f55504427'] = 'Objekt-ID'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_44749712dbec183e983dcd78a7736c41'] = 'Datum'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_2d8e32e9c23e2a7155c88028b3fbff66'] = 'Einstellungen der Prozess-Logs'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_2ce895700ba5c16bede3b769128d216f'] = 'Hier können Sie die Standardkonfiguration für diesen Process Logger ändern'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_3073ef21c0b326939d5b630edd08cfb6'] = 'Automatisches Löschen deaktivieren'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_434ef5977d28afa36e430439de18cbad'] = 'Wenn deaktiviert, werden Protokolle nach der Verzögerung automatisch gelöscht'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_1607c94671fd5baf4ac06f554b118b2a'] = 'Verzögerung beim automatischen Löschen (in Tagen)'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_71c3e06323cd5a59436ec53afca80c57'] = 'Wählen Sie die Anzahl der Tage, die Sie Protokolle in der Datenbank aufbewahren möchten'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_c9cc8cce247e49bae79f15173ce97354'] = 'Speichern'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_dcc459e0cef1e36a18a356fbc5789b16'] = 'Alle löschen'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_729a51874fe901b092899e9e8b31c97a'] = 'Sind Sie sicher?'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_f51c7af7c02cd3a846d87d97bfaf6b58'] = 'Alle Logs wurden gelöscht.'; -$_MODULE['<{stripe_official}prestashop>admin_tab_order_ce7566d1d08cc094b74cf283cf9c56a5'] = 'Stripe'; -$_MODULE['<{stripe_official}prestashop>my-account-stripe-cards_a46d3e7285f76d2401202f18b0acbcbd'] = 'Meine Karten'; -$_MODULE['<{stripe_official}prestashop>admin_cart_1ab1dfd9dc24ea4729d6c032f7f0342d'] = 'Zahlungsinformationen'; -$_MODULE['<{stripe_official}prestashop>admin_cart_3d9c6a8d9e9bd14af99a9f4444f602a4'] = 'Datum (letzte Aktualisierung)'; -$_MODULE['<{stripe_official}prestashop>admin_cart_24e85d1e652b3681994e9cae2cc1f35a'] = 'Stripe-Zahlungs-ID'; -$_MODULE['<{stripe_official}prestashop>admin_cart_49ee3087348e8d44e1feda1917443987'] = 'Name'; -$_MODULE['<{stripe_official}prestashop>admin_cart_f0aaaae189e9c7711931a65ffcd22543'] = 'Zahlungsmethode'; -$_MODULE['<{stripe_official}prestashop>admin_cart_388fd2767ba1fd2296f536425d106de3'] = 'Gezahlter Betrag'; -$_MODULE['<{stripe_official}prestashop>admin_cart_76f0ed934de85cc7131910b32ede7714'] = 'Rückerstattung'; -$_MODULE['<{stripe_official}prestashop>admin_cart_8eea62084ca7e541d918e823422bd82e'] = 'Ergebnis'; -$_MODULE['<{stripe_official}prestashop>admin_cart_650be61892bf690026089544abbd9d26'] = 'Modus'; -$_MODULE['<{stripe_official}prestashop>admin_cart_c985a711556e2edf5cac28dfbdb43ff0'] = 'Teilweise Rückerstattung'; -$_MODULE['<{stripe_official}prestashop>admin_cart_5706de961fb376d701be6e7762d8b09c'] = 'Warten'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_1e63d1811556fc2dad106dcbd4217a69'] = 'Zahlungs-ID'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_7133d45d85f629f4c8abe0e1b3d37942'] = 'Zahlungsdatum'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_f0aaaae189e9c7711931a65ffcd22543'] = 'Zahlungsmethode'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_ccd51debd3d65d453679c150b99a39c0'] = 'Autorisierungsdatum'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_3f8c6ecb084eea3b83d659fab7155e86'] = 'Erfassungsdatum'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_24fe48030f7d3097d5882535b04c3fa8'] = 'Abgelaufen'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_90cbb08c2e81b8eca5298e2533dbe3d9'] = 'Angefochtene Zahlung'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_9b12a0ddfdf2b10342c50ed2fe6e5c50'] = 'prüfen Sie die angefochtene Zahlung hier'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_bf49f5bcf72238ecbc0659c3c0c8079f'] = 'Keine angefochtenen Zahlungen'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_e2fe37d9647990819245fadb404c482e'] = 'Gutscheinvalidierung'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_e2b54a61bf4e56c4a044386b2553ed77'] = 'Gutschein validiert am:'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_2311c8c5e8f44924a3e61c78e2223049'] = 'Gutschein läuft ab am:'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_9ca4bc48596557840045a7477c803657'] = 'Sie müssen eine gültige Zahl für die \"Verzögerung des automatischen Löschens (in Tagen)\" angeben.'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_5988c28d05527a0d0ce8ae3da1134352'] = 'Protokollparameter wurden erfolgreich aktualisiert!'; $_MODULE['<{stripe_official}prestashop>main_c2cc7082a89c1ad6631a2f66af5f00c0'] = 'Verbindung'; $_MODULE['<{stripe_official}prestashop>main_76f0ed934de85cc7131910b32ede7714'] = 'Rückerstattung'; -$_MODULE['<{stripe_official}prestashop>refund_2b660da0c521cc6bc51a188bc9f7d084'] = 'Wählen Sie eine Bestellung, die Sie zurückerstatten möchten.'; -$_MODULE['<{stripe_official}prestashop>refund_24e85d1e652b3681994e9cae2cc1f35a'] = 'Stripe-Zahlungs-ID'; -$_MODULE['<{stripe_official}prestashop>refund_991bd624dcaff354bd793e4cacbd6ea3'] = 'Diese ID finden Sie auf der Stripe-Registerkarte der Bestellung, die Sie zurückerstatten möchten. Sie beginnt mit „ch_“ oder „py_“.'; -$_MODULE['<{stripe_official}prestashop>refund_c0a3c3e9b5fbd21c505e082644b2220c'] = 'Vollständige Rückerstattung'; -$_MODULE['<{stripe_official}prestashop>refund_77fd2b4393b379bedd30efcd5df02090'] = 'Teilweise Rückerstattung'; -$_MODULE['<{stripe_official}prestashop>refund_fe9cc1bcfa322db8ade8960ddf4bb19c'] = 'Wir werden jegliche Rückerstattung, die Sie vornehmen möchten, sofort an die Bank Ihres Kunden/Ihrer Kundin übermitteln.'; -$_MODULE['<{stripe_official}prestashop>refund_2b9689f82101a977f16db0056493a5aa'] = 'Ihre Kunden/Kundinnen erhalten dann die zurückerstatteten Gelder innerhalb von zwei bis drei Werktagen, nachdem die Rückerstattung veranlasst wurde.'; -$_MODULE['<{stripe_official}prestashop>refund_6e5d08adf277f2eb21b257fe74f76ddc'] = 'Rückerstattungen werden in der Regel innerhalb von fünf bis zehn Tagen auf dem Kontoauszug des Kunden/der Kundin angezeigt.'; -$_MODULE['<{stripe_official}prestashop>refund_b2f40690858b404ed10e62bdf422c704'] = 'Betrag'; -$_MODULE['<{stripe_official}prestashop>refund_f3b5fc873bba0e14e0d8d9851408b2a3'] = 'Bitte geben Sie den Betrag ein, den Sie zurückerstatten möchten.'; -$_MODULE['<{stripe_official}prestashop>refund_f87db45e2887d485ca31ffae186faae9'] = 'Rückerstattung anfordern'; $_MODULE['<{stripe_official}prestashop>configuration_e6ad4dd232a1bb7d77852af7fc2e0538'] = '[a @href1@]Richten Sie Ihr Stripe-Konto in nur zehn Minuten ein[/a] und beginnen Sie sofort mit dem Akzeptieren von Kartenzahlungen sowie lokalen Zahlungsmethoden (keine zusätzliche Vertrags-/Händler-ID von Ihrer Bank erforderlich).'; $_MODULE['<{stripe_official}prestashop>configuration_ebd8fbb49032e4992eb5050893dfa1fc'] = 'Mit Stripe verbinden'; $_MODULE['<{stripe_official}prestashop>configuration_650be61892bf690026089544abbd9d26'] = 'Modus'; @@ -115,7 +99,7 @@ $_MODULE['<{stripe_official}prestashop>configuration_e150eb523fd98533136e660e3e7862a0'] = 'China UnionPay'; $_MODULE['<{stripe_official}prestashop>configuration_53619d5dc16df90ad84a8958b7121aa8'] = 'JCB'; $_MODULE['<{stripe_official}prestashop>configuration_1f6176c4f26f546cd5424d53fac0f2f8'] = 'Discovers'; -$_MODULE['<{stripe_official}prestashop>configuration_5f07627108d0280b0fd45dd36e73d01f'] = 'Gehen Sie in Ihrem Stripe-Dashboard zu den [a @href1@]Einstellungen für Zahlungsmethoden[/a] und aktivieren die gewünschten Zahlungsmethoden.'; +$_MODULE['<{stripe_official}prestashop>configuration_0e29ba92a96e3342f6e47f324a0c8857'] = 'Digitale Geldbörsen, d. h. Apple Pay und Google Pay.[br]Durch die Nutzung von Apple Pay stimmen Sie den Nutzungsbedingungen von [a @href1@]Stripe[/a] und [a @href2@]Apple[/a] zu.'; $_MODULE['<{stripe_official}prestashop>configuration_f80b9de6d53dc9db807d2a123c149fc7'] = 'Die Postleitzahl niemals erfassen (nicht empfohlen*).'; $_MODULE['<{stripe_official}prestashop>configuration_c99b5f040533a2516fed921947a3b7f4'] = 'Anhand dieser Informationen werden die Akzeptanzraten für Karten verbessert, die in den Vereinigten Staaten, im Vereinigten Königreich und in Kanada ausgestellt wurden.'; $_MODULE['<{stripe_official}prestashop>configuration_8cb12d0aa65678a528d4395dbf3a4138'] = 'Den Namen des Karteninhabers/der Karteninhaberin erfassen'; @@ -140,21 +124,59 @@ $_MODULE['<{stripe_official}prestashop>configuration_93cba07454f06a4a960172bbd6e2a435'] = 'Ja'; $_MODULE['<{stripe_official}prestashop>configuration_0a2c4e503e93bc3135308bb3fadbe0bd'] = 'Zuerst müssen Sie diese Zahlungsmethoden in Ihrem [a @href2@]Stripe-Dashboard[/a] aktivieren.'; $_MODULE['<{stripe_official}prestashop>configuration_c9cc8cce247e49bae79f15173ce97354'] = 'Speichern'; +$_MODULE['<{stripe_official}prestashop>refund_2b660da0c521cc6bc51a188bc9f7d084'] = 'Wählen Sie eine Bestellung, die Sie zurückerstatten möchten.'; +$_MODULE['<{stripe_official}prestashop>refund_24e85d1e652b3681994e9cae2cc1f35a'] = 'Stripe-Zahlungs-ID'; +$_MODULE['<{stripe_official}prestashop>refund_991bd624dcaff354bd793e4cacbd6ea3'] = 'Diese ID finden Sie auf der Stripe-Registerkarte der Bestellung, die Sie zurückerstatten möchten. Sie beginnt mit „ch_“ oder „py_“.'; +$_MODULE['<{stripe_official}prestashop>refund_c0a3c3e9b5fbd21c505e082644b2220c'] = 'Vollständige Rückerstattung'; +$_MODULE['<{stripe_official}prestashop>refund_77fd2b4393b379bedd30efcd5df02090'] = 'Teilweise Rückerstattung'; +$_MODULE['<{stripe_official}prestashop>refund_fe9cc1bcfa322db8ade8960ddf4bb19c'] = 'Wir werden jegliche Rückerstattung, die Sie vornehmen möchten, sofort an die Bank Ihres Kunden/Ihrer Kundin übermitteln.'; +$_MODULE['<{stripe_official}prestashop>refund_2b9689f82101a977f16db0056493a5aa'] = 'Ihre Kunden/Kundinnen erhalten dann die zurückerstatteten Gelder innerhalb von zwei bis drei Werktagen, nachdem die Rückerstattung veranlasst wurde.'; +$_MODULE['<{stripe_official}prestashop>refund_6e5d08adf277f2eb21b257fe74f76ddc'] = 'Rückerstattungen werden in der Regel innerhalb von fünf bis zehn Tagen auf dem Kontoauszug des Kunden/der Kundin angezeigt.'; +$_MODULE['<{stripe_official}prestashop>refund_b2f40690858b404ed10e62bdf422c704'] = 'Betrag'; +$_MODULE['<{stripe_official}prestashop>refund_f3b5fc873bba0e14e0d8d9851408b2a3'] = 'Bitte geben Sie den Betrag ein, den Sie zurückerstatten möchten.'; +$_MODULE['<{stripe_official}prestashop>refund_f87db45e2887d485ca31ffae186faae9'] = 'Rückerstattung anfordern'; +$_MODULE['<{stripe_official}prestashop>admin_tab_order_ce7566d1d08cc094b74cf283cf9c56a5'] = 'Stripe'; +$_MODULE['<{stripe_official}prestashop>my-account-stripe-cards_a46d3e7285f76d2401202f18b0acbcbd'] = 'Meine Karten'; +$_MODULE['<{stripe_official}prestashop>admin_cart_1ab1dfd9dc24ea4729d6c032f7f0342d'] = 'Zahlungsinformationen'; +$_MODULE['<{stripe_official}prestashop>admin_cart_3d9c6a8d9e9bd14af99a9f4444f602a4'] = 'Datum (letzte Aktualisierung)'; +$_MODULE['<{stripe_official}prestashop>admin_cart_24e85d1e652b3681994e9cae2cc1f35a'] = 'Stripe-Zahlungs-ID'; +$_MODULE['<{stripe_official}prestashop>admin_cart_49ee3087348e8d44e1feda1917443987'] = 'Name'; +$_MODULE['<{stripe_official}prestashop>admin_cart_f0aaaae189e9c7711931a65ffcd22543'] = 'Zahlungsmethode'; +$_MODULE['<{stripe_official}prestashop>admin_cart_388fd2767ba1fd2296f536425d106de3'] = 'Gezahlter Betrag'; +$_MODULE['<{stripe_official}prestashop>admin_cart_76f0ed934de85cc7131910b32ede7714'] = 'Rückerstattung'; +$_MODULE['<{stripe_official}prestashop>admin_cart_8eea62084ca7e541d918e823422bd82e'] = 'Ergebnis'; +$_MODULE['<{stripe_official}prestashop>admin_cart_650be61892bf690026089544abbd9d26'] = 'Modus'; +$_MODULE['<{stripe_official}prestashop>admin_cart_c985a711556e2edf5cac28dfbdb43ff0'] = 'Teilweise Rückerstattung'; +$_MODULE['<{stripe_official}prestashop>admin_cart_5706de961fb376d701be6e7762d8b09c'] = 'Warten'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_1e63d1811556fc2dad106dcbd4217a69'] = 'Zahlungs-ID'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_7133d45d85f629f4c8abe0e1b3d37942'] = 'Zahlungsdatum'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_f0aaaae189e9c7711931a65ffcd22543'] = 'Zahlungsmethode'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_ccd51debd3d65d453679c150b99a39c0'] = 'Autorisierungsdatum'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_3f8c6ecb084eea3b83d659fab7155e86'] = 'Erfassungsdatum'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_24fe48030f7d3097d5882535b04c3fa8'] = 'Abgelaufen'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_90cbb08c2e81b8eca5298e2533dbe3d9'] = 'Angefochtene Zahlung'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_9b12a0ddfdf2b10342c50ed2fe6e5c50'] = 'prüfen Sie die angefochtene Zahlung hier'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_bf49f5bcf72238ecbc0659c3c0c8079f'] = 'Keine angefochtenen Zahlungen'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_e2fe37d9647990819245fadb404c482e'] = 'Gutscheinvalidierung'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_e2b54a61bf4e56c4a044386b2553ed77'] = 'Gutschein validiert am:'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_2311c8c5e8f44924a3e61c78e2223049'] = 'Gutschein läuft ab am:'; $_MODULE['<{stripe_official}prestashop>payment_form_oxxo_49ee3087348e8d44e1feda1917443987'] = 'Name'; $_MODULE['<{stripe_official}prestashop>payment_form_oxxo_ce8ae9da5b7cd6c3df2929543a9af92d'] = 'E-Mail'; -$_MODULE['<{stripe_official}prestashop>payment_form_ideal_ac23f66a874a7808e300a15f2e94320a'] = 'Mit iDeal zahlen'; -$_MODULE['<{stripe_official}prestashop>payment_form_ideal_eeceac1af4e7620894d6d2083921bb73'] = 'Jetzt kaufen'; $_MODULE['<{stripe_official}prestashop>stripe-cards_4e997b9d3b7152f2afeacd96ab1ef1cb'] = 'Meine Karten'; $_MODULE['<{stripe_official}prestashop>stripe-cards_a1fa27779242b4902f7ae3bdd5c6d508'] = 'Typ'; $_MODULE['<{stripe_official}prestashop>stripe-cards_a44217022190f5734b2f72ba1e4f8a79'] = 'Kartennummer'; $_MODULE['<{stripe_official}prestashop>stripe-cards_b07cc2801693b2e722906a3db3d9c447'] = 'Gültigkeit'; $_MODULE['<{stripe_official}prestashop>stripe-cards_f2a6c498fb90ee345d997f888fce3b18'] = 'Löschen'; $_MODULE['<{stripe_official}prestashop>stripe-cards_78560f5a4e1f5716c8fb9d7cb35f56de'] = 'Sie haben noch keine Karte registriert.'; +$_MODULE['<{stripe_official}prestashop>payment_form_bancontact_d536f6cb1304cde5da44c530d3157886'] = 'Mit Bancontact zahlen'; $_MODULE['<{stripe_official}prestashop>payment_form_sepa_debit_28d20d5ce69c797169658d647110374b'] = 'Mit SEPA-Lastschrift zahlen'; $_MODULE['<{stripe_official}prestashop>payment_form_sepa_debit_eeceac1af4e7620894d6d2083921bb73'] = 'Jetzt kaufen'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_9d67bee92ea535ba9c7840797966edfa'] = 'Bei der Zahlung ist ein Fehler aufgetreten.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = 'Bitte [a @href1@]versuchen Sie es erneut[/a] oder wenden Sie sich an den Besitzer der Website.'; -$_MODULE['<{stripe_official}prestashop>payment_form_bancontact_d536f6cb1304cde5da44c530d3157886'] = 'Mit Bancontact zahlen'; +$_MODULE['<{stripe_official}prestashop>payment_info_redirect_f3ee3ad3c8443ee27192d35a7a9d86c9'] = 'Sie werden zur Bankseite weitergeleitet, um Ihre Bezahlung abzuschließen.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_3380b659ba0a8b01af98dbe7494c0706'] = 'Glückwunsch, Ihre Bestellung ist abgeschlossen und wird in Kürze bearbeitet.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_77031dd06e26cfdab21b078a37741bb6'] = 'Ihre Bestellreferenz ist [b]@target@[/b]. Sie erhalten in Kürze eine Bestätigungs-E-Mail.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_2a69d95c0cc64162865573233beb3369'] = 'Sie können Ihren OXXO-Gutschein [a @href1@]hier[/a] anzeigen.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Wir bedanken uns für Ihr Vertrauen.'; +$_MODULE['<{stripe_official}prestashop>payment_form_sofort_068bcd34a6ded96b1805ca0b9a6745bb'] = 'Mit SOFORT zahlen'; $_MODULE['<{stripe_official}prestashop>payment_form_card_f73a8b5c0b42c88867a7650fc6fde345'] = 'Bevor Sie fortfahren können, müssen Sie unsere allgemeinen Geschäftsbedingungen akzeptieren.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_d9b1a32393ffc57f2ee4f07626e76d46'] = 'Zahlen Sie jetzt mit der Karte, die in Ihrem Gerät gespeichert ist, indem Sie auf die Schaltfläche oben klicken. Alternativ können Sie die Kartenangaben unten eingeben und am Ende der Seite bestätigen.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_d9a3493a581e1b2900c5eb45dcb0dc02'] = 'Name des Karteninhabers/der Karteninhaberin'; @@ -166,28 +188,32 @@ $_MODULE['<{stripe_official}prestashop>payment_form_card_96e7de5dba463d377178948e998cdf27'] = 'Ihre Kartenangaben werden mittels der Sicherheitsstandards PCI DSS v3.2 geschützt.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_48334cb46587c0571f12ac31e8e9364a'] = 'Ihre Kartenangaben werden automatisch für Ihren nächsten Kauf gespeichert.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_eeceac1af4e7620894d6d2083921bb73'] = 'Jetzt kaufen'; -$_MODULE['<{stripe_official}prestashop>payment_info_redirect_f3ee3ad3c8443ee27192d35a7a9d86c9'] = 'Sie werden zur Bankseite weitergeleitet, um Ihre Bezahlung abzuschließen.'; -$_MODULE['<{stripe_official}prestashop>payment_form_giropay_32e26982dda43a14285657baee320523'] = 'Mit Giropay zahlen'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_9d67bee92ea535ba9c7840797966edfa'] = 'Bei der Zahlung ist ein Fehler aufgetreten.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = 'Bitte [a @href1@]versuchen Sie es erneut[/a] oder wenden Sie sich an den Besitzer der Website.'; -$_MODULE['<{stripe_official}prestashop>payment_form_p24_751e90522b3385322c4c34b6f73847d2'] = 'Mit P24 zahlen'; -$_MODULE['<{stripe_official}prestashop>payment_form_fpx_74253765ffa5a6b91d758c7df4d3c871'] = 'Mit FPX zahlen'; -$_MODULE['<{stripe_official}prestashop>payment_form_fpx_eeceac1af4e7620894d6d2083921bb73'] = 'Jetzt kaufen'; -$_MODULE['<{stripe_official}prestashop>payment_form_sofort_068bcd34a6ded96b1805ca0b9a6745bb'] = 'Mit SOFORT zahlen'; -$_MODULE['<{stripe_official}prestashop>payment_form_save_card_6e9c53f6d39367724e9b996b3ea9ef22'] = 'Mit Karte zahlen:'; -$_MODULE['<{stripe_official}prestashop>payment_form_save_card_eeceac1af4e7620894d6d2083921bb73'] = 'Jetzt kaufen'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_3380b659ba0a8b01af98dbe7494c0706'] = 'Glückwunsch, Ihre Bestellung ist abgeschlossen und wird in Kürze bearbeitet.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_77031dd06e26cfdab21b078a37741bb6'] = 'Ihre Bestellreferenz ist [b]@target@[/b]. Sie erhalten in Kürze eine Bestätigungs-E-Mail.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_2a69d95c0cc64162865573233beb3369'] = 'Sie können Ihren OXXO-Gutschein [a @href1@]hier[/a] anzeigen.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Wir bedanken uns für Ihr Vertrauen.'; -$_MODULE['<{stripe_official}prestashop>payment_form_alipay_47e1e580d173b931fdfdeb6bb5f14848'] = 'Mit Alipay zahlen'; +$_MODULE['<{stripe_official}prestashop>payment_form_ideal_ac23f66a874a7808e300a15f2e94320a'] = 'Mit iDeal zahlen'; +$_MODULE['<{stripe_official}prestashop>payment_form_ideal_eeceac1af4e7620894d6d2083921bb73'] = 'Jetzt kaufen'; +$_MODULE['<{stripe_official}prestashop>payment_form_eps_c446bbd08309aff37eee1e0c43b19cde'] = 'Mit EPS zahlen'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_a46d3e7285f76d2401202f18b0acbcbd'] = 'Meine Karten'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_a1fa27779242b4902f7ae3bdd5c6d508'] = 'Typ'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_a44217022190f5734b2f72ba1e4f8a79'] = 'Kartennummer'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_b07cc2801693b2e722906a3db3d9c447'] = 'Gültigkeit'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_f2a6c498fb90ee345d997f888fce3b18'] = 'Löschen'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_78560f5a4e1f5716c8fb9d7cb35f56de'] = 'Sie haben noch keine Karte registriert.'; -$_MODULE['<{stripe_official}prestashop>payment_form_eps_c446bbd08309aff37eee1e0c43b19cde'] = 'Mit EPS zahlen'; +$_MODULE['<{stripe_official}prestashop>payment_form_p24_751e90522b3385322c4c34b6f73847d2'] = 'Mit P24 zahlen'; +$_MODULE['<{stripe_official}prestashop>payment_form_save_card_6e9c53f6d39367724e9b996b3ea9ef22'] = 'Mit Karte zahlen:'; +$_MODULE['<{stripe_official}prestashop>payment_form_save_card_eeceac1af4e7620894d6d2083921bb73'] = 'Jetzt kaufen'; +$_MODULE['<{stripe_official}prestashop>payment_form_giropay_32e26982dda43a14285657baee320523'] = 'Mit Giropay zahlen'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_9d67bee92ea535ba9c7840797966edfa'] = 'Bei der Zahlung ist ein Fehler aufgetreten.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = 'Bitte [a @href1@]versuchen Sie es erneut[/a] oder wenden Sie sich an den Besitzer der Website.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_3380b659ba0a8b01af98dbe7494c0706'] = 'Félicitations, votre commande est validée et sera traitée sous peu.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_2a69d95c0cc64162865573233beb3369'] = 'Vous pouvez accéder à votre coupon OXXO [a @href1@]ici[/a].'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Merci de votre confiance.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_3380b659ba0a8b01af98dbe7494c0706'] = 'Félicitations, votre commande est validée et sera traitée sous peu.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_2a69d95c0cc64162865573233beb3369'] = 'Vous pouvez accéder à votre coupon OXXO [a @href1@]ici[/a].'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Merci de votre confiance.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_9d67bee92ea535ba9c7840797966edfa'] = 'Bei der Zahlung ist ein Fehler aufgetreten.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = 'Bitte [a @href1@]versuchen Sie es erneut[/a] oder wenden Sie sich an den Besitzer der Website.'; +$_MODULE['<{stripe_official}prestashop>payment_form_alipay_47e1e580d173b931fdfdeb6bb5f14848'] = 'Mit Alipay zahlen'; +$_MODULE['<{stripe_official}prestashop>payment_form_fpx_74253765ffa5a6b91d758c7df4d3c871'] = 'Mit FPX zahlen'; +$_MODULE['<{stripe_official}prestashop>payment_form_fpx_eeceac1af4e7620894d6d2083921bb73'] = 'Jetzt kaufen'; $_MODULE['<{stripe_official}prestashop>configurationactions_187b101d0358396a634514ea228616d5'] = 'Anstatt der API-Test-Schlüssel wurden API-Live-Schlüssel angegeben'; $_MODULE['<{stripe_official}prestashop>configurationactions_2df5570b8a0e0c076571d1213f7f901e'] = 'Die Felder für Kunden-ID und Geheimschlüssel sind verpflichtend'; $_MODULE['<{stripe_official}prestashop>configurationactions_5fba3565c1b6638ac41f7627066aaa58'] = 'Anstatt der API-Live-Schlüssel wurden API-Test-Schlüssel angegeben'; diff --git a/translations/es.php b/translations/es.php old mode 100644 new mode 100755 index d66a5d8..8e7d2b4 --- a/translations/es.php +++ b/translations/es.php @@ -20,6 +20,17 @@ $_MODULE['<{stripe_official}prestashop>stripe_official_7c716e01a03b426976692f4a7a0d80be'] = 'Con Stripe, comienza hoy mismo a aceptar pagos ¡directamente desde tu tienda!'; $_MODULE['<{stripe_official}prestashop>stripe_official_876f23178c29dc2552c0b48bf23cd9bd'] = '¿Estás seguro de que deseas desinstalarlo?'; $_MODULE['<{stripe_official}prestashop>stripe_official_6341ee14cd6d47787171f68d27f1f41b'] = 'Pago con Stripe'; +$_MODULE['<{stripe_official}prestashop>stripe_official_a6ee78c840497aed8a81b6164d4224e6'] = 'Debe habilitar SSL en la tienda si desea utilizar este módulo en producción.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_66f67e1a8f01161f2009c2ed39c3cb1e'] = 'Alcanzó el límite de 16 puntos finales de webhook registrados en su Dashboard Stripe para esta cuenta. Elimine uno de ellos si desea registrar este dominio.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_69e6a2456656fcc3c9a79452ef3a7928'] = 'Su versión de TLS no es compatible. Deberá actualizar su integración. Consulte las preguntas frecuentes si no sabe cómo hacerlo.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_47daed1af40eaa1fb3c750322137815d'] = 'La configuración de webhook no se puede encontrar en PrestaShop, haga clic en el botón Guardar para solucionar el problema. Se creará un nuevo webhook en Stripe y luego se guardará en PrestaShop.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_4684c4310f6bd9917b3c079bc38fd335'] = 'La configuración de la URL del webhook es incorrecta, haga clic en el botón Guardar para solucionar el problema. Se corregirá la configuración de webhook.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_572bde45cccf4cde600e2a846cfe8085'] = 'URL actual del webhook:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_12632987bdd5031845a591acdf5faa40'] = 'URL de webhook esperada:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_2226fcd706ac6ba242dc3381636cf74b'] = 'La configuración de los eventos de webhook es incorrecta, haga clic en el botón Guardar para solucionar el problema. Se corregirá la configuración de webhook.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_4047173bbb1dd67cd5e877f7736c1e86'] = 'Eventos actuales de webhook:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_78b8b4d922d4061d31e55caece729f8b'] = 'Eventos esperados de webhook:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_21e8380e65bb6a9cc714dae46e2b6dbf'] = 'No se puede acceder a la configuración de webhook, haga clic en el botón Guardar para solucionar el problema. Se creará un nuevo webhook en Stripe.'; $_MODULE['<{stripe_official}prestashop>stripe_official_b32006c07b70b4db49be9fcc111b074f'] = 'Las claves están vacías.'; $_MODULE['<{stripe_official}prestashop>stripe_official_3e5298c1c5d8c871334c4e3994481f90'] = 'La ID de pago de Stripe no puede estar vacía.'; $_MODULE['<{stripe_official}prestashop>stripe_official_eb804bebeffc55fb161165d50bcf74f8'] = 'ID de pago de Stripe desconocida.'; @@ -31,8 +42,10 @@ $_MODULE['<{stripe_official}prestashop>stripe_official_fd2bdc826d325902e451236cf6fd774e'] = 'Procesando...'; $_MODULE['<{stripe_official}prestashop>stripe_official_b24ee2c7cb1734370b544eb4e6cdc2b6'] = 'Acepta las Condiciones de servicio'; $_MODULE['<{stripe_official}prestashop>stripe_official_15f04500d9edaac382bb3d451c8b4198'] = 'Redireccionando...'; +$_MODULE['<{stripe_official}prestashop>stripe_official_86c7338e09e2c3ca2e458da630895e25'] = 'No se han proporcionado claves de API. Póngase en contacto con el propietario del sitio web.'; $_MODULE['<{stripe_official}prestashop>stripecards_cd81f9f55969c822377f076017bb3484'] = 'Tarjetas'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_d3b206d196cd6be3a2764c1fb90b200f'] = 'Eliminar selección'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_53c6a96a3df980c3270d6ed82b6f174b'] = '¿Le gustaría eliminar los elementos seleccionados?'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_b718adec73e04ce3ec720dd11a06a308'] = 'ID'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_49ee3087348e8d44e1feda1917443987'] = 'Nombre'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_4c2a8fe7eaf24721cc7a9f0175115bd4'] = 'Mensaje'; @@ -41,48 +54,19 @@ $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_d95fc016a6eee828f434ed5f55504427'] = 'ID del objeto'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_44749712dbec183e983dcd78a7736c41'] = 'Fecha'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_2d8e32e9c23e2a7155c88028b3fbff66'] = 'Configuración del registrador de procesos'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_2ce895700ba5c16bede3b769128d216f'] = 'Aquí puede cambiar la configuración predeterminada de este registrador de procesos'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_3073ef21c0b326939d5b630edd08cfb6'] = 'Desactivar el borrado automático'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_434ef5977d28afa36e430439de18cbad'] = 'Si está desactivado, los registros se borrarán automáticamente después de la demora'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_1607c94671fd5baf4ac06f554b118b2a'] = 'Retraso de borrado automático (en días)'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_71c3e06323cd5a59436ec53afca80c57'] = 'Elija la cantidad de días que desea mantener los registros en la base de datos'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_c9cc8cce247e49bae79f15173ce97354'] = 'Guardar'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_dcc459e0cef1e36a18a356fbc5789b16'] = 'Borrar todo'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_729a51874fe901b092899e9e8b31c97a'] = '¿Estás seguro?'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_f51c7af7c02cd3a846d87d97bfaf6b58'] = 'Se han borrado todos los registros.'; -$_MODULE['<{stripe_official}prestashop>admin_tab_order_ce7566d1d08cc094b74cf283cf9c56a5'] = 'Stripe'; -$_MODULE['<{stripe_official}prestashop>my-account-stripe-cards_a46d3e7285f76d2401202f18b0acbcbd'] = 'Mis tarjetas'; -$_MODULE['<{stripe_official}prestashop>admin_cart_1ab1dfd9dc24ea4729d6c032f7f0342d'] = 'Información del pago'; -$_MODULE['<{stripe_official}prestashop>admin_cart_3d9c6a8d9e9bd14af99a9f4444f602a4'] = 'Fecha (última actualización)'; -$_MODULE['<{stripe_official}prestashop>admin_cart_24e85d1e652b3681994e9cae2cc1f35a'] = 'ID de pago de Stripe'; -$_MODULE['<{stripe_official}prestashop>admin_cart_49ee3087348e8d44e1feda1917443987'] = 'Nombre'; -$_MODULE['<{stripe_official}prestashop>admin_cart_f0aaaae189e9c7711931a65ffcd22543'] = 'Método de pago'; -$_MODULE['<{stripe_official}prestashop>admin_cart_388fd2767ba1fd2296f536425d106de3'] = 'Importe pagado'; -$_MODULE['<{stripe_official}prestashop>admin_cart_76f0ed934de85cc7131910b32ede7714'] = 'Rembolso'; -$_MODULE['<{stripe_official}prestashop>admin_cart_8eea62084ca7e541d918e823422bd82e'] = 'Resultado'; -$_MODULE['<{stripe_official}prestashop>admin_cart_650be61892bf690026089544abbd9d26'] = 'Modo'; -$_MODULE['<{stripe_official}prestashop>admin_cart_c985a711556e2edf5cac28dfbdb43ff0'] = 'Rembolso parcial'; -$_MODULE['<{stripe_official}prestashop>admin_cart_5706de961fb376d701be6e7762d8b09c'] = 'En espera'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_1e63d1811556fc2dad106dcbd4217a69'] = 'ID de pago'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_7133d45d85f629f4c8abe0e1b3d37942'] = 'Fecha de pago'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_f0aaaae189e9c7711931a65ffcd22543'] = 'Método de pago'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_ccd51debd3d65d453679c150b99a39c0'] = 'Fecha de autorización'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_3f8c6ecb084eea3b83d659fab7155e86'] = 'Fecha de captura'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_24fe48030f7d3097d5882535b04c3fa8'] = 'Caducado'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_90cbb08c2e81b8eca5298e2533dbe3d9'] = 'Disputa de pago'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_9b12a0ddfdf2b10342c50ed2fe6e5c50'] = 'consulta tu disputa aquí'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_bf49f5bcf72238ecbc0659c3c0c8079f'] = 'Sin disputas'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_e2fe37d9647990819245fadb404c482e'] = 'Validación del cupón'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_e2b54a61bf4e56c4a044386b2553ed77'] = 'Cupón validado el:'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_2311c8c5e8f44924a3e61c78e2223049'] = 'El cupón caducará el:'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_9ca4bc48596557840045a7477c803657'] = 'Debe especificar un número válido de \"Retraso de borrado automático (en días)\".'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_5988c28d05527a0d0ce8ae3da1134352'] = 'Los parámetros de registro se actualizaron correctamente.'; $_MODULE['<{stripe_official}prestashop>main_c2cc7082a89c1ad6631a2f66af5f00c0'] = 'Conexión'; $_MODULE['<{stripe_official}prestashop>main_76f0ed934de85cc7131910b32ede7714'] = 'Rembolso'; -$_MODULE['<{stripe_official}prestashop>refund_2b660da0c521cc6bc51a188bc9f7d084'] = 'Elige un pedido que quieras rembolsar'; -$_MODULE['<{stripe_official}prestashop>refund_24e85d1e652b3681994e9cae2cc1f35a'] = 'ID de pago de Stripe'; -$_MODULE['<{stripe_official}prestashop>refund_991bd624dcaff354bd793e4cacbd6ea3'] = 'Encontrarás el ID en la pestaña de Stripe del pedido que deseas rembolsar. Empieza con \"ch_\" o \"py_\".'; -$_MODULE['<{stripe_official}prestashop>refund_c0a3c3e9b5fbd21c505e082644b2220c'] = 'Rembolso total'; -$_MODULE['<{stripe_official}prestashop>refund_77fd2b4393b379bedd30efcd5df02090'] = 'Rembolso parcial'; -$_MODULE['<{stripe_official}prestashop>refund_fe9cc1bcfa322db8ade8960ddf4bb19c'] = 'Enviaremos los rembolsos que efectúes a la cuenta bancaria del cliente de inmediato.'; -$_MODULE['<{stripe_official}prestashop>refund_2b9689f82101a977f16db0056493a5aa'] = 'El cliente recibirá los fondos aproximadamente 2 o 3 días hábiles después de la fecha de inicio del rembolso.'; -$_MODULE['<{stripe_official}prestashop>refund_6e5d08adf277f2eb21b257fe74f76ddc'] = 'Los rembolsos aparecen en el extracto del cliente en el plazo de 5 a 10 días.'; -$_MODULE['<{stripe_official}prestashop>refund_b2f40690858b404ed10e62bdf422c704'] = 'Importe'; -$_MODULE['<{stripe_official}prestashop>refund_f3b5fc873bba0e14e0d8d9851408b2a3'] = 'Introduce el importe que deseas rembolsar.'; -$_MODULE['<{stripe_official}prestashop>refund_f87db45e2887d485ca31ffae186faae9'] = 'Solicitar rembolso'; $_MODULE['<{stripe_official}prestashop>configuration_e6ad4dd232a1bb7d77852af7fc2e0538'] = '[a @href1@]Crea tu cuenta de Stripe en 10 minutos[/a] y comienza a aceptar pagos con tarjeta y con métodos de pago locales al instante (no se requiere ningún ID de comerciante ni contrato adicional de tu banco).'; $_MODULE['<{stripe_official}prestashop>configuration_ebd8fbb49032e4992eb5050893dfa1fc'] = 'Conectar con Stripe'; $_MODULE['<{stripe_official}prestashop>configuration_650be61892bf690026089544abbd9d26'] = 'Modo'; @@ -115,7 +99,7 @@ $_MODULE['<{stripe_official}prestashop>configuration_e150eb523fd98533136e660e3e7862a0'] = 'China UnionPay'; $_MODULE['<{stripe_official}prestashop>configuration_53619d5dc16df90ad84a8958b7121aa8'] = 'JCB'; $_MODULE['<{stripe_official}prestashop>configuration_1f6176c4f26f546cd5424d53fac0f2f8'] = 'Discovers'; -$_MODULE['<{stripe_official}prestashop>configuration_5f07627108d0280b0fd45dd36e73d01f'] = 'Monederos digitales, como Apple Pay, Google Pay y Microsoft Pay.[br]Al usar Apple Pay, aceptas las condiciones de servicio de [a @href1@]Stripe[/a] y [a @href2@]Apple[/a].'; +$_MODULE['<{stripe_official}prestashop>configuration_0e29ba92a96e3342f6e47f324a0c8857'] = 'Carteras digitales, es decir, Apple Pay y Google Pay. [br] Al usar Apple Pay, aceptas los términos de servicio de [a @href1@] Stripe [/a] y [a @href2@] Apple [/a].'; $_MODULE['<{stripe_official}prestashop>configuration_f80b9de6d53dc9db807d2a123c149fc7'] = 'No recopiles el código postal (no se recomienda*).'; $_MODULE['<{stripe_official}prestashop>configuration_c99b5f040533a2516fed921947a3b7f4'] = 'Esta información mejora las tasas de aceptación de las tarjetas emitidas en los Estados Unidos, el Reino Unido y Canadá.'; $_MODULE['<{stripe_official}prestashop>configuration_8cb12d0aa65678a528d4395dbf3a4138'] = 'Recopilar el nombre del titular de la tarjeta'; @@ -140,21 +124,59 @@ $_MODULE['<{stripe_official}prestashop>configuration_93cba07454f06a4a960172bbd6e2a435'] = 'Sí'; $_MODULE['<{stripe_official}prestashop>configuration_0a2c4e503e93bc3135308bb3fadbe0bd'] = 'Primero debes activar estos métodos de pago en tu [a @href2@]Dashboard de Stripe[/a].'; $_MODULE['<{stripe_official}prestashop>configuration_c9cc8cce247e49bae79f15173ce97354'] = 'Guardar'; +$_MODULE['<{stripe_official}prestashop>refund_2b660da0c521cc6bc51a188bc9f7d084'] = 'Elige un pedido que quieras rembolsar'; +$_MODULE['<{stripe_official}prestashop>refund_24e85d1e652b3681994e9cae2cc1f35a'] = 'ID de pago de Stripe'; +$_MODULE['<{stripe_official}prestashop>refund_991bd624dcaff354bd793e4cacbd6ea3'] = 'Encontrarás el ID en la pestaña de Stripe del pedido que deseas rembolsar. Empieza con \"ch_\" o \"py_\".'; +$_MODULE['<{stripe_official}prestashop>refund_c0a3c3e9b5fbd21c505e082644b2220c'] = 'Rembolso total'; +$_MODULE['<{stripe_official}prestashop>refund_77fd2b4393b379bedd30efcd5df02090'] = 'Rembolso parcial'; +$_MODULE['<{stripe_official}prestashop>refund_fe9cc1bcfa322db8ade8960ddf4bb19c'] = 'Enviaremos los rembolsos que efectúes a la cuenta bancaria del cliente de inmediato.'; +$_MODULE['<{stripe_official}prestashop>refund_2b9689f82101a977f16db0056493a5aa'] = 'El cliente recibirá los fondos aproximadamente 2 o 3 días hábiles después de la fecha de inicio del rembolso.'; +$_MODULE['<{stripe_official}prestashop>refund_6e5d08adf277f2eb21b257fe74f76ddc'] = 'Los rembolsos aparecen en el extracto del cliente en el plazo de 5 a 10 días.'; +$_MODULE['<{stripe_official}prestashop>refund_b2f40690858b404ed10e62bdf422c704'] = 'Importe'; +$_MODULE['<{stripe_official}prestashop>refund_f3b5fc873bba0e14e0d8d9851408b2a3'] = 'Introduce el importe que deseas rembolsar.'; +$_MODULE['<{stripe_official}prestashop>refund_f87db45e2887d485ca31ffae186faae9'] = 'Solicitar rembolso'; +$_MODULE['<{stripe_official}prestashop>admin_tab_order_ce7566d1d08cc094b74cf283cf9c56a5'] = 'Stripe'; +$_MODULE['<{stripe_official}prestashop>my-account-stripe-cards_a46d3e7285f76d2401202f18b0acbcbd'] = 'Mis tarjetas'; +$_MODULE['<{stripe_official}prestashop>admin_cart_1ab1dfd9dc24ea4729d6c032f7f0342d'] = 'Información del pago'; +$_MODULE['<{stripe_official}prestashop>admin_cart_3d9c6a8d9e9bd14af99a9f4444f602a4'] = 'Fecha (última actualización)'; +$_MODULE['<{stripe_official}prestashop>admin_cart_24e85d1e652b3681994e9cae2cc1f35a'] = 'ID de pago de Stripe'; +$_MODULE['<{stripe_official}prestashop>admin_cart_49ee3087348e8d44e1feda1917443987'] = 'Nombre'; +$_MODULE['<{stripe_official}prestashop>admin_cart_f0aaaae189e9c7711931a65ffcd22543'] = 'Método de pago'; +$_MODULE['<{stripe_official}prestashop>admin_cart_388fd2767ba1fd2296f536425d106de3'] = 'Importe pagado'; +$_MODULE['<{stripe_official}prestashop>admin_cart_76f0ed934de85cc7131910b32ede7714'] = 'Rembolso'; +$_MODULE['<{stripe_official}prestashop>admin_cart_8eea62084ca7e541d918e823422bd82e'] = 'Resultado'; +$_MODULE['<{stripe_official}prestashop>admin_cart_650be61892bf690026089544abbd9d26'] = 'Modo'; +$_MODULE['<{stripe_official}prestashop>admin_cart_c985a711556e2edf5cac28dfbdb43ff0'] = 'Rembolso parcial'; +$_MODULE['<{stripe_official}prestashop>admin_cart_5706de961fb376d701be6e7762d8b09c'] = 'En espera'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_1e63d1811556fc2dad106dcbd4217a69'] = 'ID de pago'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_7133d45d85f629f4c8abe0e1b3d37942'] = 'Fecha de pago'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_f0aaaae189e9c7711931a65ffcd22543'] = 'Método de pago'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_ccd51debd3d65d453679c150b99a39c0'] = 'Fecha de autorización'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_3f8c6ecb084eea3b83d659fab7155e86'] = 'Fecha de captura'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_24fe48030f7d3097d5882535b04c3fa8'] = 'Caducado'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_90cbb08c2e81b8eca5298e2533dbe3d9'] = 'Disputa de pago'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_9b12a0ddfdf2b10342c50ed2fe6e5c50'] = 'consulta tu disputa aquí'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_bf49f5bcf72238ecbc0659c3c0c8079f'] = 'Sin disputas'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_e2fe37d9647990819245fadb404c482e'] = 'Validación del cupón'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_e2b54a61bf4e56c4a044386b2553ed77'] = 'Cupón validado el:'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_2311c8c5e8f44924a3e61c78e2223049'] = 'El cupón caducará el:'; $_MODULE['<{stripe_official}prestashop>payment_form_oxxo_49ee3087348e8d44e1feda1917443987'] = 'Nombre'; $_MODULE['<{stripe_official}prestashop>payment_form_oxxo_ce8ae9da5b7cd6c3df2929543a9af92d'] = 'Correo electrónico'; -$_MODULE['<{stripe_official}prestashop>payment_form_ideal_ac23f66a874a7808e300a15f2e94320a'] = 'Pagar con iDeal'; -$_MODULE['<{stripe_official}prestashop>payment_form_ideal_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar ahora'; $_MODULE['<{stripe_official}prestashop>stripe-cards_4e997b9d3b7152f2afeacd96ab1ef1cb'] = 'Mis tarjetas'; $_MODULE['<{stripe_official}prestashop>stripe-cards_a1fa27779242b4902f7ae3bdd5c6d508'] = 'Tipo'; $_MODULE['<{stripe_official}prestashop>stripe-cards_a44217022190f5734b2f72ba1e4f8a79'] = 'Número de tarjeta'; $_MODULE['<{stripe_official}prestashop>stripe-cards_b07cc2801693b2e722906a3db3d9c447'] = 'Validez'; $_MODULE['<{stripe_official}prestashop>stripe-cards_f2a6c498fb90ee345d997f888fce3b18'] = 'Eliminar'; $_MODULE['<{stripe_official}prestashop>stripe-cards_78560f5a4e1f5716c8fb9d7cb35f56de'] = 'Aún no has registrado una tarjeta.'; +$_MODULE['<{stripe_official}prestashop>payment_form_bancontact_d536f6cb1304cde5da44c530d3157886'] = 'Pagar con Bancontact'; $_MODULE['<{stripe_official}prestashop>payment_form_sepa_debit_28d20d5ce69c797169658d647110374b'] = 'Pagar con Adeudo directo SEPA'; $_MODULE['<{stripe_official}prestashop>payment_form_sepa_debit_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar ahora'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_9d67bee92ea535ba9c7840797966edfa'] = 'Se ha producido un error durante el pago.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Inténtalo de nuevo[/a] o ponte en contacto con el propietario del sitio web.'; -$_MODULE['<{stripe_official}prestashop>payment_form_bancontact_d536f6cb1304cde5da44c530d3157886'] = 'Pagar con Bancontact'; +$_MODULE['<{stripe_official}prestashop>payment_info_redirect_f3ee3ad3c8443ee27192d35a7a9d86c9'] = 'Se te redirigirá al sitio del banco para completar el pago.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_3380b659ba0a8b01af98dbe7494c0706'] = 'Enhorabuena, se ha completado tu pedido y se procesará en breve.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_77031dd06e26cfdab21b078a37741bb6'] = 'La referencia del pedido es [b]@target@[/b]. Recibirás un correo electrónico de confirmación muy pronto.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_2a69d95c0cc64162865573233beb3369'] = 'Puedes ver tu cupón de OXXO [a @href1@]aquí[/a].'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Te agradecemos la confianza depositada en nosotros.'; +$_MODULE['<{stripe_official}prestashop>payment_form_sofort_068bcd34a6ded96b1805ca0b9a6745bb'] = 'Pagar con SOFORT'; $_MODULE['<{stripe_official}prestashop>payment_form_card_f73a8b5c0b42c88867a7650fc6fde345'] = 'Antes de continuar, cerciórate de haber aceptado nuestras condiciones de servicio.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_d9b1a32393ffc57f2ee4f07626e76d46'] = 'Paga ahora con la tarjeta guardada en tu dispositivo haciendo clic en el botón de arriba o completa los datos de la tarjeta abajo y ve al final de la página para enviar.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_d9a3493a581e1b2900c5eb45dcb0dc02'] = 'Nombre del titular de la tarjeta'; @@ -166,28 +188,32 @@ $_MODULE['<{stripe_official}prestashop>payment_form_card_96e7de5dba463d377178948e998cdf27'] = 'Los datos de la tarjeta se protegen mediante las normas de seguridad de datos de la industria de tarjetas de pago (PCI DSS 3.2).'; $_MODULE['<{stripe_official}prestashop>payment_form_card_48334cb46587c0571f12ac31e8e9364a'] = 'Los datos de la tarjeta se guardarán automáticamente para tu próxima compra.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar ahora'; -$_MODULE['<{stripe_official}prestashop>payment_info_redirect_f3ee3ad3c8443ee27192d35a7a9d86c9'] = 'Se te redirigirá al sitio del banco para completar el pago.'; -$_MODULE['<{stripe_official}prestashop>payment_form_giropay_32e26982dda43a14285657baee320523'] = 'Pagar con GiroPay'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_9d67bee92ea535ba9c7840797966edfa'] = 'Se ha producido un error durante el pago.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Inténtalo de nuevo[/a] o ponte en contacto con el propietario del sitio web.'; -$_MODULE['<{stripe_official}prestashop>payment_form_p24_751e90522b3385322c4c34b6f73847d2'] = 'Pagar con P24'; -$_MODULE['<{stripe_official}prestashop>payment_form_fpx_74253765ffa5a6b91d758c7df4d3c871'] = 'Pagar con FPX'; -$_MODULE['<{stripe_official}prestashop>payment_form_fpx_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar ahora'; -$_MODULE['<{stripe_official}prestashop>payment_form_sofort_068bcd34a6ded96b1805ca0b9a6745bb'] = 'Pagar con SOFORT'; -$_MODULE['<{stripe_official}prestashop>payment_form_save_card_6e9c53f6d39367724e9b996b3ea9ef22'] = 'Pagar con tarjeta:'; -$_MODULE['<{stripe_official}prestashop>payment_form_save_card_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar ahora'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_3380b659ba0a8b01af98dbe7494c0706'] = 'Enhorabuena, se ha completado tu pedido y se procesará en breve.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_77031dd06e26cfdab21b078a37741bb6'] = 'La referencia del pedido es [b]@target@[/b]. Recibirás un correo electrónico de confirmación muy pronto.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_2a69d95c0cc64162865573233beb3369'] = 'Puedes ver tu cupón de OXXO [a @href1@]aquí[/a].'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Te agradecemos la confianza depositada en nosotros.'; -$_MODULE['<{stripe_official}prestashop>payment_form_alipay_47e1e580d173b931fdfdeb6bb5f14848'] = 'Pagar con Alipay'; +$_MODULE['<{stripe_official}prestashop>payment_form_ideal_ac23f66a874a7808e300a15f2e94320a'] = 'Pagar con iDeal'; +$_MODULE['<{stripe_official}prestashop>payment_form_ideal_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar ahora'; +$_MODULE['<{stripe_official}prestashop>payment_form_eps_c446bbd08309aff37eee1e0c43b19cde'] = 'Pagar con EPS'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_a46d3e7285f76d2401202f18b0acbcbd'] = 'Mis tarjetas'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_a1fa27779242b4902f7ae3bdd5c6d508'] = 'Tipo'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_a44217022190f5734b2f72ba1e4f8a79'] = 'Número de tarjeta'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_b07cc2801693b2e722906a3db3d9c447'] = 'Validez'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_f2a6c498fb90ee345d997f888fce3b18'] = 'Eliminar'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_78560f5a4e1f5716c8fb9d7cb35f56de'] = 'Aún no has registrado una tarjeta.'; -$_MODULE['<{stripe_official}prestashop>payment_form_eps_c446bbd08309aff37eee1e0c43b19cde'] = 'Pagar con EPS'; +$_MODULE['<{stripe_official}prestashop>payment_form_p24_751e90522b3385322c4c34b6f73847d2'] = 'Pagar con P24'; +$_MODULE['<{stripe_official}prestashop>payment_form_save_card_6e9c53f6d39367724e9b996b3ea9ef22'] = 'Pagar con tarjeta:'; +$_MODULE['<{stripe_official}prestashop>payment_form_save_card_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar ahora'; +$_MODULE['<{stripe_official}prestashop>payment_form_giropay_32e26982dda43a14285657baee320523'] = 'Pagar con GiroPay'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_9d67bee92ea535ba9c7840797966edfa'] = 'Se ha producido un error durante el pago.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Inténtalo de nuevo[/a] o ponte en contacto con el propietario del sitio web.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_3380b659ba0a8b01af98dbe7494c0706'] = 'Félicitations, votre commande est validée et sera traitée sous peu.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_2a69d95c0cc64162865573233beb3369'] = 'Vous pouvez accéder à votre coupon OXXO [a @href1@]ici[/a].'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Merci de votre confiance.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_3380b659ba0a8b01af98dbe7494c0706'] = 'Félicitations, votre commande est validée et sera traitée sous peu.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_2a69d95c0cc64162865573233beb3369'] = 'Vous pouvez accéder à votre coupon OXXO [a @href1@]ici[/a].'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Merci de votre confiance.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_9d67bee92ea535ba9c7840797966edfa'] = 'Se ha producido un error durante el pago.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Inténtalo de nuevo[/a] o ponte en contacto con el propietario del sitio web.'; +$_MODULE['<{stripe_official}prestashop>payment_form_alipay_47e1e580d173b931fdfdeb6bb5f14848'] = 'Pagar con Alipay'; +$_MODULE['<{stripe_official}prestashop>payment_form_fpx_74253765ffa5a6b91d758c7df4d3c871'] = 'Pagar con FPX'; +$_MODULE['<{stripe_official}prestashop>payment_form_fpx_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar ahora'; $_MODULE['<{stripe_official}prestashop>configurationactions_187b101d0358396a634514ea228616d5'] = 'Se proporcionaron claves de API activas en lugar de claves de prueba.'; $_MODULE['<{stripe_official}prestashop>configurationactions_2df5570b8a0e0c076571d1213f7f901e'] = 'Los campos ID de cliente y Clave secreta son obligatorios.'; $_MODULE['<{stripe_official}prestashop>configurationactions_5fba3565c1b6638ac41f7627066aaa58'] = 'Se proporcionaron claves de API de prueba en lugar de claves activas.'; diff --git a/translations/fr.php b/translations/fr.php old mode 100644 new mode 100755 index 5793404..72d28c0 --- a/translations/fr.php +++ b/translations/fr.php @@ -20,6 +20,17 @@ $_MODULE['<{stripe_official}prestashop>stripe_official_7c716e01a03b426976692f4a7a0d80be'] = 'Commencez à accepter des paiements Stripe dès aujourd\'hui, directement depuis votre boutique !'; $_MODULE['<{stripe_official}prestashop>stripe_official_876f23178c29dc2552c0b48bf23cd9bd'] = 'Voulez-vous vraiment désinstaller ?'; $_MODULE['<{stripe_official}prestashop>stripe_official_6341ee14cd6d47787171f68d27f1f41b'] = 'Paiement par Stripe'; +$_MODULE['<{stripe_official}prestashop>stripe_official_a6ee78c840497aed8a81b6164d4224e6'] = 'Vous devez activer SSL sur la boutique si vous souhaitez utiliser ce module en production.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_66f67e1a8f01161f2009c2ed39c3cb1e'] = 'Vous avez atteint la limite de 16 points de terminaison de webhook enregistrés dans votre Dashboard Stripe pour ce compte. Veuillez en supprimer un si vous souhaitez enregistrer ce domaine.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_69e6a2456656fcc3c9a79452ef3a7928'] = 'Votre version TLS n\'est pas prise en charge. Vous devrez mettre à jour votre intégration. Veuillez consulter la FAQ si vous ne savez pas comment faire.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_47daed1af40eaa1fb3c750322137815d'] = 'La configuration du Webhook est introuvable dans PrestaShop, cliquez sur le bouton Enregistrer pour résoudre le problème. Un nouveau webhook sera créé sur Stripe, puis enregistré dans PrestaShop.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_4684c4310f6bd9917b3c079bc38fd335'] = 'La configuration de l\'URL du Webhook est incorrecte, cliquez sur le bouton Enregistrer pour résoudre le problème. La configuration du Webhook sera corrigée.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_572bde45cccf4cde600e2a846cfe8085'] = 'URL du webhook actuel :'; +$_MODULE['<{stripe_official}prestashop>stripe_official_12632987bdd5031845a591acdf5faa40'] = 'URL de webhook attendue :'; +$_MODULE['<{stripe_official}prestashop>stripe_official_2226fcd706ac6ba242dc3381636cf74b'] = 'La configuration des événements Webhook est incorrecte, cliquez sur le bouton Enregistrer pour résoudre le problème. La configuration du Webhook sera corrigée.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_4047173bbb1dd67cd5e877f7736c1e86'] = 'Evénements webhook actuels :'; +$_MODULE['<{stripe_official}prestashop>stripe_official_78b8b4d922d4061d31e55caece729f8b'] = 'Evénements webhook attendus :'; +$_MODULE['<{stripe_official}prestashop>stripe_official_21e8380e65bb6a9cc714dae46e2b6dbf'] = 'La configuration du Webhook n\'est pas accessible, cliquez sur le bouton Enregistrer pour résoudre le problème. Un nouveau webhook sera créé sur Stripe.'; $_MODULE['<{stripe_official}prestashop>stripe_official_b32006c07b70b4db49be9fcc111b074f'] = 'Les clés sont vides.'; $_MODULE['<{stripe_official}prestashop>stripe_official_3e5298c1c5d8c871334c4e3994481f90'] = 'L\'ID de paiement Stripe ne peut être vide.'; $_MODULE['<{stripe_official}prestashop>stripe_official_eb804bebeffc55fb161165d50bcf74f8'] = 'ID de paiement Stripe inconnu.'; @@ -31,13 +42,10 @@ $_MODULE['<{stripe_official}prestashop>stripe_official_fd2bdc826d325902e451236cf6fd774e'] = 'Traitement'; $_MODULE['<{stripe_official}prestashop>stripe_official_b24ee2c7cb1734370b544eb4e6cdc2b6'] = 'Veuillez accepter les CGV'; $_MODULE['<{stripe_official}prestashop>stripe_official_15f04500d9edaac382bb3d451c8b4198'] = 'Redirection'; -$_MODULE['<{stripe_official}prestashop>configurationactions_187b101d0358396a634514ea228616d5'] = 'Vous avez fourni des clés API de production au lieu de clés API de test'; -$_MODULE['<{stripe_official}prestashop>configurationactions_2df5570b8a0e0c076571d1213f7f901e'] = 'Les champs ID du client et Clé secrète sont obligatoires'; -$_MODULE['<{stripe_official}prestashop>configurationactions_5fba3565c1b6638ac41f7627066aaa58'] = 'Vous avez fourni des clés API de test au lieu de clés API de production'; -$_MODULE['<{stripe_official}prestashop>configurationactions_50ce374ab3f05a63a6981484b8757094'] = 'Activer l\'autorisation et la capture distinctes'; -$_MODULE['<{stripe_official}prestashop>configurationactions_8dd2f915acf4ec98006d11c9a4b0945b'] = 'Paramètres mis à jour.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_86c7338e09e2c3ca2e458da630895e25'] = 'Aucune clé API n\'a été fournie. Veuillez contacter le propriétaire du site Web.'; $_MODULE['<{stripe_official}prestashop>stripecards_cd81f9f55969c822377f076017bb3484'] = 'Cartes bancaires'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_d3b206d196cd6be3a2764c1fb90b200f'] = 'Supprimer la sélection'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_53c6a96a3df980c3270d6ed82b6f174b'] = 'Souhaitez-vous supprimer les éléments sélectionnés ?'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_b718adec73e04ce3ec720dd11a06a308'] = 'ID'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_49ee3087348e8d44e1feda1917443987'] = 'Nom'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_4c2a8fe7eaf24721cc7a9f0175115bd4'] = 'Message'; @@ -46,48 +54,19 @@ $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_d95fc016a6eee828f434ed5f55504427'] = 'ID de l\'objet'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_44749712dbec183e983dcd78a7736c41'] = 'Date'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_2d8e32e9c23e2a7155c88028b3fbff66'] = 'Paramètres de l\'outil de consignation des processus'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_2ce895700ba5c16bede3b769128d216f'] = 'Ici, vous pouvez modifier la configuration par défaut de ce processus de logs'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_3073ef21c0b326939d5b630edd08cfb6'] = 'Désactiver l\'effacement automatique'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_434ef5977d28afa36e430439de18cbad'] = 'Si désactivé, les journaux seront automatiquement effacés après le délai'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_1607c94671fd5baf4ac06f554b118b2a'] = 'Délai d\'effacement automatique (en jours)'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_71c3e06323cd5a59436ec53afca80c57'] = 'Choisissez le nombre de jours pendant lesquels vous souhaitez conserver les journaux dans la base de données'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_c9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_dcc459e0cef1e36a18a356fbc5789b16'] = 'Effacer tout'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_729a51874fe901b092899e9e8b31c97a'] = 'Êtes-vous sûr(e) ?'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_f51c7af7c02cd3a846d87d97bfaf6b58'] = 'Tous les logs ont été effacés'; -$_MODULE['<{stripe_official}prestashop>admin_tab_order_ce7566d1d08cc094b74cf283cf9c56a5'] = 'Stripe'; -$_MODULE['<{stripe_official}prestashop>my-account-stripe-cards_a46d3e7285f76d2401202f18b0acbcbd'] = 'Mes cartes bancaires'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_1e63d1811556fc2dad106dcbd4217a69'] = 'ID de paiement'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_7133d45d85f629f4c8abe0e1b3d37942'] = 'Date du paiement'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_f0aaaae189e9c7711931a65ffcd22543'] = 'Moyen de paiement'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_ccd51debd3d65d453679c150b99a39c0'] = 'Date d\'autorisation'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_3f8c6ecb084eea3b83d659fab7155e86'] = 'Date de capture'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_24fe48030f7d3097d5882535b04c3fa8'] = 'Expiré'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_90cbb08c2e81b8eca5298e2533dbe3d9'] = 'Litige concernant un paiement'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_9b12a0ddfdf2b10342c50ed2fe6e5c50'] = 'Consultez votre litige ici'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_bf49f5bcf72238ecbc0659c3c0c8079f'] = 'Aucun litige'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_e2fe37d9647990819245fadb404c482e'] = 'Validation du coupon'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_e2b54a61bf4e56c4a044386b2553ed77'] = 'Coupon validé le :'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_2311c8c5e8f44924a3e61c78e2223049'] = 'Expiration du coupon le :'; -$_MODULE['<{stripe_official}prestashop>admin_cart_1ab1dfd9dc24ea4729d6c032f7f0342d'] = 'Informations de paiement'; -$_MODULE['<{stripe_official}prestashop>admin_cart_3d9c6a8d9e9bd14af99a9f4444f602a4'] = 'Date (dernière mise à jour)'; -$_MODULE['<{stripe_official}prestashop>admin_cart_24e85d1e652b3681994e9cae2cc1f35a'] = 'ID de paiement Stripe'; -$_MODULE['<{stripe_official}prestashop>admin_cart_49ee3087348e8d44e1feda1917443987'] = 'Nom'; -$_MODULE['<{stripe_official}prestashop>admin_cart_f0aaaae189e9c7711931a65ffcd22543'] = 'Moyen de paiement'; -$_MODULE['<{stripe_official}prestashop>admin_cart_388fd2767ba1fd2296f536425d106de3'] = 'Montant payé'; -$_MODULE['<{stripe_official}prestashop>admin_cart_76f0ed934de85cc7131910b32ede7714'] = 'Remboursement'; -$_MODULE['<{stripe_official}prestashop>admin_cart_8eea62084ca7e541d918e823422bd82e'] = 'Résultat'; -$_MODULE['<{stripe_official}prestashop>admin_cart_650be61892bf690026089544abbd9d26'] = 'Mode'; -$_MODULE['<{stripe_official}prestashop>admin_cart_c985a711556e2edf5cac28dfbdb43ff0'] = 'Remboursement partiel'; -$_MODULE['<{stripe_official}prestashop>admin_cart_5706de961fb376d701be6e7762d8b09c'] = 'En attente'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_9ca4bc48596557840045a7477c803657'] = 'Vous devez spécifier un nombre \"Délai d\'effacement automatique (en jours)\" valide.'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_5988c28d05527a0d0ce8ae3da1134352'] = 'Les paramètres de journal ont été mis à jour avec succès !'; $_MODULE['<{stripe_official}prestashop>main_c2cc7082a89c1ad6631a2f66af5f00c0'] = 'Connexion'; $_MODULE['<{stripe_official}prestashop>main_76f0ed934de85cc7131910b32ede7714'] = 'Remboursement'; -$_MODULE['<{stripe_official}prestashop>refund_2b660da0c521cc6bc51a188bc9f7d084'] = 'Sélectionnez la commande que vous voulez rembourser'; -$_MODULE['<{stripe_official}prestashop>refund_24e85d1e652b3681994e9cae2cc1f35a'] = 'ID de paiement Stripe'; -$_MODULE['<{stripe_official}prestashop>refund_991bd624dcaff354bd793e4cacbd6ea3'] = 'Cet ID se trouve dans l\'onglet Stripe de la commande que vous souhaitez rembourser. Il commence par « ch_ » ou « py_ ».'; -$_MODULE['<{stripe_official}prestashop>refund_c0a3c3e9b5fbd21c505e082644b2220c'] = 'Remboursement total'; -$_MODULE['<{stripe_official}prestashop>refund_77fd2b4393b379bedd30efcd5df02090'] = 'Remboursement partiel'; -$_MODULE['<{stripe_official}prestashop>refund_fe9cc1bcfa322db8ade8960ddf4bb19c'] = 'Nous enverrons immédiatement tout remboursement effectué à la banque de votre client.'; -$_MODULE['<{stripe_official}prestashop>refund_2b9689f82101a977f16db0056493a5aa'] = 'Votre client recevra les fonds correspondants sous environ 2 à 3 jours ouvrés suivant la date du remboursement.'; -$_MODULE['<{stripe_official}prestashop>refund_6e5d08adf277f2eb21b257fe74f76ddc'] = 'Il faut compter de 5 à 10 jours pour que les remboursements apparaissent sur le relevé bancaire de votre client.'; -$_MODULE['<{stripe_official}prestashop>refund_b2f40690858b404ed10e62bdf422c704'] = 'Montant'; -$_MODULE['<{stripe_official}prestashop>refund_f3b5fc873bba0e14e0d8d9851408b2a3'] = 'Veuillez renseigner le montant que vous souhaitez rembourser'; -$_MODULE['<{stripe_official}prestashop>refund_f87db45e2887d485ca31ffae186faae9'] = 'Demander un remboursement'; $_MODULE['<{stripe_official}prestashop>configuration_e6ad4dd232a1bb7d77852af7fc2e0538'] = '[a @href1@]Créez votre compte Stripe en 10 minutes[/a] et commencez immédiatement à accepter les paiements par carte bancaire ainsi que les moyens de paiement locaux (sans aucun autre ID de contrat/marchand requis de votre banque).'; $_MODULE['<{stripe_official}prestashop>configuration_ebd8fbb49032e4992eb5050893dfa1fc'] = 'Connexion avec Stripe'; $_MODULE['<{stripe_official}prestashop>configuration_650be61892bf690026089544abbd9d26'] = 'Mode'; @@ -120,7 +99,7 @@ $_MODULE['<{stripe_official}prestashop>configuration_e150eb523fd98533136e660e3e7862a0'] = 'China UnionPay'; $_MODULE['<{stripe_official}prestashop>configuration_53619d5dc16df90ad84a8958b7121aa8'] = 'JCB'; $_MODULE['<{stripe_official}prestashop>configuration_1f6176c4f26f546cd5424d53fac0f2f8'] = 'Discovers'; -$_MODULE['<{stripe_official}prestashop>configuration_5f07627108d0280b0fd45dd36e73d01f'] = 'Portefeuilles électroniques, tels qu\'Apple Pay, Google Pay et Microsoft Pay.[br]En utilisant Apple Pay, vous acceptez les conditions d\'utilisation du service de [a @href1@]Stripe[/a] et d\'[a @href2@]Apple[/a].'; +$_MODULE['<{stripe_official}prestashop>configuration_0e29ba92a96e3342f6e47f324a0c8857'] = 'Portefeuilles numériques, c\'est-à-dire Apple Pay et Google Pay.[br]En utilisant Apple Pay, vous acceptez les conditions d\'utilisation de [a @href1@]Stripe[/a] et [a @href2@]Apple[/a].'; $_MODULE['<{stripe_official}prestashop>configuration_f80b9de6d53dc9db807d2a123c149fc7'] = 'Ne jamais recueillir le code postal (non recommandé*).'; $_MODULE['<{stripe_official}prestashop>configuration_c99b5f040533a2516fed921947a3b7f4'] = 'Cette information augmente le taux d\'acceptation des cartes émises aux États-Unis, au Royaume-Uni et au Canada.'; $_MODULE['<{stripe_official}prestashop>configuration_8cb12d0aa65678a528d4395dbf3a4138'] = 'Recueillir le nom du titulaire de la carte bancaire'; @@ -145,33 +124,59 @@ $_MODULE['<{stripe_official}prestashop>configuration_93cba07454f06a4a960172bbd6e2a435'] = 'Oui'; $_MODULE['<{stripe_official}prestashop>configuration_0a2c4e503e93bc3135308bb3fadbe0bd'] = 'Vous devez commencer par activer ces moyens de paiement dans votre [a @href2@]Dashboard Stripe[/a].'; $_MODULE['<{stripe_official}prestashop>configuration_c9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer'; +$_MODULE['<{stripe_official}prestashop>refund_2b660da0c521cc6bc51a188bc9f7d084'] = 'Sélectionnez la commande que vous voulez rembourser'; +$_MODULE['<{stripe_official}prestashop>refund_24e85d1e652b3681994e9cae2cc1f35a'] = 'ID de paiement Stripe'; +$_MODULE['<{stripe_official}prestashop>refund_991bd624dcaff354bd793e4cacbd6ea3'] = 'Cet ID se trouve dans l\'onglet Stripe de la commande que vous souhaitez rembourser. Il commence par « ch_ » ou « py_ ».'; +$_MODULE['<{stripe_official}prestashop>refund_c0a3c3e9b5fbd21c505e082644b2220c'] = 'Remboursement total'; +$_MODULE['<{stripe_official}prestashop>refund_77fd2b4393b379bedd30efcd5df02090'] = 'Remboursement partiel'; +$_MODULE['<{stripe_official}prestashop>refund_fe9cc1bcfa322db8ade8960ddf4bb19c'] = 'Nous enverrons immédiatement tout remboursement effectué à la banque de votre client.'; +$_MODULE['<{stripe_official}prestashop>refund_2b9689f82101a977f16db0056493a5aa'] = 'Votre client recevra les fonds correspondants sous environ 2 à 3 jours ouvrés suivant la date du remboursement.'; +$_MODULE['<{stripe_official}prestashop>refund_6e5d08adf277f2eb21b257fe74f76ddc'] = 'Il faut compter de 5 à 10 jours pour que les remboursements apparaissent sur le relevé bancaire de votre client.'; +$_MODULE['<{stripe_official}prestashop>refund_b2f40690858b404ed10e62bdf422c704'] = 'Montant'; +$_MODULE['<{stripe_official}prestashop>refund_f3b5fc873bba0e14e0d8d9851408b2a3'] = 'Veuillez renseigner le montant que vous souhaitez rembourser'; +$_MODULE['<{stripe_official}prestashop>refund_f87db45e2887d485ca31ffae186faae9'] = 'Demander un remboursement'; +$_MODULE['<{stripe_official}prestashop>admin_tab_order_ce7566d1d08cc094b74cf283cf9c56a5'] = 'Stripe'; +$_MODULE['<{stripe_official}prestashop>my-account-stripe-cards_a46d3e7285f76d2401202f18b0acbcbd'] = 'Mes cartes bancaires'; +$_MODULE['<{stripe_official}prestashop>admin_cart_1ab1dfd9dc24ea4729d6c032f7f0342d'] = 'Informations de paiement'; +$_MODULE['<{stripe_official}prestashop>admin_cart_3d9c6a8d9e9bd14af99a9f4444f602a4'] = 'Date (dernière mise à jour)'; +$_MODULE['<{stripe_official}prestashop>admin_cart_24e85d1e652b3681994e9cae2cc1f35a'] = 'ID de paiement Stripe'; +$_MODULE['<{stripe_official}prestashop>admin_cart_49ee3087348e8d44e1feda1917443987'] = 'Nom'; +$_MODULE['<{stripe_official}prestashop>admin_cart_f0aaaae189e9c7711931a65ffcd22543'] = 'Moyen de paiement'; +$_MODULE['<{stripe_official}prestashop>admin_cart_388fd2767ba1fd2296f536425d106de3'] = 'Montant payé'; +$_MODULE['<{stripe_official}prestashop>admin_cart_76f0ed934de85cc7131910b32ede7714'] = 'Remboursement'; +$_MODULE['<{stripe_official}prestashop>admin_cart_8eea62084ca7e541d918e823422bd82e'] = 'Résultat'; +$_MODULE['<{stripe_official}prestashop>admin_cart_650be61892bf690026089544abbd9d26'] = 'Mode'; +$_MODULE['<{stripe_official}prestashop>admin_cart_c985a711556e2edf5cac28dfbdb43ff0'] = 'Remboursement partiel'; +$_MODULE['<{stripe_official}prestashop>admin_cart_5706de961fb376d701be6e7762d8b09c'] = 'En attente'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_1e63d1811556fc2dad106dcbd4217a69'] = 'ID de paiement'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_7133d45d85f629f4c8abe0e1b3d37942'] = 'Date du paiement'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_f0aaaae189e9c7711931a65ffcd22543'] = 'Moyen de paiement'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_ccd51debd3d65d453679c150b99a39c0'] = 'Date d\'autorisation'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_3f8c6ecb084eea3b83d659fab7155e86'] = 'Date de capture'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_24fe48030f7d3097d5882535b04c3fa8'] = 'Expiré'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_90cbb08c2e81b8eca5298e2533dbe3d9'] = 'Litige concernant un paiement'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_9b12a0ddfdf2b10342c50ed2fe6e5c50'] = 'Consultez votre litige ici'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_bf49f5bcf72238ecbc0659c3c0c8079f'] = 'Aucun litige'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_e2fe37d9647990819245fadb404c482e'] = 'Validation du coupon'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_e2b54a61bf4e56c4a044386b2553ed77'] = 'Coupon validé le :'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_2311c8c5e8f44924a3e61c78e2223049'] = 'Expiration du coupon le :'; +$_MODULE['<{stripe_official}prestashop>payment_form_oxxo_49ee3087348e8d44e1feda1917443987'] = 'Nom'; +$_MODULE['<{stripe_official}prestashop>payment_form_oxxo_ce8ae9da5b7cd6c3df2929543a9af92d'] = 'E-mail'; $_MODULE['<{stripe_official}prestashop>stripe-cards_4e997b9d3b7152f2afeacd96ab1ef1cb'] = 'Mes cartes bancaires'; $_MODULE['<{stripe_official}prestashop>stripe-cards_a1fa27779242b4902f7ae3bdd5c6d508'] = 'Type'; $_MODULE['<{stripe_official}prestashop>stripe-cards_a44217022190f5734b2f72ba1e4f8a79'] = 'Numéro de carte bancaire'; $_MODULE['<{stripe_official}prestashop>stripe-cards_b07cc2801693b2e722906a3db3d9c447'] = 'Validité'; $_MODULE['<{stripe_official}prestashop>stripe-cards_f2a6c498fb90ee345d997f888fce3b18'] = 'Supprimer'; $_MODULE['<{stripe_official}prestashop>stripe-cards_78560f5a4e1f5716c8fb9d7cb35f56de'] = 'Vous n\'avez pas encore enregistré de carte bancaire.'; +$_MODULE['<{stripe_official}prestashop>payment_form_bancontact_d536f6cb1304cde5da44c530d3157886'] = 'Payer avec Bancontact'; +$_MODULE['<{stripe_official}prestashop>payment_form_sepa_debit_28d20d5ce69c797169658d647110374b'] = 'Payer par prélèvement SEPA'; +$_MODULE['<{stripe_official}prestashop>payment_form_sepa_debit_eeceac1af4e7620894d6d2083921bb73'] = 'Acheter'; $_MODULE['<{stripe_official}prestashop>payment_info_redirect_f3ee3ad3c8443ee27192d35a7a9d86c9'] = 'Vous serez redirigé vers le site de votre banque pour effectuer votre paiement.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_9d67bee92ea535ba9c7840797966edfa'] = 'Une erreur est survenue lors de votre paiement.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = 'Veuillez [a @href1@]réessayer[/a] ou contacter le propriétaire du site Web.'; -$_MODULE['<{stripe_official}prestashop>payment_form_ideal_ac23f66a874a7808e300a15f2e94320a'] = 'Payer avec iDeal'; -$_MODULE['<{stripe_official}prestashop>payment_form_ideal_eeceac1af4e7620894d6d2083921bb73'] = 'Acheter maintenant'; -$_MODULE['<{stripe_official}prestashop>stripe-cards16_a46d3e7285f76d2401202f18b0acbcbd'] = 'Mes cartes bancaires'; -$_MODULE['<{stripe_official}prestashop>stripe-cards16_a1fa27779242b4902f7ae3bdd5c6d508'] = 'Type'; -$_MODULE['<{stripe_official}prestashop>stripe-cards16_a44217022190f5734b2f72ba1e4f8a79'] = 'Numéro de carte bancaire'; -$_MODULE['<{stripe_official}prestashop>stripe-cards16_b07cc2801693b2e722906a3db3d9c447'] = 'Validité'; -$_MODULE['<{stripe_official}prestashop>stripe-cards16_f2a6c498fb90ee345d997f888fce3b18'] = 'Supprimer'; -$_MODULE['<{stripe_official}prestashop>stripe-cards16_78560f5a4e1f5716c8fb9d7cb35f56de'] = 'Vous n\'avez pas encore enregistré de carte bancaire.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_9d67bee92ea535ba9c7840797966edfa'] = 'Une erreur est survenue lors de votre paiement.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = 'Veuillez [a @href1@]réessayer[/a] ou contacter le propriétaire du site Web.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_3380b659ba0a8b01af98dbe7494c0706'] = 'Félicitations, votre commande est validée et sera traitée sous peu.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_77031dd06e26cfdab21b078a37741bb6'] = 'La référence de votre commande est [b]@target@[/b]. Vous devriez recevoir un e-mail de confirmation sous peu.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_2a69d95c0cc64162865573233beb3369'] = 'Vous pouvez accéder à votre coupon OXXO [a @href1@]ici[/a].'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Merci de votre confiance.'; $_MODULE['<{stripe_official}prestashop>payment_form_sofort_068bcd34a6ded96b1805ca0b9a6745bb'] = 'Payer avec SOFORT'; -$_MODULE['<{stripe_official}prestashop>payment_form_alipay_47e1e580d173b931fdfdeb6bb5f14848'] = 'Payer avec Alipay'; -$_MODULE['<{stripe_official}prestashop>payment_form_bancontact_d536f6cb1304cde5da44c530d3157886'] = 'Payer avec Bancontact'; -$_MODULE['<{stripe_official}prestashop>payment_form_eps_c446bbd08309aff37eee1e0c43b19cde'] = 'Payer avec EPS'; -$_MODULE['<{stripe_official}prestashop>payment_form_save_card_6e9c53f6d39367724e9b996b3ea9ef22'] = 'Payer par carte bancaire :'; -$_MODULE['<{stripe_official}prestashop>payment_form_save_card_eeceac1af4e7620894d6d2083921bb73'] = 'Acheter maintenant'; -$_MODULE['<{stripe_official}prestashop>payment_form_fpx_74253765ffa5a6b91d758c7df4d3c871'] = 'Payer avec FPX'; -$_MODULE['<{stripe_official}prestashop>payment_form_fpx_eeceac1af4e7620894d6d2083921bb73'] = 'Acheter'; $_MODULE['<{stripe_official}prestashop>payment_form_card_f73a8b5c0b42c88867a7650fc6fde345'] = 'Veuillez accepter nos Conditions d\'utilisation du service avant de continuer.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_d9b1a32393ffc57f2ee4f07626e76d46'] = 'Pour payer maintenant, cliquez sur le bouton ci-dessus si vous souhaitez utiliser la carte bancaire enregistrée dans votre appareil, ou saisissez les informations de carte ci-dessous, puis validez en bas de page'; $_MODULE['<{stripe_official}prestashop>payment_form_card_d9a3493a581e1b2900c5eb45dcb0dc02'] = 'Nom du titulaire de la carte bancaire'; @@ -183,19 +188,34 @@ $_MODULE['<{stripe_official}prestashop>payment_form_card_96e7de5dba463d377178948e998cdf27'] = 'Les informations de votre carte sont protégées par les normes de sécurité PCI DSS v3.2.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_48334cb46587c0571f12ac31e8e9364a'] = 'Les informations de votre carte bancaire seront automatiquement enregistrées pour votre prochain achat.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_eeceac1af4e7620894d6d2083921bb73'] = 'Acheter maintenant'; -$_MODULE['<{stripe_official}prestashop>payment_form_sepa_debit_28d20d5ce69c797169658d647110374b'] = 'Payer par prélèvement SEPA'; -$_MODULE['<{stripe_official}prestashop>payment_form_sepa_debit_eeceac1af4e7620894d6d2083921bb73'] = 'Acheter'; -$_MODULE['<{stripe_official}prestashop>payment_form_giropay_32e26982dda43a14285657baee320523'] = 'Payer avec Giropay'; -$_MODULE['<{stripe_official}prestashop>payment_form_oxxo_49ee3087348e8d44e1feda1917443987'] = 'Nom'; -$_MODULE['<{stripe_official}prestashop>payment_form_oxxo_ce8ae9da5b7cd6c3df2929543a9af92d'] = 'E-mail'; +$_MODULE['<{stripe_official}prestashop>payment_form_ideal_ac23f66a874a7808e300a15f2e94320a'] = 'Payer avec iDeal'; +$_MODULE['<{stripe_official}prestashop>payment_form_ideal_eeceac1af4e7620894d6d2083921bb73'] = 'Acheter maintenant'; +$_MODULE['<{stripe_official}prestashop>payment_form_eps_c446bbd08309aff37eee1e0c43b19cde'] = 'Payer avec EPS'; +$_MODULE['<{stripe_official}prestashop>stripe-cards16_a46d3e7285f76d2401202f18b0acbcbd'] = 'Mes cartes bancaires'; +$_MODULE['<{stripe_official}prestashop>stripe-cards16_a1fa27779242b4902f7ae3bdd5c6d508'] = 'Type'; +$_MODULE['<{stripe_official}prestashop>stripe-cards16_a44217022190f5734b2f72ba1e4f8a79'] = 'Numéro de carte bancaire'; +$_MODULE['<{stripe_official}prestashop>stripe-cards16_b07cc2801693b2e722906a3db3d9c447'] = 'Validité'; +$_MODULE['<{stripe_official}prestashop>stripe-cards16_f2a6c498fb90ee345d997f888fce3b18'] = 'Supprimer'; +$_MODULE['<{stripe_official}prestashop>stripe-cards16_78560f5a4e1f5716c8fb9d7cb35f56de'] = 'Vous n\'avez pas encore enregistré de carte bancaire.'; $_MODULE['<{stripe_official}prestashop>payment_form_p24_751e90522b3385322c4c34b6f73847d2'] = 'Payer avec P24'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_3380b659ba0a8b01af98dbe7494c0706'] = 'Félicitations, votre commande est validée et sera traitée sous peu.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_77031dd06e26cfdab21b078a37741bb6'] = 'La référence de votre commande est [b]@target@[/b]. Vous devriez recevoir un e-mail de confirmation sous peu.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_2a69d95c0cc64162865573233beb3369'] = 'Vous pouvez accéder à votre coupon OXXO [a @href1@]ici[/a].'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Merci de votre confiance.'; +$_MODULE['<{stripe_official}prestashop>payment_form_save_card_6e9c53f6d39367724e9b996b3ea9ef22'] = 'Payer par carte bancaire :'; +$_MODULE['<{stripe_official}prestashop>payment_form_save_card_eeceac1af4e7620894d6d2083921bb73'] = 'Acheter maintenant'; +$_MODULE['<{stripe_official}prestashop>payment_form_giropay_32e26982dda43a14285657baee320523'] = 'Payer avec Giropay'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_9d67bee92ea535ba9c7840797966edfa'] = 'Une erreur est survenue lors de votre paiement.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = 'Veuillez [a @href1@]réessayer[/a] ou contacter le propriétaire du site Web.'; $_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_3380b659ba0a8b01af98dbe7494c0706'] = 'Félicitations, votre commande est validée et sera traitée sous peu.'; $_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_2a69d95c0cc64162865573233beb3369'] = 'Vous pouvez accéder à votre coupon OXXO [a @href1@]ici[/a].'; $_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Merci de votre confiance.'; $_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_3380b659ba0a8b01af98dbe7494c0706'] = 'Félicitations, votre commande est validée et sera traitée sous peu.'; $_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_2a69d95c0cc64162865573233beb3369'] = 'Vous pouvez accéder à votre coupon OXXO [a @href1@]ici[/a].'; $_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Merci de votre confiance.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_9d67bee92ea535ba9c7840797966edfa'] = 'Une erreur est survenue lors de votre paiement.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = 'Veuillez [a @href1@]réessayer[/a] ou contacter le propriétaire du site Web.'; +$_MODULE['<{stripe_official}prestashop>payment_form_alipay_47e1e580d173b931fdfdeb6bb5f14848'] = 'Payer avec Alipay'; +$_MODULE['<{stripe_official}prestashop>payment_form_fpx_74253765ffa5a6b91d758c7df4d3c871'] = 'Payer avec FPX'; +$_MODULE['<{stripe_official}prestashop>payment_form_fpx_eeceac1af4e7620894d6d2083921bb73'] = 'Acheter'; +$_MODULE['<{stripe_official}prestashop>configurationactions_187b101d0358396a634514ea228616d5'] = 'Vous avez fourni des clés API de production au lieu de clés API de test'; +$_MODULE['<{stripe_official}prestashop>configurationactions_2df5570b8a0e0c076571d1213f7f901e'] = 'Les champs ID du client et Clé secrète sont obligatoires'; +$_MODULE['<{stripe_official}prestashop>configurationactions_5fba3565c1b6638ac41f7627066aaa58'] = 'Vous avez fourni des clés API de test au lieu de clés API de production'; +$_MODULE['<{stripe_official}prestashop>configurationactions_50ce374ab3f05a63a6981484b8757094'] = 'Activer l\'autorisation et la capture distinctes'; +$_MODULE['<{stripe_official}prestashop>configurationactions_8dd2f915acf4ec98006d11c9a4b0945b'] = 'Paramètres mis à jour.'; diff --git a/translations/index.php b/translations/index.php old mode 100644 new mode 100755 diff --git a/translations/it.php b/translations/it.php old mode 100644 new mode 100755 index c058716..94e9bb5 --- a/translations/it.php +++ b/translations/it.php @@ -20,6 +20,17 @@ $_MODULE['<{stripe_official}prestashop>stripe_official_7c716e01a03b426976692f4a7a0d80be'] = 'Accetta fin da subito i pagamenti con Stripe, direttamente dal tuo e-shop!'; $_MODULE['<{stripe_official}prestashop>stripe_official_876f23178c29dc2552c0b48bf23cd9bd'] = 'Disinstallare il modulo?'; $_MODULE['<{stripe_official}prestashop>stripe_official_6341ee14cd6d47787171f68d27f1f41b'] = 'Pagamento con Stripe'; +$_MODULE['<{stripe_official}prestashop>stripe_official_a6ee78c840497aed8a81b6164d4224e6'] = 'È necessario abilitare SSL sullo store se si desidera utilizzare questo modulo in produzione.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_66f67e1a8f01161f2009c2ed39c3cb1e'] = 'Hai raggiunto il limite di 16 endpoint webhook registrati nella tua Dashboard Stripe per questo account. Rimuovine uno se desideri registrare questo dominio.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_69e6a2456656fcc3c9a79452ef3a7928'] = 'La tua versione TLS non è supportata. Dovrai aggiornare la tua integrazione. Si prega di controllare le FAQ se non si sa come farlo.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_47daed1af40eaa1fb3c750322137815d'] = 'Impossibile trovare la configurazione di Webhook in PrestaShop, fare clic sul pulsante Salva per risolvere il problema. Verrà creato un nuovo webhook su Stripe, quindi salvato in PrestaShop.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_4684c4310f6bd9917b3c079bc38fd335'] = 'La La configurazione dell\'URL di Webhook è errata, fare clic sul pulsante Salva per risolvere il problema. La configurazione del webhook verrà corretta..'; +$_MODULE['<{stripe_official}prestashop>stripe_official_572bde45cccf4cde600e2a846cfe8085'] = 'URL webhook corrente:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_12632987bdd5031845a591acdf5faa40'] = 'URL webhook previsto:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_2226fcd706ac6ba242dc3381636cf74b'] = 'La configurazione degli eventi Webhook è errata, fare clic sul pulsante Salva per risolvere il problema. La configurazione del webhook verrà corretta.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_4047173bbb1dd67cd5e877f7736c1e86'] = 'Eventi attuali del webhook:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_78b8b4d922d4061d31e55caece729f8b'] = 'Eventi webhook previsti:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_21e8380e65bb6a9cc714dae46e2b6dbf'] = 'Non è possibile accedere alla configurazione di Webhook, fare clic sul pulsante Salva per risolvere il problema. Verrà creato un nuovo webhook su Stripe.'; $_MODULE['<{stripe_official}prestashop>stripe_official_b32006c07b70b4db49be9fcc111b074f'] = 'Le chiavi sono vuote.'; $_MODULE['<{stripe_official}prestashop>stripe_official_3e5298c1c5d8c871334c4e3994481f90'] = 'L\'ID pagamento Stripe non può essere vuoto.'; $_MODULE['<{stripe_official}prestashop>stripe_official_eb804bebeffc55fb161165d50bcf74f8'] = 'ID pagamento Stripe sconosciuto.'; @@ -31,8 +42,10 @@ $_MODULE['<{stripe_official}prestashop>stripe_official_fd2bdc826d325902e451236cf6fd774e'] = 'Elaborazione...'; $_MODULE['<{stripe_official}prestashop>stripe_official_b24ee2c7cb1734370b544eb4e6cdc2b6'] = 'Accetta le condizioni generali di vendita'; $_MODULE['<{stripe_official}prestashop>stripe_official_15f04500d9edaac382bb3d451c8b4198'] = 'Reindirizzamento...'; +$_MODULE['<{stripe_official}prestashop>stripe_official_86c7338e09e2c3ca2e458da630895e25'] = 'Non sono state fornite chiavi API. Si prega di contattare il proprietario del sito web.'; $_MODULE['<{stripe_official}prestashop>stripecards_cd81f9f55969c822377f076017bb3484'] = 'Carte'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_d3b206d196cd6be3a2764c1fb90b200f'] = 'Elimina selezione'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_53c6a96a3df980c3270d6ed82b6f174b'] = 'Vuoi eliminare gli elementi selezionati?'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_b718adec73e04ce3ec720dd11a06a308'] = 'ID'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_49ee3087348e8d44e1feda1917443987'] = 'Nome'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_4c2a8fe7eaf24721cc7a9f0175115bd4'] = 'Messaggio'; @@ -41,48 +54,19 @@ $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_d95fc016a6eee828f434ed5f55504427'] = 'ID oggetto'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_44749712dbec183e983dcd78a7736c41'] = 'Data'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_2d8e32e9c23e2a7155c88028b3fbff66'] = 'Impostazioni registratore processo'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_2ce895700ba5c16bede3b769128d216f'] = 'Qui puoi modificare la configurazione predefinita per questo Process Logger'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_3073ef21c0b326939d5b630edd08cfb6'] = 'Disabilita la cancellazione automatica'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_434ef5977d28afa36e430439de18cbad'] = 'Se disabilitato, i registri verranno automaticamente cancellati dopo il ritardo'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_1607c94671fd5baf4ac06f554b118b2a'] = 'Ritardo cancellazione automatica (in giorni)'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_71c3e06323cd5a59436ec53afca80c57'] = 'Scegli il numero di giorni in cui desideri conservare i log nel database'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_c9cc8cce247e49bae79f15173ce97354'] = 'Salva'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_dcc459e0cef1e36a18a356fbc5789b16'] = 'Cancella tutto'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_729a51874fe901b092899e9e8b31c97a'] = 'Confermi?'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_f51c7af7c02cd3a846d87d97bfaf6b58'] = 'Tutti i log sono stati cancellati'; -$_MODULE['<{stripe_official}prestashop>admin_tab_order_ce7566d1d08cc094b74cf283cf9c56a5'] = 'Stripe'; -$_MODULE['<{stripe_official}prestashop>my-account-stripe-cards_a46d3e7285f76d2401202f18b0acbcbd'] = 'Le mie carte'; -$_MODULE['<{stripe_official}prestashop>admin_cart_1ab1dfd9dc24ea4729d6c032f7f0342d'] = 'Informazioni sul pagamento'; -$_MODULE['<{stripe_official}prestashop>admin_cart_3d9c6a8d9e9bd14af99a9f4444f602a4'] = 'Data (ultimo aggiornamento)'; -$_MODULE['<{stripe_official}prestashop>admin_cart_24e85d1e652b3681994e9cae2cc1f35a'] = 'ID pagamento Stripe'; -$_MODULE['<{stripe_official}prestashop>admin_cart_49ee3087348e8d44e1feda1917443987'] = 'Nome'; -$_MODULE['<{stripe_official}prestashop>admin_cart_f0aaaae189e9c7711931a65ffcd22543'] = 'Modalità di pagamento'; -$_MODULE['<{stripe_official}prestashop>admin_cart_388fd2767ba1fd2296f536425d106de3'] = 'Importo pagato'; -$_MODULE['<{stripe_official}prestashop>admin_cart_76f0ed934de85cc7131910b32ede7714'] = 'Rimborso'; -$_MODULE['<{stripe_official}prestashop>admin_cart_8eea62084ca7e541d918e823422bd82e'] = 'Risultato'; -$_MODULE['<{stripe_official}prestashop>admin_cart_650be61892bf690026089544abbd9d26'] = 'Modalità'; -$_MODULE['<{stripe_official}prestashop>admin_cart_c985a711556e2edf5cac28dfbdb43ff0'] = 'Rimborso parziale'; -$_MODULE['<{stripe_official}prestashop>admin_cart_5706de961fb376d701be6e7762d8b09c'] = 'In attesa'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_1e63d1811556fc2dad106dcbd4217a69'] = 'ID pagamento'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_7133d45d85f629f4c8abe0e1b3d37942'] = 'Data pagamento'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_f0aaaae189e9c7711931a65ffcd22543'] = 'Modalità di pagamento'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_ccd51debd3d65d453679c150b99a39c0'] = 'Data autorizzazione'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_3f8c6ecb084eea3b83d659fab7155e86'] = 'Data addebito'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_24fe48030f7d3097d5882535b04c3fa8'] = 'Scaduta'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_90cbb08c2e81b8eca5298e2533dbe3d9'] = 'Contestazione pagamento'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_9b12a0ddfdf2b10342c50ed2fe6e5c50'] = 'controlla la tua contestazione qui'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_bf49f5bcf72238ecbc0659c3c0c8079f'] = 'Nessuna contestazione'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_e2fe37d9647990819245fadb404c482e'] = 'Convalida voucher'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_e2b54a61bf4e56c4a044386b2553ed77'] = 'Data convalida voucher:'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_2311c8c5e8f44924a3e61c78e2223049'] = 'Data scadenza voucher:'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_9ca4bc48596557840045a7477c803657'] = 'È necessario specificare un numero valido \"Ritardo cancellazione automatica (in giorni)\".'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_5988c28d05527a0d0ce8ae3da1134352'] = 'I parametri del registro sono stati aggiornati con successo!'; $_MODULE['<{stripe_official}prestashop>main_c2cc7082a89c1ad6631a2f66af5f00c0'] = 'Connessione'; $_MODULE['<{stripe_official}prestashop>main_76f0ed934de85cc7131910b32ede7714'] = 'Rimborso'; -$_MODULE['<{stripe_official}prestashop>refund_2b660da0c521cc6bc51a188bc9f7d084'] = 'Scegli un ordine da rimborsare'; -$_MODULE['<{stripe_official}prestashop>refund_24e85d1e652b3681994e9cae2cc1f35a'] = 'ID pagamento Stripe'; -$_MODULE['<{stripe_official}prestashop>refund_991bd624dcaff354bd793e4cacbd6ea3'] = 'L\'ID è reperibile nella scheda Stripe dell\'ordine che desideri rimborsare. Inizia con \"ch_\" o \"py_\".'; -$_MODULE['<{stripe_official}prestashop>refund_c0a3c3e9b5fbd21c505e082644b2220c'] = 'Rimborso completo'; -$_MODULE['<{stripe_official}prestashop>refund_77fd2b4393b379bedd30efcd5df02090'] = 'Rimborso parziale'; -$_MODULE['<{stripe_official}prestashop>refund_fe9cc1bcfa322db8ade8960ddf4bb19c'] = 'Invieremo immediatamente qualsiasi rimborso che effettui alla banca del tuo cliente.'; -$_MODULE['<{stripe_official}prestashop>refund_2b9689f82101a977f16db0056493a5aa'] = 'Il tuo cliente riceverà, quindi, i fondi del rimborso, entro circa 2-3 giorni lavorativi dalla data in cui è stato avviato il rimborso.'; -$_MODULE['<{stripe_official}prestashop>refund_6e5d08adf277f2eb21b257fe74f76ddc'] = 'I rimborsi richiedono da 5 a 10 giorni per essere visualizzati sull\'estratto conto del cliente.'; -$_MODULE['<{stripe_official}prestashop>refund_b2f40690858b404ed10e62bdf422c704'] = 'Importo'; -$_MODULE['<{stripe_official}prestashop>refund_f3b5fc873bba0e14e0d8d9851408b2a3'] = 'Inserisci un importo che desideri rimborsare'; -$_MODULE['<{stripe_official}prestashop>refund_f87db45e2887d485ca31ffae186faae9'] = 'Richiedi rimborso'; $_MODULE['<{stripe_official}prestashop>configuration_e6ad4dd232a1bb7d77852af7fc2e0538'] = '[a @href1@]Crea il tuo account Stripe in 10 minuti[/a] e inizia subito ad accettare pagamenti con carta oltre che tramite modalità di pagamento locali (nessun ulteriore contratto/ID esercente necessario dalla tua banca).'; $_MODULE['<{stripe_official}prestashop>configuration_ebd8fbb49032e4992eb5050893dfa1fc'] = 'Connettiti con Stripe'; $_MODULE['<{stripe_official}prestashop>configuration_650be61892bf690026089544abbd9d26'] = 'Modalità'; @@ -115,7 +99,7 @@ $_MODULE['<{stripe_official}prestashop>configuration_e150eb523fd98533136e660e3e7862a0'] = 'China UnionPay'; $_MODULE['<{stripe_official}prestashop>configuration_53619d5dc16df90ad84a8958b7121aa8'] = 'JCB'; $_MODULE['<{stripe_official}prestashop>configuration_1f6176c4f26f546cd5424d53fac0f2f8'] = 'Discovers'; -$_MODULE['<{stripe_official}prestashop>configuration_5f07627108d0280b0fd45dd36e73d01f'] = 'Portafogli elettronici, ad esempio Apple Pay/Google Pay e Microsoft Pay.[br]Utilizzando Apple Pay, accetti i Termini di servizio di [a @href1@]Stripe[/a] e [a @href2@]Apple[/a].'; +$_MODULE['<{stripe_official}prestashop>configuration_0e29ba92a96e3342f6e47f324a0c8857'] = 'Portafogli digitali, ovvero Apple Pay e Google Pay.[br]Utilizzando Apple Pay, accetti i termini di servizio di [a @href1@]Stripe[/a] e [a @href2@]Apple[/a].'; $_MODULE['<{stripe_official}prestashop>configuration_f80b9de6d53dc9db807d2a123c149fc7'] = 'Non acquisire mai il codice postale (opzione non consigliata*).'; $_MODULE['<{stripe_official}prestashop>configuration_c99b5f040533a2516fed921947a3b7f4'] = 'Queste informazioni migliorano il tasso di accettazione per le carte emesse in Stati Uniti, Regno Unito e Canada.'; $_MODULE['<{stripe_official}prestashop>configuration_8cb12d0aa65678a528d4395dbf3a4138'] = 'Acquisisci nome del titolare della carta'; @@ -140,21 +124,59 @@ $_MODULE['<{stripe_official}prestashop>configuration_93cba07454f06a4a960172bbd6e2a435'] = 'Sì'; $_MODULE['<{stripe_official}prestashop>configuration_0a2c4e503e93bc3135308bb3fadbe0bd'] = 'Tali modalità di pagamento vanno prima attivate su [a @href2@]Stripe Dashboard[/a].'; $_MODULE['<{stripe_official}prestashop>configuration_c9cc8cce247e49bae79f15173ce97354'] = 'Salva'; +$_MODULE['<{stripe_official}prestashop>refund_2b660da0c521cc6bc51a188bc9f7d084'] = 'Scegli un ordine da rimborsare'; +$_MODULE['<{stripe_official}prestashop>refund_24e85d1e652b3681994e9cae2cc1f35a'] = 'ID pagamento Stripe'; +$_MODULE['<{stripe_official}prestashop>refund_991bd624dcaff354bd793e4cacbd6ea3'] = 'L\'ID è reperibile nella scheda Stripe dell\'ordine che desideri rimborsare. Inizia con \"ch_\" o \"py_\".'; +$_MODULE['<{stripe_official}prestashop>refund_c0a3c3e9b5fbd21c505e082644b2220c'] = 'Rimborso completo'; +$_MODULE['<{stripe_official}prestashop>refund_77fd2b4393b379bedd30efcd5df02090'] = 'Rimborso parziale'; +$_MODULE['<{stripe_official}prestashop>refund_fe9cc1bcfa322db8ade8960ddf4bb19c'] = 'Invieremo immediatamente qualsiasi rimborso che effettui alla banca del tuo cliente.'; +$_MODULE['<{stripe_official}prestashop>refund_2b9689f82101a977f16db0056493a5aa'] = 'Il tuo cliente riceverà, quindi, i fondi del rimborso, entro circa 2-3 giorni lavorativi dalla data in cui è stato avviato il rimborso.'; +$_MODULE['<{stripe_official}prestashop>refund_6e5d08adf277f2eb21b257fe74f76ddc'] = 'I rimborsi richiedono da 5 a 10 giorni per essere visualizzati sull\'estratto conto del cliente.'; +$_MODULE['<{stripe_official}prestashop>refund_b2f40690858b404ed10e62bdf422c704'] = 'Importo'; +$_MODULE['<{stripe_official}prestashop>refund_f3b5fc873bba0e14e0d8d9851408b2a3'] = 'Inserisci un importo che desideri rimborsare'; +$_MODULE['<{stripe_official}prestashop>refund_f87db45e2887d485ca31ffae186faae9'] = 'Richiedi rimborso'; +$_MODULE['<{stripe_official}prestashop>admin_tab_order_ce7566d1d08cc094b74cf283cf9c56a5'] = 'Stripe'; +$_MODULE['<{stripe_official}prestashop>my-account-stripe-cards_a46d3e7285f76d2401202f18b0acbcbd'] = 'Le mie carte'; +$_MODULE['<{stripe_official}prestashop>admin_cart_1ab1dfd9dc24ea4729d6c032f7f0342d'] = 'Informazioni sul pagamento'; +$_MODULE['<{stripe_official}prestashop>admin_cart_3d9c6a8d9e9bd14af99a9f4444f602a4'] = 'Data (ultimo aggiornamento)'; +$_MODULE['<{stripe_official}prestashop>admin_cart_24e85d1e652b3681994e9cae2cc1f35a'] = 'ID pagamento Stripe'; +$_MODULE['<{stripe_official}prestashop>admin_cart_49ee3087348e8d44e1feda1917443987'] = 'Nome'; +$_MODULE['<{stripe_official}prestashop>admin_cart_f0aaaae189e9c7711931a65ffcd22543'] = 'Modalità di pagamento'; +$_MODULE['<{stripe_official}prestashop>admin_cart_388fd2767ba1fd2296f536425d106de3'] = 'Importo pagato'; +$_MODULE['<{stripe_official}prestashop>admin_cart_76f0ed934de85cc7131910b32ede7714'] = 'Rimborso'; +$_MODULE['<{stripe_official}prestashop>admin_cart_8eea62084ca7e541d918e823422bd82e'] = 'Risultato'; +$_MODULE['<{stripe_official}prestashop>admin_cart_650be61892bf690026089544abbd9d26'] = 'Modalità'; +$_MODULE['<{stripe_official}prestashop>admin_cart_c985a711556e2edf5cac28dfbdb43ff0'] = 'Rimborso parziale'; +$_MODULE['<{stripe_official}prestashop>admin_cart_5706de961fb376d701be6e7762d8b09c'] = 'In attesa'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_1e63d1811556fc2dad106dcbd4217a69'] = 'ID pagamento'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_7133d45d85f629f4c8abe0e1b3d37942'] = 'Data pagamento'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_f0aaaae189e9c7711931a65ffcd22543'] = 'Modalità di pagamento'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_ccd51debd3d65d453679c150b99a39c0'] = 'Data autorizzazione'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_3f8c6ecb084eea3b83d659fab7155e86'] = 'Data addebito'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_24fe48030f7d3097d5882535b04c3fa8'] = 'Scaduta'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_90cbb08c2e81b8eca5298e2533dbe3d9'] = 'Contestazione pagamento'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_9b12a0ddfdf2b10342c50ed2fe6e5c50'] = 'controlla la tua contestazione qui'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_bf49f5bcf72238ecbc0659c3c0c8079f'] = 'Nessuna contestazione'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_e2fe37d9647990819245fadb404c482e'] = 'Convalida voucher'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_e2b54a61bf4e56c4a044386b2553ed77'] = 'Data convalida voucher:'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_2311c8c5e8f44924a3e61c78e2223049'] = 'Data scadenza voucher:'; $_MODULE['<{stripe_official}prestashop>payment_form_oxxo_49ee3087348e8d44e1feda1917443987'] = 'Nome'; $_MODULE['<{stripe_official}prestashop>payment_form_oxxo_ce8ae9da5b7cd6c3df2929543a9af92d'] = 'Email'; -$_MODULE['<{stripe_official}prestashop>payment_form_ideal_ac23f66a874a7808e300a15f2e94320a'] = 'Paga con iDeal'; -$_MODULE['<{stripe_official}prestashop>payment_form_ideal_eeceac1af4e7620894d6d2083921bb73'] = 'Acquista ora'; $_MODULE['<{stripe_official}prestashop>stripe-cards_4e997b9d3b7152f2afeacd96ab1ef1cb'] = 'Le mie carte'; $_MODULE['<{stripe_official}prestashop>stripe-cards_a1fa27779242b4902f7ae3bdd5c6d508'] = 'Tipo'; $_MODULE['<{stripe_official}prestashop>stripe-cards_a44217022190f5734b2f72ba1e4f8a79'] = 'Numero di carta'; $_MODULE['<{stripe_official}prestashop>stripe-cards_b07cc2801693b2e722906a3db3d9c447'] = 'Validità'; $_MODULE['<{stripe_official}prestashop>stripe-cards_f2a6c498fb90ee345d997f888fce3b18'] = 'Elimina'; $_MODULE['<{stripe_official}prestashop>stripe-cards_78560f5a4e1f5716c8fb9d7cb35f56de'] = 'Non hai ancora registrato una carta.'; +$_MODULE['<{stripe_official}prestashop>payment_form_bancontact_d536f6cb1304cde5da44c530d3157886'] = 'Paga con Bancontact'; $_MODULE['<{stripe_official}prestashop>payment_form_sepa_debit_28d20d5ce69c797169658d647110374b'] = 'Paga con addebito diretto SEPA'; $_MODULE['<{stripe_official}prestashop>payment_form_sepa_debit_eeceac1af4e7620894d6d2083921bb73'] = 'Compra subito'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_9d67bee92ea535ba9c7840797966edfa'] = 'Si è verificato un errore durante il pagamento.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Riprova[/a] o contatta il titolare del sito web.'; -$_MODULE['<{stripe_official}prestashop>payment_form_bancontact_d536f6cb1304cde5da44c530d3157886'] = 'Paga con Bancontact'; +$_MODULE['<{stripe_official}prestashop>payment_info_redirect_f3ee3ad3c8443ee27192d35a7a9d86c9'] = 'Sarai reindirizzato sul sito della tua banca per completare il pagamento.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_3380b659ba0a8b01af98dbe7494c0706'] = 'Congratulazioni, l\'ordine è stato inviato e verrà elaborato al più presto'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_77031dd06e26cfdab21b078a37741bb6'] = 'Il codice di riferimento del tuo ordine è [b]@target@[/b]. A breve riceverai un\'e-mail di conferma.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_2a69d95c0cc64162865573233beb3369'] = 'Puoi vedere il tuo voucher OXXO [a @href1@]qui[/a].'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Grazie per la fiducia accordataci.'; +$_MODULE['<{stripe_official}prestashop>payment_form_sofort_068bcd34a6ded96b1805ca0b9a6745bb'] = 'Paga con SOFORT'; $_MODULE['<{stripe_official}prestashop>payment_form_card_f73a8b5c0b42c88867a7650fc6fde345'] = 'Assicurati di aver accettato i nostri Termini di servizio prima di procedere'; $_MODULE['<{stripe_official}prestashop>payment_form_card_d9b1a32393ffc57f2ee4f07626e76d46'] = 'Paga ora con la carta salvata sul tuo dispositivo facendo clic sul pulsante sopra o compila i dati della tua carta di seguito e inviali mediante il pulsante in fondo alla pagina'; $_MODULE['<{stripe_official}prestashop>payment_form_card_d9a3493a581e1b2900c5eb45dcb0dc02'] = 'Nome del titolare della carta'; @@ -166,28 +188,32 @@ $_MODULE['<{stripe_official}prestashop>payment_form_card_96e7de5dba463d377178948e998cdf27'] = 'I dati della carta sono protetti grazie agli standard di sicurezza PCI DSS v 3.2.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_48334cb46587c0571f12ac31e8e9364a'] = 'I dati della carta verranno salvati automaticamente per il tuo prossimo acquisto.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_eeceac1af4e7620894d6d2083921bb73'] = 'Acquista ora'; -$_MODULE['<{stripe_official}prestashop>payment_info_redirect_f3ee3ad3c8443ee27192d35a7a9d86c9'] = 'Sarai reindirizzato sul sito della tua banca per completare il pagamento.'; -$_MODULE['<{stripe_official}prestashop>payment_form_giropay_32e26982dda43a14285657baee320523'] = 'Paga con Giropay'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_9d67bee92ea535ba9c7840797966edfa'] = 'Si è verificato un errore durante il pagamento.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Riprova[/a] o contatta il titolare del sito web.'; -$_MODULE['<{stripe_official}prestashop>payment_form_p24_751e90522b3385322c4c34b6f73847d2'] = 'Paga con P24'; -$_MODULE['<{stripe_official}prestashop>payment_form_fpx_74253765ffa5a6b91d758c7df4d3c871'] = 'Paga con FPX'; -$_MODULE['<{stripe_official}prestashop>payment_form_fpx_eeceac1af4e7620894d6d2083921bb73'] = 'Compra subito'; -$_MODULE['<{stripe_official}prestashop>payment_form_sofort_068bcd34a6ded96b1805ca0b9a6745bb'] = 'Paga con SOFORT'; -$_MODULE['<{stripe_official}prestashop>payment_form_save_card_6e9c53f6d39367724e9b996b3ea9ef22'] = 'Paga con carta:'; -$_MODULE['<{stripe_official}prestashop>payment_form_save_card_eeceac1af4e7620894d6d2083921bb73'] = 'Acquista ora'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_3380b659ba0a8b01af98dbe7494c0706'] = 'Congratulazioni, l\'ordine è stato inviato e verrà elaborato al più presto'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_77031dd06e26cfdab21b078a37741bb6'] = 'Il codice di riferimento del tuo ordine è [b]@target@[/b]. A breve riceverai un\'e-mail di conferma.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_2a69d95c0cc64162865573233beb3369'] = 'Puoi vedere il tuo voucher OXXO [a @href1@]qui[/a].'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Grazie per la fiducia accordataci.'; -$_MODULE['<{stripe_official}prestashop>payment_form_alipay_47e1e580d173b931fdfdeb6bb5f14848'] = 'Paga con Alipay'; +$_MODULE['<{stripe_official}prestashop>payment_form_ideal_ac23f66a874a7808e300a15f2e94320a'] = 'Paga con iDeal'; +$_MODULE['<{stripe_official}prestashop>payment_form_ideal_eeceac1af4e7620894d6d2083921bb73'] = 'Acquista ora'; +$_MODULE['<{stripe_official}prestashop>payment_form_eps_c446bbd08309aff37eee1e0c43b19cde'] = 'Paga con EPS'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_a46d3e7285f76d2401202f18b0acbcbd'] = 'Le mie carte'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_a1fa27779242b4902f7ae3bdd5c6d508'] = 'Tipo'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_a44217022190f5734b2f72ba1e4f8a79'] = 'Numero di carta'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_b07cc2801693b2e722906a3db3d9c447'] = 'Validità'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_f2a6c498fb90ee345d997f888fce3b18'] = 'Elimina'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_78560f5a4e1f5716c8fb9d7cb35f56de'] = 'Non hai ancora registrato una carta.'; -$_MODULE['<{stripe_official}prestashop>payment_form_eps_c446bbd08309aff37eee1e0c43b19cde'] = 'Paga con EPS'; +$_MODULE['<{stripe_official}prestashop>payment_form_p24_751e90522b3385322c4c34b6f73847d2'] = 'Paga con P24'; +$_MODULE['<{stripe_official}prestashop>payment_form_save_card_6e9c53f6d39367724e9b996b3ea9ef22'] = 'Paga con carta:'; +$_MODULE['<{stripe_official}prestashop>payment_form_save_card_eeceac1af4e7620894d6d2083921bb73'] = 'Acquista ora'; +$_MODULE['<{stripe_official}prestashop>payment_form_giropay_32e26982dda43a14285657baee320523'] = 'Paga con Giropay'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_9d67bee92ea535ba9c7840797966edfa'] = 'Si è verificato un errore durante il pagamento.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Riprova[/a] o contatta il titolare del sito web.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_3380b659ba0a8b01af98dbe7494c0706'] = 'Félicitations, votre commande est validée et sera traitée sous peu.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_2a69d95c0cc64162865573233beb3369'] = 'Vous pouvez accéder à votre coupon OXXO [a @href1@]ici[/a].'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Merci de votre confiance.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_3380b659ba0a8b01af98dbe7494c0706'] = 'Félicitations, votre commande est validée et sera traitée sous peu.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_2a69d95c0cc64162865573233beb3369'] = 'Vous pouvez accéder à votre coupon OXXO [a @href1@]ici[/a].'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Merci de votre confiance.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_9d67bee92ea535ba9c7840797966edfa'] = 'Si è verificato un errore durante il pagamento.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Riprova[/a] o contatta il titolare del sito web.'; +$_MODULE['<{stripe_official}prestashop>payment_form_alipay_47e1e580d173b931fdfdeb6bb5f14848'] = 'Paga con Alipay'; +$_MODULE['<{stripe_official}prestashop>payment_form_fpx_74253765ffa5a6b91d758c7df4d3c871'] = 'Paga con FPX'; +$_MODULE['<{stripe_official}prestashop>payment_form_fpx_eeceac1af4e7620894d6d2083921bb73'] = 'Compra subito'; $_MODULE['<{stripe_official}prestashop>configurationactions_187b101d0358396a634514ea228616d5'] = 'Chiavi API live fornite in luogo delle chiavi API di test'; $_MODULE['<{stripe_official}prestashop>configurationactions_2df5570b8a0e0c076571d1213f7f901e'] = 'I campi ID cliente e Chiave segreta sono obbligatori'; $_MODULE['<{stripe_official}prestashop>configurationactions_5fba3565c1b6638ac41f7627066aaa58'] = 'Chiavi API di test fornite in luogo delle chiavi API live'; diff --git a/translations/nl.php b/translations/nl.php old mode 100644 new mode 100755 index 9c2276f..6be0747 --- a/translations/nl.php +++ b/translations/nl.php @@ -20,6 +20,17 @@ $_MODULE['<{stripe_official}prestashop>stripe_official_7c716e01a03b426976692f4a7a0d80be'] = 'Accepteer vanaf nu betalingen via Stripe, direct in uw winkel!'; $_MODULE['<{stripe_official}prestashop>stripe_official_876f23178c29dc2552c0b48bf23cd9bd'] = 'Weet u zeker dat u de installatie ongedaan wilt maken?'; $_MODULE['<{stripe_official}prestashop>stripe_official_6341ee14cd6d47787171f68d27f1f41b'] = 'Betaling met Stripe'; +$_MODULE['<{stripe_official}prestashop>stripe_official_a6ee78c840497aed8a81b6164d4224e6'] = 'U moet SSL inschakelen in de winkel als u deze module in productie wilt gebruiken.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_66f67e1a8f01161f2009c2ed39c3cb1e'] = 'U heeft de limiet van 16 webhook-eindpunten bereikt die zijn geregistreerd in uw Dashboard Stripe voor dit account. Verwijder een van deze als u dit domein wilt registreren.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_69e6a2456656fcc3c9a79452ef3a7928'] = 'Uw TLS-versie wordt niet ondersteund. U moet uw integratie upgraden. Raadpleeg de veelgestelde vragen als u niet weet hoe u dit moet doen.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_47daed1af40eaa1fb3c750322137815d'] = 'Webhook-configuratie kan niet worden gevonden in PrestaShop, klik op de knop Opslaan om het probleem op te lossen. Er wordt een nieuwe webhook gemaakt op Stripe en vervolgens opgeslagen in PrestaShop.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_4684c4310f6bd9917b3c079bc38fd335'] = 'Webhook URL-configuratie is verkeerd, klik op de knop Opslaan om het probleem op te lossen. Webhook-configuratie wordt gecorrigeerd.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_572bde45cccf4cde600e2a846cfe8085'] = 'Huidige webhook-URL:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_12632987bdd5031845a591acdf5faa40'] = 'Verwachte webhook-URL:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_2226fcd706ac6ba242dc3381636cf74b'] = 'Configuratie van webhookgebeurtenissen is verkeerd, klik op de knop Opslaan om het probleem op te lossen. Webhook-configuratie wordt gecorrigeerd.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_4047173bbb1dd67cd5e877f7736c1e86'] = 'Huidige webhook-evenementen:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_78b8b4d922d4061d31e55caece729f8b'] = 'Verwachte webhook-gebeurtenissen:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_21e8380e65bb6a9cc714dae46e2b6dbf'] = 'Webhook-configuratie is niet toegankelijk, klik op de knop Opslaan om het probleem op te lossen. Er wordt een nieuwe webhook gemaakt op Stripe.'; $_MODULE['<{stripe_official}prestashop>stripe_official_b32006c07b70b4db49be9fcc111b074f'] = 'Sleutels zijn leeg.'; $_MODULE['<{stripe_official}prestashop>stripe_official_3e5298c1c5d8c871334c4e3994481f90'] = 'De betaal-ID van Stripe mag niet leeg zijn.'; $_MODULE['<{stripe_official}prestashop>stripe_official_eb804bebeffc55fb161165d50bcf74f8'] = 'Onbekende betaal-ID Stripe'; @@ -31,8 +42,10 @@ $_MODULE['<{stripe_official}prestashop>stripe_official_fd2bdc826d325902e451236cf6fd774e'] = 'Wordt verwerkt'; $_MODULE['<{stripe_official}prestashop>stripe_official_b24ee2c7cb1734370b544eb4e6cdc2b6'] = 'Accepteer de servicevoorwaarden'; $_MODULE['<{stripe_official}prestashop>stripe_official_15f04500d9edaac382bb3d451c8b4198'] = 'Wordt omgeleid'; +$_MODULE['<{stripe_official}prestashop>stripe_official_86c7338e09e2c3ca2e458da630895e25'] = 'Er zijn geen API-sleutels verstrekt. Neem dan contact op met de eigenaar van de website.'; $_MODULE['<{stripe_official}prestashop>stripecards_cd81f9f55969c822377f076017bb3484'] = 'Kaarten'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_d3b206d196cd6be3a2764c1fb90b200f'] = 'Selectie verwijderen'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_53c6a96a3df980c3270d6ed82b6f174b'] = 'Wilt u de geselecteerde items verwijderen?'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_b718adec73e04ce3ec720dd11a06a308'] = 'ID'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_49ee3087348e8d44e1feda1917443987'] = 'Naam'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_4c2a8fe7eaf24721cc7a9f0175115bd4'] = 'Bericht'; @@ -41,48 +54,19 @@ $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_d95fc016a6eee828f434ed5f55504427'] = 'Object-ID'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_44749712dbec183e983dcd78a7736c41'] = 'Datum'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_2d8e32e9c23e2a7155c88028b3fbff66'] = 'Logger-instellingen verwerken'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_2ce895700ba5c16bede3b769128d216f'] = 'Hier kunt u de standaardconfiguratie voor deze Process Logger wijzigen'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_3073ef21c0b326939d5b630edd08cfb6'] = 'Automatisch wissen uitschakelen'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_434ef5977d28afa36e430439de18cbad'] = 'Indien uitgeschakeld, worden logboeken na de vertraging automatisch gewist'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_1607c94671fd5baf4ac06f554b118b2a'] = 'Vertraging automatisch wissen (in dagen)'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_71c3e06323cd5a59436ec53afca80c57'] = 'Kies het aantal dagen dat u logs in de database wilt bewaren'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_c9cc8cce247e49bae79f15173ce97354'] = 'Opslaan'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_dcc459e0cef1e36a18a356fbc5789b16'] = 'Alles wissen'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_729a51874fe901b092899e9e8b31c97a'] = 'Weet u het zeker?'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_f51c7af7c02cd3a846d87d97bfaf6b58'] = 'Alle logboeken zijn gewist'; -$_MODULE['<{stripe_official}prestashop>admin_tab_order_ce7566d1d08cc094b74cf283cf9c56a5'] = 'Stripe'; -$_MODULE['<{stripe_official}prestashop>my-account-stripe-cards_a46d3e7285f76d2401202f18b0acbcbd'] = 'Mijn kaarten'; -$_MODULE['<{stripe_official}prestashop>admin_cart_1ab1dfd9dc24ea4729d6c032f7f0342d'] = 'Betaalinformatie'; -$_MODULE['<{stripe_official}prestashop>admin_cart_3d9c6a8d9e9bd14af99a9f4444f602a4'] = 'Datum (laatste update)'; -$_MODULE['<{stripe_official}prestashop>admin_cart_24e85d1e652b3681994e9cae2cc1f35a'] = 'Stripe-betaal-ID'; -$_MODULE['<{stripe_official}prestashop>admin_cart_49ee3087348e8d44e1feda1917443987'] = 'Naam'; -$_MODULE['<{stripe_official}prestashop>admin_cart_f0aaaae189e9c7711931a65ffcd22543'] = 'Betaalmethode'; -$_MODULE['<{stripe_official}prestashop>admin_cart_388fd2767ba1fd2296f536425d106de3'] = 'Betaald bedrag'; -$_MODULE['<{stripe_official}prestashop>admin_cart_76f0ed934de85cc7131910b32ede7714'] = 'Terugbetaling'; -$_MODULE['<{stripe_official}prestashop>admin_cart_8eea62084ca7e541d918e823422bd82e'] = 'Resultaat'; -$_MODULE['<{stripe_official}prestashop>admin_cart_650be61892bf690026089544abbd9d26'] = 'Modus'; -$_MODULE['<{stripe_official}prestashop>admin_cart_c985a711556e2edf5cac28dfbdb43ff0'] = 'Gedeeltelijke terugbetaling'; -$_MODULE['<{stripe_official}prestashop>admin_cart_5706de961fb376d701be6e7762d8b09c'] = 'Wachten'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_1e63d1811556fc2dad106dcbd4217a69'] = 'Betaal-ID'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_7133d45d85f629f4c8abe0e1b3d37942'] = 'Betaaldatum'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_f0aaaae189e9c7711931a65ffcd22543'] = 'Betaalmethode'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_ccd51debd3d65d453679c150b99a39c0'] = 'Autorisatiedatum'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_3f8c6ecb084eea3b83d659fab7155e86'] = 'Opnamedatum'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_24fe48030f7d3097d5882535b04c3fa8'] = 'Verlopen'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_90cbb08c2e81b8eca5298e2533dbe3d9'] = 'Betwiste betaling'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_9b12a0ddfdf2b10342c50ed2fe6e5c50'] = 'bekijk je betwiste betaling hier'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_bf49f5bcf72238ecbc0659c3c0c8079f'] = 'Geen betwiste betaling'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_e2fe37d9647990819245fadb404c482e'] = 'Vouchervalidatie'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_e2b54a61bf4e56c4a044386b2553ed77'] = 'Voucher gevalideerd op:'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_2311c8c5e8f44924a3e61c78e2223049'] = 'Voucher verloopt op:'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_9ca4bc48596557840045a7477c803657'] = 'U moet een geldig nummer voor \"Automatisch wissen (in dagen)\" opgeven.'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_5988c28d05527a0d0ce8ae3da1134352'] = 'Logparameters zijn succesvol bijgewerkt!'; $_MODULE['<{stripe_official}prestashop>main_c2cc7082a89c1ad6631a2f66af5f00c0'] = 'Verbinding'; $_MODULE['<{stripe_official}prestashop>main_76f0ed934de85cc7131910b32ede7714'] = 'Terugbetaling'; -$_MODULE['<{stripe_official}prestashop>refund_2b660da0c521cc6bc51a188bc9f7d084'] = 'Kies een bestelling waarvoor u een terugbetaling wilt ontvangen'; -$_MODULE['<{stripe_official}prestashop>refund_24e85d1e652b3681994e9cae2cc1f35a'] = 'Stripe-betaal-ID'; -$_MODULE['<{stripe_official}prestashop>refund_991bd624dcaff354bd793e4cacbd6ea3'] = 'U vindt deze ID op het Stripe-tabblad van de bestellingen die u wilt terugbetalen. Deze begint met \"ch_\" of \"py_\".'; -$_MODULE['<{stripe_official}prestashop>refund_c0a3c3e9b5fbd21c505e082644b2220c'] = 'Volledige terugbetaling'; -$_MODULE['<{stripe_official}prestashop>refund_77fd2b4393b379bedd30efcd5df02090'] = 'Gedeeltelijke terugbetaling'; -$_MODULE['<{stripe_official}prestashop>refund_fe9cc1bcfa322db8ade8960ddf4bb19c'] = 'We dienen terugbetalingen die u doet aan de bank van de klant onmiddellijk in.'; -$_MODULE['<{stripe_official}prestashop>refund_2b9689f82101a977f16db0056493a5aa'] = 'Uw klant ontvangt de geldmiddelen van de terugbetaling ongeveer 2-3 werkdagen na de datum waarop de terugbetaling in gang is gezet.'; -$_MODULE['<{stripe_official}prestashop>refund_6e5d08adf277f2eb21b257fe74f76ddc'] = 'Het kan 5 tot 10 dagen duren voordat een terugbetaling op het bankafschrift van de klant zichtbaar is.'; -$_MODULE['<{stripe_official}prestashop>refund_b2f40690858b404ed10e62bdf422c704'] = 'Bedrag'; -$_MODULE['<{stripe_official}prestashop>refund_f3b5fc873bba0e14e0d8d9851408b2a3'] = 'Vul het bedrag in dat u wilt terugbetalen'; -$_MODULE['<{stripe_official}prestashop>refund_f87db45e2887d485ca31ffae186faae9'] = 'Om terugbetaling verzoeken'; $_MODULE['<{stripe_official}prestashop>configuration_e6ad4dd232a1bb7d77852af7fc2e0538'] = '[a @href1@]Maak in 10 minuten een Stripe-account[/a] en begin onmiddellijk met het accepteren van kaartbetalingen en lokale betaalmethoden (geen extra contract/handelaar-ID van uw bank nodig).'; $_MODULE['<{stripe_official}prestashop>configuration_ebd8fbb49032e4992eb5050893dfa1fc'] = 'Verbinding maken met Stripe'; $_MODULE['<{stripe_official}prestashop>configuration_650be61892bf690026089544abbd9d26'] = 'Modus'; @@ -115,7 +99,7 @@ $_MODULE['<{stripe_official}prestashop>configuration_e150eb523fd98533136e660e3e7862a0'] = 'China UnionPay'; $_MODULE['<{stripe_official}prestashop>configuration_53619d5dc16df90ad84a8958b7121aa8'] = 'JCB'; $_MODULE['<{stripe_official}prestashop>configuration_1f6176c4f26f546cd5424d53fac0f2f8'] = 'Discovers'; -$_MODULE['<{stripe_official}prestashop>configuration_5f07627108d0280b0fd45dd36e73d01f'] = 'Digitale portemonnees, zoals Apple Pay, Google Pay en Microsoft Pay.[br]Door gebruik te maken van Apple Pay gaat u akkoord met de servicevoorwaarden van [a @href1@]Stripe[/a] en [a @href2@]Apple[/a].'; +$_MODULE['<{stripe_official}prestashop>configuration_0e29ba92a96e3342f6e47f324a0c8857'] = 'Digitale portemonnees, d.w.z. Apple Pay en Google Pay.[br]Door Apple Pay te gebruiken, gaat u akkoord met de servicevoorwaarden van [a @href1@]Stripe[/a] en [a @href2@]Apple[/a].'; $_MODULE['<{stripe_official}prestashop>configuration_f80b9de6d53dc9db807d2a123c149fc7'] = 'Nooit de postcode registreren (niet aanbevolen*).'; $_MODULE['<{stripe_official}prestashop>configuration_c99b5f040533a2516fed921947a3b7f4'] = 'Deze informatie verbetert de acceptatiepercentages voor kaarten die zijn uitgegeven in de Verenigde Staten, het Verenigd Koninkrijk en Canada.'; $_MODULE['<{stripe_official}prestashop>configuration_8cb12d0aa65678a528d4395dbf3a4138'] = 'De naam van de kaarthouder registreren'; @@ -140,21 +124,59 @@ $_MODULE['<{stripe_official}prestashop>configuration_93cba07454f06a4a960172bbd6e2a435'] = 'Ja'; $_MODULE['<{stripe_official}prestashop>configuration_0a2c4e503e93bc3135308bb3fadbe0bd'] = 'U moet deze betaalmethoden eerst op uw [a @href2@]Stripe-dashboard[/a] reserveren.'; $_MODULE['<{stripe_official}prestashop>configuration_c9cc8cce247e49bae79f15173ce97354'] = 'Opslaan'; +$_MODULE['<{stripe_official}prestashop>refund_2b660da0c521cc6bc51a188bc9f7d084'] = 'Kies een bestelling waarvoor u een terugbetaling wilt ontvangen'; +$_MODULE['<{stripe_official}prestashop>refund_24e85d1e652b3681994e9cae2cc1f35a'] = 'Stripe-betaal-ID'; +$_MODULE['<{stripe_official}prestashop>refund_991bd624dcaff354bd793e4cacbd6ea3'] = 'U vindt deze ID op het Stripe-tabblad van de bestellingen die u wilt terugbetalen. Deze begint met \"ch_\" of \"py_\".'; +$_MODULE['<{stripe_official}prestashop>refund_c0a3c3e9b5fbd21c505e082644b2220c'] = 'Volledige terugbetaling'; +$_MODULE['<{stripe_official}prestashop>refund_77fd2b4393b379bedd30efcd5df02090'] = 'Gedeeltelijke terugbetaling'; +$_MODULE['<{stripe_official}prestashop>refund_fe9cc1bcfa322db8ade8960ddf4bb19c'] = 'We dienen terugbetalingen die u doet aan de bank van de klant onmiddellijk in.'; +$_MODULE['<{stripe_official}prestashop>refund_2b9689f82101a977f16db0056493a5aa'] = 'Uw klant ontvangt de geldmiddelen van de terugbetaling ongeveer 2-3 werkdagen na de datum waarop de terugbetaling in gang is gezet.'; +$_MODULE['<{stripe_official}prestashop>refund_6e5d08adf277f2eb21b257fe74f76ddc'] = 'Het kan 5 tot 10 dagen duren voordat een terugbetaling op het bankafschrift van de klant zichtbaar is.'; +$_MODULE['<{stripe_official}prestashop>refund_b2f40690858b404ed10e62bdf422c704'] = 'Bedrag'; +$_MODULE['<{stripe_official}prestashop>refund_f3b5fc873bba0e14e0d8d9851408b2a3'] = 'Vul het bedrag in dat u wilt terugbetalen'; +$_MODULE['<{stripe_official}prestashop>refund_f87db45e2887d485ca31ffae186faae9'] = 'Om terugbetaling verzoeken'; +$_MODULE['<{stripe_official}prestashop>admin_tab_order_ce7566d1d08cc094b74cf283cf9c56a5'] = 'Stripe'; +$_MODULE['<{stripe_official}prestashop>my-account-stripe-cards_a46d3e7285f76d2401202f18b0acbcbd'] = 'Mijn kaarten'; +$_MODULE['<{stripe_official}prestashop>admin_cart_1ab1dfd9dc24ea4729d6c032f7f0342d'] = 'Betaalinformatie'; +$_MODULE['<{stripe_official}prestashop>admin_cart_3d9c6a8d9e9bd14af99a9f4444f602a4'] = 'Datum (laatste update)'; +$_MODULE['<{stripe_official}prestashop>admin_cart_24e85d1e652b3681994e9cae2cc1f35a'] = 'Stripe-betaal-ID'; +$_MODULE['<{stripe_official}prestashop>admin_cart_49ee3087348e8d44e1feda1917443987'] = 'Naam'; +$_MODULE['<{stripe_official}prestashop>admin_cart_f0aaaae189e9c7711931a65ffcd22543'] = 'Betaalmethode'; +$_MODULE['<{stripe_official}prestashop>admin_cart_388fd2767ba1fd2296f536425d106de3'] = 'Betaald bedrag'; +$_MODULE['<{stripe_official}prestashop>admin_cart_76f0ed934de85cc7131910b32ede7714'] = 'Terugbetaling'; +$_MODULE['<{stripe_official}prestashop>admin_cart_8eea62084ca7e541d918e823422bd82e'] = 'Resultaat'; +$_MODULE['<{stripe_official}prestashop>admin_cart_650be61892bf690026089544abbd9d26'] = 'Modus'; +$_MODULE['<{stripe_official}prestashop>admin_cart_c985a711556e2edf5cac28dfbdb43ff0'] = 'Gedeeltelijke terugbetaling'; +$_MODULE['<{stripe_official}prestashop>admin_cart_5706de961fb376d701be6e7762d8b09c'] = 'Wachten'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_1e63d1811556fc2dad106dcbd4217a69'] = 'Betaal-ID'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_7133d45d85f629f4c8abe0e1b3d37942'] = 'Betaaldatum'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_f0aaaae189e9c7711931a65ffcd22543'] = 'Betaalmethode'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_ccd51debd3d65d453679c150b99a39c0'] = 'Autorisatiedatum'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_3f8c6ecb084eea3b83d659fab7155e86'] = 'Opnamedatum'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_24fe48030f7d3097d5882535b04c3fa8'] = 'Verlopen'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_90cbb08c2e81b8eca5298e2533dbe3d9'] = 'Betwiste betaling'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_9b12a0ddfdf2b10342c50ed2fe6e5c50'] = 'bekijk je betwiste betaling hier'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_bf49f5bcf72238ecbc0659c3c0c8079f'] = 'Geen betwiste betaling'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_e2fe37d9647990819245fadb404c482e'] = 'Vouchervalidatie'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_e2b54a61bf4e56c4a044386b2553ed77'] = 'Voucher gevalideerd op:'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_2311c8c5e8f44924a3e61c78e2223049'] = 'Voucher verloopt op:'; $_MODULE['<{stripe_official}prestashop>payment_form_oxxo_49ee3087348e8d44e1feda1917443987'] = 'Naam'; $_MODULE['<{stripe_official}prestashop>payment_form_oxxo_ce8ae9da5b7cd6c3df2929543a9af92d'] = 'E-mailadres'; -$_MODULE['<{stripe_official}prestashop>payment_form_ideal_ac23f66a874a7808e300a15f2e94320a'] = 'Betalen met iDEAL'; -$_MODULE['<{stripe_official}prestashop>payment_form_ideal_eeceac1af4e7620894d6d2083921bb73'] = 'Nu kopen'; $_MODULE['<{stripe_official}prestashop>stripe-cards_4e997b9d3b7152f2afeacd96ab1ef1cb'] = 'Mijn kaarten'; $_MODULE['<{stripe_official}prestashop>stripe-cards_a1fa27779242b4902f7ae3bdd5c6d508'] = 'Type'; $_MODULE['<{stripe_official}prestashop>stripe-cards_a44217022190f5734b2f72ba1e4f8a79'] = 'Kaartnummer'; $_MODULE['<{stripe_official}prestashop>stripe-cards_b07cc2801693b2e722906a3db3d9c447'] = 'Geldigheid'; $_MODULE['<{stripe_official}prestashop>stripe-cards_f2a6c498fb90ee345d997f888fce3b18'] = 'Verwijderen'; $_MODULE['<{stripe_official}prestashop>stripe-cards_78560f5a4e1f5716c8fb9d7cb35f56de'] = 'U hebt nog geen kaart geregistreerd.'; +$_MODULE['<{stripe_official}prestashop>payment_form_bancontact_d536f6cb1304cde5da44c530d3157886'] = 'Betalen met Bancontact'; $_MODULE['<{stripe_official}prestashop>payment_form_sepa_debit_28d20d5ce69c797169658d647110374b'] = 'Betalen met SEPA-incasso'; $_MODULE['<{stripe_official}prestashop>payment_form_sepa_debit_eeceac1af4e7620894d6d2083921bb73'] = 'Nu kopen'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_9d67bee92ea535ba9c7840797966edfa'] = 'Er is een fout opgetreden tijdens uw betaling.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Probeer het opnieuw[/a] of neem contact op met de beheerder van de website.'; -$_MODULE['<{stripe_official}prestashop>payment_form_bancontact_d536f6cb1304cde5da44c530d3157886'] = 'Betalen met Bancontact'; +$_MODULE['<{stripe_official}prestashop>payment_info_redirect_f3ee3ad3c8443ee27192d35a7a9d86c9'] = 'U wordt doorgeleid naar de site van de bank om de betaling af te ronden.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_3380b659ba0a8b01af98dbe7494c0706'] = 'Gefeliciteerd. Uw bestelling is geplaatst en wordt op korte termijn verwerkt.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_77031dd06e26cfdab21b078a37741bb6'] = 'Het referentienummer van uw bestelling is [b]@target@[/b]. U ontvangt binnenkort een bevestigingsmail.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_2a69d95c0cc64162865573233beb3369'] = 'Je kunt je OXXO-voucher [a @href1@]hier[/a] bekijken.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Bedankt voor uw vertrouwen.'; +$_MODULE['<{stripe_official}prestashop>payment_form_sofort_068bcd34a6ded96b1805ca0b9a6745bb'] = 'Betalen met SOFORT'; $_MODULE['<{stripe_official}prestashop>payment_form_card_f73a8b5c0b42c88867a7650fc6fde345'] = 'U moet akkoord gaan met de servicevoorwaarden voordat u doorgaat.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_d9b1a32393ffc57f2ee4f07626e76d46'] = 'Betaal nu met de kaart die op uw apparaat is opgeslagen door op de knop hierboven te klikken, of vul hieronder uw kaartgegevens in en dien deze aan het eind van de pagina in.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_d9a3493a581e1b2900c5eb45dcb0dc02'] = 'Naam van kaarthouder'; @@ -166,28 +188,32 @@ $_MODULE['<{stripe_official}prestashop>payment_form_card_96e7de5dba463d377178948e998cdf27'] = 'Uw kaartgegevens worden beveiligd met PCI DSS v3.2-beveiligingsnormen.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_48334cb46587c0571f12ac31e8e9364a'] = 'Uw kaartgegevens worden automatisch opgeslagen voor uw volgende aankoop.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_eeceac1af4e7620894d6d2083921bb73'] = 'Nu kopen'; -$_MODULE['<{stripe_official}prestashop>payment_info_redirect_f3ee3ad3c8443ee27192d35a7a9d86c9'] = 'U wordt doorgeleid naar de site van de bank om de betaling af te ronden.'; -$_MODULE['<{stripe_official}prestashop>payment_form_giropay_32e26982dda43a14285657baee320523'] = 'Betalen met Giropay'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_9d67bee92ea535ba9c7840797966edfa'] = 'Er is een fout opgetreden tijdens uw betaling.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Probeer het opnieuw[/a] of neem contact op met de beheerder van de website.'; -$_MODULE['<{stripe_official}prestashop>payment_form_p24_751e90522b3385322c4c34b6f73847d2'] = 'Betalen met P24'; -$_MODULE['<{stripe_official}prestashop>payment_form_fpx_74253765ffa5a6b91d758c7df4d3c871'] = 'Betalen met FPX'; -$_MODULE['<{stripe_official}prestashop>payment_form_fpx_eeceac1af4e7620894d6d2083921bb73'] = 'Nu kopen'; -$_MODULE['<{stripe_official}prestashop>payment_form_sofort_068bcd34a6ded96b1805ca0b9a6745bb'] = 'Betalen met SOFORT'; -$_MODULE['<{stripe_official}prestashop>payment_form_save_card_6e9c53f6d39367724e9b996b3ea9ef22'] = 'Betalen met kaart:'; -$_MODULE['<{stripe_official}prestashop>payment_form_save_card_eeceac1af4e7620894d6d2083921bb73'] = 'Nu kopen'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_3380b659ba0a8b01af98dbe7494c0706'] = 'Gefeliciteerd. Uw bestelling is geplaatst en wordt op korte termijn verwerkt.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_77031dd06e26cfdab21b078a37741bb6'] = 'Het referentienummer van uw bestelling is [b]@target@[/b]. U ontvangt binnenkort een bevestigingsmail.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_2a69d95c0cc64162865573233beb3369'] = 'Je kunt je OXXO-voucher [a @href1@]hier[/a] bekijken.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Bedankt voor uw vertrouwen.'; -$_MODULE['<{stripe_official}prestashop>payment_form_alipay_47e1e580d173b931fdfdeb6bb5f14848'] = 'Betalen met Alipay'; +$_MODULE['<{stripe_official}prestashop>payment_form_ideal_ac23f66a874a7808e300a15f2e94320a'] = 'Betalen met iDEAL'; +$_MODULE['<{stripe_official}prestashop>payment_form_ideal_eeceac1af4e7620894d6d2083921bb73'] = 'Nu kopen'; +$_MODULE['<{stripe_official}prestashop>payment_form_eps_c446bbd08309aff37eee1e0c43b19cde'] = 'Betalen met EPS'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_a46d3e7285f76d2401202f18b0acbcbd'] = 'Mijn kaarten'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_a1fa27779242b4902f7ae3bdd5c6d508'] = 'Type'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_a44217022190f5734b2f72ba1e4f8a79'] = 'Kaartnummer'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_b07cc2801693b2e722906a3db3d9c447'] = 'Geldigheid'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_f2a6c498fb90ee345d997f888fce3b18'] = 'Verwijderen'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_78560f5a4e1f5716c8fb9d7cb35f56de'] = 'U hebt nog geen kaart geregistreerd.'; -$_MODULE['<{stripe_official}prestashop>payment_form_eps_c446bbd08309aff37eee1e0c43b19cde'] = 'Betalen met EPS'; +$_MODULE['<{stripe_official}prestashop>payment_form_p24_751e90522b3385322c4c34b6f73847d2'] = 'Betalen met P24'; +$_MODULE['<{stripe_official}prestashop>payment_form_save_card_6e9c53f6d39367724e9b996b3ea9ef22'] = 'Betalen met kaart:'; +$_MODULE['<{stripe_official}prestashop>payment_form_save_card_eeceac1af4e7620894d6d2083921bb73'] = 'Nu kopen'; +$_MODULE['<{stripe_official}prestashop>payment_form_giropay_32e26982dda43a14285657baee320523'] = 'Betalen met Giropay'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_9d67bee92ea535ba9c7840797966edfa'] = 'Er is een fout opgetreden tijdens uw betaling.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Probeer het opnieuw[/a] of neem contact op met de beheerder van de website.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_3380b659ba0a8b01af98dbe7494c0706'] = 'Félicitations, votre commande est validée et sera traitée sous peu.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_2a69d95c0cc64162865573233beb3369'] = 'Vous pouvez accéder à votre coupon OXXO [a @href1@]ici[/a].'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Merci de votre confiance.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_3380b659ba0a8b01af98dbe7494c0706'] = 'Félicitations, votre commande est validée et sera traitée sous peu.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_2a69d95c0cc64162865573233beb3369'] = 'Vous pouvez accéder à votre coupon OXXO [a @href1@]ici[/a].'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Merci de votre confiance.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_9d67bee92ea535ba9c7840797966edfa'] = 'Er is een fout opgetreden tijdens uw betaling.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Probeer het opnieuw[/a] of neem contact op met de beheerder van de website.'; +$_MODULE['<{stripe_official}prestashop>payment_form_alipay_47e1e580d173b931fdfdeb6bb5f14848'] = 'Betalen met Alipay'; +$_MODULE['<{stripe_official}prestashop>payment_form_fpx_74253765ffa5a6b91d758c7df4d3c871'] = 'Betalen met FPX'; +$_MODULE['<{stripe_official}prestashop>payment_form_fpx_eeceac1af4e7620894d6d2083921bb73'] = 'Nu kopen'; $_MODULE['<{stripe_official}prestashop>configurationactions_187b101d0358396a634514ea228616d5'] = 'Er zijn API-sleutels voor de livemodus opgegeven in plaats van API-sleutels voor de testmodus'; $_MODULE['<{stripe_official}prestashop>configurationactions_2df5570b8a0e0c076571d1213f7f901e'] = 'De velden Client-ID en Geheime sleutel zijn verplicht'; $_MODULE['<{stripe_official}prestashop>configurationactions_5fba3565c1b6638ac41f7627066aaa58'] = 'Er zijn API-sleutels voor de testmodus opgegeven in plaats van API-sleutels voor de livemodus'; diff --git a/translations/pt.php b/translations/pt.php old mode 100644 new mode 100755 index 4ad639e..23e977d --- a/translations/pt.php +++ b/translations/pt.php @@ -20,6 +20,17 @@ $_MODULE['<{stripe_official}prestashop>stripe_official_7c716e01a03b426976692f4a7a0d80be'] = 'Comece hoje a aceitar pagamentos Stripe, diretamente a partir da sua loja!'; $_MODULE['<{stripe_official}prestashop>stripe_official_876f23178c29dc2552c0b48bf23cd9bd'] = 'Tem a certeza de que quer desinstalar?'; $_MODULE['<{stripe_official}prestashop>stripe_official_6341ee14cd6d47787171f68d27f1f41b'] = 'Pagamento com Stripe'; +$_MODULE['<{stripe_official}prestashop>stripe_official_a6ee78c840497aed8a81b6164d4224e6'] = 'Você deve habilitar SSL na loja se quiser usar este módulo na produção.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_66f67e1a8f01161f2009c2ed39c3cb1e'] = 'Você atingiu o limite de 16 endpoints de webhook registrados em seu Dashboard Stripe para esta conta. Remova um deles se quiser registrar este domínio.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_69e6a2456656fcc3c9a79452ef3a7928'] = 'Sua versão TLS não é compatível. Você precisará atualizar sua integração. Por favor, verifique o FAQ se você não sabe como fazê-lo.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_47daed1af40eaa1fb3c750322137815d'] = 'A configuração do Webhook não pode ser encontrada no PrestaShop, clique no botão Salvar para corrigir o problema. Um novo webhook será criado no Stripe e, em seguida, salvo no PrestaShop.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_4684c4310f6bd9917b3c079bc38fd335'] = 'A configuração do URL do webhook está incorreta. Clique no botão Salvar para corrigir o problema. A configuração do webhook será corrigida.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_572bde45cccf4cde600e2a846cfe8085'] = 'URL do webhook atual:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_12632987bdd5031845a591acdf5faa40'] = 'URL de webhook esperado:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_2226fcd706ac6ba242dc3381636cf74b'] = 'A configuração dos eventos do webhook está incorreta, clique no botão Salvar para corrigir o problema. A configuração do webhook será corrigida.'; +$_MODULE['<{stripe_official}prestashop>stripe_official_4047173bbb1dd67cd5e877f7736c1e86'] = 'Eventos de webhook atuais:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_78b8b4d922d4061d31e55caece729f8b'] = 'Eventos de webhook esperados:'; +$_MODULE['<{stripe_official}prestashop>stripe_official_21e8380e65bb6a9cc714dae46e2b6dbf'] = 'A configuração do webhook não pode ser acessada, clique no botão Salvar para corrigir o problema. Um novo webhook será criado no Stripe.'; $_MODULE['<{stripe_official}prestashop>stripe_official_b32006c07b70b4db49be9fcc111b074f'] = 'As chaves estão vazias.'; $_MODULE['<{stripe_official}prestashop>stripe_official_3e5298c1c5d8c871334c4e3994481f90'] = 'A identificação de Pagamento Stripe não pode estar vazia.'; $_MODULE['<{stripe_official}prestashop>stripe_official_eb804bebeffc55fb161165d50bcf74f8'] = 'Identificação de Pagamento Stripe desconhecida.'; @@ -31,8 +42,10 @@ $_MODULE['<{stripe_official}prestashop>stripe_official_fd2bdc826d325902e451236cf6fd774e'] = 'A processar...'; $_MODULE['<{stripe_official}prestashop>stripe_official_b24ee2c7cb1734370b544eb4e6cdc2b6'] = 'Aceite as Condições de Utilização'; $_MODULE['<{stripe_official}prestashop>stripe_official_15f04500d9edaac382bb3d451c8b4198'] = 'A reencaminhar...'; +$_MODULE['<{stripe_official}prestashop>stripe_official_86c7338e09e2c3ca2e458da630895e25'] = 'Nenhuma chave API foi fornecida. Entre em contato com o proprietário do site.'; $_MODULE['<{stripe_official}prestashop>stripecards_cd81f9f55969c822377f076017bb3484'] = 'Cartões'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_d3b206d196cd6be3a2764c1fb90b200f'] = 'Supprimer la sélection'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_53c6a96a3df980c3270d6ed82b6f174b'] = 'Souhaitez-vous supprimer les éléments sélectionnés ?'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_b718adec73e04ce3ec720dd11a06a308'] = 'ID'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_49ee3087348e8d44e1feda1917443987'] = 'Nom'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_4c2a8fe7eaf24721cc7a9f0175115bd4'] = 'Message'; @@ -41,48 +54,19 @@ $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_d95fc016a6eee828f434ed5f55504427'] = 'ID de l\'objet'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_44749712dbec183e983dcd78a7736c41'] = 'Date'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_2d8e32e9c23e2a7155c88028b3fbff66'] = 'Paramètres de l\'outil de consignation des processus'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_2ce895700ba5c16bede3b769128d216f'] = 'Ici, vous pouvez modifier la configuration par défaut de ce processus de logs'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_3073ef21c0b326939d5b630edd08cfb6'] = 'Désactiver l\'effacement automatique'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_434ef5977d28afa36e430439de18cbad'] = 'Si désactivé, les journaux seront automatiquement effacés après le délai'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_1607c94671fd5baf4ac06f554b118b2a'] = 'Délai d\'effacement automatique (en jours)'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_71c3e06323cd5a59436ec53afca80c57'] = 'Choisissez le nombre de jours pendant lesquels vous souhaitez conserver les journaux dans la base de données'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_c9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_dcc459e0cef1e36a18a356fbc5789b16'] = 'Effacer tout'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_729a51874fe901b092899e9e8b31c97a'] = 'Êtes-vous sûr(e) ?'; $_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_f51c7af7c02cd3a846d87d97bfaf6b58'] = 'Tous les logs ont été effacés'; -$_MODULE['<{stripe_official}prestashop>admin_tab_order_ce7566d1d08cc094b74cf283cf9c56a5'] = 'Stripe'; -$_MODULE['<{stripe_official}prestashop>my-account-stripe-cards_a46d3e7285f76d2401202f18b0acbcbd'] = 'Os meus cartões'; -$_MODULE['<{stripe_official}prestashop>admin_cart_1ab1dfd9dc24ea4729d6c032f7f0342d'] = 'Informações de pagamento'; -$_MODULE['<{stripe_official}prestashop>admin_cart_3d9c6a8d9e9bd14af99a9f4444f602a4'] = 'Data (última atualização)'; -$_MODULE['<{stripe_official}prestashop>admin_cart_24e85d1e652b3681994e9cae2cc1f35a'] = 'Identificação de pagamento Stripe'; -$_MODULE['<{stripe_official}prestashop>admin_cart_49ee3087348e8d44e1feda1917443987'] = 'Nome'; -$_MODULE['<{stripe_official}prestashop>admin_cart_f0aaaae189e9c7711931a65ffcd22543'] = 'Método de pagamento'; -$_MODULE['<{stripe_official}prestashop>admin_cart_388fd2767ba1fd2296f536425d106de3'] = 'Montante pago'; -$_MODULE['<{stripe_official}prestashop>admin_cart_76f0ed934de85cc7131910b32ede7714'] = 'Reembolso'; -$_MODULE['<{stripe_official}prestashop>admin_cart_8eea62084ca7e541d918e823422bd82e'] = 'Resultado'; -$_MODULE['<{stripe_official}prestashop>admin_cart_650be61892bf690026089544abbd9d26'] = 'Modo'; -$_MODULE['<{stripe_official}prestashop>admin_cart_c985a711556e2edf5cac28dfbdb43ff0'] = 'Reembolso parcial'; -$_MODULE['<{stripe_official}prestashop>admin_cart_5706de961fb376d701be6e7762d8b09c'] = 'Em espera'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_1e63d1811556fc2dad106dcbd4217a69'] = 'Identificação do pagamento'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_7133d45d85f629f4c8abe0e1b3d37942'] = 'Data do pagamento'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_f0aaaae189e9c7711931a65ffcd22543'] = 'Método de pagamento'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_ccd51debd3d65d453679c150b99a39c0'] = 'Data da autorização'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_3f8c6ecb084eea3b83d659fab7155e86'] = 'Data da captura'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_24fe48030f7d3097d5882535b04c3fa8'] = 'Expirado'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_90cbb08c2e81b8eca5298e2533dbe3d9'] = 'Litígio de pagamento'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_9b12a0ddfdf2b10342c50ed2fe6e5c50'] = 'consulte o seu litígio aqui'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_bf49f5bcf72238ecbc0659c3c0c8079f'] = 'Nenhum litígio'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_e2fe37d9647990819245fadb404c482e'] = 'Validação do vale'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_e2b54a61bf4e56c4a044386b2553ed77'] = 'Validação do vale em:'; -$_MODULE['<{stripe_official}prestashop>admin_content_order_2311c8c5e8f44924a3e61c78e2223049'] = 'O vale irá expirar em:'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_9ca4bc48596557840045a7477c803657'] = 'Vous devez spécifier un nombre \"Délai d\'effacement automatique (en jours)\" valide.'; +$_MODULE['<{stripe_official}prestashop>adminprocessloggercontroller_5988c28d05527a0d0ce8ae3da1134352'] = 'Les paramètres de journal ont été mis à jour avec succès !'; $_MODULE['<{stripe_official}prestashop>main_c2cc7082a89c1ad6631a2f66af5f00c0'] = 'Ligação'; $_MODULE['<{stripe_official}prestashop>main_76f0ed934de85cc7131910b32ede7714'] = 'Reembolso'; -$_MODULE['<{stripe_official}prestashop>refund_2b660da0c521cc6bc51a188bc9f7d084'] = 'Escolha um Pedido que queira Reembolsar'; -$_MODULE['<{stripe_official}prestashop>refund_24e85d1e652b3681994e9cae2cc1f35a'] = 'Identificação de pagamento Stripe'; -$_MODULE['<{stripe_official}prestashop>refund_991bd624dcaff354bd793e4cacbd6ea3'] = 'Pode encontrar essa identificação no separador \"Stripe\" do pedido que gostaria de reembolsar. Começa com \"ch_\" ou \"py_\".'; -$_MODULE['<{stripe_official}prestashop>refund_c0a3c3e9b5fbd21c505e082644b2220c'] = 'Reembolso completo'; -$_MODULE['<{stripe_official}prestashop>refund_77fd2b4393b379bedd30efcd5df02090'] = 'Reembolso parcial'; -$_MODULE['<{stripe_official}prestashop>refund_fe9cc1bcfa322db8ade8960ddf4bb19c'] = 'Submeteremos imediatamente qualquer reembolso que faça ao banco do seu cliente.'; -$_MODULE['<{stripe_official}prestashop>refund_2b9689f82101a977f16db0056493a5aa'] = 'O seu cliente receberá os fundos de um reembolso aproximadamente 2-3 dias úteis após a data em que o reembolso foi iniciado.'; -$_MODULE['<{stripe_official}prestashop>refund_6e5d08adf277f2eb21b257fe74f76ddc'] = 'Os reembolsos demoram 5 a 10 dias a aparecer na declaração do seu cliente.'; -$_MODULE['<{stripe_official}prestashop>refund_b2f40690858b404ed10e62bdf422c704'] = 'Montante'; -$_MODULE['<{stripe_official}prestashop>refund_f3b5fc873bba0e14e0d8d9851408b2a3'] = 'Introduza o montante que pretende reembolsar'; -$_MODULE['<{stripe_official}prestashop>refund_f87db45e2887d485ca31ffae186faae9'] = 'Pedir reembolso'; $_MODULE['<{stripe_official}prestashop>configuration_e6ad4dd232a1bb7d77852af7fc2e0538'] = '[a @href1@]Crie a sua conta Stripe em 10 minutos[/a] e comece imediatamente a aceitar pagamentos com cartão, bem como métodos de pagamento locais (não é necessário um contrato adicional/identificação do comerciante do seu banco).'; $_MODULE['<{stripe_official}prestashop>configuration_ebd8fbb49032e4992eb5050893dfa1fc'] = 'Ligar com a Stripe'; $_MODULE['<{stripe_official}prestashop>configuration_650be61892bf690026089544abbd9d26'] = 'Modo'; @@ -115,7 +99,7 @@ $_MODULE['<{stripe_official}prestashop>configuration_e150eb523fd98533136e660e3e7862a0'] = 'China UnionPay'; $_MODULE['<{stripe_official}prestashop>configuration_53619d5dc16df90ad84a8958b7121aa8'] = 'JCB'; $_MODULE['<{stripe_official}prestashop>configuration_1f6176c4f26f546cd5424d53fac0f2f8'] = 'Discovers'; -$_MODULE['<{stripe_official}prestashop>configuration_5f07627108d0280b0fd45dd36e73d01f'] = 'Carteiras digitais, ou seja, Apple Pay, Google Pay e Microsoft Pay.[br]Ao utilizar a Apple Pay, concorda com as condições de utilização da [a @href1@]Stripe[/a] e da [a @href2@]Apple[/a].'; +$_MODULE['<{stripe_official}prestashop>configuration_0e29ba92a96e3342f6e47f324a0c8857'] = 'Carteiras digitais, ou seja, Apple Pay e Google Pay. [br] Ao usar o Apple Pay, você concorda com os termos de serviço de [a@href1@] Stripe [/a] e [a@href2@] Apple [/a].'; $_MODULE['<{stripe_official}prestashop>configuration_f80b9de6d53dc9db807d2a123c149fc7'] = 'Nunca recolher o código postal (não recomendado*).'; $_MODULE['<{stripe_official}prestashop>configuration_c99b5f040533a2516fed921947a3b7f4'] = 'Esta informação melhora as taxas de aceitação dos cartões emitidos nos Estados Unidos, no Reino Unido e no Canadá.'; $_MODULE['<{stripe_official}prestashop>configuration_8cb12d0aa65678a528d4395dbf3a4138'] = 'Recolher o nome do titular do cartão'; @@ -140,21 +124,59 @@ $_MODULE['<{stripe_official}prestashop>configuration_93cba07454f06a4a960172bbd6e2a435'] = 'Sim'; $_MODULE['<{stripe_official}prestashop>configuration_0a2c4e503e93bc3135308bb3fadbe0bd'] = 'Precisa de ativar estes métodos de pagamento no seu [a @href2@]Stripe Dashboard[/a] primeiro'; $_MODULE['<{stripe_official}prestashop>configuration_c9cc8cce247e49bae79f15173ce97354'] = 'Guardar'; +$_MODULE['<{stripe_official}prestashop>refund_2b660da0c521cc6bc51a188bc9f7d084'] = 'Escolha um Pedido que queira Reembolsar'; +$_MODULE['<{stripe_official}prestashop>refund_24e85d1e652b3681994e9cae2cc1f35a'] = 'Identificação de pagamento Stripe'; +$_MODULE['<{stripe_official}prestashop>refund_991bd624dcaff354bd793e4cacbd6ea3'] = 'Pode encontrar essa identificação no separador \"Stripe\" do pedido que gostaria de reembolsar. Começa com \"ch_\" ou \"py_\".'; +$_MODULE['<{stripe_official}prestashop>refund_c0a3c3e9b5fbd21c505e082644b2220c'] = 'Reembolso completo'; +$_MODULE['<{stripe_official}prestashop>refund_77fd2b4393b379bedd30efcd5df02090'] = 'Reembolso parcial'; +$_MODULE['<{stripe_official}prestashop>refund_fe9cc1bcfa322db8ade8960ddf4bb19c'] = 'Submeteremos imediatamente qualquer reembolso que faça ao banco do seu cliente.'; +$_MODULE['<{stripe_official}prestashop>refund_2b9689f82101a977f16db0056493a5aa'] = 'O seu cliente receberá os fundos de um reembolso aproximadamente 2-3 dias úteis após a data em que o reembolso foi iniciado.'; +$_MODULE['<{stripe_official}prestashop>refund_6e5d08adf277f2eb21b257fe74f76ddc'] = 'Os reembolsos demoram 5 a 10 dias a aparecer na declaração do seu cliente.'; +$_MODULE['<{stripe_official}prestashop>refund_b2f40690858b404ed10e62bdf422c704'] = 'Montante'; +$_MODULE['<{stripe_official}prestashop>refund_f3b5fc873bba0e14e0d8d9851408b2a3'] = 'Introduza o montante que pretende reembolsar'; +$_MODULE['<{stripe_official}prestashop>refund_f87db45e2887d485ca31ffae186faae9'] = 'Pedir reembolso'; +$_MODULE['<{stripe_official}prestashop>admin_tab_order_ce7566d1d08cc094b74cf283cf9c56a5'] = 'Stripe'; +$_MODULE['<{stripe_official}prestashop>my-account-stripe-cards_a46d3e7285f76d2401202f18b0acbcbd'] = 'Os meus cartões'; +$_MODULE['<{stripe_official}prestashop>admin_cart_1ab1dfd9dc24ea4729d6c032f7f0342d'] = 'Informações de pagamento'; +$_MODULE['<{stripe_official}prestashop>admin_cart_3d9c6a8d9e9bd14af99a9f4444f602a4'] = 'Data (última atualização)'; +$_MODULE['<{stripe_official}prestashop>admin_cart_24e85d1e652b3681994e9cae2cc1f35a'] = 'Identificação de pagamento Stripe'; +$_MODULE['<{stripe_official}prestashop>admin_cart_49ee3087348e8d44e1feda1917443987'] = 'Nome'; +$_MODULE['<{stripe_official}prestashop>admin_cart_f0aaaae189e9c7711931a65ffcd22543'] = 'Método de pagamento'; +$_MODULE['<{stripe_official}prestashop>admin_cart_388fd2767ba1fd2296f536425d106de3'] = 'Montante pago'; +$_MODULE['<{stripe_official}prestashop>admin_cart_76f0ed934de85cc7131910b32ede7714'] = 'Reembolso'; +$_MODULE['<{stripe_official}prestashop>admin_cart_8eea62084ca7e541d918e823422bd82e'] = 'Resultado'; +$_MODULE['<{stripe_official}prestashop>admin_cart_650be61892bf690026089544abbd9d26'] = 'Modo'; +$_MODULE['<{stripe_official}prestashop>admin_cart_c985a711556e2edf5cac28dfbdb43ff0'] = 'Reembolso parcial'; +$_MODULE['<{stripe_official}prestashop>admin_cart_5706de961fb376d701be6e7762d8b09c'] = 'Em espera'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_1e63d1811556fc2dad106dcbd4217a69'] = 'Identificação do pagamento'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_7133d45d85f629f4c8abe0e1b3d37942'] = 'Data do pagamento'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_f0aaaae189e9c7711931a65ffcd22543'] = 'Método de pagamento'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_ccd51debd3d65d453679c150b99a39c0'] = 'Data da autorização'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_3f8c6ecb084eea3b83d659fab7155e86'] = 'Data da captura'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_24fe48030f7d3097d5882535b04c3fa8'] = 'Expirado'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_90cbb08c2e81b8eca5298e2533dbe3d9'] = 'Litígio de pagamento'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_9b12a0ddfdf2b10342c50ed2fe6e5c50'] = 'consulte o seu litígio aqui'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_bf49f5bcf72238ecbc0659c3c0c8079f'] = 'Nenhum litígio'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_e2fe37d9647990819245fadb404c482e'] = 'Validação do vale'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_e2b54a61bf4e56c4a044386b2553ed77'] = 'Validação do vale em:'; +$_MODULE['<{stripe_official}prestashop>admin_content_order_2311c8c5e8f44924a3e61c78e2223049'] = 'O vale irá expirar em:'; $_MODULE['<{stripe_official}prestashop>payment_form_oxxo_49ee3087348e8d44e1feda1917443987'] = 'Nome'; $_MODULE['<{stripe_official}prestashop>payment_form_oxxo_ce8ae9da5b7cd6c3df2929543a9af92d'] = 'E-mail'; -$_MODULE['<{stripe_official}prestashop>payment_form_ideal_ac23f66a874a7808e300a15f2e94320a'] = 'Pagar com iDeal'; -$_MODULE['<{stripe_official}prestashop>payment_form_ideal_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar agora'; $_MODULE['<{stripe_official}prestashop>stripe-cards_4e997b9d3b7152f2afeacd96ab1ef1cb'] = 'Os meus cartões'; $_MODULE['<{stripe_official}prestashop>stripe-cards_a1fa27779242b4902f7ae3bdd5c6d508'] = 'Tipo'; $_MODULE['<{stripe_official}prestashop>stripe-cards_a44217022190f5734b2f72ba1e4f8a79'] = 'Número do cartão'; $_MODULE['<{stripe_official}prestashop>stripe-cards_b07cc2801693b2e722906a3db3d9c447'] = 'Validade'; $_MODULE['<{stripe_official}prestashop>stripe-cards_f2a6c498fb90ee345d997f888fce3b18'] = 'Eliminar'; $_MODULE['<{stripe_official}prestashop>stripe-cards_78560f5a4e1f5716c8fb9d7cb35f56de'] = 'Ainda não registou um cartão.'; +$_MODULE['<{stripe_official}prestashop>payment_form_bancontact_d536f6cb1304cde5da44c530d3157886'] = 'Pagar com Bancontact'; $_MODULE['<{stripe_official}prestashop>payment_form_sepa_debit_28d20d5ce69c797169658d647110374b'] = 'Pagar com Débito direto SEPA'; $_MODULE['<{stripe_official}prestashop>payment_form_sepa_debit_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar agora'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_9d67bee92ea535ba9c7840797966edfa'] = 'Ocorreu um erro durante o pagamento.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Tente novamente[/a] ou contacte o proprietário do website.'; -$_MODULE['<{stripe_official}prestashop>payment_form_bancontact_d536f6cb1304cde5da44c530d3157886'] = 'Pagar com Bancontact'; +$_MODULE['<{stripe_official}prestashop>payment_info_redirect_f3ee3ad3c8443ee27192d35a7a9d86c9'] = 'Será reencaminhado para o website bancário para concluir o pagamento.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_3380b659ba0a8b01af98dbe7494c0706'] = 'Parabéns, o seu pedido foi efetuado e será processado em breve.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_77031dd06e26cfdab21b078a37741bb6'] = 'A referência do seu pedido é [b]@target@[/b], deverá receber um e-mail de confirmação em breve.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_2a69d95c0cc64162865573233beb3369'] = 'Pode consultar o seu vale OXXO [a @href1@]aqui[/a].'; +$_MODULE['<{stripe_official}prestashop>order-confirmation_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Agradecemos o seu negócio.'; +$_MODULE['<{stripe_official}prestashop>payment_form_sofort_068bcd34a6ded96b1805ca0b9a6745bb'] = 'Pagar com SOFORT'; $_MODULE['<{stripe_official}prestashop>payment_form_card_f73a8b5c0b42c88867a7650fc6fde345'] = 'Certifique-se de que concordou com as nossas Condições de utilização antes de avançar'; $_MODULE['<{stripe_official}prestashop>payment_form_card_d9b1a32393ffc57f2ee4f07626e76d46'] = 'Pague agora com o cartão guardado no seu dispositivo ao clicar no botão acima ou preencha os detalhes do cartão abaixo e envie no final da página'; $_MODULE['<{stripe_official}prestashop>payment_form_card_d9a3493a581e1b2900c5eb45dcb0dc02'] = 'Nome do titular do cartão'; @@ -166,28 +188,32 @@ $_MODULE['<{stripe_official}prestashop>payment_form_card_96e7de5dba463d377178948e998cdf27'] = 'Os detalhes do cartão são protegidos através das normas de segurança PCI DSS v3.2.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_48334cb46587c0571f12ac31e8e9364a'] = 'Os detalhes do cartão serão guardados automaticamente para a sua próxima compra.'; $_MODULE['<{stripe_official}prestashop>payment_form_card_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar agora'; -$_MODULE['<{stripe_official}prestashop>payment_info_redirect_f3ee3ad3c8443ee27192d35a7a9d86c9'] = 'Será reencaminhado para o website bancário para concluir o pagamento.'; -$_MODULE['<{stripe_official}prestashop>payment_form_giropay_32e26982dda43a14285657baee320523'] = 'Pagar com GiroPay'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_9d67bee92ea535ba9c7840797966edfa'] = 'Ocorreu um erro durante o pagamento.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Tente novamente[/a] ou contacte o proprietário do website.'; -$_MODULE['<{stripe_official}prestashop>payment_form_p24_751e90522b3385322c4c34b6f73847d2'] = 'Pagar com P24'; -$_MODULE['<{stripe_official}prestashop>payment_form_fpx_74253765ffa5a6b91d758c7df4d3c871'] = 'Pagar com FPX'; -$_MODULE['<{stripe_official}prestashop>payment_form_fpx_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar agora'; -$_MODULE['<{stripe_official}prestashop>payment_form_sofort_068bcd34a6ded96b1805ca0b9a6745bb'] = 'Pagar com SOFORT'; -$_MODULE['<{stripe_official}prestashop>payment_form_save_card_6e9c53f6d39367724e9b996b3ea9ef22'] = 'Pagar com cartão:'; -$_MODULE['<{stripe_official}prestashop>payment_form_save_card_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar agora'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_3380b659ba0a8b01af98dbe7494c0706'] = 'Parabéns, o seu pedido foi efetuado e será processado em breve.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_77031dd06e26cfdab21b078a37741bb6'] = 'A referência do seu pedido é [b]@target@[/b], deverá receber um e-mail de confirmação em breve.'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_2a69d95c0cc64162865573233beb3369'] = 'Pode consultar o seu vale OXXO [a @href1@]aqui[/a].'; -$_MODULE['<{stripe_official}prestashop>order-confirmation_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Agradecemos o seu negócio.'; -$_MODULE['<{stripe_official}prestashop>payment_form_alipay_47e1e580d173b931fdfdeb6bb5f14848'] = 'Pagar com Alipay'; +$_MODULE['<{stripe_official}prestashop>payment_form_ideal_ac23f66a874a7808e300a15f2e94320a'] = 'Pagar com iDeal'; +$_MODULE['<{stripe_official}prestashop>payment_form_ideal_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar agora'; +$_MODULE['<{stripe_official}prestashop>payment_form_eps_c446bbd08309aff37eee1e0c43b19cde'] = 'Pagar com EPS'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_a46d3e7285f76d2401202f18b0acbcbd'] = 'Os meus cartões'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_a1fa27779242b4902f7ae3bdd5c6d508'] = 'Tipo'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_a44217022190f5734b2f72ba1e4f8a79'] = 'Número do cartão'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_b07cc2801693b2e722906a3db3d9c447'] = 'Validade'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_f2a6c498fb90ee345d997f888fce3b18'] = 'Eliminar'; $_MODULE['<{stripe_official}prestashop>stripe-cards16_78560f5a4e1f5716c8fb9d7cb35f56de'] = 'Ainda não registou um cartão.'; -$_MODULE['<{stripe_official}prestashop>payment_form_eps_c446bbd08309aff37eee1e0c43b19cde'] = 'Pagar com EPS'; +$_MODULE['<{stripe_official}prestashop>payment_form_p24_751e90522b3385322c4c34b6f73847d2'] = 'Pagar com P24'; +$_MODULE['<{stripe_official}prestashop>payment_form_save_card_6e9c53f6d39367724e9b996b3ea9ef22'] = 'Pagar com cartão:'; +$_MODULE['<{stripe_official}prestashop>payment_form_save_card_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar agora'; +$_MODULE['<{stripe_official}prestashop>payment_form_giropay_32e26982dda43a14285657baee320523'] = 'Pagar com GiroPay'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_9d67bee92ea535ba9c7840797966edfa'] = 'Ocorreu um erro durante o pagamento.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-16_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Tente novamente[/a] ou contacte o proprietário do website.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_3380b659ba0a8b01af98dbe7494c0706'] = 'Félicitations, votre commande est validée et sera traitée sous peu.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_2a69d95c0cc64162865573233beb3369'] = 'Vous pouvez accéder à votre coupon OXXO [a @href1@]ici[/a].'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-17_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Merci de votre confiance.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_3380b659ba0a8b01af98dbe7494c0706'] = 'Félicitations, votre commande est validée et sera traitée sous peu.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_2a69d95c0cc64162865573233beb3369'] = 'Vous pouvez accéder à votre coupon OXXO [a @href1@]ici[/a].'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-success-16_978dec2eec7a6d7350ceefbbb6b1e1b1'] = 'Merci de votre confiance.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_9d67bee92ea535ba9c7840797966edfa'] = 'Ocorreu um erro durante o pagamento.'; +$_MODULE['<{stripe_official}prestashop>order-confirmation-failed-17_7dc9c0e2e38c2bbf16923bc6d79b7b06'] = '[a @href1@]Tente novamente[/a] ou contacte o proprietário do website.'; +$_MODULE['<{stripe_official}prestashop>payment_form_alipay_47e1e580d173b931fdfdeb6bb5f14848'] = 'Pagar com Alipay'; +$_MODULE['<{stripe_official}prestashop>payment_form_fpx_74253765ffa5a6b91d758c7df4d3c871'] = 'Pagar com FPX'; +$_MODULE['<{stripe_official}prestashop>payment_form_fpx_eeceac1af4e7620894d6d2083921bb73'] = 'Comprar agora'; $_MODULE['<{stripe_official}prestashop>configurationactions_187b101d0358396a634514ea228616d5'] = 'Chaves API em tempo real fornecidas em vez de chaves API de teste'; $_MODULE['<{stripe_official}prestashop>configurationactions_2df5570b8a0e0c076571d1213f7f901e'] = 'Os campos de identificação do cliente e Chave Secreta são obrigatórios'; $_MODULE['<{stripe_official}prestashop>configurationactions_5fba3565c1b6638ac41f7627066aaa58'] = 'Chaves API de teste fornecidas em vez de chaves API em tempo real'; diff --git a/views/templates/admin/_partials/configuration.tpl b/views/templates/admin/_partials/configuration.tpl index b49334d..136fe5a 100755 --- a/views/templates/admin/_partials/configuration.tpl +++ b/views/templates/admin/_partials/configuration.tpl @@ -132,7 +132,7 @@
@@ -261,4 +261,4 @@ - \ No newline at end of file + From 0494758c055f687ec8b28f59c56b68c9c63b89ec Mon Sep 17 00:00:00 2001 From: afayadas Date: Thu, 2 Sep 2021 09:56:50 +0200 Subject: [PATCH 07/62] ref #25071 : removing unused order state for stripe refund --- stripe_official.php | 38 ------------------------------- upgrade/Upgrade-2.3.7.php | 47 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 38 deletions(-) mode change 100644 => 100755 stripe_official.php create mode 100755 upgrade/Upgrade-2.3.7.php diff --git a/stripe_official.php b/stripe_official.php old mode 100644 new mode 100755 index efebc12..333f31a --- a/stripe_official.php +++ b/stripe_official.php @@ -58,7 +58,6 @@ class Stripe_official extends PaymentModule const TEST_KEY = 'STRIPE_TEST_KEY'; const PUBLISHABLE = 'STRIPE_PUBLISHABLE'; const TEST_PUBLISHABLE = 'STRIPE_TEST_PUBLISHABLE'; - const PARTIAL_REFUND_STATE = 'STRIPE_PARTIAL_REFUND_STATE'; const OS_SOFORT_WAITING = 'STRIPE_OS_SOFORT_WAITING'; const CAPTURE_WAITING = 'STRIPE_CAPTURE_WAITING'; const SEPA_WAITING = 'STRIPE_SEPA_WAITING'; @@ -588,43 +587,6 @@ public function installOrderState() Configuration::updateValue(self::OS_SOFORT_WAITING, (int) $order_state->id, false, $shopGroupId, $shopId); } - /* Create Order State for Stripe */ - if (!Configuration::get(self::PARTIAL_REFUND_STATE,null, $shopGroupId, $shopId) - || !Validate::isLoadedObject(new OrderState(Configuration::get(self::PARTIAL_REFUND_STATE,null, $shopGroupId, $shopId)))) { - $order_state = new OrderState(); - $order_state->name = array(); - foreach (Language::getLanguages() as $language) { - switch (Tools::strtolower($language['iso_code'])) { - case 'fr': - $order_state->name[$language['id_lang']] = pSQL('Remboursement partiel Stripe'); - break; - case 'es': - $order_state->name[$language['id_lang']] = pSQL('Reembolso parcial Stripe'); - break; - case 'de': - $order_state->name[$language['id_lang']] = pSQL('Teilweise Rückerstattung Stripe'); - break; - case 'nl': - $order_state->name[$language['id_lang']] = pSQL('Gedeeltelijke terugbetaling Stripe'); - break; - case 'it': - $order_state->name[$language['id_lang']] = pSQL('Rimborso parziale Stripe'); - break; - - default: - $order_state->name[$language['id_lang']] = pSQL('Stripe Partial Refund'); - break; - } - } - $order_state->invoice = false; - $order_state->send_email = false; - $order_state->logable = true; - $order_state->color = '#FFDD99'; - $order_state->add(); - - Configuration::updateValue(self::PARTIAL_REFUND_STATE, $order_state->id, false, $shopGroupId, $shopId); - } - /* Create Order State for Stripe */ if (!Configuration::get(self::CAPTURE_WAITING,null, $shopGroupId, $shopId) || !Validate::isLoadedObject(new OrderState(Configuration::get(self::CAPTURE_WAITING,null, $shopGroupId, $shopId)))) { diff --git a/upgrade/Upgrade-2.3.7.php b/upgrade/Upgrade-2.3.7.php new file mode 100755 index 0000000..ba27e82 --- /dev/null +++ b/upgrade/Upgrade-2.3.7.php @@ -0,0 +1,47 @@ + + * @copyright Copyright (c) Stripe + * @license Commercial license + */ + +if (!defined('_PS_VERSION_')) { + exit; +} + +/** + * @throws \Stripe\Exception\ApiErrorException + */ +function upgrade_module_2_3_7() +{ + $shopGroupId = Stripe_official::getShopGroupIdContext(); + $shopId = Stripe_official::getShopIdContext(); + + if (Configuration::get('STRIPE_PARTIAL_REFUND_STATE',null, $shopGroupId, $shopId) + && $orderState = new OrderState(Configuration::get('STRIPE_PARTIAL_REFUND_STATE',null, $shopGroupId, $shopId))) { + if (!Configuration::deleteByName('STRIPE_PARTIAL_REFUND_STATE') && !$orderState->delete()) { + return false; + } + } + + return true; +} From 248f87c9118b227eb7f3f21f58fdc8ea496a7a17 Mon Sep 17 00:00:00 2001 From: afayadas Date: Thu, 2 Sep 2021 16:46:49 +0200 Subject: [PATCH 08/62] ref #30932 : adding module cache cleaner into 2.3.6 and 2.3.7 upgrade to prevent uncaptured payment issue --- stripe_official.php | 40 +++++++++++++++++++++++++++++++++++++++ upgrade/Upgrade-2.3.6.php | 4 +++- upgrade/Upgrade-2.3.7.php | 4 +++- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/stripe_official.php b/stripe_official.php index 333f31a..70b6dc5 100755 --- a/stripe_official.php +++ b/stripe_official.php @@ -1208,6 +1208,46 @@ public function isZeroDecimalCurrency($currency) return in_array(Tools::strtoupper($currency), $zeroDecimalCurrencies); } + /** + * Get a list of files contained in directory + * + * @param string $dir Target directory path + * @param string $regex Apply regex + * @param false $onlyFilename Get only filename + * @param array $results Results search + * @return array + */ + private static function getDirContentFiles($dir, $regex = '/.*/', $onlyFilename = false, &$results = array()) { + $files = scandir($dir); + + foreach ($files as $value) { + $path = realpath($dir . DIRECTORY_SEPARATOR . $value); + if (!is_dir($path) && preg_match($regex, $value)) { + $results[] = $onlyFilename ? $value : $path; + } else if ($value != "." && $value != "..") { + self::getDirContentFiles($path, $regex, $onlyFilename, $results); + } + } + + return $results; + } + + /** + * clean cache for upgrader to prevent issue during module upgrade + * + * @return void + */ + public function cleanModuleCache() + { + $path =_PS_MODULE_DIR_.'stripe_official/views/templates'; + $regPattern = '/.*\.tpl/'; + $templates = self::getDirContentFiles($path, $regPattern, true); + + foreach ($templates as $tpl) { + $this->_clearCache($tpl); + } + } + /** * get current ShopId according to activate multishop feature * diff --git a/upgrade/Upgrade-2.3.6.php b/upgrade/Upgrade-2.3.6.php index 83164cd..614b443 100755 --- a/upgrade/Upgrade-2.3.6.php +++ b/upgrade/Upgrade-2.3.6.php @@ -31,7 +31,7 @@ /** * @throws \Stripe\Exception\ApiErrorException */ -function upgrade_module_2_3_6() +function upgrade_module_2_3_6($module) { $sql = 'ALTER TABLE `'._DB_PREFIX_.'stripe_official_processlogger` MODIFY msg TEXT'; if (!Db::getInstance()->execute($sql)) { @@ -154,5 +154,7 @@ function upgrade_module_2_3_6() } } + $module->cleanModuleCache(); + return true; } diff --git a/upgrade/Upgrade-2.3.7.php b/upgrade/Upgrade-2.3.7.php index ba27e82..57b7695 100755 --- a/upgrade/Upgrade-2.3.7.php +++ b/upgrade/Upgrade-2.3.7.php @@ -31,7 +31,7 @@ /** * @throws \Stripe\Exception\ApiErrorException */ -function upgrade_module_2_3_7() +function upgrade_module_2_3_7($module) { $shopGroupId = Stripe_official::getShopGroupIdContext(); $shopId = Stripe_official::getShopIdContext(); @@ -43,5 +43,7 @@ function upgrade_module_2_3_7() } } + $module->cleanModuleCache(); + return true; } From 8151a17195802e8972811f93330042117b986252 Mon Sep 17 00:00:00 2001 From: afayadas Date: Thu, 2 Sep 2021 16:50:52 +0200 Subject: [PATCH 09/62] ref #30910 : fixing wrong order status with out of stock order --- classes/actions/ValidationOrderActions.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/classes/actions/ValidationOrderActions.php b/classes/actions/ValidationOrderActions.php index 9f37ffd..5ead255 100755 --- a/classes/actions/ValidationOrderActions.php +++ b/classes/actions/ValidationOrderActions.php @@ -759,7 +759,8 @@ public function chargeWebhook() } elseif ($event_type == 'charge.failed' && $order->getCurrentState() != Configuration::get('PS_OS_PAYMENT')) { $order->setCurrentState(Configuration::get('PS_OS_ERROR')); - } elseif ($event_type == 'charge.succeeded') { + } elseif ($event_type == 'charge.succeeded' + && $order->getCurrentState() != Configuration::get('PS_OS_OUTOFSTOCK_PAID')) { $order->setCurrentState(Configuration::get('PS_OS_PAYMENT')); if ($this->conveyor['event_json']->data->object->payment_method_details->type == 'oxxo') { $stripePayment = new StripePayment(); @@ -775,7 +776,8 @@ public function chargeWebhook() 'ValidationOrderActions - chargeWebhook' ); } - } elseif ($event_type == 'charge.captured') { + } elseif ($event_type == 'charge.captured' + && $order->getCurrentState() != Configuration::get('PS_OS_OUTOFSTOCK_PAID')) { $history = new OrderHistory(); $history->id_order = (int) $order->id; $history->id_employee = 0; From be33a640c2f8802fc6f43eeb17837760d1af64f9 Mon Sep 17 00:00:00 2001 From: afayadas Date: Wed, 8 Sep 2021 11:12:21 +0200 Subject: [PATCH 10/62] ref #31011 : fix issue about PaymentModule::validateOrder - Country is not active --- classes/actions/ValidationOrderActions.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/classes/actions/ValidationOrderActions.php b/classes/actions/ValidationOrderActions.php index 5ead255..8036ad9 100755 --- a/classes/actions/ValidationOrderActions.php +++ b/classes/actions/ValidationOrderActions.php @@ -338,10 +338,8 @@ public function createOrder() ); try { - if (Configuration::get('PS_GEOLOCATION_ENABLED')) { - $addressInvoice = new Address($this->conveyor['cart']->id_address_invoice); - $this->context->country = new Country($addressInvoice->id_country); - } + $addressDelivery = new Address($this->conveyor['cart']->id_address_delivery); + $this->context->country = new Country($addressDelivery->id_country); $this->module->validateOrder( (int)$this->conveyor['id_cart'], From 4827e0204b03694cc4499e7756cf8786db100cd1 Mon Sep 17 00:00:00 2001 From: afayadas Date: Thu, 23 Sep 2021 16:47:16 +0200 Subject: [PATCH 11/62] ref #30682 : fixing issue about duplicate amount with sepa payment + fixing order state misconfigurations --- classes/actions/ValidationOrderActions.php | 8 ++- stripe_official.php | 68 ++++++++++++---------- upgrade/Upgrade-2.3.7.php | 32 ++++++++++ 3 files changed, 73 insertions(+), 35 deletions(-) diff --git a/classes/actions/ValidationOrderActions.php b/classes/actions/ValidationOrderActions.php index 8036ad9..9596b1e 100755 --- a/classes/actions/ValidationOrderActions.php +++ b/classes/actions/ValidationOrderActions.php @@ -607,8 +607,9 @@ public function addTentative() $stripePayment->setDateAdd(date("Y-m-d H:i:s")); $stripePayment->save(); - // Payent with Sofort is not accepted yet so we can't get his orderPayment - if (Tools::strtolower($cardType) != 'sofort') { + // Payment with Sofort is not accepted yet, so we can't get his orderPayment + if (Tools::strtolower($cardType) != 'sofort' + && Tools::strtolower($cardType) != 'sepa_debit') { $orderId = Order::getOrderByCartId((int)$this->context->cart->id); $orderPaymentDatas = OrderPayment::getByOrderId($orderId); @@ -795,7 +796,8 @@ public function chargeWebhook() $history->addWithemail(); } elseif ($event_type == 'charge.refunded') { - if ($this->conveyor['event_json']->data->object->amount_refunded !== $this->conveyor['event_json']->data->object->amount_captured) { + if ($this->conveyor['event_json']->data->object->amount_refunded !== $this->conveyor['event_json']->data->object->amount_captured + || $this->conveyor['event_json']->data->object->amount_refunded !== $this->conveyor['event_json']->data->object->amount) { $order->setCurrentState(Configuration::get('PS_CHECKOUT_STATE_PARTIAL_REFUND')); ProcessLoggerHandler::logInfo( 'Partial refund of payment => '.$this->conveyor['event_json']->data->object->id, diff --git a/stripe_official.php b/stripe_official.php index 70b6dc5..1d4cf4d 100755 --- a/stripe_official.php +++ b/stripe_official.php @@ -546,8 +546,8 @@ public function installOrderState() $shopGroupId = Stripe_official::getShopGroupIdContext(); $shopId = Stripe_official::getShopIdContext(); - if (!Configuration::get(self::OS_SOFORT_WAITING,null, $shopGroupId, $shopId) - || !Validate::isLoadedObject(new OrderState(Configuration::get(self::OS_SOFORT_WAITING,null, $shopGroupId, $shopId)))) { + if (!Configuration::get(self::OS_SOFORT_WAITING) + || !Validate::isLoadedObject(new OrderState(Configuration::get(self::OS_SOFORT_WAITING)))) { $order_state = new OrderState(); $order_state->name = array(); foreach (Language::getLanguages() as $language) { @@ -584,12 +584,12 @@ public function installOrderState() $destination = _PS_ROOT_DIR_.'/img/os/'.(int) $order_state->id.'.gif'; copy($source, $destination); } - Configuration::updateValue(self::OS_SOFORT_WAITING, (int) $order_state->id, false, $shopGroupId, $shopId); + Configuration::updateValue(self::OS_SOFORT_WAITING, (int) $order_state->id); } /* Create Order State for Stripe */ - if (!Configuration::get(self::CAPTURE_WAITING,null, $shopGroupId, $shopId) - || !Validate::isLoadedObject(new OrderState(Configuration::get(self::CAPTURE_WAITING,null, $shopGroupId, $shopId)))) { + if (!Configuration::get(self::CAPTURE_WAITING) + || !Validate::isLoadedObject(new OrderState(Configuration::get(self::CAPTURE_WAITING)))) { $order_state = new OrderState(); $order_state->name = array(); foreach (Language::getLanguages() as $language) { @@ -629,26 +629,26 @@ public function installOrderState() } /* Create Order State for Stripe */ - if (!Configuration::get(self::SEPA_WAITING,null, $shopGroupId, $shopId) - || !Validate::isLoadedObject(new OrderState(Configuration::get(self::SEPA_WAITING,null, $shopGroupId, $shopId)))) { + if (!Configuration::get(self::SEPA_WAITING) + || !Validate::isLoadedObject(new OrderState(Configuration::get(self::SEPA_WAITING)))) { $order_state = new OrderState(); $order_state->name = array(); foreach (Language::getLanguages() as $language) { switch (Tools::strtolower($language['iso_code'])) { case 'fr': - $order_state->name[$language['id_lang']] = pSQL('Waiting for SEPA payment'); + $order_state->name[$language['id_lang']] = pSQL('En attente de paiement SEPA'); break; case 'es': - $order_state->name[$language['id_lang']] = pSQL('Waiting for SEPA payment'); + $order_state->name[$language['id_lang']] = pSQL('Esperando pago SEPA'); break; case 'de': - $order_state->name[$language['id_lang']] = pSQL('Waiting for SEPA payment'); + $order_state->name[$language['id_lang']] = pSQL('Warten auf SEPA-Zahlung'); break; case 'nl': - $order_state->name[$language['id_lang']] = pSQL('Waiting for SEPA payment'); + $order_state->name[$language['id_lang']] = pSQL('Wachten op SEPA-betaling'); break; case 'it': - $order_state->name[$language['id_lang']] = pSQL('Waiting for SEPA payment'); + $order_state->name[$language['id_lang']] = pSQL('In attesa del pagamento SEPA'); break; default: @@ -656,9 +656,11 @@ public function installOrderState() break; } } - $order_state->invoice = false; $order_state->send_email = false; - $order_state->logable = true; + $order_state->hidden = false; + $order_state->delivery = false; + $order_state->logable = false; + $order_state->invoice = false; $order_state->color = '#fcba03'; if ($order_state->add()) { $source = _PS_MODULE_DIR_.'stripe_official/views/img/ca_icon.gif'; @@ -666,30 +668,30 @@ public function installOrderState() copy($source, $destination); } - Configuration::updateValue(self::SEPA_WAITING, $order_state->id, false, $shopGroupId, $shopId); + Configuration::updateValue(self::SEPA_WAITING, $order_state->id); } /* Create Order State for Stripe */ - if (!Configuration::get(self::SEPA_DISPUTE,null, $shopGroupId, $shopId) - || !Validate::isLoadedObject(new OrderState(Configuration::get(self::SEPA_DISPUTE,null, $shopGroupId, $shopId)))) { + if (!Configuration::get(self::SEPA_DISPUTE) + || !Validate::isLoadedObject(new OrderState(Configuration::get(self::SEPA_DISPUTE)))) { $order_state = new OrderState(); $order_state->name = array(); foreach (Language::getLanguages() as $language) { switch (Tools::strtolower($language['iso_code'])) { case 'fr': - $order_state->name[$language['id_lang']] = pSQL('SEPA dispute'); + $order_state->name[$language['id_lang']] = pSQL('Litige SEPA'); break; case 'es': - $order_state->name[$language['id_lang']] = pSQL('SEPA dispute'); + $order_state->name[$language['id_lang']] = pSQL('Disputa SEPA'); break; case 'de': - $order_state->name[$language['id_lang']] = pSQL('SEPA dispute'); + $order_state->name[$language['id_lang']] = pSQL('SEPA-Streit'); break; case 'nl': - $order_state->name[$language['id_lang']] = pSQL('SEPA dispute'); + $order_state->name[$language['id_lang']] = pSQL('SEPA-geschil'); break; case 'it': - $order_state->name[$language['id_lang']] = pSQL('SEPA dispute'); + $order_state->name[$language['id_lang']] = pSQL('Controversia SEPA'); break; default: @@ -707,30 +709,30 @@ public function installOrderState() copy($source, $destination); } - Configuration::updateValue(self::SEPA_DISPUTE, $order_state->id, false, $shopGroupId, $shopId); + Configuration::updateValue(self::SEPA_DISPUTE, $order_state->id); } /* Create Order State for Stripe */ - if (!Configuration::get(self::OXXO_WAITING,null, $shopGroupId, $shopId) - || !Validate::isLoadedObject(new OrderState(Configuration::get(self::OXXO_WAITING,null, $shopGroupId, $shopId)))) { + if (!Configuration::get(self::OXXO_WAITING) + || !Validate::isLoadedObject(new OrderState(Configuration::get(self::OXXO_WAITING)))) { $order_state = new OrderState(); $order_state->name = array(); foreach (Language::getLanguages() as $language) { switch (Tools::strtolower($language['iso_code'])) { case 'fr': - $order_state->name[$language['id_lang']] = pSQL('Waiting for OXXO payment confirmation'); + $order_state->name[$language['id_lang']] = pSQL('En attente de la confirmation de paiement OXXO'); break; case 'es': - $order_state->name[$language['id_lang']] = pSQL('Waiting for OXXO payment confirmation'); + $order_state->name[$language['id_lang']] = pSQL('Esperando la confirmación del pago de OXXO'); break; case 'de': - $order_state->name[$language['id_lang']] = pSQL('Waiting for OXXO payment confirmation'); + $order_state->name[$language['id_lang']] = pSQL('Warten auf OXXO-Zahlungsbestätigung'); break; case 'nl': - $order_state->name[$language['id_lang']] = pSQL('Waiting for OXXO payment confirmation'); + $order_state->name[$language['id_lang']] = pSQL('Wachten op OXXO betalingsbevestiging'); break; case 'it': - $order_state->name[$language['id_lang']] = pSQL('Waiting for OXXO payment confirmation'); + $order_state->name[$language['id_lang']] = pSQL('In attesa della conferma del pagamento OXXO'); break; default: @@ -740,7 +742,9 @@ public function installOrderState() } $order_state->invoice = false; $order_state->send_email = false; - $order_state->logable = true; + $order_state->hidden = false; + $order_state->delivery = false; + $order_state->logable = false; $order_state->color = '#C23416'; if ($order_state->add()) { $source = _PS_MODULE_DIR_.'stripe_official/views/img/ca_icon.gif'; @@ -748,7 +752,7 @@ public function installOrderState() copy($source, $destination); } - Configuration::updateValue(self::OXXO_WAITING, $order_state->id, false, $shopGroupId, $shopId); + Configuration::updateValue(self::OXXO_WAITING, $order_state->id); } return true; diff --git a/upgrade/Upgrade-2.3.7.php b/upgrade/Upgrade-2.3.7.php index 57b7695..886f859 100755 --- a/upgrade/Upgrade-2.3.7.php +++ b/upgrade/Upgrade-2.3.7.php @@ -43,6 +43,38 @@ function upgrade_module_2_3_7($module) } } + $os_sofort_waiting = Configuration::get(self::OS_SOFORT_WAITING) ?: Configuration::get(self::OS_SOFORT_WAITING, null, $shopGroupId, $shopId); + if ($os_sofort_waiting) { + Configuration::deleteByName(self::OS_SOFORT_WAITING); + Configuration::updateValue(self::CAPTURE_WAITING, $os_sofort_waiting); + } + $capture_waiting = Configuration::get(self::CAPTURE_WAITING) ?: Configuration::get(self::CAPTURE_WAITING, null, $shopGroupId, $shopId); + if ($capture_waiting) { + Configuration::deleteByName(self::CAPTURE_WAITING); + Configuration::updateValue(self::CAPTURE_WAITING, $capture_waiting); + } + $sepa_waiting = Configuration::get(self::SEPA_WAITING) ?: Configuration::get(self::SEPA_WAITING, null, $shopGroupId, $shopId); + if ($sepa_waiting) { + Configuration::deleteByName(self::SEPA_WAITING); + $orderState = new OrderState($sepa_waiting); + $orderState->logable = false; + $orderState->save(); + Configuration::updateValue(self::SEPA_WAITING, $orderState->id); + } + $sepa_dispute = Configuration::get(self::SEPA_DISPUTE) ?: Configuration::get(self::SEPA_DISPUTE, null, $shopGroupId, $shopId); + if ($sepa_dispute) { + Configuration::deleteByName(self::SEPA_DISPUTE); + Configuration::updateValue(self::SEPA_DISPUTE, $sepa_dispute); + } + $oxxo_waiting = Configuration::get(self::OXXO_WAITING) ?: Configuration::get(self::OXXO_WAITING, null, $shopGroupId, $shopId); + if ($oxxo_waiting) { + Configuration::deleteByName(self::OXXO_WAITING); + $orderState = new OrderState($sepa_dispute); + $orderState->logable = false; + $orderState->save(); + Configuration::updateValue(self::OXXO_WAITING, $orderState->id); + } + $module->cleanModuleCache(); return true; From af6977435bfe8d6823bebb03f480da33a3065175 Mon Sep 17 00:00:00 2001 From: afayadas Date: Thu, 23 Sep 2021 16:52:15 +0200 Subject: [PATCH 12/62] ref #31198 : undisplay saved card tab in customer account --- stripe_official.php | 6 +++- .../hook/my-account-stripe-cards.tpl | 32 ++++++++++--------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/stripe_official.php b/stripe_official.php index 1d4cf4d..65fec61 100755 --- a/stripe_official.php +++ b/stripe_official.php @@ -1973,8 +1973,12 @@ public function hookDisplayCustomerAccount() $prestashop_version = '1.6'; } + $shopGroupId = Stripe_official::getShopGroupIdContext(); + $shopId = Stripe_official::getShopIdContext(); + $this->context->smarty->assign(array( - 'prestashop_version' => $prestashop_version + 'prestashop_version' => $prestashop_version, + 'isSaveCard' => Configuration::get(self::SAVE_CARD, null, $shopGroupId, $shopId), )); return $this->display(__FILE__, 'my-account-stripe-cards.tpl'); diff --git a/views/templates/hook/my-account-stripe-cards.tpl b/views/templates/hook/my-account-stripe-cards.tpl index 1d300cc..770416a 100755 --- a/views/templates/hook/my-account-stripe-cards.tpl +++ b/views/templates/hook/my-account-stripe-cards.tpl @@ -21,18 +21,20 @@ * @copyright Copyright (c) Stripe * @license Commercial license *} -{if $prestashop_version == '1.7'} - - - payment - {l s='My cards' mod='stripe_official'} - - -{else} -
  • - - - {l s='My cards' mod='stripe_official'} - -
  • -{/if} \ No newline at end of file +{if $isSaveCard } + {if $prestashop_version == '1.7'} + + + payment + {l s='My cards' mod='stripe_official'} + + + {else} +
  • + + + {l s='My cards' mod='stripe_official'} + +
  • + {/if} +{/if} From 0526a0a352984d65796ebba9957306bd8e6ab75a Mon Sep 17 00:00:00 2001 From: afayadas Date: Fri, 1 Oct 2021 16:42:29 +0200 Subject: [PATCH 13/62] refs #31292 : fixing refunded split order issue --- classes/actions/ValidationOrderActions.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/classes/actions/ValidationOrderActions.php b/classes/actions/ValidationOrderActions.php index 9596b1e..0a79727 100755 --- a/classes/actions/ValidationOrderActions.php +++ b/classes/actions/ValidationOrderActions.php @@ -363,6 +363,16 @@ public function createOrder() $idOrder = Order::getOrderByCartId((int)$this->conveyor['id_cart']); $order = new Order($idOrder); + // Check if order is split + $splitOrder = Order::getByReference($order->reference); + if ($splitOrder->count() > 1) { + $total_paid_real = 0; + foreach ($splitOrder->getResults() as $result) { + $total_paid_real += $result->total_paid; + } + $order->total_paid = $total_paid_real; + } + // capture payment for card if no catch and authorize enabled $intent = \Stripe\PaymentIntent::retrieve($this->conveyor['paymentIntent']); ProcessLoggerHandler::logInfo( From 17957b342dbf6cc8fbe4fb31db4c4f7d9ee34913 Mon Sep 17 00:00:00 2001 From: afayadas Date: Thu, 7 Oct 2021 09:30:49 +0200 Subject: [PATCH 14/62] refs #31469 : fix issue during 2.3.7 upgrade --- stripe_official.php | 2 +- upgrade/Upgrade-2.3.7.php | 33 +++++++++++++++------------------ 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/stripe_official.php b/stripe_official.php index 65fec61..f6e6632 100755 --- a/stripe_official.php +++ b/stripe_official.php @@ -1228,7 +1228,7 @@ private static function getDirContentFiles($dir, $regex = '/.*/', $onlyFilename $path = realpath($dir . DIRECTORY_SEPARATOR . $value); if (!is_dir($path) && preg_match($regex, $value)) { $results[] = $onlyFilename ? $value : $path; - } else if ($value != "." && $value != "..") { + } else if (is_dir($path) && $value != "." && $value != "..") { self::getDirContentFiles($path, $regex, $onlyFilename, $results); } } diff --git a/upgrade/Upgrade-2.3.7.php b/upgrade/Upgrade-2.3.7.php index 886f859..b73f8fd 100755 --- a/upgrade/Upgrade-2.3.7.php +++ b/upgrade/Upgrade-2.3.7.php @@ -28,9 +28,6 @@ exit; } -/** - * @throws \Stripe\Exception\ApiErrorException - */ function upgrade_module_2_3_7($module) { $shopGroupId = Stripe_official::getShopGroupIdContext(); @@ -43,36 +40,36 @@ function upgrade_module_2_3_7($module) } } - $os_sofort_waiting = Configuration::get(self::OS_SOFORT_WAITING) ?: Configuration::get(self::OS_SOFORT_WAITING, null, $shopGroupId, $shopId); + $os_sofort_waiting = Configuration::get(Stripe_official::OS_SOFORT_WAITING) ?: Configuration::get(Stripe_official::OS_SOFORT_WAITING, null, $shopGroupId, $shopId); if ($os_sofort_waiting) { - Configuration::deleteByName(self::OS_SOFORT_WAITING); - Configuration::updateValue(self::CAPTURE_WAITING, $os_sofort_waiting); + Configuration::deleteByName(Stripe_official::OS_SOFORT_WAITING); + Configuration::updateValue(Stripe_official::CAPTURE_WAITING, $os_sofort_waiting); } - $capture_waiting = Configuration::get(self::CAPTURE_WAITING) ?: Configuration::get(self::CAPTURE_WAITING, null, $shopGroupId, $shopId); + $capture_waiting = Configuration::get(Stripe_official::CAPTURE_WAITING) ?: Configuration::get(Stripe_official::CAPTURE_WAITING, null, $shopGroupId, $shopId); if ($capture_waiting) { - Configuration::deleteByName(self::CAPTURE_WAITING); - Configuration::updateValue(self::CAPTURE_WAITING, $capture_waiting); + Configuration::deleteByName(Stripe_official::CAPTURE_WAITING); + Configuration::updateValue(Stripe_official::CAPTURE_WAITING, $capture_waiting); } - $sepa_waiting = Configuration::get(self::SEPA_WAITING) ?: Configuration::get(self::SEPA_WAITING, null, $shopGroupId, $shopId); + $sepa_waiting = Configuration::get(Stripe_official::SEPA_WAITING) ?: Configuration::get(Stripe_official::SEPA_WAITING, null, $shopGroupId, $shopId); if ($sepa_waiting) { - Configuration::deleteByName(self::SEPA_WAITING); + Configuration::deleteByName(Stripe_official::SEPA_WAITING); $orderState = new OrderState($sepa_waiting); $orderState->logable = false; $orderState->save(); - Configuration::updateValue(self::SEPA_WAITING, $orderState->id); + Configuration::updateValue(Stripe_official::SEPA_WAITING, $orderState->id); } - $sepa_dispute = Configuration::get(self::SEPA_DISPUTE) ?: Configuration::get(self::SEPA_DISPUTE, null, $shopGroupId, $shopId); + $sepa_dispute = Configuration::get(Stripe_official::SEPA_DISPUTE) ?: Configuration::get(Stripe_official::SEPA_DISPUTE, null, $shopGroupId, $shopId); if ($sepa_dispute) { - Configuration::deleteByName(self::SEPA_DISPUTE); - Configuration::updateValue(self::SEPA_DISPUTE, $sepa_dispute); + Configuration::deleteByName(Stripe_official::SEPA_DISPUTE); + Configuration::updateValue(Stripe_official::SEPA_DISPUTE, $sepa_dispute); } - $oxxo_waiting = Configuration::get(self::OXXO_WAITING) ?: Configuration::get(self::OXXO_WAITING, null, $shopGroupId, $shopId); + $oxxo_waiting = Configuration::get(Stripe_official::OXXO_WAITING) ?: Configuration::get(Stripe_official::OXXO_WAITING, null, $shopGroupId, $shopId); if ($oxxo_waiting) { - Configuration::deleteByName(self::OXXO_WAITING); + Configuration::deleteByName(Stripe_official::OXXO_WAITING); $orderState = new OrderState($sepa_dispute); $orderState->logable = false; $orderState->save(); - Configuration::updateValue(self::OXXO_WAITING, $orderState->id); + Configuration::updateValue(Stripe_official::OXXO_WAITING, $orderState->id); } $module->cleanModuleCache(); From 6a8306e656930ae3d86b65dc427fa3b69f4edeb4 Mon Sep 17 00:00:00 2001 From: afayadas Date: Thu, 7 Oct 2021 15:58:25 +0200 Subject: [PATCH 15/62] refs #31037 : update classlib to 2.6.x --- 202/classlib.yml | 2 +- .../src/Actions/ActionsHandler.php | 73 ++- .../src/Actions/DefaultActions.php | 23 +- .../src/Database/Action/ActionFactory.php | 54 ++ .../src/Database/Action/ActionInterface.php | 38 ++ .../src/Database/Action/ActionType.php | 33 ++ .../src/Database/Action/InstallAction.php | 87 +++ .../Action/Table/AbstractTableAction.php | 38 ++ .../Action/Table/CreateTableAction.php | 113 ++++ .../Action/Table/DeleteTableAction.php | 42 ++ .../Action/Table/TableActionFactory.php | 57 ++ .../Database/Action/Table/TableActionType.php | 35 ++ .../Action/Table/UpdateTableAction.php | 120 +++++ .../src/Database/Action/UninstallAction.php | 73 +++ .../src/Database/DbObjectHandler.php | 31 ++ .../Definition/Field/FieldDefinition.php | 127 +++++ .../Field/FieldDefinitionColumnBuilder.php | 98 ++++ .../ObjectModel/ObjectModelDefinition.php | 441 +++++++++++++++ .../Definition/Schema/SchemaDefinition.php | 94 ++++ .../Table/AbstractTableDefinitionBuilder.php | 76 +++ .../Table/LangTableDefinitionBuilder.php | 122 +++++ .../Table/MainTableDefinitionBuilder.php | 82 +++ .../Table/ShopTableDefinitionBuilder.php | 97 ++++ .../Definition/Table/TableDefinition.php | 266 +++++++++ .../Table/TableDefinitionFactory.php | 70 +++ .../Database/Definition/Table/TableType.php | 35 ++ .../src/Database/ForeignKey/ForeignKey.php | 249 +++++++++ .../Database/ForeignKey/ForeignKeyHandler.php | 112 ++++ .../Database/ForeignKey/ReferenceOption.php | 39 ++ .../src/Database/Index/Index.php | 193 +++++++ .../src/Database/Index/IndexField.php | 51 ++ .../src/Database/Index/IndexHandler.php | 111 ++++ .../src/Database/Index/IndexType.php | 37 ++ .../src/Database/ObjectModelExtension.php | 79 +++ .../Database/Repository/ActionRepository.php | 43 ++ vendor/totpsclasslib/src/Db/DbSchema.php | 74 --- vendor/totpsclasslib/src/Db/DbTable.php | 387 ------------- .../src/Db/DbTableDefinitionModel.php | 284 ---------- .../src/Db/DbTableDefinitionRelation.php | 385 ------------- .../src/Db/ObjectModelDefinition.php | 505 ----------------- .../src/Db/ObjectModelExtension.php | 120 ----- .../Extensions/AbstractModuleExtension.php | 126 ++++- .../AdminProcessLoggerController.php | 276 ---------- .../Classes/ProcessLoggerObjectModel.php | 72 +-- .../Admin/AdminProcessLoggerController.php | 154 +++--- .../ProcessLogger/ProcessLoggerExtension.php | 26 +- .../ProcessLogger/ProcessLoggerHandler.php | 139 +++-- .../ProcessLoggerObjectModel.php | 89 --- .../Classes/ProcessMonitorObjectModel.php | 124 +++++ .../ProcessMonitor/ProcessMonitorHandler.php | 205 +++++++ .../totpsclasslib/src/Hook/AbstractHook.php | 76 +++ .../src/Hook/AbstractHookDispatcher.php | 150 ++++++ .../src/Install/AbstractInstaller.php | 131 +++-- .../src/Install/ExtensionInstaller.php | 59 +- .../totpsclasslib/src/Install/Installer.php | 508 ------------------ .../src/Install/ModuleInstaller.php | 62 ++- vendor/totpsclasslib/src/Module.php | 311 +++++++++++ vendor/totpsclasslib/src/Registry.php | 37 +- .../src/Utils/Translate/TranslateTrait.php | 66 +++ 59 files changed, 4701 insertions(+), 2906 deletions(-) mode change 100644 => 100755 202/classlib.yml create mode 100644 vendor/totpsclasslib/src/Database/Action/ActionFactory.php create mode 100644 vendor/totpsclasslib/src/Database/Action/ActionInterface.php create mode 100644 vendor/totpsclasslib/src/Database/Action/ActionType.php create mode 100644 vendor/totpsclasslib/src/Database/Action/InstallAction.php create mode 100644 vendor/totpsclasslib/src/Database/Action/Table/AbstractTableAction.php create mode 100644 vendor/totpsclasslib/src/Database/Action/Table/CreateTableAction.php create mode 100644 vendor/totpsclasslib/src/Database/Action/Table/DeleteTableAction.php create mode 100644 vendor/totpsclasslib/src/Database/Action/Table/TableActionFactory.php create mode 100644 vendor/totpsclasslib/src/Database/Action/Table/TableActionType.php create mode 100644 vendor/totpsclasslib/src/Database/Action/Table/UpdateTableAction.php create mode 100644 vendor/totpsclasslib/src/Database/Action/UninstallAction.php create mode 100644 vendor/totpsclasslib/src/Database/DbObjectHandler.php create mode 100644 vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinition.php create mode 100644 vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinitionColumnBuilder.php create mode 100644 vendor/totpsclasslib/src/Database/Definition/ObjectModel/ObjectModelDefinition.php create mode 100644 vendor/totpsclasslib/src/Database/Definition/Schema/SchemaDefinition.php create mode 100644 vendor/totpsclasslib/src/Database/Definition/Table/AbstractTableDefinitionBuilder.php create mode 100644 vendor/totpsclasslib/src/Database/Definition/Table/LangTableDefinitionBuilder.php create mode 100644 vendor/totpsclasslib/src/Database/Definition/Table/MainTableDefinitionBuilder.php create mode 100644 vendor/totpsclasslib/src/Database/Definition/Table/ShopTableDefinitionBuilder.php create mode 100644 vendor/totpsclasslib/src/Database/Definition/Table/TableDefinition.php create mode 100644 vendor/totpsclasslib/src/Database/Definition/Table/TableDefinitionFactory.php create mode 100644 vendor/totpsclasslib/src/Database/Definition/Table/TableType.php create mode 100644 vendor/totpsclasslib/src/Database/ForeignKey/ForeignKey.php create mode 100644 vendor/totpsclasslib/src/Database/ForeignKey/ForeignKeyHandler.php create mode 100644 vendor/totpsclasslib/src/Database/ForeignKey/ReferenceOption.php create mode 100644 vendor/totpsclasslib/src/Database/Index/Index.php create mode 100644 vendor/totpsclasslib/src/Database/Index/IndexField.php create mode 100644 vendor/totpsclasslib/src/Database/Index/IndexHandler.php create mode 100644 vendor/totpsclasslib/src/Database/Index/IndexType.php create mode 100644 vendor/totpsclasslib/src/Database/ObjectModelExtension.php create mode 100644 vendor/totpsclasslib/src/Database/Repository/ActionRepository.php delete mode 100644 vendor/totpsclasslib/src/Db/DbSchema.php delete mode 100755 vendor/totpsclasslib/src/Db/DbTable.php delete mode 100644 vendor/totpsclasslib/src/Db/DbTableDefinitionModel.php delete mode 100644 vendor/totpsclasslib/src/Db/DbTableDefinitionRelation.php delete mode 100644 vendor/totpsclasslib/src/Db/ObjectModelDefinition.php delete mode 100644 vendor/totpsclasslib/src/Db/ObjectModelExtension.php delete mode 100644 vendor/totpsclasslib/src/Extensions/ProcessLogger/AdminProcessLoggerController.php mode change 100755 => 100644 vendor/totpsclasslib/src/Extensions/ProcessLogger/Classes/ProcessLoggerObjectModel.php delete mode 100644 vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerObjectModel.php create mode 100644 vendor/totpsclasslib/src/Extensions/ProcessMonitor/Classes/ProcessMonitorObjectModel.php create mode 100644 vendor/totpsclasslib/src/Extensions/ProcessMonitor/ProcessMonitorHandler.php create mode 100644 vendor/totpsclasslib/src/Hook/AbstractHook.php create mode 100644 vendor/totpsclasslib/src/Hook/AbstractHookDispatcher.php delete mode 100644 vendor/totpsclasslib/src/Install/Installer.php create mode 100644 vendor/totpsclasslib/src/Module.php create mode 100644 vendor/totpsclasslib/src/Utils/Translate/TranslateTrait.php diff --git a/202/classlib.yml b/202/classlib.yml old mode 100644 new mode 100755 index abbfb40..fb413bf --- a/202/classlib.yml +++ b/202/classlib.yml @@ -1 +1 @@ -version: release/2.1.0 +version: develop diff --git a/vendor/totpsclasslib/src/Actions/ActionsHandler.php b/vendor/totpsclasslib/src/Actions/ActionsHandler.php index 1663ce0..7db5980 100644 --- a/vendor/totpsclasslib/src/Actions/ActionsHandler.php +++ b/vendor/totpsclasslib/src/Actions/ActionsHandler.php @@ -20,34 +20,40 @@ * @author 202-ecommerce * @copyright Copyright (c) 202-ecommerce * @license Commercial license - * @version release/2.1.0 + * + * @version develop */ namespace Stripe_officialClasslib\Actions; -use \Tools; +use Hook; +use Module; +use ObjectModel; +use Tools; /** * Actions Handler */ class ActionsHandler { + const PROCESS_OVERRIDE_HOOK = 'actionStripe_officialActionsHandler'; + /** - * @var ObjectModel $modelObject + * @var ObjectModel */ protected $modelObject; /** * Values conveyored by the classes * - * @var array $conveyor + * @var array */ - protected $conveyor = array(); + protected $conveyor = []; /** * List of actions * - * @var array $actions + * @var array */ protected $actions; @@ -55,6 +61,7 @@ class ActionsHandler * Set an modelObject * * @param ObjectModel $modelObject + * * @return $this */ public function setModelObject($modelObject) @@ -68,6 +75,7 @@ public function setModelObject($modelObject) * Set the conveyor * * @param array $conveyorData + * * @return $this */ public function setConveyor($conveyorData) @@ -91,53 +99,68 @@ public function getConveyor() * Call sevral actions * * @param mixed $actions + * * @return $this */ public function addActions($actions) { $this->actions = func_get_args(); + return $this; } /** * Process the action call back of cross modules * - * @param string $chain Name of the actions chain + * @param string $className Name of the actions chain / Namespaced classname + * * @return bool + * + * @throws \Exception */ - public function process($chain) + public function process($className) { - $className = Tools::ucfirst($chain).'Actions'; - if (!preg_match("/^[a-zA-Z]+$/", $className)) { - throw new \Exception($className .'" class name not valid "'); + if (!class_exists($className)) { + $className = Tools::ucfirst($className) . 'Actions'; + if (!preg_match('/^[a-zA-Z]+$/', $className)) { + throw new \Exception($className . '" class name not valid "'); + } + include_once _PS_MODULE_DIR_ . 'stripe_official/classes/actions/' . $className . '.php'; + + $overridePath = _PS_OVERRIDE_DIR_ . 'modules/stripe_official/classes/actions/' . $className . '.php'; + if (file_exists($overridePath)) { + $className .= 'Override'; + include_once $overridePath; + } } - include_once _PS_MODULE_DIR_.'stripe_official/classes/actions/'.$className.'.php'; - - $overridePath = _PS_OVERRIDE_DIR_.'modules/stripe_official/classes/actions/'.$className.'.php'; - if (file_exists($overridePath)) { - $className .= 'Override'; - include_once $overridePath; + + $moduleId = Module::getModuleIdByName('stripe_official'); + /** @var array $hookResult */ + $hookResult = Hook::exec(self::PROCESS_OVERRIDE_HOOK, ['className' => $className], $moduleId, true, false); + if (!empty($hookResult) && !empty($hookResult['stripe_official'])) { + $className = $hookResult['stripe_official']; } - + if (class_exists($className)) { - /** @var Stripe_officialDefaultActions $classAction */ - $classAction = new $className; + /** @var DefaultActions $classAction */ + $classAction = new $className(); $classAction->setModelObject($this->modelObject); $classAction->setConveyor($this->conveyor); - + foreach ($this->actions as $action) { - if (!is_callable(array($classAction, $action), false, $callable_name)) { + if (!is_callable([$classAction, $action], false, $callableName)) { continue; } - if (!call_user_func_array(array($classAction, $action), array())) { + if (!call_user_func_array([$classAction, $action], [])) { $this->setConveyor($classAction->getConveyor()); + return false; } } - + $this->setConveyor($classAction->getConveyor()); } else { - throw new \Exception($className .'" class not defined "'); + throw new \Exception($className . '" class not defined "'); } return true; diff --git a/vendor/totpsclasslib/src/Actions/DefaultActions.php b/vendor/totpsclasslib/src/Actions/DefaultActions.php index b0fd73d..7e19271 100644 --- a/vendor/totpsclasslib/src/Actions/DefaultActions.php +++ b/vendor/totpsclasslib/src/Actions/DefaultActions.php @@ -20,12 +20,13 @@ * @author 202-ecommerce * @copyright Copyright (c) 202-ecommerce * @license Commercial license - * @version release/2.1.0 + * + * @version develop */ namespace Stripe_officialClasslib\Actions; -use \Translate; +use Translate; /** * DefaultActions @@ -33,21 +34,22 @@ class DefaultActions { /** - * @var \ObjectModel $modelObject + * @var \ObjectModel */ protected $modelObject; /** * Values conveyored by the classes * - * @var array $conveyor + * @var array */ - protected $conveyor = array(); + protected $conveyor = []; /** * Set the modelObject * * @param \ObjectModel $modelObject + * * @return $this */ public function setModelObject($modelObject) @@ -61,6 +63,7 @@ public function setModelObject($modelObject) * Set the conveyor * * @param array $conveyorData + * * @return $this */ public function setConveyor($conveyorData) @@ -84,24 +87,28 @@ public function getConveyor() * Call next action call back of cross modules * * @param mixed $action Name of the actions chain + * * @return bool */ protected function forward($action) { - if (!is_callable(array($this, $action), false)) { - echo $action.' not defined'; + if (!is_callable([$this, $action], false)) { + echo $action . ' not defined'; exit; } - if (!call_user_func_array(array($this, $action), array())) { + if (!call_user_func_array([$this, $action], [])) { return false; } + return true; } /** * Translation function; needed so PS will properly parse the file + * * @param string $string the string to translate * @param string $source the file with the translation; should always be the current file + * * @return mixed|string */ protected function l($string, $source) diff --git a/vendor/totpsclasslib/src/Database/Action/ActionFactory.php b/vendor/totpsclasslib/src/Database/Action/ActionFactory.php new file mode 100644 index 0000000..4fd492c --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Action/ActionFactory.php @@ -0,0 +1,54 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Action; + +use Stripe_officialClasslib\Database\Action\ActionInterface; +use Stripe_officialClasslib\Database\Action\ActionType; +use Stripe_officialClasslib\Database\Action\InstallAction; +use Stripe_officialClasslib\Database\Action\UninstallAction; +use PrestaShopException; + +class ActionFactory +{ + /** + * @param string $actionType + * + * @return ActionInterface + * + * @throws PrestaShopException + */ + public function getAction(string $actionType) + { + switch ($actionType) { + case ActionType::INSTALL: + return new InstallAction(); + case ActionType::UNINSTALL: + return new UninstallAction(); + default: + throw new PrestaShopException('Database not found action'); + } + } +} diff --git a/vendor/totpsclasslib/src/Database/Action/ActionInterface.php b/vendor/totpsclasslib/src/Database/Action/ActionInterface.php new file mode 100644 index 0000000..becdb45 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Action/ActionInterface.php @@ -0,0 +1,38 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Action; + +use Stripe_officialClasslib\Database\Definition\ObjectModel\ObjectModelDefinition; + +interface ActionInterface +{ + /** + * @param ObjectModelDefinition $objectModelDefinition + * + * @return bool + */ + public function performAction(ObjectModelDefinition $objectModelDefinition); +} diff --git a/vendor/totpsclasslib/src/Database/Action/ActionType.php b/vendor/totpsclasslib/src/Database/Action/ActionType.php new file mode 100644 index 0000000..8759d03 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Action/ActionType.php @@ -0,0 +1,33 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Action; + +class ActionType +{ + const INSTALL = 'INSTALL'; + + const UNINSTALL = 'UNINSTALL'; +} diff --git a/vendor/totpsclasslib/src/Database/Action/InstallAction.php b/vendor/totpsclasslib/src/Database/Action/InstallAction.php new file mode 100644 index 0000000..b398120 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Action/InstallAction.php @@ -0,0 +1,87 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Action; + +use Stripe_officialClasslib\Database\Action\Table\TableActionFactory; +use Stripe_officialClasslib\Database\Action\Table\TableActionType; +use Stripe_officialClasslib\Database\Definition\ObjectModel\ObjectModelDefinition; +use Stripe_officialClasslib\Database\Definition\Schema\SchemaDefinition; +use Stripe_officialClasslib\Database\Definition\Table\TableDefinition; +use Stripe_officialClasslib\Database\Repository\ActionRepository; +use Stripe_officialClasslib\Registry; + +class InstallAction implements ActionInterface +{ + /** + * @var ActionRepository + */ + protected $actionRepository; + + /** + * @var TableActionFactory + */ + protected $tableActionFactory; + + public function __construct() + { + $this->actionRepository = new ActionRepository(); + $this->tableActionFactory = new TableActionFactory(); + } + + /** + * @param ObjectModelDefinition $objectModelDefinition + * + * @return bool + * + * @throws \PrestaShopException + */ + public function performAction(ObjectModelDefinition $objectModelDefinition) + { + $schemaDefinition = new SchemaDefinition($objectModelDefinition); + $schemaDefinition->buildTableDefinitions(); + + $tableDefinitions = $schemaDefinition->getTableDefinitions(); + foreach ($tableDefinitions as $tableDefinition) { + if (!$this->actionRepository->isTableExist($tableDefinition->getName())) { + $this->tableActionFactory->getTableAction(TableActionType::CREATE)->handle($tableDefinition); + } + $this->tableActionFactory->getTableAction(TableActionType::UPDATE)->handle($tableDefinition); + $this->addTableToRegistry($tableDefinition); + } + + return true; + } + + protected function addTableToRegistry(TableDefinition $tableDefinition) + { + $tables = Registry::get('tables'); + if (empty($tables)) { + $tables = []; + } + + Registry::set('tables', array_merge($tables, [$tableDefinition])); + } +} diff --git a/vendor/totpsclasslib/src/Database/Action/Table/AbstractTableAction.php b/vendor/totpsclasslib/src/Database/Action/Table/AbstractTableAction.php new file mode 100644 index 0000000..c5ccce4 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Action/Table/AbstractTableAction.php @@ -0,0 +1,38 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Action\Table; + +use Stripe_officialClasslib\Database\Definition\Table\TableDefinition; + +abstract class AbstractTableAction +{ + /** + * @param TableDefinition $tableDefinition + * + * @return bool + */ + abstract public function handle(TableDefinition $tableDefinition); +} diff --git a/vendor/totpsclasslib/src/Database/Action/Table/CreateTableAction.php b/vendor/totpsclasslib/src/Database/Action/Table/CreateTableAction.php new file mode 100644 index 0000000..c0e7a25 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Action/Table/CreateTableAction.php @@ -0,0 +1,113 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Action\Table; + +use Stripe_officialClasslib\Database\Definition\Field\FieldDefinition; +use Stripe_officialClasslib\Database\Definition\Table\TableDefinition; +use Db; + +class CreateTableAction extends AbstractTableAction +{ + /** + * @param TableDefinition $tableDefinition + * + * @return bool + */ + public function handle(TableDefinition $tableDefinition) + { + $result = true; + + $result &= $this->installTable($tableDefinition); + $result &= $this->createPrimaryKey($tableDefinition); + + return $result; + } + + protected function installTable(TableDefinition $tableDefinition) + { + $columns = array_map(function (FieldDefinition $fieldDefinition) { + return $fieldDefinition->getColumn(); + }, $tableDefinition->getFields()); + + return Db::getInstance()->execute("CREATE TABLE IF NOT EXISTS `{$tableDefinition->getName()}` (" . + implode(', ', array_merge($columns, $this->getPrimaryKeySql($tableDefinition))) . + ") ENGINE={$tableDefinition->getEngine()} CHARSET={$tableDefinition->getCharset()} COLLATE={$tableDefinition->getCollation()};"); + } + + protected function createPrimaryKey(TableDefinition $tableDefinition) + { + if (count($tableDefinition->getPrimaryKey()) == 1) { + return true; + } + + if ($this->hasPrimaryKey($tableDefinition)) { + $this->dropPrimaryKey($tableDefinition); + } + + return $this->addPrimaryKey($tableDefinition); + } + + protected function hasPrimaryKey(TableDefinition $tableDefinition) + { + $hasKey = Db::getInstance()->getValue( + "SELECT EXISTS( + SELECT * + FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_NAME='" . $tableDefinition->getName() . "' + AND TABLE_SCHEMA = '" . _DB_NAME_ . "' + AND COLUMN_KEY = 'PRI' + );", false); + + return !empty($hasKey); + } + + protected function dropPrimaryKey(TableDefinition $tableDefinition) + { + return Db::getInstance()->execute( + "ALTER TABLE {$tableDefinition->getName()} + DROP PRIMARY KEY; + ", false); + } + + protected function addPrimaryKey(TableDefinition $tableDefinition) + { + $pkName = 'PK_' . strtoupper($tableDefinition->getName()); + $pkFields = implode(', ', $tableDefinition->getPrimaryKey()); + + return Db::getInstance()->execute( + "ALTER TABLE {$tableDefinition->getName()} + ADD CONSTRAINT $pkName PRIMARY KEY ($pkFields)", false); + } + + protected function getPrimaryKeySql(TableDefinition $tableDefinition) + { + if (count($tableDefinition->getPrimaryKey()) > 1) { + return []; + } + + return ["PRIMARY KEY ({$tableDefinition->getPrimaryKey()[0]})"]; + } +} diff --git a/vendor/totpsclasslib/src/Database/Action/Table/DeleteTableAction.php b/vendor/totpsclasslib/src/Database/Action/Table/DeleteTableAction.php new file mode 100644 index 0000000..97927dc --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Action/Table/DeleteTableAction.php @@ -0,0 +1,42 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Action\Table; + +use Stripe_officialClasslib\Database\Definition\Table\TableDefinition; +use Db; + +class DeleteTableAction extends AbstractTableAction +{ + /** + * @param TableDefinition $tableDefinition + * + * @return bool + */ + public function handle(TableDefinition $tableDefinition) + { + return Db::getInstance()->execute("DROP TABLE IF EXISTS `{$tableDefinition->getName()}`;"); + } +} diff --git a/vendor/totpsclasslib/src/Database/Action/Table/TableActionFactory.php b/vendor/totpsclasslib/src/Database/Action/Table/TableActionFactory.php new file mode 100644 index 0000000..a3d1904 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Action/Table/TableActionFactory.php @@ -0,0 +1,57 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Action\Table; + +use Stripe_officialClasslib\Database\Action\Table\AbstractTableAction; +use Stripe_officialClasslib\Database\Action\Table\CreateTableAction; +use Stripe_officialClasslib\Database\Action\Table\DeleteTableAction; +use Stripe_officialClasslib\Database\Action\Table\TableActionType; +use Stripe_officialClasslib\Database\Action\Table\UpdateTableAction; +use PrestaShopException; + +class TableActionFactory +{ + /** + * @param $tableAction + * + * @return AbstractTableAction + * + * @throws PrestaShopException + */ + public function getTableAction($tableAction) + { + switch ($tableAction) { + case TableActionType::CREATE: + return new CreateTableAction(); + case TableActionType::UPDATE: + return new UpdateTableAction(); + case TableActionType::DELETE: + return new DeleteTableAction(); + default: + throw new PrestaShopException("Unknown table action $tableAction"); + } + } +} diff --git a/vendor/totpsclasslib/src/Database/Action/Table/TableActionType.php b/vendor/totpsclasslib/src/Database/Action/Table/TableActionType.php new file mode 100644 index 0000000..5c05498 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Action/Table/TableActionType.php @@ -0,0 +1,35 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Action\Table; + +class TableActionType +{ + const CREATE = 'CREATE'; + + const DELETE = 'DELETE'; + + const UPDATE = 'UPDATE'; +} diff --git a/vendor/totpsclasslib/src/Database/Action/Table/UpdateTableAction.php b/vendor/totpsclasslib/src/Database/Action/Table/UpdateTableAction.php new file mode 100644 index 0000000..e34d4e0 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Action/Table/UpdateTableAction.php @@ -0,0 +1,120 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Action\Table; + +use Stripe_officialClasslib\Database\Definition\Field\FieldDefinition; +use Stripe_officialClasslib\Database\Definition\Table\TableDefinition; +use Stripe_officialClasslib\Database\Index\IndexHandler; +use Db; + +class UpdateTableAction extends AbstractTableAction +{ + /** + * @param TableDefinition $tableDefinition + * + * @return bool + */ + public function handle(TableDefinition $tableDefinition) + { + $result = true; + + $result &= $this->modifyColumns($tableDefinition); + $result &= $this->handleIndexes($tableDefinition); + + return $result; + } + + protected function modifyColumns(TableDefinition $tableDefinition) + { + $tableColumns = $this->getTableColumns($tableDefinition); + + $columns = array_map(function (FieldDefinition $fieldDefinition) { + return $fieldDefinition->getColumn(); + }, $tableDefinition->getFields()); + + foreach ($tableColumns as &$col) { + $col['modelDef'] = '`' . $col['Field'] . '` ' . strtoupper($col['Type']) . ' '; + if ('NO' === $col['Null']) { + $col['modelDef'] .= 'NOT NULL '; + } + if (false === empty($col['Extra'])) { + $col['modelDef'] .= strtoupper($col['Extra']); + } + } + + $alterToSkip = []; + $alterToExecute = []; + $alters = []; + + foreach ($columns as $key => $column) { + foreach ($tableColumns as $tableColumn) { + if (trim($column) === trim($tableColumn['modelDef'])) { + $alterToSkip[$key] = true; + } elseif (false !== strpos($column, '`' . $tableColumn['Field'] . '`')) { + $alterToExecute[$key] = 'MODIFY'; + $alters[$key] = "ALTER TABLE `{$tableDefinition->getName()}` MODIFY $column;"; + } + } + if (empty($alterToExecute[$key]) && empty($alterToSkip[$key])) { + $alterToExecute[$key]['action'] = 'ADD ' . $column; + $alters[$key] = "ALTER TABLE `{$tableDefinition->getName()}` ADD $column;"; + } + } + + $result = true; + foreach ($alters as $alter) { + $result &= Db::getInstance()->execute($alter, false); + } + + $tableDefinitionColumns = array_map(function (FieldDefinition $fieldDefinition) { + return $fieldDefinition->getName(); + }, $tableDefinition->getFields()); + + $currentTableColumns = array_column($tableColumns, 'Field'); + $columnsToDelete = array_diff($currentTableColumns, $tableDefinitionColumns); + + foreach ($columnsToDelete as $columnToDelete) { + Db::getInstance()->execute(" + ALTER TABLE `{$tableDefinition->getName()}` + DROP COLUMN {$columnToDelete};" + ); + } + + return $result; + } + + protected function handleIndexes(TableDefinition $tableDefinition) + { + $indexHandler = new IndexHandler($tableDefinition); + + return $indexHandler->handle(); + } + + protected function getTableColumns(TableDefinition $tableDefinition) + { + return Db::getInstance()->executeS("SHOW COLUMNS FROM `{$tableDefinition->getName()}`"); + } +} diff --git a/vendor/totpsclasslib/src/Database/Action/UninstallAction.php b/vendor/totpsclasslib/src/Database/Action/UninstallAction.php new file mode 100644 index 0000000..2c17c0b --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Action/UninstallAction.php @@ -0,0 +1,73 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Action; + +use Stripe_officialClasslib\Database\Action\Table\TableActionFactory; +use Stripe_officialClasslib\Database\Action\Table\TableActionType; +use Stripe_officialClasslib\Database\Definition\ObjectModel\ObjectModelDefinition; +use Stripe_officialClasslib\Database\Definition\Schema\SchemaDefinition; +use Stripe_officialClasslib\Database\Repository\ActionRepository; + +class UninstallAction implements ActionInterface +{ + /** + * @var ActionRepository + */ + protected $actionRepository; + + /** + * @var TableActionFactory + */ + protected $tableActionFactory; + + public function __construct() + { + $this->actionRepository = new ActionRepository(); + $this->tableActionFactory = new TableActionFactory(); + } + + /** + * @param ObjectModelDefinition $objectModelDefinition + * + * @return bool + * + * @throws \PrestaShopException + */ + public function performAction(ObjectModelDefinition $objectModelDefinition) + { + $schemaDefinition = new SchemaDefinition($objectModelDefinition); + $schemaDefinition->buildTableDefinitions(); + + $tableDefinitions = $schemaDefinition->filterTableByAction(TableActionType::DELETE); + foreach ($tableDefinitions as $tableDefinition) { + if ($this->actionRepository->isTableExist($tableDefinition->getName())) { + $this->tableActionFactory->getTableAction(TableActionType::DELETE)->handle($tableDefinition); + } + } + + return true; + } +} diff --git a/vendor/totpsclasslib/src/Database/DbObjectHandler.php b/vendor/totpsclasslib/src/Database/DbObjectHandler.php new file mode 100644 index 0000000..ec407d5 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/DbObjectHandler.php @@ -0,0 +1,31 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database; + +interface DbObjectHandler +{ + public function handle(); +} diff --git a/vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinition.php b/vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinition.php new file mode 100644 index 0000000..8e4881f --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinition.php @@ -0,0 +1,127 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Definition\Field; + +use Stripe_officialClasslib\Database\Definition\Field\FieldDefinitionColumnBuilder; + +class FieldDefinition +{ + /** + * @var string + */ + private $name; + + /** + * @var array + */ + private $definition; + + /** + * @var string + */ + private $column; + + /** + * @param string $name + * @param array $definition + */ + public function __construct(string $name, array $definition) + { + $this->name = $name; + $this->definition = $definition; + } + + /** + * @return string + */ + public function getName(): string + { + return $this->name; + } + + /** + * @param string $name + * + * @return FieldDefinition + */ + public function setName(string $name): FieldDefinition + { + $this->name = $name; + + return $this; + } + + /** + * @return array + */ + public function getDefinition(): array + { + return $this->definition; + } + + /** + * @param array $definition + * + * @return FieldDefinition + */ + public function setDefinition(array $definition): FieldDefinition + { + $this->definition = $definition; + + return $this; + } + + /** + * @return string + * + * @throws \PrestaShopException + */ + public function getColumn(): string + { + if (!empty($this->column)) { + return $this->column; + } + + $this->column = (new FieldDefinitionColumnBuilder())->buildFieldDefinition($this); + + return $this->column; + } + + public function isLangField() + { + return !empty($this->getDefinition()['lang']); + } + + public function isShopField() + { + return !empty($this->getDefinition()['shop']); + } + + public function isShopLangBoth() + { + return $this->isShopField() && $this->getDefinition()['shop'] == 'both'; + } +} diff --git a/vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinitionColumnBuilder.php b/vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinitionColumnBuilder.php new file mode 100644 index 0000000..6d7e75e --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinitionColumnBuilder.php @@ -0,0 +1,98 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Definition\Field; + +use ObjectModel; +use Tools; + +class FieldDefinitionColumnBuilder +{ + public function buildFieldDefinition(FieldDefinition $fieldDefinition) + { + $name = $fieldDefinition->getName(); + $constraints = $fieldDefinition->getDefinition(); + $column = "`$name` "; + if (empty($constraints['values'])) { + switch ($constraints['type']) { + case ObjectModel::TYPE_BOOL: + $column .= 'TINYINT(1) UNSIGNED'; + break; + case ObjectModel::TYPE_DATE: + $column .= 'DATETIME'; + break; + case ObjectModel::TYPE_FLOAT: + $column .= 'DECIMAL' . ( + isset($constraints['size'], $constraints['scale']) + ? "({$constraints['size']},{$constraints['scale']})" + : '' + ); + break; + case ObjectModel::TYPE_HTML: + $length = isset($constraints['size']) ? $constraints['size'] : null; + $length = isset($length['max']) ? $length['max'] : $length; + if ($length >= 65535) { + $column .= $length ? "TEXT($length)" : 'TEXT'; + } else { + $column .= 'MEDIUMTEXT'; + } + break; + case ObjectModel::TYPE_INT: + $column .= 'INT(10)' . ( + !empty($constraints['validate']) + && strpos(Tools::strtolower($constraints['validate']), 'unsigned') + ? ' UNSIGNED' + : ' SIGNED' + ); + break; + case ObjectModel::TYPE_STRING: + $length = isset($constraints['size']) ? $constraints['size'] : 255; + $length = isset($length['max']) ? $length['max'] : $length; + $column .= "VARCHAR($length)"; + break; + default: + throw new \PrestaShopException("Missing type constraint definition for field $name"); + } + } + + if (!empty($constraints['values'])) { + $column .= " ENUM('" . implode("','", $constraints['values']) . "')"; + } + + if (empty($constraints['allow_null']) || isset($constraints['default']) || !empty($constraints['required'])) { + $column .= ' NOT NULL'; + } + + if (isset($constraints['default'])) { + $column .= " DEFAULT '" . addslashes($constraints['default']) . "'"; + } + + if (!empty($constraints['primary'])) { + $column .= ' AUTO_INCREMENT'; + } + + return $column; + } +} diff --git a/vendor/totpsclasslib/src/Database/Definition/ObjectModel/ObjectModelDefinition.php b/vendor/totpsclasslib/src/Database/Definition/ObjectModel/ObjectModelDefinition.php new file mode 100644 index 0000000..d9c07e9 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Definition/ObjectModel/ObjectModelDefinition.php @@ -0,0 +1,441 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Definition\ObjectModel; + +use Stripe_officialClasslib\Database\Definition\Field\FieldDefinition; +use Stripe_officialClasslib\Database\ForeignKey\ForeignKey; +use Stripe_officialClasslib\Database\Index\Index; + +class ObjectModelDefinition +{ + //region Fields + + /** + * @var string + */ + private $objectName; + + /** + * @var string + */ + private $table; + + /** + * @var array + */ + private $primary; + + /** + * @var bool + */ + private $multilang = false; + + /** + * @var bool + */ + private $multilangShop = false; + + /** + * @var bool + */ + private $multishop = false; + + /** + * @var FieldDefinition[] + */ + private $fields = []; + + /** + * @var array + */ + private $associations = []; + + /** + * @var Index[] + */ + private $indexes = []; + + /** + * @var string + */ + private $charset = 'utf8'; + + /** + * @var string + */ + private $collation = 'utf8_general_ci'; + + /** + * @var string + */ + private $engine = _MYSQL_ENGINE_; + + /** + * @var string + */ + private $dbPrefix = _DB_PREFIX_; + + //endregion + + //region Getters/Setters + + /** + * @param string $objectName + */ + public function __construct(string $objectName) + { + $this->objectName = $objectName; + } + + /** + * @return string + */ + public function getObjectName() + { + return $this->objectName; + } + + /** + * @param string $objectName + * + * @return ObjectModelDefinition + */ + public function setObjectName($objectName) + { + $this->objectName = $objectName; + + return $this; + } + + /** + * @return string + */ + public function getTable(): string + { + return $this->table; + } + + /** + * @param string $table + * + * @return ObjectModelDefinition + */ + public function setTable(string $table): ObjectModelDefinition + { + $this->table = $table; + + return $this; + } + + /** + * @return array + */ + public function getPrimary(): array + { + return $this->primary; + } + + /** + * @param string $primary + * + * @return ObjectModelDefinition + */ + public function setPrimary(string $primary): ObjectModelDefinition + { + $this->primary = array_map(function ($primaryKey) { + return trim($primaryKey); + }, explode(',', $primary)); + + return $this; + } + + /** + * @return bool + */ + public function isMultilang(): bool + { + return $this->multilang; + } + + /** + * @param bool $multilang + * + * @return ObjectModelDefinition + */ + public function setMultilang(bool $multilang): ObjectModelDefinition + { + $this->multilang = $multilang; + + return $this; + } + + /** + * @return bool + */ + public function isMultilangShop(): bool + { + return $this->multilangShop; + } + + /** + * @param bool $multilangShop + * + * @return ObjectModelDefinition + */ + public function setMultilangShop(bool $multilangShop): ObjectModelDefinition + { + $this->multilangShop = $multilangShop; + + return $this; + } + + /** + * @return bool + */ + public function isMultishop(): bool + { + return $this->multishop; + } + + /** + * @param bool $multishop + * + * @return ObjectModelDefinition + */ + public function setMultishop(bool $multishop): ObjectModelDefinition + { + $this->multishop = $multishop; + + return $this; + } + + /** + * @return array + */ + public function getFields(): array + { + return $this->fields; + } + + /** + * @param array $fields + * + * @return ObjectModelDefinition + */ + public function setFields(array $fields): ObjectModelDefinition + { + $this->fields = $fields; + + return $this; + } + + /** + * @return array + */ + public function getAssociations(): array + { + return $this->associations; + } + + /** + * @param array $associations + * + * @return ObjectModelDefinition + */ + public function setAssociations(array $associations): ObjectModelDefinition + { + $this->associations = $associations; + + return $this; + } + + /** + * @return Index[] + */ + public function getIndexes(): array + { + return $this->indexes; + } + + /** + * @param Index[] $indexes + * + * @return ObjectModelDefinition + */ + public function setIndexes(array $indexes): ObjectModelDefinition + { + $this->indexes = $indexes; + + return $this; + } + + /** + * @return string + */ + public function getCharset(): string + { + return $this->charset; + } + + /** + * @param string $charset + * + * @return ObjectModelDefinition + */ + public function setCharset(string $charset): ObjectModelDefinition + { + $this->charset = $charset; + + return $this; + } + + /** + * @return string + */ + public function getCollation(): string + { + return $this->collation; + } + + /** + * @param string $collation + * + * @return ObjectModelDefinition + */ + public function setCollation(string $collation): ObjectModelDefinition + { + $this->collation = $collation; + + return $this; + } + + /** + * @return string + */ + public function getEngine() + { + return $this->engine; + } + + /** + * @param string $engine + * + * @return ObjectModelDefinition + */ + public function setEngine($engine) + { + $this->engine = $engine; + + return $this; + } + + /** + * @return string + */ + public function getDbPrefix() + { + return $this->dbPrefix; + } + + /** + * @param string $dbPrefix + * + * @return ObjectModelDefinition + */ + public function setDbPrefix($dbPrefix) + { + $this->dbPrefix = $dbPrefix; + + return $this; + } + + //endregion + + /** + * @param array $definition + * + * @return $this + * + * @throws \PrestaShopException + */ + public function build($definition) + { + $this->setTable($definition['table']) + ->setPrimary($definition['primary']); + + if (isset($definition['charset'])) { + $this->setCharset($definition['charset']); + } + + if (isset($definition['collation'])) { + $this->setCollation($definition['collation']); + } + + if (isset($definition['engine'])) { + $this->setEngine($definition['engine']); + } + + if (isset($definition['multilang'])) { + $this->setMultilang($definition['multilang']); + } + + if (isset($definition['multishop'])) { + $this->setMultishop($definition['multishop']); + } + + if (isset($definition['multilang_shop'])) { + $this->setMultilangShop($definition['multilang_shop']); + } + + if (isset($definition['indexes'])) { + $indexes = []; + foreach ($definition['indexes'] as $index) { + $indexes[] = Index::build($index, $this->dbPrefix . $definition['table']); + } + $this->setIndexes($indexes); + } + + if (isset($definition['fields'])) { + $fields = []; + foreach ($definition['fields'] as $field => $description) { + $fieldDefinition = new FieldDefinition($field, $description); + $fields[] = $fieldDefinition; + } + $this->setFields($fields); + } + + if (isset($definition['associations'])) { + $associations = []; + foreach ($definition['associations'] as $name => $association) { + $foreignKey = (new ForeignKey())->build($this->getDbPrefix() . $definition['table'], $association); + $associations[] = $foreignKey; + } + $this->setAssociations($associations); + } + + return $this; + } +} diff --git a/vendor/totpsclasslib/src/Database/Definition/Schema/SchemaDefinition.php b/vendor/totpsclasslib/src/Database/Definition/Schema/SchemaDefinition.php new file mode 100644 index 0000000..9338746 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Definition/Schema/SchemaDefinition.php @@ -0,0 +1,94 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Definition\Schema; + +use Stripe_officialClasslib\Database\Action\Table\TableActionType; +use Stripe_officialClasslib\Database\Definition\ObjectModel\ObjectModelDefinition; +use Stripe_officialClasslib\Database\Definition\Table\TableDefinition; +use Stripe_officialClasslib\Database\Definition\Table\TableDefinitionFactory; +use Stripe_officialClasslib\Database\Definition\Table\TableType; + +class SchemaDefinition +{ + /** + * @var ObjectModelDefinition + */ + private $objectModelDefinition; + + /** + * @var TableDefinition[] + */ + private $tableDefinitions = []; + + /** + * @param ObjectModelDefinition $objectModelDefinition + */ + public function __construct(ObjectModelDefinition $objectModelDefinition) + { + $this->objectModelDefinition = $objectModelDefinition; + } + + public function buildTableDefinitions() + { + $tableDefinitionFactory = new TableDefinitionFactory($this->objectModelDefinition); + $this->tableDefinitions[] = ($tableDefinitionFactory->getTableDefinitionBuilder(TableType::MAIN))->build(); + + if ($this->objectModelDefinition->isMultilang() || $this->objectModelDefinition->isMultilangShop()) { + $this->tableDefinitions[] = ($tableDefinitionFactory->getTableDefinitionBuilder(TableType::LANG))->build(); + } + + if ($this->objectModelDefinition->isMultishop()) { + $this->tableDefinitions[] = ($tableDefinitionFactory->getTableDefinitionBuilder(TableType::SHOP))->build(); + } + + return $this; + } + + /** + * @return array + */ + public function getTableDefinitions() + { + return $this->tableDefinitions; + } + + public function filterTableByAction($actionType) + { + if ($actionType != TableActionType::DELETE) { + return $this->getTableDefinitions(); + } + + $langShopsTables = array_filter($this->getTableDefinitions(), function (TableDefinition $tableDefinition) { + return $tableDefinition->getAlias() != 'm'; + }); + + $mainTables = array_filter($this->getTableDefinitions(), function (TableDefinition $tableDefinition) { + return $tableDefinition->getAlias() == 'm'; + }); + + return array_merge($langShopsTables, $mainTables); + } +} diff --git a/vendor/totpsclasslib/src/Database/Definition/Table/AbstractTableDefinitionBuilder.php b/vendor/totpsclasslib/src/Database/Definition/Table/AbstractTableDefinitionBuilder.php new file mode 100644 index 0000000..040e434 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Definition/Table/AbstractTableDefinitionBuilder.php @@ -0,0 +1,76 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Definition\Table; + +use Stripe_officialClasslib\Database\Definition\ObjectModel\ObjectModelDefinition; + +abstract class AbstractTableDefinitionBuilder +{ + /** + * @var ObjectModelDefinition + */ + protected $objectModelDefinition; + + /** + * @param ObjectModelDefinition $objectModelDefinition + */ + public function __construct(ObjectModelDefinition $objectModelDefinition) + { + $this->objectModelDefinition = $objectModelDefinition; + } + + /** + * @return TableDefinition + */ + public function build() + { + $tableDefinition = new TableDefinition(); + + $this->buildCommonFields($tableDefinition) + ->buildSpecificFields($tableDefinition); + + return $tableDefinition; + } + + protected function buildCommonFields(TableDefinition $tableDefinition) + { + $tableDefinition->setCharset($this->objectModelDefinition->getCharset()) + ->setCollation($this->objectModelDefinition->getCollation()) + ->setEngine($this->objectModelDefinition->getEngine()) + ->setFields($this->getColumns()); + + return $this; + } + + /** + * @param TableDefinition $tableDefinition + * + * @return AbstractTableDefinitionBuilder + */ + abstract protected function buildSpecificFields(TableDefinition $tableDefinition); + + abstract protected function getColumns(); +} diff --git a/vendor/totpsclasslib/src/Database/Definition/Table/LangTableDefinitionBuilder.php b/vendor/totpsclasslib/src/Database/Definition/Table/LangTableDefinitionBuilder.php new file mode 100644 index 0000000..74d622b --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Definition/Table/LangTableDefinitionBuilder.php @@ -0,0 +1,122 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Definition\Table; + +use Stripe_officialClasslib\Database\Definition\Field\FieldDefinition; +use Stripe_officialClasslib\Database\ForeignKey\ForeignKey; +use Language; +use ObjectModel; +use Shop; + +class LangTableDefinitionBuilder extends AbstractTableDefinitionBuilder +{ + protected function getColumns() + { + $fields = []; + + foreach ($this->objectModelDefinition->getPrimary() as $primaryKey) { + $fields[] = new FieldDefinition($primaryKey, [ + 'type' => ObjectModel::TYPE_INT, + 'validate' => 'isUnsignedId', + 'required' => true, + ]); + } + + $fields[] = new FieldDefinition('id_lang', [ + 'type' => ObjectModel::TYPE_INT, + 'validate' => 'isInt', + 'required' => true, + ]); + + if ($this->objectModelDefinition->isMultilangShop()) { + $fields[] = new FieldDefinition('id_shop', [ + 'type' => ObjectModel::TYPE_INT, + 'validate' => 'isInt', + 'required' => true, + ]); + } + + $fieldsDefinitions = array_filter($this->objectModelDefinition->getFields(), function (FieldDefinition $fieldDefinition) { + return !empty($fieldDefinition->getDefinition()['lang']); + }); + + return array_merge($fields, $fieldsDefinitions); + } + + /** + * @param TableDefinition $tableDefinition + * + * @return AbstractTableDefinitionBuilder + */ + protected function buildSpecificFields(TableDefinition $tableDefinition) + { + $primaryKey = array_merge( + $this->objectModelDefinition->getPrimary(), + ['id_lang'] + ); + if ($this->objectModelDefinition->isMultilangShop()) { + $primaryKey[] = 'id_shop'; + } + $tableDefinition->setName($this->objectModelDefinition->getDbPrefix() . $this->objectModelDefinition->getTable() . '_lang') + ->setAlias('l') + ->setPrimaryKey($primaryKey) + ->setForeignKeys($this->getForeignKeys()); + + return $this; + } + + protected function getForeignKeys() + { + $foreignKeys = []; + + foreach ($this->objectModelDefinition->getPrimary() as $mainPrimaryKey) { + $foreignKeys[] = (new ForeignKey())->build($this->objectModelDefinition->getDbPrefix() . $this->objectModelDefinition->getTable() . '_lang', [ + 'type' => ObjectModel::HAS_ONE, + 'object' => $this->objectModelDefinition->getObjectName(), + 'association' => $this->objectModelDefinition->getTable(), + 'field' => $mainPrimaryKey, + ]); + } + + $foreignKeys[] = (new ForeignKey())->build($this->objectModelDefinition->getDbPrefix() . $this->objectModelDefinition->getTable() . '_lang', [ + 'type' => ObjectModel::HAS_ONE, + 'object' => Language::class, + 'association' => Language::$definition['table'], + 'field' => 'id_lang', + ]); + + if ($this->objectModelDefinition->isMultilangShop()) { + $foreignKeys[] = (new ForeignKey())->build($this->objectModelDefinition->getDbPrefix() . $this->objectModelDefinition->getTable() . '_lang', [ + 'type' => ObjectModel::HAS_ONE, + 'object' => Shop::class, + 'association' => Shop::$definition['table'], + 'field' => 'id_shop', + ]); + } + + return $foreignKeys; + } +} diff --git a/vendor/totpsclasslib/src/Database/Definition/Table/MainTableDefinitionBuilder.php b/vendor/totpsclasslib/src/Database/Definition/Table/MainTableDefinitionBuilder.php new file mode 100644 index 0000000..01aefa3 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Definition/Table/MainTableDefinitionBuilder.php @@ -0,0 +1,82 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Definition\Table; + +use Stripe_officialClasslib\Database\Definition\Field\FieldDefinition; +use ObjectModel; + +class MainTableDefinitionBuilder extends AbstractTableDefinitionBuilder +{ + protected function getColumns() + { + $fields = []; + + if (count($this->objectModelDefinition->getPrimary()) == 1) { + $fields[] = new FieldDefinition($this->objectModelDefinition->getPrimary()[0], [ + 'type' => ObjectModel::TYPE_INT, + 'validate' => 'isUnsignedId', + 'required' => true, + 'primary' => true, + ]); + } else { + foreach ($this->objectModelDefinition->getPrimary() as $primaryKey) { + $keyFound = false; + foreach ($this->objectModelDefinition->getFields() as $fieldDefinition) { + if ($fieldDefinition->getName() == $primaryKey) { + $keyFound = true; + break; + } + } + if (!$keyFound) { + throw new \PrestaShopException(sprintf('Primary key %s not found in field definitions', $primaryKey)); + } + } + } + + $fieldsDefinitions = array_filter($this->objectModelDefinition->getFields(), function (FieldDefinition $fieldDefinition) { + return (empty($fieldDefinition->getDefinition()['lang']) && empty($fieldDefinition->getDefinition()['shop'])) + || (isset($fieldDefinition->getDefinition()['shop']) && $fieldDefinition->getDefinition()['shop'] == 'both'); + }); + + return array_merge($fields, $fieldsDefinitions); + } + + /** + * @param TableDefinition $tableDefinition + * + * @return AbstractTableDefinitionBuilder + */ + protected function buildSpecificFields(TableDefinition $tableDefinition) + { + $tableDefinition->setName($this->objectModelDefinition->getDbPrefix() . $this->objectModelDefinition->getTable()) + ->setAlias('m') + ->setIndexes($this->objectModelDefinition->getIndexes()) + ->setPrimaryKey($this->objectModelDefinition->getPrimary()) + ->setForeignKeys($this->objectModelDefinition->getAssociations()); + + return $this; + } +} diff --git a/vendor/totpsclasslib/src/Database/Definition/Table/ShopTableDefinitionBuilder.php b/vendor/totpsclasslib/src/Database/Definition/Table/ShopTableDefinitionBuilder.php new file mode 100644 index 0000000..c81cd53 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Definition/Table/ShopTableDefinitionBuilder.php @@ -0,0 +1,97 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Definition\Table; + +use Stripe_officialClasslib\Database\Definition\Field\FieldDefinition; +use Stripe_officialClasslib\Database\ForeignKey\ForeignKey; +use ObjectModel; +use Shop; + +class ShopTableDefinitionBuilder extends AbstractTableDefinitionBuilder +{ + protected function getColumns() + { + $fields = []; + + foreach ($this->objectModelDefinition->getPrimary() as $primaryKey) { + $fields[] = new FieldDefinition($primaryKey, [ + 'type' => ObjectModel::TYPE_INT, + 'validate' => 'isUnsignedId', + 'required' => true, + ]); + } + + $fields[] = new FieldDefinition('id_shop', [ + 'type' => ObjectModel::TYPE_INT, + 'validate' => 'isInt', + 'required' => true, + ]); + + $fieldsDefinitions = array_filter($this->objectModelDefinition->getFields(), function (FieldDefinition $fieldDefinition) { + return !empty($fieldDefinition->getDefinition()['shop']); + }); + + return array_merge($fields, $fieldsDefinitions); + } + + /** + * @param TableDefinition $tableDefinition + * + * @return AbstractTableDefinitionBuilder + */ + protected function buildSpecificFields(TableDefinition $tableDefinition) + { + $tableDefinition->setName($this->objectModelDefinition->getDbPrefix() . $this->objectModelDefinition->getTable() . '_shop') + ->setAlias('s') + ->setPrimaryKey(array_merge($this->objectModelDefinition->getPrimary(), ['id_shop'])) + ->setForeignKeys($this->getForeignKeys()); + + return $this; + } + + protected function getForeignKeys() + { + $foreignKeys = []; + + foreach ($this->objectModelDefinition->getPrimary() as $primaryMainKey) { + $foreignKeys[] = (new ForeignKey())->build($this->objectModelDefinition->getDbPrefix() . $this->objectModelDefinition->getTable() . '_shop', [ + 'type' => ObjectModel::HAS_ONE, + 'object' => $this->objectModelDefinition->getObjectName(), + 'association' => $this->objectModelDefinition->getTable(), + 'field' => $primaryMainKey, + ]); + } + + $foreignKeys[] = (new ForeignKey())->build($this->objectModelDefinition->getDbPrefix() . $this->objectModelDefinition->getTable() . '_shop', [ + 'type' => ObjectModel::HAS_ONE, + 'object' => Shop::class, + 'association' => Shop::$definition['table'], + 'field' => 'id_shop', + ]); + + return $foreignKeys; + } +} diff --git a/vendor/totpsclasslib/src/Database/Definition/Table/TableDefinition.php b/vendor/totpsclasslib/src/Database/Definition/Table/TableDefinition.php new file mode 100644 index 0000000..1edaa9a --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Definition/Table/TableDefinition.php @@ -0,0 +1,266 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Definition\Table; + +use Stripe_officialClasslib\Database\Definition\Field\FieldDefinition; +use Stripe_officialClasslib\Database\ForeignKey\ForeignKey; +use Stripe_officialClasslib\Database\Index\Index; + +class TableDefinition +{ + //region Fields + + /** + * @var string + */ + private $name; + + /** + * @var string + */ + private $alias; + + /** + * @var FieldDefinition[] + */ + private $fields; + + /** + * @var string + */ + private $engine; + + /** + * @var string + */ + private $charset; + + /** + * @var string + */ + private $collation; + + /** + * @var ForeignKey[] + */ + private $foreignKeys; + + /** + * @var array + */ + private $primaryKey; + + /** + * @var Index[] + */ + private $indexes = []; + + //endregion + + //region Getters/Setters + + /** + * @return string + */ + public function getName(): string + { + return $this->name; + } + + /** + * @param string $name + * + * @return TableDefinition + */ + public function setName(string $name): TableDefinition + { + $this->name = $name; + + return $this; + } + + /** + * @return FieldDefinition[] + */ + public function getFields(): array + { + return $this->fields; + } + + /** + * @param FieldDefinition[] $fields + * + * @return TableDefinition + */ + public function setFields(array $fields): TableDefinition + { + $this->fields = $fields; + + return $this; + } + + /** + * @return string + */ + public function getEngine(): string + { + return $this->engine; + } + + /** + * @param string $engine + * + * @return TableDefinition + */ + public function setEngine(string $engine): TableDefinition + { + $this->engine = $engine; + + return $this; + } + + /** + * @return string + */ + public function getCharset(): string + { + return $this->charset; + } + + /** + * @param string $charset + * + * @return TableDefinition + */ + public function setCharset(string $charset): TableDefinition + { + $this->charset = $charset; + + return $this; + } + + /** + * @return string + */ + public function getCollation(): string + { + return $this->collation; + } + + /** + * @param string $collation + * + * @return TableDefinition + */ + public function setCollation(string $collation): TableDefinition + { + $this->collation = $collation; + + return $this; + } + + /** + * @return ForeignKey[] + */ + public function getForeignKeys(): array + { + return $this->foreignKeys; + } + + /** + * @param ForeignKey[] $foreignKeys + * + * @return TableDefinition + */ + public function setForeignKeys(array $foreignKeys): TableDefinition + { + $this->foreignKeys = $foreignKeys; + + return $this; + } + + /** + * @return Index[] + */ + public function getIndexes(): array + { + return $this->indexes; + } + + /** + * @param Index[] $indexes + * + * @return TableDefinition + */ + public function setIndexes(array $indexes): TableDefinition + { + $this->indexes = $indexes; + + return $this; + } + + /** + * @return string + */ + public function getAlias(): string + { + return $this->alias; + } + + /** + * @param string $alias + * + * @return TableDefinition + */ + public function setAlias(string $alias): TableDefinition + { + $this->alias = $alias; + + return $this; + } + + /** + * @return string[] + */ + public function getPrimaryKey(): array + { + return $this->primaryKey; + } + + /** + * @param array $primaryKey + * + * @return TableDefinition + */ + public function setPrimaryKey(array $primaryKey): TableDefinition + { + $this->primaryKey = $primaryKey; + + return $this; + } + + //endregion +} diff --git a/vendor/totpsclasslib/src/Database/Definition/Table/TableDefinitionFactory.php b/vendor/totpsclasslib/src/Database/Definition/Table/TableDefinitionFactory.php new file mode 100644 index 0000000..1bfd12d --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Definition/Table/TableDefinitionFactory.php @@ -0,0 +1,70 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Definition\Table; + +use Stripe_officialClasslib\Database\Definition\ObjectModel\ObjectModelDefinition; +use Stripe_officialClasslib\Database\Definition\Table\AbstractTableDefinitionBuilder; +use Stripe_officialClasslib\Database\Definition\Table\LangTableDefinitionBuilder; +use Stripe_officialClasslib\Database\Definition\Table\MainTableDefinitionBuilder; +use Stripe_officialClasslib\Database\Definition\Table\ShopTableDefinitionBuilder; +use PrestaShopException; + +class TableDefinitionFactory +{ + /** + * @var ObjectModelDefinition + */ + protected $objectModelDefinition; + + /** + * @param ObjectModelDefinition $objectModelDefinition + */ + public function __construct(ObjectModelDefinition $objectModelDefinition) + { + $this->objectModelDefinition = $objectModelDefinition; + } + + /** + * @param $type + * + * @return AbstractTableDefinitionBuilder + * + * @throws PrestaShopException + */ + public function getTableDefinitionBuilder($type) + { + switch ($type) { + case TableType::MAIN: + return new MainTableDefinitionBuilder($this->objectModelDefinition); + case TableType::LANG: + return new LangTableDefinitionBuilder($this->objectModelDefinition); + case TableType::SHOP: + return new ShopTableDefinitionBuilder($this->objectModelDefinition); + default: + throw new PrestaShopException('Table builder not found'); + } + } +} diff --git a/vendor/totpsclasslib/src/Database/Definition/Table/TableType.php b/vendor/totpsclasslib/src/Database/Definition/Table/TableType.php new file mode 100644 index 0000000..2e77e0e --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Definition/Table/TableType.php @@ -0,0 +1,35 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Definition\Table; + +class TableType +{ + const MAIN = 'MAIN'; + + const LANG = 'LANG'; + + const SHOP = 'SHOP'; +} diff --git a/vendor/totpsclasslib/src/Database/ForeignKey/ForeignKey.php b/vendor/totpsclasslib/src/Database/ForeignKey/ForeignKey.php new file mode 100644 index 0000000..2368621 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/ForeignKey/ForeignKey.php @@ -0,0 +1,249 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\ForeignKey; + +use Stripe_officialClasslib\Database\ForeignKey\ReferenceOption; +use ObjectModel; +use PrestaShopException; + +class ForeignKey +{ + //region Fields + + private $table; + + private $type = ObjectModel::HAS_MANY; + + private $association; + + private $object; + + private $field; + + private $onUpdate = ReferenceOption::CASCADE; + + private $onDelete = ReferenceOption::CASCADE; + + //endregion + + //region Get-Set + + /** + * @return mixed + */ + public function getTable() + { + return $this->table; + } + + /** + * @param mixed $table + * + * @return ForeignKey + */ + public function setTable($table) + { + $this->table = $table; + + return $this; + } + + /** + * @return int + */ + public function getType(): int + { + return $this->type; + } + + /** + * @param int $type + * + * @return ForeignKey + */ + public function setType(int $type): ForeignKey + { + $this->type = $type; + + return $this; + } + + /** + * @return mixed + */ + public function getObject() + { + return $this->object; + } + + /** + * @param mixed $object + * + * @return ForeignKey + */ + public function setObject($object) + { + $this->object = $object; + + return $this; + } + + /** + * @return mixed + */ + public function getAssociation() + { + return $this->association; + } + + /** + * @param mixed $association + * + * @return ForeignKey + */ + public function setAssociation($association) + { + $this->association = $association; + + return $this; + } + + /** + * @return mixed + */ + public function getField() + { + return $this->field; + } + + /** + * @param mixed $field + * + * @return ForeignKey + */ + public function setField($field) + { + $this->field = $field; + + return $this; + } + + /** + * @return string + */ + public function getOnUpdate(): string + { + return $this->onUpdate; + } + + /** + * @param string $onUpdate + * + * @return ForeignKey + */ + public function setOnUpdate(string $onUpdate): ForeignKey + { + $this->onUpdate = $onUpdate; + + return $this; + } + + /** + * @return string + */ + public function getOnDelete(): string + { + return $this->onDelete; + } + + /** + * @param string $onDelete + * + * @return ForeignKey + */ + public function setOnDelete(string $onDelete): ForeignKey + { + $this->onDelete = $onDelete; + + return $this; + } + + //endregion + + public function getForeignKey() + { + $object = $this->getObject(); + $objectTable = _DB_PREFIX_ . $object::$definition['table']; + + return " + ALTER TABLE {$this->getTable()} + ADD FOREIGN KEY ({$this->getField()}) + REFERENCES {$objectTable} ({$object::$definition['primary']}) + ON DELETE {$this->getOnDelete()} + ON UPDATE {$this->getOnUpdate()} + "; + } + + /** + * @return ForeignKey + * + * @throws PrestaShopException + */ + public function build($table, $association) + { + $this->setTable($table); + + if ($association['association']) { + $this->setAssociation($association['association']); + } + + if (isset($association['type'])) { + $this->setType($association['type']); + } + + if (isset($association['object'])) { + $this->setObject($association['object']); + } else { + throw new PrestaShopException('Association should have an associated object'); + } + + if (isset($association['field'])) { + $this->setField($association['field']); + } else { + throw new PrestaShopException('Association should have an associated field'); + } + + if (isset($association['on_delete'])) { + $this->setOnDelete($association['on_delete']); + } + + if (isset($association['on_update'])) { + $this->setOnUpdate($association['on_update']); + } + + return $this; + } +} diff --git a/vendor/totpsclasslib/src/Database/ForeignKey/ForeignKeyHandler.php b/vendor/totpsclasslib/src/Database/ForeignKey/ForeignKeyHandler.php new file mode 100644 index 0000000..ef29702 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/ForeignKey/ForeignKeyHandler.php @@ -0,0 +1,112 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\ForeignKey; + +use Stripe_officialClasslib\Database\DbObjectHandler; +use Stripe_officialClasslib\Database\Definition\Table\TableDefinition; +use Db; +use PrestaShopLogger; + +class ForeignKeyHandler implements DbObjectHandler +{ + /** + * @var TableDefinition + */ + protected $tableDefinition; + + /** + * @param TableDefinition $tableDefinition + */ + public function __construct(TableDefinition $tableDefinition) + { + $this->tableDefinition = $tableDefinition; + } + + /** + * @return bool + */ + public function handle() + { + if (empty($this->tableDefinition->getForeignKeys())) { + return true; + } + + $keys = $this->getKeys(); + + $keyNames = array_column($keys, 'CONSTRAINT_NAME'); + $keyNames = array_unique($keyNames); + + foreach ($keyNames as $key) { + $this->dropKey($key); + } + + foreach ($this->tableDefinition->getForeignKeys() as $foreignKey) { + $foreignKeySql = $foreignKey->getForeignKey(); + if (empty($foreignKeySql)) { + continue; + } + + try { + Db::getInstance()->execute($foreignKeySql); + } catch (\Exception $e) { + PrestaShopLogger::addLog( + 'Add foreign key : ' . $e->getMessage(), + 3, + null, + self::class + ); + } + } + + return true; + } + + protected function getKeys() + { + return Db::getInstance()->executeS(" + SELECT CONSTRAINT_NAME + FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE + WHERE REFERENCED_TABLE_SCHEMA = '" . _DB_NAME_ . "' + AND TABLE_NAME = '" . $this->tableDefinition->getName() . "'; + "); + } + + protected function dropKey($key) + { + try { + Db::getInstance()->execute(" + ALTER TABLE `{$this->tableDefinition->getName()}` DROP FOREIGN KEY `$key`;" + ); + } catch (\Exception $e) { + PrestaShopLogger::addLog( + "Drop foreign key : `$key` " . $e->getMessage(), + 3, + null, + self::class + ); + } + } +} diff --git a/vendor/totpsclasslib/src/Database/ForeignKey/ReferenceOption.php b/vendor/totpsclasslib/src/Database/ForeignKey/ReferenceOption.php new file mode 100644 index 0000000..1b1bc33 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/ForeignKey/ReferenceOption.php @@ -0,0 +1,39 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\ForeignKey; + +class ReferenceOption +{ + const RESTRICT = 'RESTRICT'; + + const CASCADE = 'CASCADE'; + + const SET_NULL = 'SET NULL'; + + const NO_ACTION = 'NO ACTION'; + + const SET_DEFAULT = 'SET DEFAULT'; +} diff --git a/vendor/totpsclasslib/src/Database/Index/Index.php b/vendor/totpsclasslib/src/Database/Index/Index.php new file mode 100644 index 0000000..aa842d5 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Index/Index.php @@ -0,0 +1,193 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Index; + +use Stripe_officialClasslib\Database\Index\IndexField; +use Stripe_officialClasslib\Database\Index\IndexType; + +class Index +{ + /** + * @var array + */ + private $fields = []; + + private $type = IndexType::STANDARD; + + private $name; + + private $options = ''; + + private $table; + + /** + * @return array + */ + public function getFields(): array + { + return $this->fields; + } + + /** + * @param array $fields + * + * @return Index + */ + public function setFields(array $fields): Index + { + $this->fields = $fields; + + return $this; + } + + /** + * @return string + */ + public function getType(): string + { + return $this->type; + } + + /** + * @param string $type + * + * @return Index + */ + public function setType(string $type): Index + { + $this->type = $type; + + return $this; + } + + /** + * @return mixed + */ + public function getName() + { + return $this->name; + } + + /** + * @param mixed $name + * + * @return Index + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getOptions(): string + { + return $this->options; + } + + /** + * @param string $options + * + * @return Index + */ + public function setOptions(string $options): Index + { + $this->options = $options; + + return $this; + } + + /** + * @return mixed + */ + public function getTable() + { + return $this->table; + } + + /** + * @param mixed $table + * + * @return Index + */ + public function setTable($table) + { + $this->table = $table; + + return $this; + } + + public function getIndex() + { + if (empty($this->getFields()) || empty($this->getTable())) { + return null; + } + + $type = $this->getType(); + $columns = implode(', ', array_map(function ($field) { + return $field->getColumn(); + }, $this->getFields())); + $name = $this->getName(); + if (empty($name)) { + $name = 'ix_' . preg_replace('/[^A-Za-z0-9\-_]/', '', $columns); + } + $options = $this->getOptions(); + $table = $this->getTable(); + + return "CREATE $type INDEX $name ON $table ($columns) $options"; + } + + public static function build($index, $table) + { + $indexObj = new Index(); + $indexObj->setTable($table); + + if (!empty($index['type'])) { + $indexObj->setType($index['type']); + } + + if (!empty($index['name'])) { + $indexObj->setName($index['name']); + } + + if (!empty($index['options'])) { + $indexObj->setOptions($index['options']); + } + + if (!empty($index['fields'])) { + $fields = []; + foreach ($index['fields'] as $field) { + $fields[] = (new IndexField())->setColumn($field['column']); + } + $indexObj->setFields($fields); + } + + return $indexObj; + } +} diff --git a/vendor/totpsclasslib/src/Database/Index/IndexField.php b/vendor/totpsclasslib/src/Database/Index/IndexField.php new file mode 100644 index 0000000..423582c --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Index/IndexField.php @@ -0,0 +1,51 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Index; + +class IndexField +{ + private $column; + + /** + * @return mixed + */ + public function getColumn() + { + return $this->column; + } + + /** + * @param mixed $column + * + * @return IndexField + */ + public function setColumn($column) + { + $this->column = $column; + + return $this; + } +} diff --git a/vendor/totpsclasslib/src/Database/Index/IndexHandler.php b/vendor/totpsclasslib/src/Database/Index/IndexHandler.php new file mode 100644 index 0000000..52239f4 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Index/IndexHandler.php @@ -0,0 +1,111 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Index; + +use Stripe_officialClasslib\Database\DbObjectHandler; +use Stripe_officialClasslib\Database\Definition\Table\TableDefinition; +use Db; +use PrestaShopLogger; + +class IndexHandler implements DbObjectHandler +{ + /** + * @var TableDefinition + */ + protected $tableDefinition; + + /** + * @param TableDefinition $tableDefinition + */ + public function __construct(TableDefinition $tableDefinition) + { + $this->tableDefinition = $tableDefinition; + } + + public function handle() + { + $keys = $this->getKeys(); + + $keyNames = array_column($keys, 'Key_name'); + $keyNames = array_unique($keyNames); + + foreach ($keyNames as $key) { + $this->dropKey($key); + } + + foreach ($this->tableDefinition->getIndexes() as $index) { + $indexSql = $index->getIndex(); + if (empty($indexSql)) { + continue; + } + + try { + Db::getInstance()->execute($indexSql); + } catch (\Exception $e) { + PrestaShopLogger::addLog( + 'Add index : ' . $e->getMessage(), + 3, + null, + IndexHandler::class + ); + } + } + + return true; + } + + protected function getKeys() + { + return Db::getInstance()->executeS(" + SHOW KEYS FROM `{$this->tableDefinition->getName()}` + WHERE Key_name <> 'PRIMARY'" + ); + } + + protected function dropKey($key) + { + try { + Db::getInstance()->execute(" + ALTER TABLE `{$this->tableDefinition->getName()}` DROP KEY `$key`;" + ); + } catch (\Exception $e) { + PrestaShopLogger::addLog( + 'Drop index : ' . $e->getMessage(), + 3, + null, + IndexHandler::class + ); + } + } + + /** + * @return TableDefinition + */ + public function getTableDefinition(): TableDefinition + { + return $this->tableDefinition; + } +} diff --git a/vendor/totpsclasslib/src/Database/Index/IndexType.php b/vendor/totpsclasslib/src/Database/Index/IndexType.php new file mode 100644 index 0000000..e358ad3 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Index/IndexType.php @@ -0,0 +1,37 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Index; + +class IndexType +{ + const STANDARD = ''; + + const UNIQUE = 'UNIQUE'; + + const FULLTEXT = 'FULLTEXT'; + + const SPATIAL = 'SPATIAL'; +} diff --git a/vendor/totpsclasslib/src/Database/ObjectModelExtension.php b/vendor/totpsclasslib/src/Database/ObjectModelExtension.php new file mode 100644 index 0000000..4ac5427 --- /dev/null +++ b/vendor/totpsclasslib/src/Database/ObjectModelExtension.php @@ -0,0 +1,79 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database; + +use Stripe_officialClasslib\Database\Action\ActionFactory; +use Stripe_officialClasslib\Database\Action\ActionType; +use Stripe_officialClasslib\Database\Definition\ObjectModel\ObjectModelDefinition; +use ObjectModel; + +class ObjectModelExtension +{ + /** + * @var ObjectModelDefinition + */ + private $objectModelDefinition; + + /** + * @var ActionFactory + */ + private $actionFactory; + + /** + * @param string $objectModel + * + * @throws \PrestaShopException + */ + public function __construct(string $objectModel) + { + $this->objectModelDefinition = (new ObjectModelDefinition($objectModel))->build($objectModel::$definition); + $this->actionFactory = new ActionFactory(); + } + + /** + * @return bool + * + * @throws \PrestaShopException + */ + public function install() + { + return $this->actionFactory + ->getAction(ActionType::INSTALL) + ->performAction($this->objectModelDefinition); + } + + /** + * @return bool + * + * @throws \PrestaShopException + */ + public function uninstall() + { + return $this->actionFactory + ->getAction(ActionType::UNINSTALL) + ->performAction($this->objectModelDefinition); + } +} diff --git a/vendor/totpsclasslib/src/Database/Repository/ActionRepository.php b/vendor/totpsclasslib/src/Database/Repository/ActionRepository.php new file mode 100644 index 0000000..eb4455c --- /dev/null +++ b/vendor/totpsclasslib/src/Database/Repository/ActionRepository.php @@ -0,0 +1,43 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version develop + */ + +namespace Stripe_officialClasslib\Database\Repository; + +use Db; + +class ActionRepository +{ + public function isTableExist(string $tableName) + { + $tableExist = Db::getInstance()->executeS("SHOW TABLES LIKE '$tableName'"); + + return !empty($tableExist); + } + + public function getTableColumns(string $tableName) + { + return Db::getInstance()->executeS("SHOW COLUMNS FROM `$tableName`"); + } +} diff --git a/vendor/totpsclasslib/src/Db/DbSchema.php b/vendor/totpsclasslib/src/Db/DbSchema.php deleted file mode 100644 index 8d2bc7c..0000000 --- a/vendor/totpsclasslib/src/Db/DbSchema.php +++ /dev/null @@ -1,74 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version release/2.1.0 - */ - -namespace Stripe_officialClasslib\Db; - -class DbSchema -{ - /** - * @var Stripe_officialClasslib\Db\ObjectModelDefinition - */ - protected $def; - - /** - * Table (internal) ID - * - * @var string - */ - protected $id; - - /** - * Register Stripe_officialClasslib\Db\ObjectModelDefinition and table (internal) ID - * @param Stripe_officialClasslib\Db\ObjectModelDefinition $def - * @param string $id - */ - public function __construct($def, $id) - { - $this->def = $def; - $this->id = $id; - } - - /** - * Map table properties - * @param Stripe_officialClasslib\Db\DbTable $table - * @return Stripe_officialClasslib\Db\DbTable - */ - public function map($table) - { - return $table - ->setName($this->def->getName($this->id)) - ->setEngine($this->def->getEngine($this->id)) - ->setCharset($this->def->getCharset($this->id)) - ->setCollation($this->def->getCollation($this->id)) - ->setColumns($this->def->getColumns($this->id)) - ->setKeyPrimary($this->def->getKeyPrimary($this->id)) - ->setKeysSimple($this->def->getKeysSimple($this->id)) - ->setKeysUnique($this->def->getKeysUnique($this->id)) - ->setKeysFulltext($this->def->getKeysFulltext($this->id)) - // @todo: fix foreign key with lang table not InnoDb - //->setKeysForeign($this->def->getKeysForeign($this->id)) - ; - } -} diff --git a/vendor/totpsclasslib/src/Db/DbTable.php b/vendor/totpsclasslib/src/Db/DbTable.php deleted file mode 100755 index dde53b2..0000000 --- a/vendor/totpsclasslib/src/Db/DbTable.php +++ /dev/null @@ -1,387 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version release/2.1.0 - */ - -namespace Stripe_officialClasslib\Db; - -use \Tools; - -class DbTable -{ - /** - * Key identifiers. - * - * @var int - */ - const PRIMARY = 1; - const FOREIGN = 2; - const UNIQUE = 3; - const FULLTEXT = 4; - - /** @var Db */ - protected $db; - /** @var string */ - protected $name; - /** @var string */ - protected $engine; - /** @var string */ - protected $charset; - /** @var string */ - protected $collation; - /** @var array */ - protected $columns; - /** @var array */ - protected $schema; - /** @var array */ - protected $keys; - - /** - * Register Db - * @param Db $db - */ - public function __construct($db) - { - $this->db = $db; - } - - /** - * Hydrate properties - * @param Stripe_officialClasslib\Db\DbSchema $schema - * @return Stripe_officialClasslib\Db\DbTable - */ - public function hydrate($schema) - { - $this->schema = $schema; - - return $schema->map($this); - } - - /** - * Create table - * @return bool - */ - public function create() - { - $tableExists = $this->db->executeS("SHOW TABLES LIKE '$this->name'"); - if ($tableExists == false) { - $keys = array(); - foreach ($this->keys as $modelDef) { - if (strpos($modelDef, 'FOREIGN KEY') === 0) { - continue; - } - $keys[] = $modelDef; - } - $result = $this->db->execute("CREATE TABLE IF NOT EXISTS `$this->name` (". - implode(', ', array_merge($this->columns, $keys)). - ") ENGINE=$this->engine CHARSET=$this->charset;"); - if ($result == true) { - $this->alterKeys(); - } - return $result; - } - // table exists - $alter = $this->alterFields(); - - if (!empty($alter)) { - return $this->db->execute($alter); - } - $this->alterKeys(); - - return true; - } - - /** - * Alter table fields - * @return string - */ - private function alterFields() - { - $describe = $this->db->executeS("SHOW COLUMNS FROM `$this->name`"); - - foreach ($describe as $key => $col) { - $describe[$key]['modelDef'] = '`'.$col['Field'].'` '.Tools::strtoupper($col['Type']).' '; - if ('NO' === $col['Null']) { - $describe[$key]['modelDef'] .= 'NOT NULL '; - } - if (false === empty($col['Extra'])) { - $describe[$key]['modelDef'] .= Tools::strtoupper($col['Extra']); - } - } - - $alterToSkip = array(); - $alterToExecute = array(); - $alters = array(); - foreach ($this->columns as $key => $column) { - foreach ($describe as $col) { - if (trim($column) === trim($col['modelDef'])) { - $alterToSkip[$key] = true; - } elseif (false !== strpos($column, '`' . $col['Field'] . '`')) { - $alterToExecute[$key] = 'MODIFY'; - $alters[$key] = "ALTER TABLE `$this->name` MODIFY $column;"; - } - } - if (empty($alterToExecute[$key]) && empty($alterToSkip[$key])) { - $alterToExecute[$key]['action'] = 'ADD '.$column; - $alters[$key] = "ALTER TABLE `$this->name` ADD $column;"; - } - } - - return implode("\r\n", $alters); - } - - /** - * Alter table keys - * @return string - */ - private function alterKeys() - { - $describe = $this->db->executeS("SHOW KEYS FROM `$this->name`"); - - foreach ($describe as $k => $key) { - if ($key['Key_name'] != 'PRIMARY') { - try { - $this->db->execute("ALTER TABLE `$this->name` DROP KEY `".$key['Key_name']."`; "); - } catch (\Exception $e) { - continue; - } - } - } - - if (version_compare(_PS_VERSION_, '1.7', '>')) { - $i = 0; - foreach ($this->keys as $modelDef) { - if (strpos($modelDef, 'FOREIGN KEY') === 0) { - $i++; - try { - $this->db->execute("ALTER TABLE `$this->name` DROP FOREIGN KEY `".$this->name . "_ibfk_$i`;"); - } catch (\Exception $e) { - continue; - } - } - } - } - - foreach ($this->keys as $modelDef) { - if (strpos($modelDef, 'PRIMARY KEY') === 0) { - continue; - } - try { - if (strpos($modelDef, 'FOREIGN KEY') === 0 && version_compare(_PS_VERSION_, '1.7', '<')) { - continue; - } - $this->db->execute("ALTER TABLE `$this->name` ADD ".$modelDef.";"); - } catch (\Exception $e) { - continue; - } - } - - return true; - } - - /** - * Drop table - * @return bool - */ - public function drop() - { - return $this->db->execute("DROP TABLE IF EXISTS `$this->name`;"); - } - - /** - * @param string $name - * @return Stripe_officialClasslib\Db\DbTable - */ - public function setName($name) - { - $this->name = $name; - - return $this; - } - - /** - * @param string $engine - * @return Stripe_officialClasslib\Db\DbTable - */ - public function setEngine($engine) - { - $this->engine = $engine; - - return $this; - } - - /** - * @param string $charset - * @return Stripe_officialClasslib\Db\DbTable - */ - public function setCharset($charset) - { - $this->charset = $charset; - - return $this; - } - - /** - * @param string $collation - * @return Stripe_officialClasslib\Db\DbTable - */ - public function setCollation($collation) - { - $this->collation = $collation; - - return $this; - } - - /** - * @param array $columns - * @return Stripe_officialClasslib\Db\DbTable - */ - public function setColumns($columns) - { - $this->columns = $columns; - - return $this; - } - - /** - * @param array $columns - * @return Stripe_officialClasslib\Db\DbTable - */ - public function setKeyPrimary($columns) - { - return $this->setKey($columns, static::PRIMARY); - } - - /** - * @param array $keys - * @return Stripe_officialClasslib\Db\DbTable - */ - public function setKeysForeign($keys) - { - foreach ($keys as $columns) { - $this->setKeyForeign($columns); - } - - return $this; - } - - /** - * @param array $columns - * @return Stripe_officialClasslib\Db\DbTable - */ - public function setKeyForeign($columns) - { - return $this->setKey($columns, static::FOREIGN); - } - - /** - * @param array $keys - * @return Stripe_officialClasslib\Db\DbTable - */ - public function setKeysUnique($keys) - { - return $this->setKeyUnique(array_keys($keys)); - } - - /** - * @param array $columns - * @return Stripe_officialClasslib\Db\DbTable - */ - public function setKeyUnique($columns) - { - return $this->setKey($columns, static::UNIQUE); - } - - /** - * @param array $keys - * @return Stripe_officialClasslib\Db\DbTable - */ - public function setKeysFulltext($keys) - { - return $this->setKeyFulltext(array_keys($keys)); - } - - /** - * @param array $columns - * @return Stripe_officialClasslib\Db\DbTable - */ - public function setKeyFulltext($columns) - { - return $this->setKey($columns, static::FULLTEXT); - } - - /** - * @param array $keys - * @return Stripe_officialClasslib\Db\DbTable - */ - public function setKeysSimple($keys) - { - return $this->setKeySimple(array_keys($keys)); - } - - /** - * @param array $columns - * @return Stripe_officialClasslib\Db\DbTable - */ - public function setKeySimple($columns) - { - return $this->setKey($columns); - } - - /** - * @param array $columns - * @param int|null $type - * @return Stripe_officialClasslib\Db\DbTable - */ - protected function setKey($columns, $type = null) - { - // Empty columns may be returned by `array_filter`s. - if (empty($columns)) { - return $this; - } - - $name = implode('_', $columns); - $columns = implode('`, `', $columns); - switch ($type) { - case static::PRIMARY: - $this->keys[] = "PRIMARY KEY (`$columns`)"; - break; - case static::FOREIGN: - list($table, $columns) = explode('.', $name); - $this->keys[] = "FOREIGN KEY (`$columns`) REFERENCES $table (`$columns`) - ON UPDATE CASCADE ON DELETE CASCADE"; - break; - case static::UNIQUE: - $this->keys[] = "UNIQUE KEY (`$columns`)"; - break; - case static::FULLTEXT: - $this->keys[] = "FULLTEXT KEY (`$columns`)"; - break; - default: - $this->keys[] = "KEY (`$columns`)"; - break; - } - - return $this; - } -} diff --git a/vendor/totpsclasslib/src/Db/DbTableDefinitionModel.php b/vendor/totpsclasslib/src/Db/DbTableDefinitionModel.php deleted file mode 100644 index c82046b..0000000 --- a/vendor/totpsclasslib/src/Db/DbTableDefinitionModel.php +++ /dev/null @@ -1,284 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version release/2.1.0 - */ - -namespace Stripe_officialClasslib\Db; - -use Stripe_officialClasslib\Db\ObjectModelDefinition; -use Stripe_officialClasslib\Db\DbTableDefinitionRelation; - -use \ObjectModel; - -class DbTableDefinitionModel -{ - /** - * Internal ID. - */ - const ID = 'm'; - - /** - * @var Stripe_officialClasslib\Db\ObjectModelDefinition - */ - protected $def; - - /** - * Register Stripe_officialClasslib\Db\ObjectModelDefinition - * @param Stripe_officialClasslib\Db\ObjectModelDefinition $def - */ - public function __construct($def) - { - $this->def = $def; - } - - /** - * @return string - */ - public function getName() - { - return ObjectModelDefinition::DB_PREFIX . $this->def->get('table'); - } - - /** - * @return string - */ - public function getPrimary() - { - return $this->def->get('primary'); - } - - /** - * @return string - */ - public function getEngine() - { - return !empty($this->def->get('engine')) ? $this->def->get('engine') : ObjectModelDefinition::ENGINE; - } - - /** - * @return string - */ - public function getCharset() - { - return !empty($this->def->get('charset')) ? - $this->def->get('charset') : ObjectModelDefinition::CHARSET; - } - - /** - * @return string - */ - public function getCollation() - { - return !empty($this->def->get('collation')) ? - $this->def->get('collation') : ObjectModelDefinition::COLLATION; - } - - /** - * @return array - */ - public function getColumns() - { - return $this->def->getColumnsFromFields( - $this->getFields() - ); - } - - /** - * @return array - */ - public function getKeyPrimary() - { - return array( - $this->getPrimary() - ); - } - - /** - * @return array - */ - public function getKeysForeign() - { - $ids = $this->def->getIdsSingleRelations(); - $relations = $this->def->getRelations($ids); - - return array_map(function (DbTableDefinitionRelation $relation) { - return array("{$relation->getName()}.{$relation->getPrimary()}"); - }, $relations); - } - - /** - * @return array - */ - public function getKeysSimple() - { - return array_filter( - $this->getFieldsCommon(), - array( - $this->def, - 'isFieldSimpleKey' - ) - ); - } - - /** - * @return array - */ - public function getKeysUnique() - { - return array_filter( - $this->getFieldsCommon(), - array( - $this->def, - 'isFieldUniqueKey' - ) - ); - } - - /** - * @return array - */ - public function getKeysFulltext() - { - return array_filter( - $this->getFieldsCommon(), - array( - $this->def, - 'isFieldFulltextKey' - ) - ); - } - - /** - * @param string $relation - * @return bool - */ - public function has($relation) - { - switch ($relation) { - case DbTableDefinitionRelation::ID_LANG: - return $this->def->get('multilang'); - case DbTableDefinitionRelation::ID_SHOP: - return $this->def->get('multishop'); - default: - return isset($this->def->get('associations')[$relation]); - } - } - - /** - * @param string $relation - * @return bool - */ - public function hasMany($relation) - { - return $this->has($relation) - && ObjectModel::HAS_MANY === $this->def->getRelation($relation)->getType(); - } - - /** - * @param string $relation - * @return bool - */ - public function hasSingle($relation) - { - return $this->has($relation) - && ObjectModel::HAS_ONE === $this->def->getRelation($relation)->getType(); - } - - /** - * @return array - */ - protected function getFields() - { - return array_merge( - $this->getFieldPrimary(), - $this->getFieldsCommon() - ); - } - - /** - * @return array - */ - protected function getFieldPrimary() - { - return array( - $this->getPrimary() => ObjectModelDefinition::PRIMARY_KEY_FIELD - ); - } - - /** - * @return array - */ - protected function getFieldsCommon() - { - return array_filter( - $this->def->get('fields'), - array( - $this, - 'hasField' - ) - ); - } - - /** - * Wether or not this table has a given field - * @param array $field - * @return bool - */ - protected function hasField($field) - { - return !$this->isFieldMultilang($field) - && !$this->isFieldMultishop($field) - || $this->isFieldMultishopShared($field); - } - - /** - * Wether or not given field is multilang - * @param array $field - * @return bool - */ - protected function isFieldMultilang($field) - { - return !empty($field['lang']); - } - - /** - * Wether or not given field is multishop - * @param array $field - * @return bool - */ - protected function isFieldMultishop($field) - { - return !empty($field['shop']); - } - - /** - * Wether or not given multishop field is shared with this table - * @param array $field - * @return bool - */ - protected function isFieldMultishopShared($field) - { - return !empty($field['shop']) - && 'both' === $field['shop']; - } -} diff --git a/vendor/totpsclasslib/src/Db/DbTableDefinitionRelation.php b/vendor/totpsclasslib/src/Db/DbTableDefinitionRelation.php deleted file mode 100644 index 53bbfaa..0000000 --- a/vendor/totpsclasslib/src/Db/DbTableDefinitionRelation.php +++ /dev/null @@ -1,385 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version release/2.1.0 - */ - -namespace Stripe_officialClasslib\Db; - -use Stripe_officialClasslib\Db\ObjectModelDefinition; -use Stripe_officialClasslib\Db\DbTableDefinitionRelation; - -use \ObjectModel; - -class DbTableDefinitionRelation -{ - /** - * Internal IDs. - */ - const ID_LANG = 'l'; - const ID_SHOP = 's'; - - /** - * Internal table ID. - * - * @var string - */ - protected $id; - - /** - * @var stripe_officialObjectModelDefinition - */ - protected $def; - - /** - * Register stripe_officialObjectModelDefinition and the internal ID - * @param stripe_officialObjectModelDefinition $def - * @param string $id - */ - public function __construct($def, $id) - { - $this->id = $id; - $this->def = $def; - } - - /** - * Get key value from stripe_officialObjectModel::$definition['associations'][$this->id] - * @param string $key - * @return array|null - */ - public function get($key) - { - switch ($key) { - case 'fields': - return isset($this->def->get('associations')[$this->id][$key]) ? - $this->def->get('associations')[$this->id][$key] : array(); - default: - return isset($this->def->get('associations')[$this->id][$key]) ? - $this->def->get('associations')[$this->id][$key] : null; - } - } - - /** - * @return string - */ - public function getName() - { - switch ($this->id) { - case static::ID_LANG: - return $this->def->getModel()->getName().'_lang'; - case static::ID_SHOP: - return $this->def->getModel()->getName().'_shop'; - default: - return ObjectModelDefinition::DB_PREFIX.$this->get('association'); - } - } - - /** - * @return string - */ - public function getPrimary() - { - switch ($this->id) { - case static::ID_LANG: - return 'id_lang'; - case static::ID_SHOP: - return 'id_shop'; - default: - return (string)$this->get('field'); - } - } - - /** - * @return string - */ - public function getEngine() - { - return !empty($this->get('engine')) ? (string)$this->get('engine') : ObjectModelDefinition::ENGINE; - } - - /** - * @return string - */ - public function getCharset() - { - return !empty($this->get('charset')) ? (string)$this->get('charset') : ObjectModelDefinition::CHARSET; - } - - /** - * @return string - */ - public function getCollation() - { - return !empty($this->get('collation')) ? - (string)$this->get('collation') : ObjectModelDefinition::COLLATION; - } - - /** - * @return array - */ - public function getColumns() - { - return $this->def->getColumnsFromFields( - $this->getFields() - ); - } - - /** - * @return array - */ - public function getKeyPrimary() - { - $primary = array( - $this->def->getModel()->getPrimary(), - $this->getPrimary(), - ); - - if ($this->hasMany('shop')) { - $primary[] = 'id_shop'; - } - - if ($this->hasMany('lang')) { - $primary[] = 'id_lang'; - } - - return $primary; - } - - /** - * @return array - */ - public function getKeysForeign() - { - $model_table_1 = $this->def->getModel()->getName(); - $model_primary_1 = $this->def->getModel()->getPrimary(); - $model_table_2 = $this->getForeignTable(); - $model_primary_2 = $this->getPrimary(); - - $foreign = array( - array("$model_table_1.$model_primary_1"), - array("$model_table_2.$model_primary_2"), - ); - - if ($this->hasMany('shop')) { - $foreign[] = array(_DB_PREFIX_.'shop.id_shop'); - } - - if ($this->hasMany('lang')) { - $foreign[] = array(_DB_PREFIX_.'lang.id_lang'); - } - - return $foreign; - } - - /** - * @return array - */ - public function getKeysSimple() - { - switch ($this->id) { - case DbTableDefinitionRelation::ID_LANG: - case DbTableDefinitionRelation::ID_SHOP: - return array(); - default: - return array_filter( - $this->get('fields'), - array( - $this->def, - 'isFieldSimpleKey' - ) - ); - } - } - - /** - * @return array - */ - public function getKeysUnique() - { - switch ($this->id) { - case DbTableDefinitionRelation::ID_LANG: - case DbTableDefinitionRelation::ID_SHOP: - return array(); - default: - return array_filter( - $this->getFieldsCommon(), - array( - $this->def, - 'isFieldUniqueKey' - ) - ); - } - } - - /** - * @return array - */ - public function getKeysFulltext() - { - switch ($this->id) { - case DbTableDefinitionRelation::ID_LANG: - case DbTableDefinitionRelation::ID_SHOP: - return array(); - default: - return array_filter( - $this->getFieldsCommon(), - array( - $this->def, - 'isFieldFulltextKey' - ) - ); - } - } - - /** - * @return int - */ - public function getType() - { - switch ($this->id) { - case DbTableDefinitionRelation::ID_LANG: - case DbTableDefinitionRelation::ID_SHOP: - return ObjectModel::HAS_MANY; - default: - return (int)$this->get('type'); - } - } - - /** - * Get relation fields - * @return array - */ - protected function getFields() - { - return array_merge( - $this->getFieldsPrimary(), - $this->getFieldsCommon() - ); - } - - /** - * Get relation primary fields - * @return array - */ - protected function getFieldsPrimary() - { - $fields = array( - $this->def->getModel()->getPrimary() => ObjectModelDefinition::KEY_FIELD, - $this->getPrimary() => ObjectModelDefinition::KEY_FIELD, - ); - - if ($this->hasMany('shop')) { - $fields['id_shop'] = ObjectModelDefinition::KEY_FIELD; - } - - if ($this->hasMany('lang')) { - $fields['id_lang'] = ObjectModelDefinition::KEY_FIELD; - } - - return $fields; - } - - /** - * Get relation common fields - * @return array - */ - protected function getFieldsCommon() - { - switch ($this->id) { - case DbTableDefinitionRelation::ID_LANG: - case DbTableDefinitionRelation::ID_SHOP: - return array_filter( - $this->def->get('fields'), - array( - $this, - 'hasField' - ), - ARRAY_FILTER_USE_BOTH - ); - default: - return $this->get('fields'); - } - } - - /** - * Get relation foreign table - * @return string - */ - protected function getForeignTable() - { - switch ($this->id) { - case DbTableDefinitionRelation::ID_LANG: - return _DB_PREFIX_ . 'lang'; - case DbTableDefinitionRelation::ID_SHOP: - return _DB_PREFIX_ . 'shop'; - default: - return _DB_PREFIX_ . $this->getForeignModelTableName(); - } - } - - /** - * Get table name of foreign relation model - * @return string - */ - protected function getForeignModelTableName() - { - /** @var \ObjectModel $class */ - $class = $this->get('object'); - - $classDefinition = $class::$definition; //static definition \ObjectModel named $class - - return $classDefinition['table']; - } - - /** - * Wether or not this table has a 'OneToMany' relation - * @param string $relation - * @return bool - */ - protected function hasMany($relation) - { - switch ($this->id) { - case DbTableDefinitionRelation::ID_LANG: - return !empty($this->def->get("multilang_$relation")); - default: - return !empty($this->get("multi$relation")); - } - } - - /** - * Wether or not this table has a given field - * @param array $field - * @param string $name - * @return bool - */ - protected function hasField($field, $name) - { - switch ($this->id) { - case DbTableDefinitionRelation::ID_LANG: - return !empty($field['lang']); - case DbTableDefinitionRelation::ID_SHOP: - return !empty($field['shop']); - default: - return isset($this->get('fields')[$name]); - } - } -} diff --git a/vendor/totpsclasslib/src/Db/ObjectModelDefinition.php b/vendor/totpsclasslib/src/Db/ObjectModelDefinition.php deleted file mode 100644 index 5e0dc81..0000000 --- a/vendor/totpsclasslib/src/Db/ObjectModelDefinition.php +++ /dev/null @@ -1,505 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version release/2.1.0 - */ - -namespace Stripe_officialClasslib\Db; - -use Stripe_officialClasslib\Db\DbTableDefinitionModel; -use Stripe_officialClasslib\Db\DbTableDefinitionRelation; -use Stripe_officialClasslib\Db\DbSchema; - -use \ObjectModel; -use \Tools; - -class ObjectModelDefinition -{ - /** - * Defaults. - */ - const CHARSET = 'utf8'; - const COLLATION = 'DEFAULT'; - const ENGINE = _MYSQL_ENGINE_; - const DB_PREFIX = _DB_PREFIX_; - /** - * Primary key field description. - */ - const PRIMARY_KEY_FIELD = array( - 'type' => ObjectModel::TYPE_INT, - 'validate' => 'isUnsignedId', - 'required' => true, - 'primary' => true, - ); - /** - * (Simple) Key field description. - */ - const KEY_FIELD = array( - 'type' => ObjectModel::TYPE_INT, - 'validate' => 'isUnsignedId', - 'required' => true, - ); - - /** - * ObjectModel::$definition. - * - * @var array - */ - protected $def; - - /** - * @var DbTableDefinitionModel - */ - protected $model; - - /** - * @var array of Stripe_officialClasslib\Db\DbTableDefinitionRelation - */ - protected $relations; - - /** - * Register ObjectModel::$definition as a collection data source - * @param array $def - */ - public function __construct($def) - { - $this->def = $def; - // Prestashop doesn't define shop association when fetching definition. - if ($this->get('multishop')) { - $this->def['associations'][DbTableDefinitionRelation::ID_SHOP] = array( - 'type' => ObjectModel::HAS_MANY, - 'field' => $this->get('primary'), - ); - } - } - - /** - * @param string $key - * @return array|bool|mixed|null - */ - public function get($key) - { - switch ($key) { - case 'table': - case 'primary': - return $this->def[$key]; - case 'fields': - case 'associations': - return isset($this->def[$key]) ? $this->def[$key] : array(); - case 'multilang': - case 'multilang_shop': - case 'multishop': - return isset($this->def[$key]) ? $this->def[$key] : false; - default: - return isset($this->def[$key]) ? $this->def[$key] : null; - } - } - - /** - * @return array - */ - public function getSchemas() - { - return array_map( - array( - $this, - 'getSchema' - ), - $this->getIds() - ); - } - - /** - * @param string $id - * @return Stripe_officialClasslib\Db\DbSchema - */ - public function getSchema($id) - { - return new DbSchema($this, $id); - } - - /** - * @return DbTableDefinitionModel - */ - public function getModel() - { - return isset($this->model) ? $this->model : $this->model = new DbTableDefinitionModel($this); - } - - /** - * @param array $ids - * @return array - */ - public function getRelations($ids) - { - return array_map( - array( - $this, - 'getRelation' - ), - $ids - ); - } - - /** - * @param string $id - * @return Stripe_officialClasslib\Db\DbTableDefinitionRelation - */ - public function getRelation($id) - { - return isset($this->relations[$id]) ? - $this->relations[$id] : $this->relations[$id] = new DbTableDefinitionRelation($this, $id); - } - - /** - * @return array - */ - public function getIds() - { - return array_unique(array_merge( - array($this->getIdModel()), - $this->getIdsMultiRelations() - )); - } - - /** - * @return string - */ - public function getIdModel() - { - return DbTableDefinitionModel::ID; - } - - /** - * @param int|null $type - * @return array - */ - public function getIdsRelations($type = null) - { - switch ($type) { - // OneToOne and ManyToOne. - case ObjectModel::HAS_ONE: - return array_filter( - $this->getIdsRelations(), - array( - $this->getModel(), - 'hasSingle' - ) - ); - // ManyToMany. - case ObjectModel::HAS_MANY: - return array_filter( - $this->getIdsRelations(), - array( - $this->getModel(), - 'hasMany' - ) - ); - // All potential relations. - default: - return array_merge( - array( - DbTableDefinitionRelation::ID_LANG, - DbTableDefinitionRelation::ID_SHOP - ), - array_keys($this->get('associations')) - ); - } - } - - /** - * @return array - */ - public function getIdsMultiRelations() - { - return $this->getIdsRelations(ObjectModel::HAS_MANY); - } - - /** - * @return array - */ - public function getIdsSingleRelations() - { - return $this->getIdsRelations(ObjectModel::HAS_ONE); - } - - /** - * @return array - */ - public function getNames() - { - return array_map( - array( - $this, - 'getName' - ), - $this->getIds() - ); - } - - /** - * @param string $id - * @return string - */ - public function getName($id) - { - switch ($id) { - case DbTableDefinitionModel::ID: - return $this->getModel()->getName(); - default: - return $this->getRelation($id)->getName(); - } - } - - /** - * @param string $id - * @return string - */ - public function getEngine($id) - { - switch ($id) { - case DbTableDefinitionModel::ID: - return $this->getModel()->getEngine(); - default: - return $this->getRelation($id)->getEngine(); - } - } - - /** - * @param string $id - * @return string - */ - public function getCharset($id) - { - switch ($id) { - case DbTableDefinitionModel::ID: - return $this->getModel()->getCharset(); - default: - return $this->getRelation($id)->getCharset(); - } - } - - /** - * @param string $id - * @return string - */ - public function getCollation($id) - { - switch ($id) { - case DbTableDefinitionModel::ID: - return $this->getModel()->getCollation(); - default: - return $this->getRelation($id)->getCollation(); - } - } - - /** - * @param string $id - * @return array - */ - public function getColumns($id) - { - switch ($id) { - case DbTableDefinitionModel::ID: - return $this->getModel()->getColumns(); - default: - return $this->getRelation($id)->getColumns(); - } - } - - /** - * @param array $fields - * @return array - */ - public function getColumnsFromFields($fields) - { - return array_map( - array( - $this, - 'getColumnFromField' - ), - array_keys($fields), - $fields - ); - } - - /** - * @param string $name - * @param array $constraints - * @return string - * @throws \PrestaShopException - */ - public function getColumnFromField($name, $constraints) - { - $description = "`$name` "; - if (empty($constraints['values'])) { - switch ($constraints['type']) { - case ObjectModel::TYPE_BOOL: - $description .= 'TINYINT(1) UNSIGNED'; - break; - case ObjectModel::TYPE_DATE: - $description .= 'DATETIME'; - break; - case ObjectModel::TYPE_FLOAT: - $description .= 'DECIMAL'.( - isset($constraints['size'], $constraints['scale']) - ? "({$constraints['size']},{$constraints['scale']})" - : '' - ); - break; - case ObjectModel::TYPE_HTML: - // TYPE_SQL not supported in PS 1.6.0 - //case ObjectModel::TYPE_SQL: - $length = isset($constraints['size']) ? $constraints['size'] : null; - $length = isset($length['max']) ? $length['max'] : $length; - $description .= $length ? "TEXT($length)" : 'TEXT'; - break; - case ObjectModel::TYPE_INT: - $description .= 'INT(10)'.( - !empty($constraints['validate']) - && strpos(Tools::strtolower($constraints['validate']), 'unsigned') - ? ' UNSIGNED' - : ' SIGNED' - ); - break; - case ObjectModel::TYPE_STRING: - $length = isset($constraints['size']) ? $constraints['size'] : 255; - $length = isset($length['max']) ? $length['max'] : $length; - $description .= "VARCHAR($length)"; - break; - default: - throw new \PrestaShopException("Missing type constraint definition for field $name"); - } - } - if (!empty($constraints['values'])) { - $description .= " ENUM('".implode("','", $constraints['values'])."')"; - } - if (empty($constraints['allow_null']) || isset($constraints['default']) || !empty($constraints['required'])) { - $description .= ' NOT NULL'; - } - if (isset($constraints['default'])) { - $description .= " DEFAULT '".addslashes($constraints['default'])."'"; - } - if (!empty($constraints['primary'])) { - $description .= ' AUTO_INCREMENT'; - } - - return $description; - } - - /** - * @param string $id - * @return array - */ - public function getKeyPrimary($id) - { - switch ($id) { - case DbTableDefinitionModel::ID: - return $this->getModel()->getKeyPrimary(); - default: - return $this->getRelation($id)->getKeyPrimary(); - } - } - - /** - * @param string $id - * @return array - */ - public function getKeysForeign($id) - { - switch ($id) { - case DbTableDefinitionModel::ID: - return $this->getModel()->getKeysForeign(); - default: - return $this->getRelation($id)->getKeysForeign(); - } - } - - /** - * @param string $id - * @return array - */ - public function getKeysSimple($id) - { - switch ($id) { - case DbTableDefinitionModel::ID: - return $this->getModel()->getKeysSimple(); - default: - return $this->getRelation($id)->getKeysSimple(); - } - } - - /** - * @param string $id - * @return array - */ - public function getKeysUnique($id) - { - switch ($id) { - case DbTableDefinitionModel::ID: - return $this->getModel()->getKeysUnique(); - default: - return $this->getRelation($id)->getKeysUnique(); - } - } - - /** - * @param string $id - * @return array - */ - public function getKeysFulltext($id) - { - switch ($id) { - case DbTableDefinitionModel::ID: - return $this->getModel()->getKeysFulltext(); - default: - return $this->getRelation($id)->getKeysFulltext(); - } - } - - /** - * @param array $field - * @return bool - */ - public function isFieldSimpleKey($field) - { - return !empty($field['key']); - } - - /** - * @param array $field - * @return bool - */ - public function isFieldUniqueKey($field) - { - return !empty($field['unique']); - } - - /** - * @param array $field - * @return bool - */ - public function isFieldFulltextKey($field) - { - return !empty($field['fulltext']); - } -} diff --git a/vendor/totpsclasslib/src/Db/ObjectModelExtension.php b/vendor/totpsclasslib/src/Db/ObjectModelExtension.php deleted file mode 100644 index 6691ac1..0000000 --- a/vendor/totpsclasslib/src/Db/ObjectModelExtension.php +++ /dev/null @@ -1,120 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version release/2.1.0 - */ - -namespace Stripe_officialClasslib\Db; - -use Stripe_officialClasslib\Db\ObjectModelDefinition; -use Stripe_officialClasslib\Db\DbTableDefinitionModel; -use Stripe_officialClasslib\Db\DbTableDefinitionRelation; -use Stripe_officialClasslib\Db\DbSchema; -use Stripe_officialClasslib\Db\DbTable; - -class ObjectModelExtension -{ - /** - * @var \ObjectModel - */ - protected $om; - - /** - * @var Db - */ - protected $db; - - /** - * Register ObjectModel and Db - * @param \ObjectModel $om - * @param Db $db - */ - public function __construct($om, $db) - { - $this->om = $om; - $this->db = $db; - } - - /** - * @return bool - */ - public function install() - { - $schemas = $this->getObjectModelDefinition()->getSchemas(); - - return $this->createTables($schemas); - } - - /** - * @return bool - */ - public function uninstall() - { - $names = $this->getObjectModelDefinition()->getNames(); - - return $this->dropTables(array_reverse($names)); - } - - /** - * @return Stripe_officialClasslib\Db\ObjectModelDefinition (as an array collection object) - */ - protected function getObjectModelDefinition() - { - return new ObjectModelDefinition($this->om->getDefinition($this->om)); - } - - /** - * @param array $schemas - * @return bool - */ - protected function createTables($schemas) - { - return array_product(array_map(array($this, 'createTable'), $schemas)); - } - - /** - * @param Stripe_officialClasslib\Db\DbSchema $schema - * @return bool - */ - protected function createTable($schema) - { - return (new DbTable($this->db))->hydrate($schema)->create(); - } - - /** - * @param array $names - * @return bool - */ - protected function dropTables(array $names) - { - return array_product(array_map(array($this, 'dropTable'), $names)); - } - - /** - * @param string $name - * @return bool - */ - protected function dropTable($name) - { - return (new DbTable($this->db))->setName($name)->drop(); - } -} diff --git a/vendor/totpsclasslib/src/Extensions/AbstractModuleExtension.php b/vendor/totpsclasslib/src/Extensions/AbstractModuleExtension.php index 2ebf1a6..d197e6b 100644 --- a/vendor/totpsclasslib/src/Extensions/AbstractModuleExtension.php +++ b/vendor/totpsclasslib/src/Extensions/AbstractModuleExtension.php @@ -1,28 +1,71 @@ + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + */ + namespace Stripe_officialClasslib\Extensions; +use Stripe_officialClasslib\Hook\AbstractHookDispatcher; +use Stripe_officialClasslib\Module; + abstract class AbstractModuleExtension { //region Fields public $name; + /** + * @var Module + */ public $module; - public $objectModels = array(); + public $objectModels = []; - public $hooks = array(); + public $hooks = []; - public $extensionAdminControllers = array(); + public $extensionAdminControllers = []; - public $controllers = array(); + public $controllers = []; - public $cronTasks = array(); //TODO + public $cronTasks = []; + + /** + * @var AbstractHookDispatcher + */ + protected $hookDispatcher = null; //endregion + public function __construct($module = null) + { + $this->module = $module; + } + /** + * Set the module object for the extension + * * @param Module $module + * + * @return AbstractModuleExtension */ public function setModule($module) { @@ -30,4 +73,75 @@ public function setModule($module) return $this; } -} \ No newline at end of file + + /** + * Fetch Smarty template + * + * @todo Maybe this method should belong to classlib Module class + * so we'd have a unified way of calling the fetch method + * doing `$this->module->fetch(...)` + * + * @param string $templatePath + * @param null $cache_id + * @param null $compile_id + * + * @return mixed|string + * + * @throws \SmartyException + */ + public function fetch($templatePath, $cache_id = null, $compile_id = null) + { + if (version_compare(_PS_VERSION_, '1.7', '>')) { + return $this->module->fetch($templatePath, $cache_id, $compile_id); + } + + return \Context::getContext()->smarty->fetch($templatePath, $cache_id, $compile_id); + } + + /** + * Do shmth while each initialisation of extension, must be overrided in nested classes + * + * @return void + */ + public function initExtension() + { + } + + /** + * Do smth during the installation process + * + * @return bool + */ + public function install() + { + return true; + } + + /** + * Do smth during the uninstall action + * + * @return bool + */ + public function uninstall() + { + return true; + } + + /** + * Helps to manage hooks and widgets + * + * @return AbstractHookDispatcher + */ + public function getHookDispatcher() + { + return $this->hookDispatcher; + } + + /** + * @return array + */ + public function getExtensionAdminControllers() + { + return $this->extensionAdminControllers; + } +} diff --git a/vendor/totpsclasslib/src/Extensions/ProcessLogger/AdminProcessLoggerController.php b/vendor/totpsclasslib/src/Extensions/ProcessLogger/AdminProcessLoggerController.php deleted file mode 100644 index 7ff1107..0000000 --- a/vendor/totpsclasslib/src/Extensions/ProcessLogger/AdminProcessLoggerController.php +++ /dev/null @@ -1,276 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version release/2.0.0 - */ - -namespace Stripe_officialClasslib\Extensions\ProcessLogger; - -use Stripe_officialClasslib\Extensions\ProcessLogger\ProcessLoggerObjectModel; - -use \Db; -use \Tools; -use \Configuration; - -class AdminProcessLoggerController extends \ModuleAdminController -{ - /** @var bool $bootstrap Active bootstrap for Prestashop 1.6 */ - public $bootstrap = true; - - /** @var Module Instance of your module automatically set by ModuleAdminController */ - public $module; - - /** @var string Associated object class name */ - public $className = 'Stripe_officialClasslib\Extensions\ProcessLogger\ProcessLoggerObjectModel'; - - /** @var string Associated table name */ - public $table = 'stripe_official_processlogger'; - - /** @var string|false Object identifier inside the associated table */ - public $identifier = 'id_stripe_official_processlogger'; - - /** @var string Default ORDER BY clause when $_orderBy is not defined */ - protected $_defaultOrderBy = 'id_stripe_official_processlogger'; - - /** @var string Default ORDER WAY clause when $_orderWay is not defined */ - protected $_defaultOrderWay = 'DESC'; - - /** @var bool List content lines are clickable if true */ - protected $list_no_link = true; - - public $multishop_context = 0; - - /** - * @see AdminController::__construct() - */ - public function __construct() - { - parent::__construct(); - - $this->addRowAction('delete'); - - $this->bulk_actions = array( - 'delete' => array( - 'text' => $this->module->l('Delete selected', 'AdminProcessLoggerController'), - 'confirm' => $this->module->l( - 'Would you like to delete the selected items?', - 'AdminProcessLoggerController' - ), - ) - ); - - $this->fields_list = array( - 'id_stripe_official_processlogger' => array( - 'title' => $this->module->l('ID', 'AdminProcessLoggerController'), - 'align' => 'center', - 'class' => 'fixed-width-xs', - 'search' => true, - ), - 'name' => array( - 'title' => $this->module->l('Name', 'AdminProcessLoggerController'), - ), - 'msg' => array( - 'title' => $this->module->l('Message', 'AdminProcessLoggerController'), - ), - 'level' => array( - 'title' => $this->module->l('Level', 'AdminProcessLoggerController'), - 'callback' => 'getLevel', - ), - 'object_name' => array( - 'title' => $this->module->l('Object Name', 'AdminProcessLoggerController'), - ), - 'object_id' => array( - 'title' => $this->module->l('Object ID', 'AdminProcessLoggerController'), - 'callback' => 'getObjectId', - ), - 'date_add' => array( - 'title' => $this->module->l('Date', 'AdminProcessLoggerController'), - ), - ); - - $this->fields_options = array( - 'processLogger' => array( - 'image' => '../img/admin/cog.gif', - 'title' => $this->module->l('Process Logger Settings', 'AdminProcessLoggerController'), - 'description' => $this->module->l( - 'Here you can change the default configuration for this Process Logger', - 'AdminProcessLoggerController' - ), - 'fields' => array( - 'STRIPE_OFFICIAL_EXTLOGS_ERASING_DISABLED' => array( - 'title' => $this->module->l( - 'Disable auto erasing', - 'AdminProcessLoggerController' - ), - 'hint' => $this->module->l( - 'If disabled, logs will be automatically erased after the delay', - 'AdminProcessLoggerController' - ), - 'validation' => 'isBool', - 'cast' => 'intval', - 'type' => 'bool', - ), - 'STRIPE_OFFICIAL_EXTLOGS_ERASING_DAYSMAX' => array( - 'title' => $this->module->l( - 'Auto erasing delay (in days)', - 'AdminProcessLoggerController' - ), - 'hint' => $this->module->l( - 'Choose the number of days you want to keep logs in database', - 'AdminProcessLoggerController' - ), - 'validation' => 'isInt', - 'cast' => 'intval', - 'type' => 'text', - 'defaultValue' => 5, - ), - ), - 'submit' => array( - 'title' => $this->module->l('Save', 'AdminProcessLoggerController'), - 'name' => 'submitSaveConf'), - ), - ); - } - - /** - * @param $echo string Value of field - * @param $tr array All data of the row - * @return string - */ - public function getObjectId($echo, $tr) - { - unset($tr); - return empty($echo) ? '' : $echo; - } - - /** - * @param $echo string Value of field - * @param $tr array All data of the row - * @return string - */ - public function getLevel($echo, $tr) - { - unset($tr); - switch ($echo) { - case 'info': - $echo = ''.$echo.''; - break; - case 'success': - $echo = ''.$echo.''; - break; - case 'error': - $echo = ''.$echo.''; - break; - } - return $echo; - } - - /** - * @see AdminController::initPageHeaderToolbar() - */ - public function initPageHeaderToolbar() - { - parent::initPageHeaderToolbar(); - // Remove the help icon of the toolbar which no useful for us - $this->context->smarty->clearAssign('help_link'); - } - - /** - * @see AdminController::initToolbar() - */ - public function initToolbar() - { - parent::initToolbar(); - // Remove the add new item button - unset($this->toolbar_btn['new']); - $this->toolbar_btn['delete'] = array( - 'short' => 'Erase', - 'desc' => $this->module->l('Erase all'), - 'js' => 'if (confirm(\''. - $this->module->l('Are you sure?', 'AdminProcessLoggerController'). - '\')) document.location = \''.self::$currentIndex.'&token='.$this->token.'&action=erase\';' - ); - } - - /** - * Delete all logs - * - * @return bool - */ - public function processErase() - { - $result = Db::getInstance()->delete($this->table); - - if ($result) { - $this->confirmations[] = $this->module->l('All logs has been erased', 'AdminProcessLoggerController'); - } - - return $result; - } - - public function postProcess() - { - if (Tools::isSubmit('submitSaveConf')) { - return $this->saveConfiguration(); - } - - return parent::postProcess(); - } - - public function saveConfiguration() - { - $shops = Shop::getShops(); - foreach ($shops as $shop) { - $extlogs_erasing_daysmax = Tools::getValue('STRIPE_OFFICIAL_EXTLOGS_ERASING_DAYSMAX'); - $extlogs_erasing_disabled = Tools::getValue('STRIPE_OFFICIAL_EXTLOGS_ERASING_DISABLED'); - - Configuration::updateValue( - 'STRIPE_OFFICIAL_EXTLOGS_ERASING_DISABLED', - ($extlogs_erasing_disabled ? true : false), - false, - null, - $shop['id_shop'] - ); - - if (!is_numeric($extlogs_erasing_daysmax)) { - $this->errors[] = $this->module->l( - 'You must specify a valid \"Auto erasing delay (in days)\" number.', - 'AdminProcessLoggerController' - ); - } else { - Configuration::updateValue( - 'STRIPE_OFFICIAL_EXTLOGS_ERASING_DAYSMAX', - $extlogs_erasing_daysmax, - false, - null, - $shop['id_shop'] - ); - $this->confirmations[] = $this->module->l( - 'Log parameters are successfully updated!', - 'AdminProcessLoggerController' - ); - } - } - - return true; - } -} diff --git a/vendor/totpsclasslib/src/Extensions/ProcessLogger/Classes/ProcessLoggerObjectModel.php b/vendor/totpsclasslib/src/Extensions/ProcessLogger/Classes/ProcessLoggerObjectModel.php old mode 100755 new mode 100644 index 177b168..364ef95 --- a/vendor/totpsclasslib/src/Extensions/ProcessLogger/Classes/ProcessLoggerObjectModel.php +++ b/vendor/totpsclasslib/src/Extensions/ProcessLogger/Classes/ProcessLoggerObjectModel.php @@ -20,12 +20,13 @@ * @author 202-ecommerce * @copyright Copyright (c) 202-ecommerce * @license Commercial license - * @version release/2.1.0 + * + * @version develop */ namespace Stripe_officialClasslib\Extensions\ProcessLogger\Classes; -use \ObjectModel; +use ObjectModel; class ProcessLoggerObjectModel extends ObjectModel { @@ -35,7 +36,7 @@ class ProcessLoggerObjectModel extends ObjectModel /** @var string Message to display */ public $msg; - /** @var string level (success|failed|info) */ + /** @var string level (success|error|info|deprecated) */ public $level; /** @var string Name of ObjectModel associated if needed */ @@ -44,46 +45,55 @@ class ProcessLoggerObjectModel extends ObjectModel /** @var int|null Identifier of resource announced with ObjectModel if needed */ public $object_id; + /** + * @var int|null + */ + public $id_session; + /** @var string Date */ public $date_add; /** * @see \ObjectModel::$definition */ - public static $definition = array( - 'table' => 'stripe_official_processlogger', - 'primary' => 'id_stripe_official_processlogger', - 'fields' => array( - 'name' => array( - 'type' => ObjectModel::TYPE_STRING, + public static $definition = [ + 'table' => 'stripe_official_processlogger', + 'primary' => 'id_stripe_official_processlogger', + 'fields' => [ + 'name' => [ + 'type' => ObjectModel::TYPE_STRING, 'validate' => 'isGenericName', - 'size' => 100, - ), - 'msg' => array( - 'type' => ObjectModel::TYPE_HTML, + 'size' => 100, + ], + 'msg' => [ + 'type' => ObjectModel::TYPE_HTML, 'validate' => 'isGenericName', - 'size' => 255, - ), - 'level' => array( - 'type' => ObjectModel::TYPE_STRING, + ], + 'level' => [ + 'type' => ObjectModel::TYPE_STRING, 'validate' => 'isGenericName', - 'size' => 10, - ), - 'object_name' => array( - 'type' => ObjectModel::TYPE_STRING, + 'size' => 10, + ], + 'object_name' => [ + 'type' => ObjectModel::TYPE_STRING, 'validate' => 'isGenericName', - 'size' => 100, - ), - 'object_id' => array( + 'size' => 100, + ], + 'object_id' => [ 'type' => ObjectModel::TYPE_INT, 'validate' => 'isUnsigned', 'allow_null' => true, - ), - 'date_add' => array( - 'type' => ObjectModel::TYPE_DATE, - 'validate' => 'isDate', + ], + 'id_session' => [ + 'type' => ObjectModel::TYPE_STRING, + 'validate' => 'isString', + 'allow_null' => true, + ], + 'date_add' => [ + 'type' => ObjectModel::TYPE_DATE, + 'validate' => 'isDate', 'copy_post' => false, - ), - ), - ); + ], + ], + ]; } diff --git a/vendor/totpsclasslib/src/Extensions/ProcessLogger/Controllers/Admin/AdminProcessLoggerController.php b/vendor/totpsclasslib/src/Extensions/ProcessLogger/Controllers/Admin/AdminProcessLoggerController.php index 2d39208..bce7788 100644 --- a/vendor/totpsclasslib/src/Extensions/ProcessLogger/Controllers/Admin/AdminProcessLoggerController.php +++ b/vendor/totpsclasslib/src/Extensions/ProcessLogger/Controllers/Admin/AdminProcessLoggerController.php @@ -20,20 +20,21 @@ * @author 202-ecommerce * @copyright Copyright (c) 202-ecommerce * @license Commercial license - * @version release/2.1.0 + * + * @version develop */ namespace Stripe_officialClasslib\Extensions\ProcessLogger\Controllers\Admin; use Stripe_officialClasslib\Extensions\ProcessLogger\Classes\ProcessLoggerObjectModel; - -use \Db; -use \Tools; -use \Configuration; +use Configuration; +use Db; +use Shop; +use Tools; class AdminProcessLoggerController extends \ModuleAdminController { - /** @var bool $bootstrap Active bootstrap for Prestashop 1.6 */ + /** @var bool Active bootstrap for Prestashop 1.6 */ public $bootstrap = true; /** @var \Module Instance of your module automatically set by ModuleAdminController */ @@ -48,10 +49,10 @@ class AdminProcessLoggerController extends \ModuleAdminController /** @var string|false Object identifier inside the associated table */ public $identifier = 'id_stripe_official_processlogger'; - /** @var string Default ORDER BY clause when $_orderBy is not defined */ + /** @var string Default ORDER BY clause when is not defined */ protected $_defaultOrderBy = 'id_stripe_official_processlogger'; - /** @var string Default ORDER WAY clause when $_orderWay is not defined */ + /** @var string Default ORDER WAY clause when is not defined */ protected $_defaultOrderWay = 'DESC'; /** @var bool List content lines are clickable if true */ @@ -68,103 +69,110 @@ public function __construct() $this->addRowAction('delete'); - $this->bulk_actions = array( - 'delete' => array( + $this->bulk_actions = [ + 'delete' => [ 'text' => $this->module->l('Delete selected', 'AdminProcessLoggerController'), 'confirm' => $this->module->l( 'Would you like to delete the selected items?', 'AdminProcessLoggerController' ), - ) - ); + ], + ]; - $this->fields_list = array( - 'id_stripe_official_processlogger' => array( - 'title' => $this->module->l('ID', 'AdminProcessLoggerController'), - 'align' => 'center', - 'class' => 'fixed-width-xs', + $this->fields_list = [ + 'id_stripe_official_processlogger' => [ + 'title' => $this->module->l('ID', 'AdminProcessLoggerController'), + 'align' => 'center', + 'class' => 'fixed-width-xs', 'search' => true, - ), - 'name' => array( + ], + 'name' => [ 'title' => $this->module->l('Name', 'AdminProcessLoggerController'), - ), - 'msg' => array( + ], + 'msg' => [ 'title' => $this->module->l('Message', 'AdminProcessLoggerController'), - ), - 'level' => array( - 'title' => $this->module->l('Level', 'AdminProcessLoggerController'), + ], + 'level' => [ + 'title' => $this->module->l('Level', 'AdminProcessLoggerController'), 'callback' => 'getLevel', - ), - 'object_name' => array( + ], + 'object_name' => [ 'title' => $this->module->l('Object Name', 'AdminProcessLoggerController'), - ), - 'object_id' => array( - 'title' => $this->module->l('Object ID', 'AdminProcessLoggerController'), + ], + 'object_id' => [ + 'title' => $this->module->l('Object ID', 'AdminProcessLoggerController'), 'callback' => 'getObjectId', - ), - 'date_add' => array( + ], + 'id_session' => [ + 'title' => $this->module->l('Session ID', 'AdminProcessLoggerController'), + ], + 'date_add' => [ 'title' => $this->module->l('Date', 'AdminProcessLoggerController'), - ), - ); + ], + ]; - $this->fields_options = array( - 'processLogger' => array( - 'image' => '../img/admin/cog.gif', - 'title' => $this->module->l('Process Logger Settings', 'AdminProcessLoggerController'), + $this->fields_options = [ + 'processLogger' => [ + 'image' => '../img/admin/cog.gif', + 'title' => $this->module->l('Process Logger Settings', 'AdminProcessLoggerController'), 'description' => $this->module->l( 'Here you can change the default configuration for this Process Logger', 'AdminProcessLoggerController' ), - 'fields' => array( - 'STRIPE_OFFICIAL_EXTLOGS_ERASING_DISABLED' => array( - 'title' => $this->module->l( + 'fields' => [ + 'STRIPE_OFFICIAL_EXTLOGS_ERASING_DISABLED' => [ + 'title' => $this->module->l( 'Disable auto erasing', 'AdminProcessLoggerController' ), - 'hint' => $this->module->l( + 'hint' => $this->module->l( 'If disabled, logs will be automatically erased after the delay', 'AdminProcessLoggerController' ), - 'validation' => 'isBool', - 'cast' => 'intval', - 'type' => 'bool', - ), - 'STRIPE_OFFICIAL_EXTLOGS_ERASING_DAYSMAX' => array( - 'title' => $this->module->l( + 'validation' => 'isBool', + 'cast' => 'intval', + 'type' => 'bool', + ], + 'STRIPE_OFFICIAL_EXTLOGS_ERASING_DAYSMAX' => [ + 'title' => $this->module->l( 'Auto erasing delay (in days)', 'AdminProcessLoggerController' ), - 'hint' => $this->module->l( + 'hint' => $this->module->l( 'Choose the number of days you want to keep logs in database', 'AdminProcessLoggerController' ), - 'validation' => 'isInt', - 'cast' => 'intval', - 'type' => 'text', + 'validation' => 'isInt', + 'cast' => 'intval', + 'type' => 'text', 'defaultValue' => 5, - ), - ), - 'submit' => array( + ], + ], + 'submit' => [ 'title' => $this->module->l('Save', 'AdminProcessLoggerController'), - 'name' => 'submitSaveConf'), - ), - ); + 'name' => 'submitSaveConf', + ], + ], + ]; } /** - * @param $echo string Value of field - * @param $tr array All data of the row + * @param string $echo Value of field + * @param array $tr All data of the row + * * @return string */ public function getObjectId($echo, $tr) { unset($tr); + return empty($echo) ? '' : $echo; } /** - * @param $echo string Value of field - * @param $tr array All data of the row + * @param string $echo Value of field + * @param array $tr All data of the row + * * @return string */ public function getLevel($echo, $tr) @@ -172,15 +180,19 @@ public function getLevel($echo, $tr) unset($tr); switch ($echo) { case 'info': - $echo = ''.$echo.''; + $echo = '' . $echo . ''; break; case 'success': - $echo = ''.$echo.''; + $echo = '' . $echo . ''; break; case 'error': - $echo = ''.$echo.''; + $echo = '' . $echo . ''; + break; + case 'deprecated': + $echo = '' . $echo . ''; break; } + return $echo; } @@ -202,13 +214,13 @@ public function initToolbar() parent::initToolbar(); // Remove the add new item button unset($this->toolbar_btn['new']); - $this->toolbar_btn['delete'] = array( + $this->toolbar_btn['delete'] = [ 'short' => 'Erase', 'desc' => $this->module->l('Erase all'), - 'js' => 'if (confirm(\''. - $this->module->l('Are you sure?', 'AdminProcessLoggerController'). - '\')) document.location = \''.self::$currentIndex.'&token='.$this->token.'&action=erase\';' - ); + 'js' => 'if (confirm(\'' . + $this->module->l('Are you sure?', 'AdminProcessLoggerController') . + '\')) document.location = \'' . self::$currentIndex . '&token=' . $this->token . '&action=erase\';', + ]; } /** @@ -238,11 +250,11 @@ public function postProcess() public function saveConfiguration() { - $shops = Shop::getShops(); + $shops = \Shop::getShops(); foreach ($shops as $shop) { $extlogs_erasing_daysmax = Tools::getValue('STRIPE_OFFICIAL_EXTLOGS_ERASING_DAYSMAX'); $extlogs_erasing_disabled = Tools::getValue('STRIPE_OFFICIAL_EXTLOGS_ERASING_DISABLED'); - + Configuration::updateValue( 'STRIPE_OFFICIAL_EXTLOGS_ERASING_DISABLED', ($extlogs_erasing_disabled ? true : false), diff --git a/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerExtension.php b/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerExtension.php index 49e6205..9e04ecd 100644 --- a/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerExtension.php +++ b/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerExtension.php @@ -20,31 +20,33 @@ * @author 202-ecommerce * @copyright Copyright (c) 202-ecommerce * @license Commercial license - * @version release/2.1.0 + * + * @version develop */ + namespace Stripe_officialClasslib\Extensions\ProcessLogger; use Stripe_officialClasslib\Extensions\AbstractModuleExtension; -use Stripe_officialClasslib\Extensions\ProcessLogger\Controllers\Admin\AdminProcessLoggerController; use Stripe_officialClasslib\Extensions\ProcessLogger\Classes\ProcessLoggerObjectModel; +use Stripe_officialClasslib\Extensions\ProcessLogger\Controllers\Admin\AdminProcessLoggerController; class ProcessLoggerExtension extends AbstractModuleExtension { public $name = 'process_logger'; - public $extensionAdminControllers = array( - array( - 'name' => array( + public $extensionAdminControllers = [ + [ + 'name' => [ 'en' => 'Logger Stripe_official', 'fr' => 'Logger Stripe_official', - ), + ], 'class_name' => 'AdminStripe_officialProcessLogger', 'parent_class_name' => 'stripe_official', 'visible' => true, - ), - ); + ], + ]; - public $objectModels = array( - ProcessLoggerObjectModel::class - ); -} \ No newline at end of file + public $objectModels = [ + ProcessLoggerObjectModel::class, + ]; +} diff --git a/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerHandler.php b/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerHandler.php index 488f3c7..027c8a5 100644 --- a/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerHandler.php +++ b/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerHandler.php @@ -20,32 +20,35 @@ * @author 202-ecommerce * @copyright Copyright (c) 202-ecommerce * @license Commercial license - * @version release/2.1.0 + * + * @version develop */ namespace Stripe_officialClasslib\Extensions\ProcessLogger; -use \Db; -use \Configuration; -use \Hook; +use Stripe_officialClasslib\Extensions\ProcessMonitor\ProcessMonitorHandler; +use Configuration; +use Db; +use Hook; +use Tools; class ProcessLoggerHandler { /** - * @var Stripe_officialClasslib\Extensions\ProcessMonitor\ProcessMonitorHandler - * Instance of ProcessMonitorHandler + * @var ProcessMonitorHandler + * Instance of ProcessMonitorHandler */ private static $process; /** * @var array logs */ - private static $logs = array(); + private static $logs = []; /** * Set process name and remove oldest logs * - * @param Stripe_officialClasslib\Extensions\ProcessMonitor\ProcessMonitorHandler|null $process + * @param ProcessMonitorHandler|null $process */ public static function openLogger($process = null) { @@ -55,6 +58,9 @@ public static function openLogger($process = null) /** * @param string|null $msg + * + * @throws \PrestaShopDatabaseException + * @throws \PrestaShopException */ public static function closeLogger($msg = null) { @@ -73,14 +79,15 @@ public static function closeLogger($msg = null) */ public static function addLog($msg, $objectModel = null, $objectId = null, $name = null, $level = 'info') { - self::$logs[] = array( + self::$logs[] = [ 'name' => pSQL($name), 'msg' => pSQL($msg), 'level' => pSQL($level), 'object_name' => pSQL($objectModel), 'object_id' => (int)$objectId, - 'date_add' => date("Y-m-d H:i:s"), - ); + 'date_add' => date('Y-m-d H:i:s'), + 'id_session' => self::getSessionId(), + ]; if (100 === count(self::$logs)) { self::saveLogsInDb(); @@ -129,38 +136,54 @@ public static function logInfo($msg, $objectModel = null, $objectId = null, $nam self::addLog($msg, $objectModel, $objectId, $name, 'info'); } + /** + * @param string $msg + * @param string|null $objectModel + * @param int|null $objectId + * @param string $name + */ + public static function logDeprecated($msg, $objectModel = null, $objectId = null, $name = 'default') + { + if (self::$process != null) { + $name = self::$process->getProcessName(); + } + self::addLog($msg, $objectModel, $objectId, $name, 'deprecated'); + } + /** * @return bool + * + * @throws \PrestaShopDatabaseException + * @throws \PrestaShopException */ public static function saveLogsInDb() { $result = true; if (false === empty(self::$logs) && self::getSkippingHooksResult()) { - Hook::exec( - 'actionProcessLoggerSave', - array( - 'logs' => &self::$logs, - ), - null, - true + 'actionProcessLoggerSave', + [ + 'logs' => &self::$logs, + ], + null, + true ); Hook::exec( - 'actionStripe_officialProcessLoggerSave', - array( - 'logs' => &self::$logs, - ), - null, - true + 'actionStripe_officialProcessLoggerSave', + [ + 'logs' => &self::$logs, + ], + null, + true ); - + $result = Db::getInstance()->insert( 'stripe_official_processlogger', self::$logs ); if ($result) { - self::$logs = array(); + self::$logs = []; } } @@ -206,32 +229,34 @@ public static function getAutoErasingDelayInDays() return (int)$numberOfDays; } - + /** * Executes the hooks used to skip a ProcessLogger save. This will return * false if any module hooked to either 'actionSkipProcessLoggerSave' or * 'actionSkipStripe_officialProcessLoggerSave' returns false (weak comparison) - * + * * @return bool + * + * @throws \PrestaShopException */ - protected static function getSkippingHooksResult() { - + protected static function getSkippingHooksResult() + { if (Hook::getIdByName('actionSkipProcessLoggerSave')) { $hookProcessLoggerReturnArray = Hook::exec( - 'actionSkipProcessLoggerSave', - array( - 'logs' => self::$logs, - ), - null, - true + 'actionSkipProcessLoggerSave', + [ + 'logs' => self::$logs, + ], + null, + true ); if (!is_array($hookProcessLoggerReturnArray)) { return false; } - + if (!empty($hookProcessLoggerReturnArray)) { - $hookReturn = array_reduce($hookProcessLoggerReturnArray, function($and, $hookReturn) { + $hookReturn = array_reduce($hookProcessLoggerReturnArray, function ($and, $hookReturn) { return $and && (bool)$hookReturn; }); if (!$hookReturn) { @@ -239,23 +264,23 @@ protected static function getSkippingHooksResult() { } } } - + if (Hook::getIdByName('actionSkipStripe_officialProcessLoggerSave')) { $hookModuleProcessLoggerReturnArray = Hook::exec( - 'actionSkipStripe_officialProcessLoggerSave', - array( - 'logs' => self::$logs, - ), - null, - true + 'actionSkipStripe_officialProcessLoggerSave', + [ + 'logs' => self::$logs, + ], + null, + true ); if (!is_array($hookModuleProcessLoggerReturnArray)) { return false; } - + if (!empty($hookModuleProcessLoggerReturnArray)) { - $hookReturn = array_reduce($hookModuleProcessLoggerReturnArray, function($and, $hookReturn) { + $hookReturn = array_reduce($hookModuleProcessLoggerReturnArray, function ($and, $hookReturn) { return $and && (bool)$hookReturn; }); if (!$hookReturn) { @@ -263,7 +288,25 @@ protected static function getSkippingHooksResult() { } } } - + return true; } + + protected static function getSessionId() + { + $values = []; + $remoteAddr = Tools::getRemoteAddr(); + $values[] = $remoteAddr; + if (!empty($_SERVER['REQUEST_TIME'])) { + $values[] = $_SERVER['REQUEST_TIME']; + } elseif (!empty($_SERVER['REQUEST_TIME_FLOAT'])) { + $values[] = $_SERVER['REQUEST_TIME_FLOAT']; + } + + if (!empty($_SERVER['REMOTE_PORT'])) { + $values[] = $_SERVER['REMOTE_PORT']; + } + + return sprintf('%08x', abs(crc32(implode('', $values)))); + } } diff --git a/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerObjectModel.php b/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerObjectModel.php deleted file mode 100644 index ac84047..0000000 --- a/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerObjectModel.php +++ /dev/null @@ -1,89 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version release/2.0.0 - */ - -namespace Stripe_officialClasslib\Extensions\ProcessLogger; - -use \ObjectModel; - -class ProcessLoggerObjectModel extends ObjectModel -{ - /** @var string name of action */ - public $name; - - /** @var string Message to display */ - public $msg; - - /** @var string level (success|failed|info) */ - public $level; - - /** @var string Name of ObjectModel associated if needed */ - public $object_name; - - /** @var int|null Identifier of resource announced with ObjectModel if needed */ - public $object_id; - - /** @var string Date */ - public $date_add; - - /** - * @see \ObjectModel::$definition - */ - public static $definition = array( - 'table' => 'stripe_official_processlogger', - 'primary' => 'id_stripe_official_processlogger', - 'fields' => array( - 'name' => array( - 'type' => ObjectModel::TYPE_STRING, - 'validate' => 'isGenericName', - 'size' => 100, - ), - 'msg' => array( - 'type' => ObjectModel::TYPE_STRING, - 'validate' => 'isGenericName', - 'size' => 255, - ), - 'level' => array( - 'type' => ObjectModel::TYPE_STRING, - 'validate' => 'isGenericName', - 'size' => 10, - ), - 'object_name' => array( - 'type' => ObjectModel::TYPE_STRING, - 'validate' => 'isGenericName', - 'size' => 100, - ), - 'object_id' => array( - 'type' => ObjectModel::TYPE_INT, - 'validate' => 'isUnsigned', - 'allow_null' => true, - ), - 'date_add' => array( - 'type' => ObjectModel::TYPE_DATE, - 'validate' => 'isDate', - 'copy_post' => false, - ), - ), - ); -} diff --git a/vendor/totpsclasslib/src/Extensions/ProcessMonitor/Classes/ProcessMonitorObjectModel.php b/vendor/totpsclasslib/src/Extensions/ProcessMonitor/Classes/ProcessMonitorObjectModel.php new file mode 100644 index 0000000..fb1f170 --- /dev/null +++ b/vendor/totpsclasslib/src/Extensions/ProcessMonitor/Classes/ProcessMonitorObjectModel.php @@ -0,0 +1,124 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * + * @version develop + */ + +namespace Stripe_officialClasslib\Extensions\ProcessMonitor\Classes; + +use Stripe_officialClasslib\Database\Index\IndexType; +use Db; +use DbQuery; +use ObjectModel; + +class ProcessMonitorObjectModel extends ObjectModel +{ + /** @var string name of process */ + public $name; + + /** @var int PHP's process ID associated with process */ + public $pid = null; + + /** @var string Some useful data about process execution */ + public $data; + + /** @var float */ + public $duration = 0; + + /** @var string Date */ + public $last_update; + + /** @var bool Boolean */ + public $active = true; + + /** + * @see ObjectModel::$definition + */ + public static $definition = [ + 'table' => 'stripe_official_processmonitor', + 'primary' => 'id_stripe_official_processmonitor', + 'fields' => [ + 'name' => [ + 'type' => ObjectModel::TYPE_STRING, + 'validate' => 'isGenericName', + 'size' => 100, + 'required' => true, + ], + 'pid' => [ + 'type' => ObjectModel::TYPE_INT, + 'validate' => 'isUnsignedId', + 'allow_null' => true, + ], + 'data' => [ + 'type' => ObjectModel::TYPE_STRING, + ], + 'duration' => [ + 'type' => ObjectModel::TYPE_FLOAT, + 'validate' => 'isUnsignedFloat', + 'size' => 10, + 'scale' => 6, + ], + 'active' => [ + 'type' => ObjectModel::TYPE_BOOL, + 'validate' => 'isBool', + 'required' => true, + ], + 'last_update' => [ + 'type' => ObjectModel::TYPE_DATE, + ], + ], + 'indexes' => [ + [ + 'fields' => [ + [ + 'column' => 'name', + ], + ], + 'type' => IndexType::UNIQUE, + ], + ], + ]; + + /** + * @param string $name + * + * @return mixed + */ + public function findOneByName($name) + { + $query = new DbQuery(); + $query->select('*'); + $query->from(self::$definition['table'], 'p'); + $query->where('p.name = \'' . pSQL($name) . '\''); + + $data = Db::getInstance()->getRow($query); + + if (empty($data)) { + return $this; + } + + $this->hydrate($data); + + return $this; + } +} diff --git a/vendor/totpsclasslib/src/Extensions/ProcessMonitor/ProcessMonitorHandler.php b/vendor/totpsclasslib/src/Extensions/ProcessMonitor/ProcessMonitorHandler.php new file mode 100644 index 0000000..8508ba0 --- /dev/null +++ b/vendor/totpsclasslib/src/Extensions/ProcessMonitor/ProcessMonitorHandler.php @@ -0,0 +1,205 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * + * @version develop + */ + +namespace Stripe_officialClasslib\Extensions\ProcessMonitor; + +use Stripe_officialClasslib\Extensions\ProcessMonitor\Classes\ProcessMonitorObjectModel; +use Db; +use ObjectModel; +use Tools; + +class ProcessMonitorHandler +{ + /** + * @var ProcessMonitorObjectModel + */ + protected $process; + + /** + * @var float microtime + */ + public $startTime; + + /** + * @var string + */ + protected $date_upd; + + /** + * Lock process + * + * @param string $name + * + * @return bool|mixed + * + * @throws \PrestaShopDatabaseException + * @throws \PrestaShopException + */ + public function lock($name) + { + $this->startTime = $this->microtimeFloat(); + $processMonitorObjectModel = new ProcessMonitorObjectModel(); + $this->process = $processMonitorObjectModel->findOneByName($name); + if (empty($this->process->id)) { + $this->process = new ProcessMonitorObjectModel(); + $this->process->name = $name; + $this->process->data = Tools::jsonEncode([]); + $this->process->date_add = date('Y-m-d H:i:s'); + } + if (!empty($this->process->pid)) { + $last_update = new \DateTime($this->process->last_update); + $data_now = new \DateTime('NOW'); + $diff = $data_now->diff($last_update); + $hours = $diff->h; + $hours = $hours + ($diff->days * 24); + if ($hours < 1) { + return false; + } + } + + $this->process->last_update = date('Y-m-d H:i:s'); + $this->process->pid = getmypid(); + + $this->date_upd = date('Y-m-d H:i:s'); + + /** + * We can't use the ObjectModel's "save", "add" or "update" methods. + * PS will natively call ObjectModel hooks, using the class name of the + * ObjectModel. On PS 1.6, the namespace is not escaped from the class name, + * resulting in an invalid hook name, e.g. : + * actionObjectShoppingfeedClasslib\Extensions\ProcessMonitor\ProcessMonitorObjectModelUpdateBefore + */ + $definition = ObjectModel::getDefinition($this->process); + if (empty($this->process->id)) { + Db::getInstance()->insert( + $definition['table'], + $this->process->getFields(), + false + ); + $this->process->id = Db::getInstance()->Insert_ID(); + } else { + Db::getInstance()->update( + $definition['table'], + $this->process->getFields(), + '`' . pSQL($definition['primary']) . '` = ' . (int)$this->process->id, + 0, + false + ); + } + + return Tools::jsonDecode($this->process->data, true); + } + + /** + * UnLock process + * + * @param array $data + * + * @return bool + * + * @throws \PrestaShopException + */ + public function unlock($data = []) + { + if (empty($this->process)) { + return false; + } + + if (false === empty($data)) { + $this->process->data = Tools::jsonEncode($data); + } + $this->process->last_update = date('Y-m-d H:i:s'); + $endTime = $this->microtimeFloat(); + $duration = number_format(($endTime - $this->startTime), 3); + $this->process->duration = $duration; + $this->process->pid = null; + + /** + * We can't use the ObjectModel's "save", "add" or "update" methods. + * PS will natively call ObjectModel hooks, using the class name of the + * ObjectModel. On PS 1.6, the namespace is not escaped from the class name, + * resulting in an invalid hook name, e.g. : + * actionObjectShoppingfeedClasslib\Extensions\ProcessMonitor\ProcessMonitorObjectModelUpdateBefore + */ + $definition = ObjectModel::getDefinition($this->process); + + return Db::getInstance()->update( + $definition['table'], + $this->process->getFields(), + '`' . pSQL($definition['primary']) . '` = ' . (int)$this->process->id, + 0, + false + ); + } + + /** + * Get microtime in float value + * + * @return float + */ + public function microtimeFloat() + { + list($usec, $sec) = explode(' ', microtime()); + + return (float)$usec + (float)$sec; + } + + /** + * @return string|null + */ + public function getProcessObjectModelName() + { + if (empty($this->process)) { + return null; + } + + return get_class($this->process); + } + + /** + * @return int|null + */ + public function getProcessObjectModelId() + { + if (empty($this->process)) { + return null; + } + + return (int)$this->process->id; + } + + /** + * @return string|null + */ + public function getProcessName() + { + if (empty($this->process)) { + return null; + } + + return $this->process->name; + } +} diff --git a/vendor/totpsclasslib/src/Hook/AbstractHook.php b/vendor/totpsclasslib/src/Hook/AbstractHook.php new file mode 100644 index 0000000..92268db --- /dev/null +++ b/vendor/totpsclasslib/src/Hook/AbstractHook.php @@ -0,0 +1,76 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * + * @version develop + */ + +namespace Stripe_officialClasslib\Hook; + +use Stripe_officialClasslib\Extensions\AbstractModuleExtension; +use Stripe_officialClasslib\Module; +use Stripe_officialClasslib\Utils\Translate\TranslateTrait; + +abstract class AbstractHook +{ + use TranslateTrait; + + const AVAILABLE_HOOKS = []; + + /** + * @var Module + */ + protected $module; + + /** + * AbstractExtensionHook constructor. + * + * @param Module $module + */ + public function __construct($module) + { + $this->module = $module; + } + + /** + * Get all available hooks for current object + * + * @return array + */ + public function getAvailableHooks() + { + return static::AVAILABLE_HOOKS; + } + + /** + * Remove first 4 letters of hook function and replace the first letter by lower case + * TODO maybe we should delete this function, because it isn't used + * + * @param string $functionName + * + * @return string + */ + protected function getHookNameFromFunction($functionName) + { + return lcfirst(substr($functionName, 4, strlen($functionName))); + } +} diff --git a/vendor/totpsclasslib/src/Hook/AbstractHookDispatcher.php b/vendor/totpsclasslib/src/Hook/AbstractHookDispatcher.php new file mode 100644 index 0000000..75a97a1 --- /dev/null +++ b/vendor/totpsclasslib/src/Hook/AbstractHookDispatcher.php @@ -0,0 +1,150 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * + * @version develop + */ + +namespace Stripe_officialClasslib\Hook; + +use Stripe_officialClasslib\Hook\AbstractHook; +use Stripe_officialClasslib\Module; + +abstract class AbstractHookDispatcher +{ + protected $hookClasses = []; + + protected $widgetClasses = []; + + private $defaultHooks = [ + 'actionStripe_officialCacheClean', + ]; + + /** + * List of available hooks + * + * @var string[] + */ + protected $availableHooks = []; + + /** + * Hook classes + */ + protected $hooks = []; + + protected $widgets = []; + + /** + * Module + * + * @var Module + */ + protected $module; + + /** + * Init hooks + * + * @param Module $module + */ + public function __construct($module) + { + $this->module = $module; + $this->availableHooks = array_merge($this->availableHooks, $this->defaultHooks); + + foreach ($this->hookClasses as $hookClass) { + /** @var AbstractHook $hook */ + $hook = new $hookClass($this->module); + $this->availableHooks = array_merge($this->availableHooks, $hook->getAvailableHooks()); + $this->hooks[] = $hook; + } + + foreach ($this->widgetClasses as $widgetClass) { + /** @var AbstractWidget $widgetClass */ + $widget = new $widgetClass($this->module); + $this->widgets[] = $widget; + } + } + + /** + * Get available hooks + * + * @return string[] + */ + public function getAvailableHooks() + { + return $this->availableHooks; + } + + /** + * Find hook or widget and dispatch it + * + * @param string $hookName + * @param array $params + * + * @return mixed|void + */ + public function dispatch($hookName, array $params = []) + { + $hookName = preg_replace('~^hook~', '', $hookName); + $hookName = lcfirst($hookName); + + if (!empty($hookName)) { + foreach ($this->hooks as $hook) { + if (is_callable([$hook, $hookName])) { + return call_user_func([$hook, $hookName], $params); + } + } + } + + foreach ($this->widgets as $widget) { + if (!isset($params['action'])) { + continue; + } + + if (is_callable([$widget, $params['action']])) { + return call_user_func([$widget, $params['action']], $hookName, $params); + } + } + + return null; + } + + /** + * Get hook classes + * + * @return array + */ + public function getHookClasses() + { + return $this->hookClasses; + } + + /** + * Get widget classes + * + * @return array + */ + public function getWidgetClasses() + { + return $this->widgetClasses; + } +} diff --git a/vendor/totpsclasslib/src/Install/AbstractInstaller.php b/vendor/totpsclasslib/src/Install/AbstractInstaller.php index a2246ab..30cbc42 100644 --- a/vendor/totpsclasslib/src/Install/AbstractInstaller.php +++ b/vendor/totpsclasslib/src/Install/AbstractInstaller.php @@ -1,22 +1,46 @@ + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * + * @version develop + */ namespace Stripe_officialClasslib\Install; - -use \Configuration; -use \Db; -use \DbQuery; -use \Language; -use \Tab; -use \Tools; -use Stripe_officialClasslib\Db\ObjectModelExtension; +use Stripe_officialClasslib\Database\ForeignKey\ForeignKeyHandler; +use Stripe_officialClasslib\Database\ObjectModelExtension; +use Stripe_officialClasslib\Module; +use Stripe_officialClasslib\Registry; +use Db; +use DbQuery; +use Language; +use Tab; abstract class AbstractInstaller { //region Fields /** - * @var \Stripe_official + * @var Module */ protected $module; @@ -44,24 +68,28 @@ public function __construct($module) /** * Get hooks used in module/extension + * * @return array */ abstract public function getHooks(); /** * Get admin controllers used in module/extension + * * @return array */ abstract public function getAdminControllers(); /** * Get object models used in module/extension + * * @return array */ abstract public function getObjectModels(); /** - * @param \Stripe_official $module + * @param Module $module + * * @return $this */ public function setModule($module) @@ -73,6 +101,7 @@ public function setModule($module) /** * @return bool + * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -87,6 +116,7 @@ public function install() /** * @return bool + * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -99,11 +129,14 @@ public function uninstall() } //TODO + /** * Used only if merchant choose to keep data on modal in Prestashop 1.6 * - * @param Stripe_official $module + * @param Module $module + * * @return bool + * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -120,6 +153,7 @@ public function reset($module) /** * Register hooks used by our module + * * @return bool */ public function registerHooks() @@ -128,14 +162,16 @@ public function registerHooks() return true; } - return array_product(array_map(array($this->module, 'registerHook'), $this->getHooks())); + return array_product(array_map([$this->module, 'registerHook'], $this->getHooks())); } //TODO + /** * Clear hooks used by our module * * @return bool + * * @throws \PrestaShopException */ public function clearHookUsed() @@ -150,7 +186,7 @@ public function clearHookUsed() if (false === is_array($this->getHooks())) { // If $module->hooks is not defined or is not an array - $this->hooks = array(); + $this->hooks = []; } foreach ($this->getHooks() as $hook) { @@ -175,6 +211,7 @@ public function clearHookUsed() * Retrieve hooks used by our module * * @return array + * * @throws \PrestaShopDatabaseException */ public function getHooksUsed() @@ -189,7 +226,7 @@ public function getHooksUsed() $results = Db::getInstance()->executeS($query); if (empty($results)) { - return array(); + return []; } return array_column($results, 'name'); @@ -199,6 +236,7 @@ public function getHooksUsed() * Add Tabs for our ModuleAdminController * * @return bool + * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -211,8 +249,16 @@ public function installAdminControllers() return $result; } + Tab::disableCache(); + (new Tab())->cleanPositions(0); // fix parent tab positions + foreach ($this->getAdminControllers() as $tabData) { - if (Tab::getIdFromClassName($tabData['class_name'])) { + if ($tabId = Tab::getIdFromClassName($tabData['class_name'])) { + $tabObj = new Tab($tabId); + if (isset($tabData['position'])) { + $tabObj->updatePosition('- 1', $tabData['position']); + $tabObj->cleanPositions($tabObj->id_parent); + } $result &= true; continue; } @@ -222,7 +268,7 @@ public function installAdminControllers() $parentClassName = 'AdminPreferences'; } /** 3 levels available on 1.7+ */ - $defaultTabLevel1 = array('SELL', 'IMPROVE', 'CONFIGURE', 'DEFAULT'); + $defaultTabLevel1 = ['SELL', 'IMPROVE', 'CONFIGURE', 'DEFAULT']; if (in_array($parentClassName, $defaultTabLevel1) && version_compare(_PS_VERSION_, '1.7', '<')) { continue; } @@ -257,6 +303,10 @@ public function installAdminControllers() $tab->icon = $tabData['icon']; // For Prestashop 1.7 } $result &= (bool)$tab->add(); + if (isset($tabData['position'])) { + $tab->updatePosition('- 1', $tabData['position']); + $tab->cleanPositions($tab->id_parent); + } } return $result; @@ -266,6 +316,7 @@ public function installAdminControllers() * Delete Tabs of our ModuleAdminController * * @return bool + * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -274,7 +325,7 @@ public function uninstallModuleAdminControllers() $query = new DbQuery(); $query->select('*'); $query->from('tab'); - $query->where('module = \''.pSQL($this->module->name).'\''); + $query->where('module = \'' . pSQL($this->module->name) . '\''); $tabs = Db::getInstance()->executeS($query); @@ -287,6 +338,7 @@ public function uninstallModuleAdminControllers() $tab = new Tab((int)$tabData['id_tab']); $result &= (bool)$tab->delete(); } + return $result; } @@ -301,14 +353,30 @@ public function installObjectModels() return true; } - return array_product(array_map(array($this, 'installObjectModel'), $this->getObjectModels())); + $installResult = array_product(array_map([$this, 'installObjectModel'], $this->getObjectModels())); + + $installResult &= $this->setCheckForeignKey(false); + + if (!empty(Registry::get('tables'))) { + $tables = Registry::get('tables'); + foreach ($tables as $tableDefinition) { + $foreignKeyHandler = new ForeignKeyHandler($tableDefinition); + $installResult &= $foreignKeyHandler->handle(); + } + } + + $installResult &= $this->setCheckForeignKey(true); + + return $installResult; } /** * Install model * * @param string $objectModelClassName + * * @return bool + * * @throws \Exception */ public function installObjectModel($objectModelClassName) @@ -317,13 +385,7 @@ public function installObjectModel($objectModelClassName) throw new \Exception('Installer error : ModelObject "' . $objectModelClassName . '" not found'); } - /** @var \ObjectModel $objectModel */ - $objectModel = new $objectModelClassName(); - - $objectModelExtended = new ObjectModelExtension( - $objectModel, - Db::getInstance() - ); + $objectModelExtended = new ObjectModelExtension($objectModelClassName); return $objectModelExtended->install(); } @@ -339,14 +401,18 @@ public function uninstallObjectModels() return true; } - return array_product(array_map(array($this, 'uninstallObjectModel'), $this->getObjectModels())); + return $this->setCheckForeignKey(false) + && array_product(array_map([$this, 'uninstallObjectModel'], $this->getObjectModels())) + && $this->setCheckForeignKey(true); } /** * Uninstall model * * @param string $objectModelClassName + * * @return bool + * * @throws \Exception */ public function uninstallObjectModel($objectModelClassName) @@ -355,14 +421,13 @@ public function uninstallObjectModel($objectModelClassName) throw new \Exception('Installer error : ModelObject "' . $objectModelClassName . '" not found'); } - /** @var \ObjectModel $objectModel */ - $objectModel = new $objectModelClassName(); - - $objectModelExtended = new ObjectModelExtension( - $objectModel, - Db::getInstance() - ); + $objectModelExtended = new ObjectModelExtension($objectModelClassName); return $objectModelExtended->uninstall(); } + + private function setCheckForeignKey(bool $check) + { + return Db::getInstance()->Execute('SET FOREIGN_KEY_CHECKS = ' . (int)$check); + } } diff --git a/vendor/totpsclasslib/src/Install/ExtensionInstaller.php b/vendor/totpsclasslib/src/Install/ExtensionInstaller.php index c161b05..32eefee 100644 --- a/vendor/totpsclasslib/src/Install/ExtensionInstaller.php +++ b/vendor/totpsclasslib/src/Install/ExtensionInstaller.php @@ -1,18 +1,40 @@ + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * + * @version develop + */ namespace Stripe_officialClasslib\Install; - -use \Module; -use \Db; -use \DbQuery; -use \PrestaShopDatabaseException; -use \PrestaShopException; -use \Tab; -use \Language; -use Stripe_officialClasslib\Db\ObjectModelExtension; +use Stripe_officialClasslib\Database\ObjectModelExtension; use Stripe_officialClasslib\Extensions\AbstractModuleExtension; - +use Db; +use DbQuery; +use Language; +use Module; +use PrestaShopDatabaseException; +use PrestaShopException; +use Tab; class ExtensionInstaller extends AbstractInstaller { @@ -31,11 +53,21 @@ public function __construct($module, $extension = null) $this->extension = $extension; } + public function install() + { + return parent::install() && $this->extension->install(); + } + + public function uninstall() + { + return parent::uninstall() && $this->extension->uninstall(); + } //region Get-Set /** * @return array + * * @throws PrestaShopException */ public function getHooks() @@ -49,6 +81,7 @@ public function getHooks() /** * @return array + * * @throws PrestaShopException */ public function getAdminControllers() @@ -57,11 +90,12 @@ public function getAdminControllers() throw new PrestaShopException('Extension is null, can\'t get extension\'s admin controllers'); } - return $this->extension->extensionAdminControllers; + return $this->extension->getExtensionAdminControllers(); } /** * @return array + * * @throws PrestaShopException */ public function getObjectModels() @@ -83,6 +117,7 @@ public function getExtension() /** * @param AbstractModuleExtension $extension + * * @return ExtensionInstaller */ public function setExtension($extension) @@ -93,4 +128,4 @@ public function setExtension($extension) } //endregion -} \ No newline at end of file +} diff --git a/vendor/totpsclasslib/src/Install/Installer.php b/vendor/totpsclasslib/src/Install/Installer.php deleted file mode 100644 index 1e96d37..0000000 --- a/vendor/totpsclasslib/src/Install/Installer.php +++ /dev/null @@ -1,508 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version release/2.1.0 - */ - -namespace Stripe_officialClasslib\Install; - -use Stripe_officialClasslib\Db\ObjectModelExtension; - -use \Db; -use \DbQuery; -use \Tools; -use \Tab; -use \Language; -use \Configuration; - -/** - * @deprecated Since v2.1 - * Class Installer - */ -class Installer -{ - /** - * @var Stripe_official - */ - protected $module; - - /** - * @param Stripe_official $module - * @return $this - */ - public function setModule($module) - { - $this->module = $module; - - return $this; - } - - /** - * @param Stripe_official $module - * @return bool - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException - */ - public function install($module) - { - $this->module = $module; - $result = $this->registerHooks(); - $result &= $this->registerOrderStates(); - $result &= $this->installObjectModels(); - $result &= $this->installModuleAdminControllers(); - - return $result; - } - - /** - * @param Stripe_official $module - * @return bool - * @throws \Exception - */ - public function checkPhpVersion($module) - { - if (empty($module->php_version_required)) { - return true; - } - - $phpVersion = Tools::checkPhpVersion(); - - if (Tools::version_compare($phpVersion, $module->php_version_required, '<')) { - throw new \Exception(sprintf( - '[%s] This module requires at least PHP %s or newer versions.', - $module->name, - $module->php_version_required - )); - } - - return true; - } - - /** - * @param Stripe_official $module - * @return bool - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException - */ - public function uninstall($module) - { - $this->module = $module; - $result = $this->uninstallObjectModels(); - $result &= $this->uninstallModuleAdminControllers(); - $result &= $this->uninstallConfiguration(); - $result &= $this->unregisterOrderStates(); - - return $result; - } - - /** - * Used only if merchant choose to keep data on modal in Prestashop 1.6 - * - * @param Stripe_official $module - * @return bool - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException - */ - public function reset($module) - { - $this->module = $module; - $result = $this->clearHookUsed(); - $result &= $this->installObjectModels(); - $result &= $this->uninstallModuleAdminControllers(); - $result &= $this->installModuleAdminControllers(); - - return $result; - } - - /** - * Register hooks used by our module - * @return bool - */ - public function registerHooks() - { - if (empty($this->module->hooks)) { - return true; - } - - return array_product(array_map(array($this->module, 'registerHook'), $this->module->hooks)); - } - - /** - * Clear hooks used by our module - * - * @return bool - * @throws \PrestaShopException - */ - public function clearHookUsed() - { - $result = true; - $hooksUsed = $this->getHooksUsed(); - - if (empty($hooksUsed) && empty($this->module->hooks)) { - // Both are empty, no need to continue process - return $result; - } - - if (false === is_array($this->module->hooks)) { - // If $module->hooks is not defined or is not an array - $this->module->hooks = array(); - } - - foreach ($this->module->hooks as $hook) { - if (false === in_array($hook, $hooksUsed, true)) { - // If hook is not registered, do it - $result &= $this->module->registerHook($hook); - } - } - - foreach ($hooksUsed as $hookUsed) { - if (false === in_array($hookUsed, $this->module->hooks, true)) { - // If hook is registered by module but is not used anymore - $result &= $this->module->unregisterHook($hookUsed); - $result &= $this->module->unregisterExceptions($hookUsed); - } - } - - return $result; - } - - /** - * Retrieve hooks used by our module - * - * @return array - */ - public function getHooksUsed() - { - $query = new DbQuery(); - $query->select('h.name'); - $query->from('hook', 'h'); - $query->innerJoin('hook_module', 'hm', 'hm.id_hook = h.id_hook'); - $query->where('hm.id_module = ' . (int)$this->module->id); - $query->groupBy('h.name'); - - $results = Db::getInstance()->executeS($query); - - if (empty($results)) { - return array(); - } - - return array_column($results, 'name'); - } - - /** - * Add Tabs for our ModuleAdminController - * - * @return bool - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException - */ - public function installModuleAdminControllers() - { - $result = true; - - if (empty($this->module->moduleAdminControllers)) { - // If module has no ModuleAdminController to install - return $result; - } - - foreach ($this->module->moduleAdminControllers as $tabData) { - if (Tab::getIdFromClassName($tabData['class_name'])) { - $result &= true; - continue; - } - - $parentClassName = $tabData['parent_class_name']; - if ($parentClassName == 'ShopParameters' && version_compare(_PS_VERSION_, '1.7', '<')) { - $parentClassName = 'AdminPreferences'; - } - /** 3 levels available on 1.7+ */ - $defaultTabLevel1 = array('SELL', 'IMPROVE', 'CONFIGURE', 'DEFAULT'); - if (in_array($parentClassName, $defaultTabLevel1) && version_compare(_PS_VERSION_, '1.7', '<')) { - continue; - } - if ($tabData['class_name'] == 'stripe_official' && version_compare(_PS_VERSION_, '1.7', '<')) { - $parentClassName = 'AdminParentModulesSf'; - $tabData['parent_class_name'] = 'AdminParentModulesSf'; - $tabData['visible'] = true; - } - - $tab = new Tab(); - $parentId = (int)Tab::getIdFromClassName($parentClassName); - if (!empty($parentId)) { - $tab->id_parent = $parentId; - } - $tab->class_name = $tabData['class_name']; - $tab->module = $this->module->name; - - foreach (Language::getLanguages(false) as $language) { - if (empty($tabData['name'][$language['iso_code']])) { - $tab->name[$language['id_lang']] = $tabData['name']['en']; - } else { - $tab->name[$language['id_lang']] = $tabData['name'][$language['iso_code']]; - } - } - - $tab->active = true; - if (isset($tabData['visible'])) { - $tab->active = $tabData['visible']; - } - - if (isset($tabData['icon']) && property_exists('Tab', 'icon')) { - $tab->icon = $tabData['icon']; // For Prestashop 1.7 - } - - $result &= (bool)$tab->add(); - } - return $result; - } - - /** - * Delete Tabs of our ModuleAdminController - * - * @return bool - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException - */ - public function uninstallModuleAdminControllers() - { - $query = new DbQuery(); - $query->select('*'); - $query->from('tab'); - $query->where('module = \''.pSQL($this->module->name).'\''); - - $tabs = Db::getInstance()->executeS($query); - - if (empty($tabs)) { - return true; - } - - $result = true; - foreach ($tabs as $tabData) { - $tab = new Tab((int)$tabData['id_tab']); - $result &= (bool)$tab->delete(); - } - return $result; - } - - /** - * Install all our \ObjectModel - * - * @return bool - */ - public function installObjectModels() - { - if (empty($this->module->objectModels)) { - return true; - } - - return array_product(array_map(array($this, 'installObjectModel'), $this->module->objectModels)); - } - - /** - * Install model - * - * @param string $objectModelClassName - * @return bool - * @throws \Exception - */ - public function installObjectModel($objectModelClassName) - { - if (!preg_match("/^[a-zA-Z0-9]+$/", $objectModelClassName)) { - throw new \Exception('Installer error : ModelObject "' . $objectModelClassName . - '" class name not valid "'); - } - $objectModelPath = _PS_MODULE_DIR_ . 'stripe_official/classes/'.$objectModelClassName.'.php'; - if (file_exists($objectModelPath)) { - require_once $objectModelPath; - } else { - throw new \Exception('Installer error : ModelObject "' . $objectModelClassName . - '" not found or file "' . $objectModelPath . - '" doesn\'t exist. Please check a typo ?'); - } - - /** @var \ObjectModel $objectModel */ - $objectModel = new $objectModelClassName(); - - $objectModelExtended = new ObjectModelExtension( - $objectModel, - Db::getInstance() - ); - - return $objectModelExtended->install(); - } - - /** - * Uninstall models - * - * @return bool - */ - public function uninstallObjectModels() - { - if (empty($this->module->objectModels)) { - return true; - } - - return array_product(array_map(array($this, 'uninstallObjectModel'), $this->module->objectModels)); - } - - /** - * Uninstall model - * - * @param string $objectModelClassName - * @return bool - * @throws \Exception - */ - public function uninstallObjectModel($objectModelClassName) - { - if (!preg_match("/^[a-zA-Z]+$/", $objectModelClassName)) { - throw new \Exception('Installer error : ModelObject "' . $objectModelClassName . - '" class name not valid "'); - } - $objectModelPath = _PS_MODULE_DIR_ . 'stripe_official/classes/'.$objectModelClassName.'.php'; - if (file_exists($objectModelPath)) { - require_once $objectModelPath; - } else { - throw new \Exception('Installer error : ModelObject "' . $objectModelClassName . - '" not found or file "' . $objectModelPath . - '" doesn\'t exist. Please check a typo ?'); - } - - /** @var \ObjectModel $objectModel */ - $objectModel = new $objectModelClassName(); - - $objectModelExtended = new ObjectModelExtension( - $objectModel, - Db::getInstance() - ); - - return $objectModelExtended->uninstall(); - } - - /** - * Uninstall Configuration (with or without language management) - * - * @return bool - */ - public function uninstallConfiguration() - { - $query = new DbQuery(); - $query->select('name'); - $query->from('configuration'); - $query->where('name LIKE \''.pSQL(Tools::strtoupper($this->module->name)).'_%\''); - - $results = Db::getInstance()->executeS($query); - - if (empty($results)) { - return true; - } - - $configurationKeys = array_column($results, 'name'); - - $result = true; - foreach ($configurationKeys as $configurationKey) { - $result &= Configuration::deleteByName($configurationKey); - } - - return $result; - } - - /** - * Register Order State : create new order state for this module - * - * @return bool - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException - */ - public function registerOrderStates() - { - if (empty($this->module->orderStates)) { - return true; - } - - $result = true; - foreach ($this->module->orderStates as $configurationName => $orderStateParams) { - $orderState = new OrderState(); - foreach ($orderStateParams as $key => $value) { - if ($key !== 'name' && property_exists($orderState, $key)) { - $orderState->$key = $value; - } - if ($key === 'name') { - foreach (Language::getLanguages(false) as $language) { - if (empty($value[$language['iso_code']])) { - $orderState->name[$language['id_lang']] = $value['en']; - } else { - $orderState->name[$language['id_lang']] = $value[$language['iso_code']]; - } - } - } - } - $orderState->module_name = $this->module->name; - $result &= (bool)$orderState->save(); - Configuration::updateValue($configurationName, $orderState->id); - } - - return $result; - } - - /** - * Unregister Order State : mark them as deleted - * - * @return bool - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException - */ - public function unregisterOrderStates() - { - if (empty($this->module->orderStates)) { - return true; - } - - $query = new DbQuery(); - $query->select('id_order_state'); - $query->from('order_state'); - $query->where('module_name = \''.pSQL($this->module->name).'\''); - - $orderStateData = Db::getInstance()->executeS($query); - - if (empty($orderStateData)) { - return true; - } - - $result = true; - foreach ($orderStateData as $data) { - $query = new DbQuery(); - $query->select('1'); - $query->from('orders'); - $query->where('current_state = '.$data['id_order_state']); - $isUsed = (bool)Db::getInstance()->getValue($query); - $orderState = new OrderState($data['id_order_state']); - if ($isUsed) { - $orderState->deleted = true; - $result &= (bool)$orderState->save(); - } else { - $result &= (bool)$orderState->delete(); - } - } - - return $result; - } -} diff --git a/vendor/totpsclasslib/src/Install/ModuleInstaller.php b/vendor/totpsclasslib/src/Install/ModuleInstaller.php index 9512823..f7c6421 100644 --- a/vendor/totpsclasslib/src/Install/ModuleInstaller.php +++ b/vendor/totpsclasslib/src/Install/ModuleInstaller.php @@ -1,20 +1,45 @@ + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * + * @version develop + */ namespace Stripe_officialClasslib\Install; -use \Configuration; -use \Db; -use \DbQuery; -use \Language; -use \OrderState; -use \Tools; use Stripe_officialClasslib\Install\AbstractInstaller; use Stripe_officialClasslib\Install\ExtensionInstaller; +use Configuration; +use Db; +use DbQuery; +use Language; +use OrderState; +use Tools; class ModuleInstaller extends AbstractInstaller { /** * @return bool + * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -29,6 +54,7 @@ public function install() /** * @return bool + * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -44,6 +70,7 @@ public function uninstall() /** * @return bool + * * @throws \Exception */ public function checkPhpVersion() @@ -55,11 +82,7 @@ public function checkPhpVersion() $phpVersion = Tools::checkPhpVersion(); if (Tools::version_compare($phpVersion, $this->module->php_version_required, '<')) { - throw new \Exception(sprintf( - '[%s] This module requires at least PHP %s or newer versions.', - $this->module->name, - $this->module->php_version_required - )); + throw new \Exception(sprintf('[%s] This module requires at least PHP %s or newer versions.', $this->module->name, $this->module->php_version_required)); } return true; @@ -69,6 +92,7 @@ public function checkPhpVersion() * Uninstall Configuration (with or without language management) * * @return bool + * * @throws \PrestaShopDatabaseException */ public function uninstallConfiguration() @@ -98,6 +122,7 @@ public function uninstallConfiguration() * Register Order State : create new order state for this module * * @return bool + * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -136,6 +161,7 @@ public function registerOrderStates() * Unregister Order State : mark them as deleted * * @return bool + * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -183,12 +209,14 @@ public function installExtensions() return true; } - return array_product(array_map(array($this, 'installExtension'), $this->module->extensions)); + return array_product(array_map([$this, 'installExtension'], $this->module->extensions)); } /** - * @param $extensionName + * @param string $extensionName + * * @return bool + * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -206,12 +234,14 @@ public function uninstallExtensions() return true; } - return array_product(array_map(array($this, 'uninstallExtension'), $this->module->extensions)); + return array_product(array_map([$this, 'uninstallExtension'], $this->module->extensions)); } /** - * @param $extensionName + * @param string $extensionName + * * @return bool + * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -243,4 +273,4 @@ public function getObjectModels() } //endregion -} \ No newline at end of file +} diff --git a/vendor/totpsclasslib/src/Module.php b/vendor/totpsclasslib/src/Module.php new file mode 100644 index 0000000..ab3c07a --- /dev/null +++ b/vendor/totpsclasslib/src/Module.php @@ -0,0 +1,311 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * + * @version develop + */ + +namespace Stripe_officialClasslib; + +use Stripe_officialClasslib\Extensions\AbstractModuleExtension; +use Stripe_officialClasslib\Hook\AbstractHookDispatcher; +use Stripe_officialClasslib\Install\ModuleInstaller; +use PrestaShop\PrestaShop\Core\Module\WidgetInterface; +use ReflectionClass; +use Tools; + +class Module extends \Module +{ + //region Fields + + /** + * List of objectModel used in this Module + * + * @var array + */ + public $objectModels = []; + + /** + * List of hooks used in this Module + * + * @var array + */ + public $hooks = []; + + /** + * @var array + */ + public $extensions = []; + + /** + * @var AbstractHookDispatcher + */ + protected $hookDispatcher = null; + + /** + * List of AdminControllers used in this Module + * + * @var array + */ + public $moduleAdminControllers = []; + + /** + * @var string + */ + public $secure_key; + + /** + * @var array + */ + public $cronTasks = []; + + //endregion + + /** + * Module constructor. + */ + public function __construct() + { + parent::__construct(); + foreach ($this->extensions as $extensionName) { + /** @var AbstractModuleExtension $extension */ + $extension = new $extensionName(); + $extension->setModule($this); + $extension->initExtension(); + $this->hooks = array_merge($this->hooks, $extension->hooks); + } + } + + /** + * Install Module + * + * @return bool + * + * @throws \PrestaShopException + */ + public function install() + { + $installer = new ModuleInstaller($this); + + $isPhpVersionCompliant = false; + + try { + $isPhpVersionCompliant = $installer->checkPhpVersion(); + } catch (\Exception $e) { + $this->_errors[] = Tools::displayError($e->getMessage()); + } + + return $isPhpVersionCompliant && parent::install() && $installer->install(); + } + + /** + * Uninstall Module + * + * @return bool + * + * @throws \PrestaShopDatabaseException + * @throws \PrestaShopException + */ + public function uninstall() + { + $installer = new ModuleInstaller($this); + + return parent::uninstall() && $installer->uninstall(); + } + + /** + * @TODO Reset Module only if merchant choose to keep data on modal + * + * @return bool + * + * @throws \PrestaShopDatabaseException + * @throws \PrestaShopException + */ + public function reset() + { + $installer = new ModuleInstaller($this); + + return $installer->reset($this); + } + + /** + * Handle module extension hook call + * + * @param string $hookName + * @param array $params + * + * @return array|bool|string + */ + public function handleExtensionsHook($hookName, $params) + { + $result = false; + $hookDispatcher = $this->getHookDispatcher(); + + // execute module hooks + if ($hookDispatcher != null) { + $moduleHookResult = $hookDispatcher->dispatch($hookName, $params); + if ($moduleHookResult != null) { + $result = $moduleHookResult; + } + } + + //execute extension's hooks + if (!isset($this->extensions) || empty($this->extensions)) { + if (!$result) { + return false; + } + } + + foreach ($this->extensions as $extension) { + /** @var AbstractModuleExtension $extension */ + $extension = new $extension($this); + $hookResult = null; + if (is_callable([$extension, $hookName])) { + $hookResult = $extension->{$hookName}($params); + //TODO + } elseif (is_callable([$extension, 'getHookDispatcher']) && $extension->getHookDispatcher() != null) { + $hookResult = $extension->getHookDispatcher()->dispatch($hookName, $params); + } + if ($hookResult != null) { + if ($result === false) { + $result = $hookResult; + } elseif (is_array($hookResult) && $result !== false) { + $result = array_merge($result, $hookResult); + } else { + $result .= $hookResult; + } + } + } + + return $result; + } + + /** + * Handle module widget call + * + * @param string $action + * @param string $method + * @param string $hookName + * @param array $configuration + * + * @return bool + * + * @throws \ReflectionException + * + * @deprecated use render widget function + */ + public function handleWidget($action, $method, $hookName, $configuration) + { + if (!isset($this->extensions) || empty($this->extensions)) { + return false; + } + + foreach ($this->extensions as $extension) { + /** @var AbstractModuleExtension $extension */ + $extension = new $extension(); + if (!($extension instanceof WidgetInterface)) { + continue; + } + $extensionClass = (new ReflectionClass($extension))->getShortName(); + if ($extensionClass != $action) { + continue; + } + $extension->setModule($this); + if (is_callable([$extension, $method])) { + return $extension->{$method}($hookName, $configuration); + } + } + + return false; + } + + /** + * @param string $hookName + * @param array $configuration + * + * @return bool + * + * @throws \ReflectionException + */ + public function renderWidget($hookName, array $configuration) + { + $hookDispatcher = $this->getHookDispatcher(); + // render module widgets + if ($hookDispatcher != null) { + $moduleWidgetResult = $hookDispatcher->dispatch($hookName, $configuration); + if ($moduleWidgetResult != null) { + return $moduleWidgetResult; + } + } + + // render extensions widget if module widget isn't found + if (!isset($this->extensions) || empty($this->extensions)) { + return false; + } + + foreach ($this->extensions as $extension) { + /** @var AbstractModuleExtension $extension */ + $extension = new $extension($this); + + if (is_callable([$extension, 'getHookDispatcher']) && $extension->getHookDispatcher() != null) { + $extensionWidgetResult = $extension->getHookDispatcher()->dispatch($hookName, $configuration); + if (is_null($extensionWidgetResult)) { + continue; + } + + return $extensionWidgetResult; + } + } + + //if we want to use an old approach + return $this->handleWidget($configuration['action'], __FUNCTION__, $hookName, $configuration); + } + + /** + * @param string $hookName + * @param array $configuration + * + * @return array|bool + */ + public function getWidgetVariables($hookName, array $configuration) + { + return []; + } + + /** + * Get the current module hook/widget dispatcher + * + * @return AbstractHookDispatcher|null + */ + public function getHookDispatcher() + { + return $this->hookDispatcher; + } + + /** + * @return string|null + */ + public function getPath() + { + return $this->_path; + } +} diff --git a/vendor/totpsclasslib/src/Registry.php b/vendor/totpsclasslib/src/Registry.php index dfa4cd7..390cc6d 100644 --- a/vendor/totpsclasslib/src/Registry.php +++ b/vendor/totpsclasslib/src/Registry.php @@ -20,7 +20,8 @@ * @author 202-ecommerce * @copyright Copyright (c) 202-ecommerce * @license Commercial license - * @version release/2.1.0 + * + * @version develop */ namespace Stripe_officialClasslib; @@ -30,35 +31,36 @@ */ class Registry { - /** - * @var Stripe_officialClasslib\Registry $_registry Instance of this class + * @var Registry Instance of this class */ private static $_registry = null; /** - * @var array $values + * @var array */ - private $values = array(); - + private $values = []; + /** * Get instance of this class * - * @return Stripe_officialClasslib\Registry + * @return Registry */ public static function getInstance() { if (self::$_registry === null) { - self::$_registry = new Registry; + self::$_registry = new Registry(); } + return self::$_registry; } - + /** * Get a variable in the Registry * * @param string $index - * @return bool + * + * @return mixed */ public static function get($index) { @@ -66,25 +68,27 @@ public static function get($index) if (!$instance->offsetExists($index)) { return false; } + return $instance->values[$index]; } - + /** * Set a variable in the Registry * * @param string $index - * @param string $value + * @param string|array $value */ public static function set($index, $value) { $instance = self::getInstance(); - $instance->values[$index]= $value; + $instance->values[$index] = $value; } /** * Check if var exist in the registry * * @param string $index + * * @return bool */ public static function isRegistered($index) @@ -92,6 +96,7 @@ public static function isRegistered($index) if (self::$_registry === null) { return false; } + return self::$_registry->offsetExists($index); } @@ -99,6 +104,7 @@ public static function isRegistered($index) * Check if offsetExists * * @param string $index + * * @return bool */ public function offsetExists($index) @@ -106,9 +112,10 @@ public function offsetExists($index) if (false === isset($this->values)) { return false; } + return array_key_exists($index, $this->values); } - + /** * Increment a counter in the Registry * @@ -124,7 +131,7 @@ public static function increment($index, $value = 1) $instance->values[$index] = $value; } } - + /** * Decrement a counter in the Registry * diff --git a/vendor/totpsclasslib/src/Utils/Translate/TranslateTrait.php b/vendor/totpsclasslib/src/Utils/Translate/TranslateTrait.php new file mode 100644 index 0000000..fb79e90 --- /dev/null +++ b/vendor/totpsclasslib/src/Utils/Translate/TranslateTrait.php @@ -0,0 +1,66 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * + * @version develop + */ + +namespace Stripe_officialClasslib\Utils\Translate; + +use Translate; + +trait TranslateTrait +{ + /** + * Translation method for classes that use this trait + * + * @param string $textToTranslate + * @param string $class + * @param bool $addslashes + * @param bool $htmlentities + * + * @return mixed + */ + protected function l($textToTranslate, $class = '', $addslashes = false, $htmlentities = true) + { + if (empty($class) === true) { + $class = $this->getClassShortName(); + } + + return Translate::getModuleTranslation('stripe_official', $textToTranslate, $class); + } + + /** + * @return string + * + * @throws \ReflectionException + */ + protected function getClassShortName() + { + return (new \ReflectionClass($this))->getShortName(); + } + + protected function trans($id, array $parameters = [], $domain = null, $locale = null) + { + return \Context::getContext()->getTranslator()->trans($id, $parameters, $domain, $locale); + } +} From 669b6e8cad544d54fdaec57f6a1599971b06f0b8 Mon Sep 17 00:00:00 2001 From: afayadas Date: Thu, 7 Oct 2021 16:41:30 +0200 Subject: [PATCH 16/62] refs #31037 : adding upgrader for 2.4.0 version --- upgrade/Upgrade-2.4.0.php | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 upgrade/Upgrade-2.4.0.php diff --git a/upgrade/Upgrade-2.4.0.php b/upgrade/Upgrade-2.4.0.php new file mode 100755 index 0000000..ebe3052 --- /dev/null +++ b/upgrade/Upgrade-2.4.0.php @@ -0,0 +1,40 @@ + + * @copyright Copyright (c) Stripe + * @license Commercial license + */ + +if (!defined('_PS_VERSION_')) { + exit; +} + +function upgrade_module_2_4_0($module) +{ + $installer = new Stripe_officialClasslib\Install\ModuleInstaller($module); + + if (!$installer->installObjectModels()) { + return false; + } + + return true; +} From fd07133a645c9388077feaf036538a6438ecf43e Mon Sep 17 00:00:00 2001 From: afayadas Date: Thu, 7 Oct 2021 16:42:33 +0200 Subject: [PATCH 17/62] refs #31037 : fixing upgraders from 1.3.0 and 2.3.0 versions --- upgrade/Upgrade-1.3.0.php | 20 +++++++++++++++++--- upgrade/Upgrade-2.3.0.php | 4 ++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/upgrade/Upgrade-1.3.0.php b/upgrade/Upgrade-1.3.0.php index ebd04f2..0f0923f 100644 --- a/upgrade/Upgrade-1.3.0.php +++ b/upgrade/Upgrade-1.3.0.php @@ -29,9 +29,23 @@ function upgrade_module_1_3_0() { - $sql = 'ALTER TABLE '._DB_PREFIX_.'stripe_payment ADD state tinyint(4) NOT NULL'; - if (!Db::getInstance()->execute($sql)) { - return false; + $alter_stripe_payment_table = true; + $result = Db::getInstance()->executeS('SHOW FIELDS FROM '._DB_PREFIX_.'stripe_payment'); + + if (!empty($result)) { + foreach ($result as $res) { + if ($res['Field'] == 'id_account') { + $alter_stripe_payment_table = false; + } + } + + if ($alter_stripe_payment_table === true) { + $sql = 'ALTER TABLE '._DB_PREFIX_.'stripe_payment ADD state tinyint(4) NOT NULL'; + if (!Db::getInstance()->execute($sql)) { + return false; + } + } } + return true; } diff --git a/upgrade/Upgrade-2.3.0.php b/upgrade/Upgrade-2.3.0.php index cf77728..dcea10f 100644 --- a/upgrade/Upgrade-2.3.0.php +++ b/upgrade/Upgrade-2.3.0.php @@ -57,11 +57,11 @@ function upgrade_module_2_3_0($module) if (!empty($result)) { foreach ($result as $res) { if ($res['Field'] == 'id_account') { - $alter_stripe_payment_table = false; + $alter_stripe_customer_table = false; } } - if ($alter_stripe_payment_table === true) { + if ($alter_stripe_customer_table === true) { $sql = 'ALTER TABLE '._DB_PREFIX_.'stripe_customer ADD id_account varchar(255) AFTER stripe_customer_key'; if (!Db::getInstance()->execute($sql)) { From 4ad16a5345d6c61bfddbd49b177589d4a46e75a1 Mon Sep 17 00:00:00 2001 From: afayadas Date: Thu, 7 Oct 2021 16:43:39 +0200 Subject: [PATCH 18/62] refs #31037 : refactoring webhook controller code --- controllers/front/webhook.php | 267 ++++++++++++++++++++++++---------- 1 file changed, 194 insertions(+), 73 deletions(-) diff --git a/controllers/front/webhook.php b/controllers/front/webhook.php index 7d13af3..64ea6b6 100755 --- a/controllers/front/webhook.php +++ b/controllers/front/webhook.php @@ -23,6 +23,9 @@ * @license Commercial license */ +use Stripe\Exception\SignatureVerificationException; +use Stripe\Stripe; +use Stripe\Webhook; use Stripe_officialClasslib\Actions\ActionsHandler; use Stripe_officialClasslib\Extensions\ProcessLogger\ProcessLoggerHandler; @@ -86,94 +89,188 @@ protected function canonicalRedirection($canonical_url = '') public function postProcess() { + // Retrieve secret API key $secret_key = $this->module->getSecretKey(); - ProcessLoggerHandler::logInfo($secret_key, null, null, 'webhook'); + // Check API key validity + $this->checkApiKey($secret_key); - try { - \Stripe\Stripe::setApiKey($secret_key); - } catch (Exception $e) { - print_r($e->getMessage()); - ProcessLoggerHandler::logError('setApiKey not ok: ' . $e->getMessage(), null, null, 'webhook'); - ProcessLoggerHandler::closeLogger(); - http_response_code(500); - exit; - } - // Retrieve the request's body and parse it as JSON + // Retrieve payload + $input = @Tools::file_get_contents("php://input"); ProcessLoggerHandler::logInfo( - 'setApiKey ok. Retrieve the request\'s body and parse it as JSON', + '$input => ' . $input, null, null, - 'webhook' + 'webhook - postProcess' ); - $endpoint_secret = Configuration::get(Stripe_official::WEBHOOK_SIGNATURE,null, Stripe_official::getShopGroupIdContext(), Stripe_official::getShopIdContext()); + // Retrieve http signature + $sig_header = $_SERVER['HTTP_STRIPE_SIGNATURE']; + ProcessLoggerHandler::logInfo( + 'set http stripe signature => '.$sig_header, + null, + null, + 'webhook - postProcess' + ); + // Retrieve secret endpoint + $endpoint_secret = Configuration::get(Stripe_official::WEBHOOK_SIGNATURE,null, Stripe_official::getShopGroupIdContext(), Stripe_official::getShopIdContext()); ProcessLoggerHandler::logInfo( 'set endpoint secret => '.$endpoint_secret, null, null, - 'webhook' + 'webhook - postProcess' ); - $input = @Tools::file_get_contents("php://input"); - ProcessLoggerHandler::logInfo('$input => ' . $input, null, null, 'webhook'); - - $sig_header = $_SERVER['HTTP_STRIPE_SIGNATURE']; + // Construct event charge + $event = $this->constructEvent($input, $sig_header, $endpoint_secret); + // Retrieve payment intent + if ($event->type == 'payment_intent.requires_action') { + $paymentIntent = $event->data->object->id; + } else { + $paymentIntent = $event->data->object->payment_intent; + } ProcessLoggerHandler::logInfo( - 'set http stripe signature => '.$sig_header, + 'payment_intent : '.$paymentIntent, null, null, - 'webhook' + 'webhook - postProcess' ); - $event = null; + // Create the handler + $handler = $this->createWebhookHandler($event, $paymentIntent); + + // Handle actions + $this->handleWebhookActions($handler, $event); + + ProcessLoggerHandler::closeLogger(); + exit; + } + + private function checkApiKey($secretKey) + { + try { + ProcessLoggerHandler::logInfo( + $secretKey, + null, + null, + 'webhook - checkApiKey' + ); + + Stripe::setApiKey($secretKey); + // Retrieve the request's body and parse it as JSON + ProcessLoggerHandler::logInfo( + 'setApiKey ok. Retrieve the request\'s body and parse it as JSON', + null, + null, + 'webhook - checkApiKey' + ); + } catch (Exception $e) { + print_r($e->getMessage()); + ProcessLoggerHandler::logError( + 'setApiKey not ok: ' . $e->getMessage(), + null, + null, + 'webhook - checkApiKey' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(500); + exit; + } + } + + private function constructEvent($payload, $sigHeader, $secret) + { try { - $event = \Stripe\Webhook::constructEvent( - $input, - $sig_header, - $endpoint_secret + $event = Webhook::constructEvent( + $payload, + $sigHeader, + $secret ); - } catch (\UnexpectedValueException $e) { + + if (!$event) { + $msg = 'JSON not valid'; + ProcessLoggerHandler::logError( + $msg, + null, + null, + 'webhook - constructEvent' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(500); + echo $msg; + exit; + } + + if (!in_array($event->type, Stripe_official::$webhook_events)) { + $msg = 'webhook "'.$event->type.'" call not yet supported'; + ProcessLoggerHandler::logInfo( + $msg, + null, + null, + 'webhook - constructEvent' + ); + ProcessLoggerHandler::closeLogger(); + echo $msg; + exit; + } + + ProcessLoggerHandler::logInfo( + '$event => ' . $event, + null, + null, + 'webhook - constructEvent' + ); + ProcessLoggerHandler::logInfo( + 'event ' . $event->id . ' retrieved', + null, + null, + 'webhook - constructEvent' + ); + ProcessLoggerHandler::logInfo( + 'event type : ' . $event->type, + null, + null, + 'webhook - constructEvent' + ); + return $event; + } catch (UnexpectedValueException $e) { // Invalid payload - ProcessLoggerHandler::logError('Invalid payload : '.$e->getMessage(), null, null, 'webhook'); + ProcessLoggerHandler::logError( + 'Invalid payload : '.$e->getMessage(), + null, + null, + 'webhook - constructEvent' + ); ProcessLoggerHandler::closeLogger(); http_response_code(400); echo $e->getMessage(); exit(); - } catch (\Stripe\Exception\SignatureVerificationException $e) { + } catch (SignatureVerificationException $e) { // Invalid signature - ProcessLoggerHandler::logError('Invalid signature : '.$e->getMessage(), null, null, 'webhook'); + ProcessLoggerHandler::logError( + 'Invalid signature : '.$e->getMessage(), + null, + null, + 'webhook - constructEvent' + ); ProcessLoggerHandler::closeLogger(); http_response_code(400); echo $e->getMessage(); exit(); } + } - ProcessLoggerHandler::logInfo('$event => ' . $event, null, null, 'webhook'); - ProcessLoggerHandler::logInfo('event ' . $event->id . ' retrieved', null, null, 'webhook'); - ProcessLoggerHandler::logInfo('event type : ' . $event->type, null, null, 'webhook'); - - if (!$event) { - $msg = 'JSON not valid'; - ProcessLoggerHandler::logError($msg, null, null, 'webhook'); - ProcessLoggerHandler::closeLogger(); - http_response_code(500); - echo $msg; - exit; - } - - if (!in_array($event->type, Stripe_official::$webhook_events)) { - $msg = 'webhook "'.$event->type.'" call not yet supported'; - ProcessLoggerHandler::logInfo($msg, null, null, 'webhook'); - ProcessLoggerHandler::closeLogger(); - echo $msg; - exit; - } - - ProcessLoggerHandler::logInfo('starting webhook actions', null, null, 'webhook'); + private function createWebhookHandler($event, $paymentIntent) + { + ProcessLoggerHandler::logInfo( + 'creating webhook handler', + null, + null, + 'webhook - createWebhookHandler' + ); $events_states = array( 'charge.expired' => Configuration::get('PS_OS_CANCELED'), @@ -184,13 +281,6 @@ public function postProcess() 'charge.dispute.created' => Configuration::get(Stripe_official::SEPA_DISPUTE) ); - if ($event->type == 'payment_intent.requires_action') { - $paymentIntent = $event->data->object->id; - } else { - $paymentIntent = $event->data->object->payment_intent; - } - - // Create the handler $handler = new ActionsHandler(); $handler->setConveyor(array( 'event_json' => $event, @@ -200,11 +290,33 @@ public function postProcess() 'paymentIntent' => $paymentIntent, )); - if (($event->type == 'charge.succeeded' && $event->data->object->payment_method_details->type == 'card') - || ($event->type == 'charge.pending' && $event->data->object->payment_method_details->type == 'sepa_debit') - || ($event->type == 'payment_intent.requires_action' && $event->data->object->payment_method_types[0] == 'oxxo')) { - ProcessLoggerHandler::logInfo('payment_intent : '.$paymentIntent, null, null, 'webhook'); - ProcessLoggerHandler::logInfo('$event->type : '.$event->type, null, null, 'webhook'); + return $handler; + } + + private function handleWebhookActions($handler, $event) + { + ProcessLoggerHandler::logInfo( + 'Starting webhook actions', + null, + null, + 'webhook - handleWebhookActions' + ); + + $eventType = $event->type; + $paymentMethodType = $event->data->object->payment_method_details->type; + + if (($eventType == 'charge.succeeded' + && $paymentMethodType == 'card') + || ($eventType == 'charge.pending' + && $paymentMethodType == 'sepa_debit') + || ($eventType == 'payment_intent.requires_action' + && $event->data->object->payment_method_types[0] == 'oxxo')) { + ProcessLoggerHandler::logInfo( + 'Payment method flow without redirection', + null, + null, + 'webhook - handleWebhookActions' + ); $handler->addActions( 'prepareFlowNone', 'updatePaymentIntent', @@ -213,12 +325,17 @@ public function postProcess() 'saveCard', 'addTentative' ); - } elseif (($event->type == 'charge.succeeded' - && Stripe_official::$paymentMethods[$event->data->object->payment_method_details->type]['flow'] == 'redirect' && $event->data->object->payment_method_details->type != 'sofort') - || ($event->type == 'charge.pending' - && $event->data->object->payment_method_details->type == 'sofort')) { - ProcessLoggerHandler::logInfo('payment_intent : '.$paymentIntent, null, null, 'webhook'); - ProcessLoggerHandler::logInfo('$event->type : '.$event->type, null, null, 'webhook'); + } elseif (($eventType == 'charge.succeeded' + && $paymentMethodType != 'sofort' + && Stripe_official::$paymentMethods[$paymentMethodType]['flow'] == 'redirect') + || ($eventType == 'charge.pending' + && $paymentMethodType == 'sofort')) { + ProcessLoggerHandler::logInfo( + 'Payment method flow with redirection', + null, + null, + 'webhook - handleWebhookActions' + ); $handler->addActions( 'prepareFlowRedirectPaymentIntent', 'updatePaymentIntent', @@ -230,13 +347,17 @@ public function postProcess() } else { $handler->addActions('chargeWebhook'); } + // Process actions chain if (!$handler->process('ValidationOrder')) { // Handle error - ProcessLoggerHandler::logError('Order webhook process failed.', null, null, 'webhook'); + ProcessLoggerHandler::logError( + 'Webhook actions process failed.', + null, + null, + 'webhook - handleWebhookActions' + ); ProcessLoggerHandler::closeLogger(); } - - exit; } } From a1ed3bc03a9223306f7b922b440bb167b0bcc481 Mon Sep 17 00:00:00 2001 From: afayadas Date: Fri, 8 Oct 2021 12:04:07 +0200 Subject: [PATCH 19/62] refs #31037 : adding stripe event model + adding update charge to webhook event --- classes/StripeEvent.php | 104 ++++++++++++++++++++++++++++++++++++++++ stripe_official.php | 24 +++++----- 2 files changed, 117 insertions(+), 11 deletions(-) create mode 100755 classes/StripeEvent.php diff --git a/classes/StripeEvent.php b/classes/StripeEvent.php new file mode 100755 index 0000000..af3cf1e --- /dev/null +++ b/classes/StripeEvent.php @@ -0,0 +1,104 @@ + + * @copyright Copyright (c) Stripe + * @license Commercial license + */ + +class StripeEvent extends ObjectModel +{ + /** @var string */ + public $id_payment_intent; + /** @var string */ + public $status; + /** @var date */ + public $date_add; + + /** + * @see ObjectModel::$definition + */ + public static $definition = array( + 'table' => 'stripe_event', + 'primary' => 'id_stripe_event', + 'fields' => array( + 'id_payment_intent' => array( + 'type' => ObjectModel::TYPE_STRING, + 'validate' => 'isString', + 'size' => 40, + ), + 'status' => array( + 'type' => ObjectModel::TYPE_STRING, + 'validate' => 'isString', + 'size' => 30, + ), + 'date_add' => array( + 'type' => ObjectModel::TYPE_DATE, + 'validate' => 'isDate', + ), + ), + 'indexes' => [ + [ + 'fields' => [ + [ + 'column' => 'id_payment_intent', + ], + [ + 'column' => 'status', + ] + ], + 'type' => IndexType::UNIQUE, + ], + ], + ); + + public function setIdPaymentIntent($id_payment_intent) + { + $this->id_payment_intent = $id_payment_intent; + } + + public function getIdPaymentIntent() + { + return $this->id_payment_intent; + } + + public function setStatus($status) + { + $this->status = $status; + } + + public function getStatus() + { + return $this->status; + } + + public function setDateAdd($date_add) + { + $this->date_add = $date_add; + } + + public function getDateAdd() + { + return $this->date_add; + } +} diff --git a/stripe_official.php b/stripe_official.php index f6e6632..e408fbf 100755 --- a/stripe_official.php +++ b/stripe_official.php @@ -37,15 +37,15 @@ /** * Stripe official PrestaShop module main class extends payment class -* Please note this module use _202 PrestaShop Classlib Project_ (202 classlib) a library developped by "202 ecommerce" -* This library provide utils common features as DB installer, internal logger, chain of resposability design pattern +* Please note this module use _202 PrestaShop Classlib Project_ (202 classlib) a library developed by "202 ecommerce" +* This library provide utils common features as DB installer, internal logger, chain of responsibility design pattern * * To let module compatible with Prestashop 1.6 please keep this following line commented in PrestaShop 1.6: * // use Stripe_officialClasslib\Install\ModuleInstaller; * // use Stripe_officialClasslib\Actions\ActionsHandler; * // use Stripe_officialClasslib\Extensions\ProcessLogger\ProcessLoggerExtension; * -* Developpers use declarative method to define objects, parameters, controllers... needed in this module +* Developers use declarative method to define objects, parameters, controllers... needed in this module */ class Stripe_official extends PaymentModule @@ -109,6 +109,7 @@ class Stripe_official extends PaymentModule 'StripeCapture', 'StripeCustomer', 'StripeIdempotencyKey', + 'StripeEvent', ); /** @@ -369,14 +370,15 @@ class Stripe_official extends PaymentModule ); public static $webhook_events = array( - 'charge.expired', - 'charge.failed', - 'charge.succeeded', - 'charge.pending', - 'charge.captured', - 'charge.refunded', - 'charge.dispute.created', - 'payment_intent.requires_action' + \Stripe\Event::CHARGE_UPDATED, + \Stripe\Event::CHARGE_EXPIRED, + \Stripe\Event::CHARGE_FAILED, + \Stripe\Event::CHARGE_SUCCEEDED, + \Stripe\Event::CHARGE_PENDING, + \Stripe\Event::CHARGE_CAPTURED, + \Stripe\Event::CHARGE_REFUNDED, + \Stripe\Event::CHARGE_DISPUTE_CREATED, + \Stripe\Event::PAYMENT_INTENT_REQUIRES_ACTION, ); /* refund */ From 140451a68839e670f7cab460c2340b7aac90edee Mon Sep 17 00:00:00 2001 From: afayadas Date: Mon, 11 Oct 2021 17:21:55 +0200 Subject: [PATCH 20/62] refs #31037 : adding and verifying Stripe event recording + fixing totclasslib usages --- classes/StripeEvent.php | 74 +++++++- classes/actions/ValidationOrderActions.php | 7 +- .../AdminStripe_officialProcessLogger.php | 31 ++++ ...Stripe_officialProcessLoggerController.php | 32 ---- controllers/front/validation.php | 2 +- controllers/front/webhook.php | 167 +++++++++++++++++- stripe_official.php | 2 +- 7 files changed, 272 insertions(+), 43 deletions(-) create mode 100644 controllers/admin/AdminStripe_officialProcessLogger.php delete mode 100644 controllers/admin/AdminStripe_officialProcessLoggerController.php diff --git a/classes/StripeEvent.php b/classes/StripeEvent.php index af3cf1e..1fb1fbb 100755 --- a/classes/StripeEvent.php +++ b/classes/StripeEvent.php @@ -28,14 +28,32 @@ class StripeEvent extends ObjectModel { - /** @var string */ + const PENDING_STATUS = 'PENDING'; + const AUTHORIZED_STATUS = 'AUTHORIZED'; + const CAPTURED_STATUS = 'CAPTURED'; + const REFUNDED_STATUS = 'REFUNDED'; + const FAILED_STATUS = 'FAILED'; + const EXPIRED_STATUS = 'EXPIRED'; + + /** + * @var string $id_payment_intent + */ public $id_payment_intent; - /** @var string */ + /** + * @var string $status + */ public $status; - /** @var date */ + /** + * @var DateTime $date_add + */ public $date_add; + /** + * @var bool $isProcess + */ + public $isProcessed; /** + * @var array $definition * @see ObjectModel::$definition */ public static $definition = array( @@ -56,6 +74,10 @@ class StripeEvent extends ObjectModel 'type' => ObjectModel::TYPE_DATE, 'validate' => 'isDate', ), + 'is_process' => array( + 'type' => ObjectModel::TYPE_BOOL, + 'validate' => 'isBool', + ) ), 'indexes' => [ [ @@ -101,4 +123,50 @@ public function getDateAdd() { return $this->date_add; } + + public function isProcess() + { + return $this->isProcessed; + } + + public function setIsProcessed($isProcessed) + { + $this->isProcessed = $isProcessed; + } + + public function getLastRegisteredEventByPaymentIntent($paymentIntent) + { + $query = new DbQuery(); + $query->select('*'); + $query->from(static::$definition['table']); + $query->where('payment_intent = "' . pSQL($paymentIntent) . '"'); + $query->orderBy('date_add ASC'); + + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($query->build()); + if ($result == false) { + return $this; + } + + $this->hydrate($result); + + return $this; + } + + public function getEventByPaymentIntentNStatus($paymentIntent, $status) + { + $query = new DbQuery(); + $query->select('*'); + $query->from(static::$definition['table']); + $query->where('payment_intent = "' . pSQL($paymentIntent) . '" AND status = "' . pSQL($status) . '"'); + $query->orderBy('date_add ASC'); + + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($query->build()); + if ($result == false) { + return $this; + } + + $this->hydrate($result); + + return $this; + } } diff --git a/classes/actions/ValidationOrderActions.php b/classes/actions/ValidationOrderActions.php index 0a79727..723e848 100755 --- a/classes/actions/ValidationOrderActions.php +++ b/classes/actions/ValidationOrderActions.php @@ -763,10 +763,9 @@ public function chargeWebhook() if ($event_type == 'charge.dispute.created') { $order->setCurrentState(Configuration::get(Stripe_official::SEPA_DISPUTE)); - } elseif ($event_type == 'charge.expired') { - $order->setCurrentState(Configuration::get('PS_OS_CANCELED')); - } elseif ($event_type == 'charge.failed' - && $order->getCurrentState() != Configuration::get('PS_OS_PAYMENT')) { + } elseif (($event_type == 'charge.failed' + && $order->getCurrentState() != Configuration::get('PS_OS_PAYMENT')) + || $event_type == 'charge.expired') { $order->setCurrentState(Configuration::get('PS_OS_ERROR')); } elseif ($event_type == 'charge.succeeded' && $order->getCurrentState() != Configuration::get('PS_OS_OUTOFSTOCK_PAID')) { diff --git a/controllers/admin/AdminStripe_officialProcessLogger.php b/controllers/admin/AdminStripe_officialProcessLogger.php new file mode 100644 index 0000000..bdea932 --- /dev/null +++ b/controllers/admin/AdminStripe_officialProcessLogger.php @@ -0,0 +1,31 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * + * @version develop + */ + +use Stripe_officialClasslib\Extensions\ProcessLogger\Controllers\Admin\AdminProcessLoggerController; + +class AdminStripe_officialProcessLoggerController extends AdminProcessLoggerController +{ +} diff --git a/controllers/admin/AdminStripe_officialProcessLoggerController.php b/controllers/admin/AdminStripe_officialProcessLoggerController.php deleted file mode 100644 index c406823..0000000 --- a/controllers/admin/AdminStripe_officialProcessLoggerController.php +++ /dev/null @@ -1,32 +0,0 @@ - - * @copyright Copyright (c) Stripe - * @license Commercial license - */ - -require_once dirname(__FILE__) . '/../../vendor/autoload.php'; -use Stripe_officialClasslib\Extensions\ProcessLogger\Controllers\Admin\AdminProcessLoggerController; - -class AdminStripe_officialProcessLoggerController extends AdminProcessLoggerController -{ - -} diff --git a/controllers/front/validation.php b/controllers/front/validation.php index d541499..1c4b691 100644 --- a/controllers/front/validation.php +++ b/controllers/front/validation.php @@ -90,7 +90,7 @@ public function initContent() } // Process actions chain - if ($handler->process('ValidationOrder')) { + if ($handler->process('ValidationOrderActions')) { // Retrieve and use resulting data $returnValues = $handler->getConveyor(); } else { diff --git a/controllers/front/webhook.php b/controllers/front/webhook.php index 64ea6b6..47b5a38 100755 --- a/controllers/front/webhook.php +++ b/controllers/front/webhook.php @@ -89,6 +89,13 @@ protected function canonicalRedirection($canonical_url = '') public function postProcess() { + ProcessLoggerHandler::logInfo( + '[ Webhook Process Beginning ]', + null, + null, + 'webhook - postProcess' + ); + // Retrieve secret API key $secret_key = $this->module->getSecretKey(); @@ -138,12 +145,24 @@ public function postProcess() 'webhook - postProcess' ); + // Registry Stripe event in database + $registeredEvent = $this->registerEvent($event, $paymentIntent); + // Create the handler $handler = $this->createWebhookHandler($event, $paymentIntent); // Handle actions $this->handleWebhookActions($handler, $event); + // Valid Stripe event process + $this->validProcessEvent($registeredEvent); + + ProcessLoggerHandler::logInfo( + '[ Webhook Process Ending ]', + null, + null, + 'webhook - postProcess' + ); ProcessLoggerHandler::closeLogger(); exit; } @@ -263,6 +282,145 @@ private function constructEvent($payload, $sigHeader, $secret) } } + private function registerEvent($event, $paymentIntent) + { + try { + $stripeEventStatus = $this->checkEventStatus($event, $paymentIntent); + $stripeEventDate = new DateTime(); + $stripeEventDate = $stripeEventDate->setTimestamp($event->created); + + $stripeEvent = new StripeEvent(); + $stripeEvent->setIdPaymentIntent($paymentIntent); + $stripeEvent->setStatus($stripeEventStatus); + $stripeEvent->setDateAdd($stripeEventDate); + $stripeEvent->setIsProcessed(false); + $stripeEvent->save(); + + return $stripeEvent; + } catch (PrestaShopException $e) { + $msg = 'A problem appears while recording the Stripe event => ' . $e->getMessage(); + ProcessLoggerHandler::logInfo( + $msg, + null, + null, + 'webhook - registerEvent' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(200); + echo $msg; + exit; + } + } + + private function validProcessEvent($registeredEvent) + { + try { + $registeredEvent->setIsProcessed(true); + $registeredEvent->save(); + } catch (PrestaShopException $e) { + $msg = 'A problem appears while completing the Stripe event process => ' . $e->getMessage(); + ProcessLoggerHandler::logInfo( + $msg, + null, + null, + 'webhook - registerEvent' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(200); + echo $msg; + exit; + } + } + + private function checkEventStatus($event, $paymentIntent) + { + $transitionStatus = [ + StripeEvent::FAILED_STATUS => null, + StripeEvent::PENDING_STATUS => null, + StripeEvent::AUTHORIZED_STATUS => StripeEvent::PENDING_STATUS, + StripeEvent::CAPTURED_STATUS => StripeEvent::AUTHORIZED_STATUS, + StripeEvent::REFUNDED_STATUS => StripeEvent::CAPTURED_STATUS, + StripeEvent::EXPIRED_STATUS => StripeEvent::PENDING_STATUS, + ]; + + $lastRegisteredEvent = new StripeEvent(); + $lastRegisteredEvent = $lastRegisteredEvent->getLastRegisteredEventByPaymentIntent($paymentIntent); + + $lastRegisteredEventDate = new DateTime($lastRegisteredEvent->date_add); + $currentEventDate = new DateTime(); + $currentEventDate = $currentEventDate->setTimestamp($event->created); + if ($lastRegisteredEventDate > $currentEventDate) { + $msg = 'This charge event come too late to be processed.'; + ProcessLoggerHandler::logInfo( + $msg, + null, + null, + 'webhook - checkEventStatus' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(200); + echo $msg; + exit; + } + + switch ($event->type) { + case 'charge.succeeded': + $eventStatus = StripeEvent::AUTHORIZED_STATUS; + break; + case 'charge.captured': + $eventStatus = StripeEvent::CAPTURED_STATUS; + break; + case 'charge.refunded': + $eventStatus = StripeEvent::REFUNDED_STATUS; + break; + case 'charge.failed': + $eventStatus = StripeEvent::FAILED_STATUS; + break; + case 'charge.expired': + $eventStatus = StripeEvent::EXPIRED_STATUS; + break; + default: + $eventStatus = StripeEvent::PENDING_STATUS; + break; + } + + if ($lastRegisteredEvent->status == $eventStatus) { + if ($lastRegisteredEvent->isProcessed) { + $msg = 'This Stripe module event "' .$eventStatus.'" has already been processed.'; + ProcessLoggerHandler::logInfo( + $msg, + 'StripeEvent', + $lastRegisteredEvent->id, + 'webhook - checkEventStatus' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(200); + echo $msg; + exit; + } + ProcessLoggerHandler::logInfo( + $eventStatus . ' event restarted because the previous one did not complete processing', + 'StripeEvent', + $lastRegisteredEvent->id, + 'webhook - checkEventStatus' + ); + } elseif ($lastRegisteredEvent->status != $transitionStatus[$eventStatus] || !$lastRegisteredEvent->isProcessed) { + $msg = 'This Stripe module event "' . $eventStatus . '" cannot be processed because [Last event status: ' . $lastRegisteredEvent->status . ' | Processed : ' . ($lastRegisteredEvent->isProcessed ? 'Yes' : 'No') . '].'; + ProcessLoggerHandler::logInfo( + $msg, + 'StripeEvent', + $lastRegisteredEvent->id, + 'webhook - checkEventStatus' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(200); + echo $msg; + exit; + } + + return $eventStatus; + } + private function createWebhookHandler($event, $paymentIntent) { ProcessLoggerHandler::logInfo( @@ -303,7 +461,7 @@ private function handleWebhookActions($handler, $event) ); $eventType = $event->type; - $paymentMethodType = $event->data->object->payment_method_details->type; + $paymentMethodType = $event->data->object->payment_method_details->type ?: null; if (($eventType == 'charge.succeeded' && $paymentMethodType == 'card') @@ -349,7 +507,9 @@ private function handleWebhookActions($handler, $event) } // Process actions chain - if (!$handler->process('ValidationOrder')) { + $handler->process('ValidationOrderActions'); + if (!$handler->isSuccess()) { + $conveyor = $handler->getConveyor(); // Handle error ProcessLoggerHandler::logError( 'Webhook actions process failed.', @@ -358,6 +518,9 @@ private function handleWebhookActions($handler, $event) 'webhook - handleWebhookActions' ); ProcessLoggerHandler::closeLogger(); + http_response_code(400); + echo $conveyor['error']; + exit(); } } } diff --git a/stripe_official.php b/stripe_official.php index e408fbf..a0a7a37 100755 --- a/stripe_official.php +++ b/stripe_official.php @@ -820,7 +820,7 @@ public function getContent() 'registerWebhookSignature' ); - $handler->process('Configuration'); + $handler->process('ConfigurationActions'); } $shopGroupId = Stripe_official::getShopGroupIdContext(); From f1fe9260f9283d03aec61dd9bcf8289f5551ac87 Mon Sep 17 00:00:00 2001 From: afayadas Date: Mon, 11 Oct 2021 17:25:40 +0200 Subject: [PATCH 21/62] refs #31037 : fixing upgrader 2.1.0 and 2.4.0 versions --- upgrade/Upgrade-2.1.0.php | 2 +- upgrade/Upgrade-2.4.0.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/upgrade/Upgrade-2.1.0.php b/upgrade/Upgrade-2.1.0.php index 10de0a5..5fbbdef 100755 --- a/upgrade/Upgrade-2.1.0.php +++ b/upgrade/Upgrade-2.1.0.php @@ -44,7 +44,7 @@ function upgrade_module_2_1_0($module) 'context' => Context::getContext() )); $handler->addActions('registerWebhookSignature'); - $handler->process('Configuration'); + $handler->process('ConfigurationActions'); return true; } diff --git a/upgrade/Upgrade-2.4.0.php b/upgrade/Upgrade-2.4.0.php index ebe3052..f979252 100755 --- a/upgrade/Upgrade-2.4.0.php +++ b/upgrade/Upgrade-2.4.0.php @@ -28,6 +28,8 @@ exit; } +require_once dirname(__FILE__) . '/../classes/StripeEvent.php'; + function upgrade_module_2_4_0($module) { $installer = new Stripe_officialClasslib\Install\ModuleInstaller($module); From a7f81649f5db9b10cd690119af43d90e977b70e4 Mon Sep 17 00:00:00 2001 From: afayadas Date: Wed, 13 Oct 2021 08:39:23 +0200 Subject: [PATCH 22/62] refs #31037 : fixing webhook process + fixing stripe event model --- classes/StripeEvent.php | 21 ++++---- controllers/front/createIntent.php | 18 +++++++ controllers/front/webhook.php | 86 ++++++++++++++++++------------ 3 files changed, 80 insertions(+), 45 deletions(-) diff --git a/classes/StripeEvent.php b/classes/StripeEvent.php index 1fb1fbb..e8b14ef 100755 --- a/classes/StripeEvent.php +++ b/classes/StripeEvent.php @@ -48,9 +48,9 @@ class StripeEvent extends ObjectModel */ public $date_add; /** - * @var bool $isProcess + * @var bool $is_processed */ - public $isProcessed; + public $is_processed; /** * @var array $definition @@ -74,7 +74,7 @@ class StripeEvent extends ObjectModel 'type' => ObjectModel::TYPE_DATE, 'validate' => 'isDate', ), - 'is_process' => array( + 'is_processed' => array( 'type' => ObjectModel::TYPE_BOOL, 'validate' => 'isBool', ) @@ -124,14 +124,14 @@ public function getDateAdd() return $this->date_add; } - public function isProcess() + public function isProcessed() { - return $this->isProcessed; + return $this->is_processed; } - public function setIsProcessed($isProcessed) + public function setIsProcessed($is_processed) { - $this->isProcessed = $isProcessed; + $this->is_processed = $is_processed; } public function getLastRegisteredEventByPaymentIntent($paymentIntent) @@ -139,8 +139,8 @@ public function getLastRegisteredEventByPaymentIntent($paymentIntent) $query = new DbQuery(); $query->select('*'); $query->from(static::$definition['table']); - $query->where('payment_intent = "' . pSQL($paymentIntent) . '"'); - $query->orderBy('date_add ASC'); + $query->where('id_payment_intent = "' . pSQL($paymentIntent) . '"'); + $query->orderBy('date_add DESC'); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($query->build()); if ($result == false) { @@ -157,8 +157,7 @@ public function getEventByPaymentIntentNStatus($paymentIntent, $status) $query = new DbQuery(); $query->select('*'); $query->from(static::$definition['table']); - $query->where('payment_intent = "' . pSQL($paymentIntent) . '" AND status = "' . pSQL($status) . '"'); - $query->orderBy('date_add ASC'); + $query->where('id_payment_intent = "' . pSQL($paymentIntent) . '" AND status = "' . pSQL($status) . '"'); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($query->build()); if ($result == false) { diff --git a/controllers/front/createIntent.php b/controllers/front/createIntent.php index 8680c9e..3c6b7e1 100644 --- a/controllers/front/createIntent.php +++ b/controllers/front/createIntent.php @@ -116,6 +116,24 @@ public function initContent() $stripeIdempotencyKey = new StripeIdempotencyKey(); $intent = $stripeIdempotencyKey->createNewOne($this->context->cart->id, $datasIntent); + + $stripeEvent = new StripeEvent(); + $stripeEvent->setIdPaymentIntent($intent->id); + $stripeEvent->setStatus(StripeEvent::PENDING_STATUS); + $stripeEvent->setDateAdd($intent->created); + $stripeEvent->setIsProcessed(1); + if (!$stripeEvent->save()) { + $msg = 'An issue appears during saving Stripe module event in database (the event probably already exists).'; + ProcessLoggerHandler::logInfo( + $msg, + null, + null, + 'webhook - registerEvent' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(400); + die($msg); + } } catch (Exception $e) { error_log($e->getMessage()); ProcessLoggerHandler::logError( diff --git a/controllers/front/webhook.php b/controllers/front/webhook.php index 47b5a38..cfabe3e 100755 --- a/controllers/front/webhook.php +++ b/controllers/front/webhook.php @@ -294,11 +294,23 @@ private function registerEvent($event, $paymentIntent) $stripeEvent->setStatus($stripeEventStatus); $stripeEvent->setDateAdd($stripeEventDate); $stripeEvent->setIsProcessed(false); - $stripeEvent->save(); + + if (!$stripeEvent->save()) { + $msg = 'An issue appears during saving Stripe module event in database (the event probably already exists).'; + ProcessLoggerHandler::logInfo( + $msg, + null, + null, + 'webhook - registerEvent' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(400); + die($msg); + } return $stripeEvent; } catch (PrestaShopException $e) { - $msg = 'A problem appears while recording the Stripe event => ' . $e->getMessage(); + $msg = 'A problem appears while recording the Stripe module event => ' . $e->getMessage(); ProcessLoggerHandler::logInfo( $msg, null, @@ -306,9 +318,8 @@ private function registerEvent($event, $paymentIntent) 'webhook - registerEvent' ); ProcessLoggerHandler::closeLogger(); - http_response_code(200); - echo $msg; - exit; + http_response_code(400); + die($msg); } } @@ -316,7 +327,18 @@ private function validProcessEvent($registeredEvent) { try { $registeredEvent->setIsProcessed(true); - $registeredEvent->save(); + if (!$registeredEvent->save()) { + $msg = 'An issue appears while updating the Stripe module event'; + ProcessLoggerHandler::logInfo( + $msg, + null, + null, + 'webhook - registerEvent' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(400); + die($msg); + } } catch (PrestaShopException $e) { $msg = 'A problem appears while completing the Stripe event process => ' . $e->getMessage(); ProcessLoggerHandler::logInfo( @@ -326,9 +348,8 @@ private function validProcessEvent($registeredEvent) 'webhook - registerEvent' ); ProcessLoggerHandler::closeLogger(); - http_response_code(200); - echo $msg; - exit; + http_response_code(400); + die($msg); } } @@ -346,21 +367,22 @@ private function checkEventStatus($event, $paymentIntent) $lastRegisteredEvent = new StripeEvent(); $lastRegisteredEvent = $lastRegisteredEvent->getLastRegisteredEventByPaymentIntent($paymentIntent); - $lastRegisteredEventDate = new DateTime($lastRegisteredEvent->date_add); - $currentEventDate = new DateTime(); - $currentEventDate = $currentEventDate->setTimestamp($event->created); - if ($lastRegisteredEventDate > $currentEventDate) { - $msg = 'This charge event come too late to be processed.'; - ProcessLoggerHandler::logInfo( - $msg, - null, - null, - 'webhook - checkEventStatus' - ); - ProcessLoggerHandler::closeLogger(); - http_response_code(200); - echo $msg; - exit; + if ($lastRegisteredEvent->date_add != null) { + $lastRegisteredEventDate = new DateTime($lastRegisteredEvent->date_add); + $currentEventDate = new DateTime(); + $currentEventDate = $currentEventDate->setTimestamp($event->created); + if ($lastRegisteredEventDate > $currentEventDate) { + $msg = 'This charge event come too late to be processed.'; + ProcessLoggerHandler::logInfo( + $msg, + null, + null, + 'webhook - checkEventStatus' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(400); + die($msg); + } } switch ($event->type) { @@ -385,7 +407,7 @@ private function checkEventStatus($event, $paymentIntent) } if ($lastRegisteredEvent->status == $eventStatus) { - if ($lastRegisteredEvent->isProcessed) { + if ($lastRegisteredEvent->isProcessed()) { $msg = 'This Stripe module event "' .$eventStatus.'" has already been processed.'; ProcessLoggerHandler::logInfo( $msg, @@ -404,7 +426,7 @@ private function checkEventStatus($event, $paymentIntent) $lastRegisteredEvent->id, 'webhook - checkEventStatus' ); - } elseif ($lastRegisteredEvent->status != $transitionStatus[$eventStatus] || !$lastRegisteredEvent->isProcessed) { + } elseif ($lastRegisteredEvent->status != $transitionStatus[$eventStatus] || !$lastRegisteredEvent->isProcessed()) { $msg = 'This Stripe module event "' . $eventStatus . '" cannot be processed because [Last event status: ' . $lastRegisteredEvent->status . ' | Processed : ' . ($lastRegisteredEvent->isProcessed ? 'Yes' : 'No') . '].'; ProcessLoggerHandler::logInfo( $msg, @@ -413,9 +435,8 @@ private function checkEventStatus($event, $paymentIntent) 'webhook - checkEventStatus' ); ProcessLoggerHandler::closeLogger(); - http_response_code(200); - echo $msg; - exit; + http_response_code(400); + die($msg); } return $eventStatus; @@ -507,9 +528,7 @@ private function handleWebhookActions($handler, $event) } // Process actions chain - $handler->process('ValidationOrderActions'); - if (!$handler->isSuccess()) { - $conveyor = $handler->getConveyor(); + if (!$handler->process('ValidationOrderActions')) { // Handle error ProcessLoggerHandler::logError( 'Webhook actions process failed.', @@ -519,8 +538,7 @@ private function handleWebhookActions($handler, $event) ); ProcessLoggerHandler::closeLogger(); http_response_code(400); - echo $conveyor['error']; - exit(); + die('Webhook actions process failed.'); } } } From ecd674ad4e50cd9d5a2208a1ba5d679b7fda97d1 Mon Sep 17 00:00:00 2001 From: afayadas Date: Wed, 13 Oct 2021 17:58:18 +0200 Subject: [PATCH 23/62] refs #31037 : restoring native confirmation order page + creating order creation process between indirect and direct flow --- classes/actions/ValidationOrderActions.php | 12 +- controllers/front/orderConfirmationReturn.php | 1 + controllers/front/orderSuccess.php | 200 +++++++++++++++++- controllers/front/webhook.php | 49 +++-- 4 files changed, 228 insertions(+), 34 deletions(-) diff --git a/classes/actions/ValidationOrderActions.php b/classes/actions/ValidationOrderActions.php index 723e848..3f5ae19 100755 --- a/classes/actions/ValidationOrderActions.php +++ b/classes/actions/ValidationOrderActions.php @@ -268,14 +268,16 @@ public function updatePaymentIntent() */ public function createOrder() { - if (Order::getOrderByCartId((int)$this->conveyor['id_cart'])) { + $this->conveyor['isAlreadyOrdered'] = (bool)Order::getOrderByCartId((int)$this->conveyor['id_cart']); + + if ($this->conveyor['isAlreadyOrdered']) { ProcessLoggerHandler::logInfo( 'Prestashop order has been already created for this cart', null, null, 'ValidationOrderActions - createOrder' ); - return false; + return true; } if ($this->conveyor['status'] != 'succeeded' @@ -587,6 +589,10 @@ public function saveCard() */ public function addTentative() { + if ($this->conveyor['isAlreadyOrdered']) { + return true; + } + try { if ($this->conveyor['datas']['type'] == 'American Express') { $this->conveyor['datas']['type'] = 'amex'; @@ -685,7 +691,7 @@ public function chargeWebhook() $this->conveyor['IdPaymentIntent'] = (isset($this->conveyor['event_json']->data->object->payment_intent)) ? $this->conveyor['event_json']->data->object->payment_intent - : $this->conveyor['IdPaymentIntent'] = $this->conveyor['event_json']->data->object->id;; + : $this->conveyor['event_json']->data->object->id;; ProcessLoggerHandler::logInfo( 'chargeWebhook with IdPaymentIntent => ' . $this->conveyor['IdPaymentIntent'], null, diff --git a/controllers/front/orderConfirmationReturn.php b/controllers/front/orderConfirmationReturn.php index dcc1e46..3c09661 100644 --- a/controllers/front/orderConfirmationReturn.php +++ b/controllers/front/orderConfirmationReturn.php @@ -65,6 +65,7 @@ public function initContent() ); } else { $datas = array( + 'payment_intent' => $payment_intent, 'payment_method' => $payment_method ); diff --git a/controllers/front/orderSuccess.php b/controllers/front/orderSuccess.php index c6f9136..35ee096 100644 --- a/controllers/front/orderSuccess.php +++ b/controllers/front/orderSuccess.php @@ -1,4 +1,8 @@ Tools::getValue('payment_method') - ); + $payment_intent = Tools::getValue('payment_intent'); + $payment_method = Tools::getValue('payment_method'); + + if ($this->registerStripeEvent($payment_intent)) { + $handler = new ActionsHandler(); + $handler->setConveyor(array( + //'event_json' => $event, + 'module' => $this->module, + 'context' => $this->context, + //'events_states' => $events_states, + 'paymentIntent' => $payment_intent, + )); + + if ($payment_method == 'card' + || $payment_method == 'sepa_debit' + || $payment_method == 'oxxo') { + ProcessLoggerHandler::logInfo( + 'Payment method flow without redirection', + null, + null, + 'orderSuccess - initContent' + ); + $handler->addActions( + 'prepareFlowNone', + 'updatePaymentIntent', + 'createOrder', + 'sendMail', + 'saveCard', + 'addTentative' + ); + } elseif ($payment_method == 'sofort') { + ProcessLoggerHandler::logInfo( + 'Payment method flow with redirection', + null, + null, + 'orderSuccess - initContent' + ); + $handler->addActions( + 'prepareFlowRedirectPaymentIntent', + 'updatePaymentIntent', + 'createOrder', + 'sendMail', + 'saveCard', + 'addTentative' + ); + } + + if (!$handler->process('ValidationOrderActions')) { + // Handle error + ProcessLoggerHandler::logError( + 'Order creation process failed.', + null, + null, + 'orderSuccess - initContent' + ); + ProcessLoggerHandler::closeLogger(); + + $url = Context::getContext()->link->getModuleLink( + 'stripe_official', + 'orderFailure', + array(), + true + ); + } else { + $url = $this->createOrder(); + } + } else { + $url = $this->createOrder(); + } + + Tools::redirect($url); + exit; + } + + private function registerStripeEvent($paymentIntent) + { + $intent = \Stripe\PaymentIntent::retrieve($paymentIntent); + + $eventCharge = isset($intent->charges->data[0]) ? $intent->charges->data[0] : $intent; + + $transitionStatus = [ + StripeEvent::FAILED_STATUS => null, + StripeEvent::PENDING_STATUS => null, + StripeEvent::AUTHORIZED_STATUS => StripeEvent::PENDING_STATUS, + StripeEvent::CAPTURED_STATUS => StripeEvent::AUTHORIZED_STATUS, + StripeEvent::REFUNDED_STATUS => StripeEvent::CAPTURED_STATUS, + StripeEvent::EXPIRED_STATUS => StripeEvent::PENDING_STATUS, + ]; - if (Tools::getValue('payment_method') == 'oxxo') { - $datas['voucher_url'] = Tools::getValue('voucher_url'); + $lastRegisteredEvent = new StripeEvent(); + $lastRegisteredEvent = $lastRegisteredEvent->getLastRegisteredEventByPaymentIntent($paymentIntent); + + if ($lastRegisteredEvent->date_add != null) { + $lastRegisteredEventDate = new DateTime($lastRegisteredEvent->date_add); + $currentEventDate = new DateTime(); + $currentEventDate = $currentEventDate->setTimestamp($eventCharge->created); + if ($lastRegisteredEventDate > $currentEventDate) { + ProcessLoggerHandler::logInfo( + 'This charge event come too late to be processed [Last event : ' . $lastRegisteredEventDate->format('Y-m-d H:m:s') . ' | Current event : ' . $currentEventDate->format('Y-m-d H:m:s') . '].', + null, + null, + 'orderSuccess - registerStripeEvent' + ); + ProcessLoggerHandler::closeLogger(); + return false; + } + } + + switch ($eventCharge ->type) { + case 'charge.succeeded': + $stripeEventStatus = StripeEvent::AUTHORIZED_STATUS; + break; + case 'charge.captured': + $stripeEventStatus = StripeEvent::CAPTURED_STATUS; + break; + case 'charge.refunded': + $stripeEventStatus = StripeEvent::REFUNDED_STATUS; + break; + case 'charge.failed': + $stripeEventStatus = StripeEvent::FAILED_STATUS; + break; + case 'charge.expired': + $stripeEventStatus = StripeEvent::EXPIRED_STATUS; + break; + default: + $stripeEventStatus = StripeEvent::PENDING_STATUS; + break; + } + + if ($lastRegisteredEvent->status != $transitionStatus[$stripeEventStatus]) { + ProcessLoggerHandler::logInfo( + 'This Stripe module event "' .$stripeEventStatus.'" has already been processed.', + 'StripeEvent', + $lastRegisteredEvent->id, + 'webhook - checkEventStatus' + ); + ProcessLoggerHandler::closeLogger(); + return false; } - $this->context->smarty->assign($datas); + $stripeEventDate = new DateTime(); + $stripeEventDate = $stripeEventDate->setTimestamp($eventCharge->created); + + $stripeEvent = new StripeEvent(); + $stripeEvent = $stripeEvent->getEventByPaymentIntentNStatus($paymentIntent, $stripeEventStatus); + $stripeEvent->setIdPaymentIntent($paymentIntent); + $stripeEvent->setStatus($stripeEventStatus); + $stripeEvent->setDateAdd($stripeEventDate->format('Y-m-d H:i:s')); + $stripeEvent->setIsProcessed(true); - if (version_compare(_PS_VERSION_, '1.7', '>=')) { - $this->setTemplate('module:stripe_official/views/templates/front/order-confirmation-success-17.tpl'); + try { + return $stripeEvent->save(); + } catch (PrestaShopException $e) { + ProcessLoggerHandler::logInfo( + 'Cannot process event', + null, + null, + 'orderSuccess - registerStripeEvent' + ); + ProcessLoggerHandler::closeLogger(); + return false; + } + } + + private function createOrder() + { + ProcessLoggerHandler::logInfo( + 'Create order', + null, + null, + 'orderSuccess - createOrder' + ); + ProcessLoggerHandler::closeLogger(); + + $id_order = Order::getOrderByCartId($this->context->cart->id); + + if (isset($this->context->customer->secure_key)) { + $secure_key = $this->context->customer->secure_key; } else { - $this->setTemplate('order-confirmation-success-16.tpl'); + $secure_key = false; } + + return Context::getContext()->link->getPageLink( + 'order-confirmation', + true, + null, + array( + 'id_cart' => (int)$this->context->cart->id, + 'id_module' => (int)$this->module->id, + 'id_order' => (int)$id_order, + 'key' => $secure_key + ) + ); } } diff --git a/controllers/front/webhook.php b/controllers/front/webhook.php index cfabe3e..9131f75 100755 --- a/controllers/front/webhook.php +++ b/controllers/front/webhook.php @@ -290,10 +290,15 @@ private function registerEvent($event, $paymentIntent) $stripeEventDate = $stripeEventDate->setTimestamp($event->created); $stripeEvent = new StripeEvent(); - $stripeEvent->setIdPaymentIntent($paymentIntent); - $stripeEvent->setStatus($stripeEventStatus); - $stripeEvent->setDateAdd($stripeEventDate); - $stripeEvent->setIsProcessed(false); + $stripeEvent = $stripeEvent->getEventByPaymentIntentNStatus($paymentIntent, $stripeEventStatus); + if ($stripeEvent->id != null) { + $stripeEvent->setDateAdd($stripeEventDate->format('Y-m-d H:i:s')); + } else { + $stripeEvent->setIdPaymentIntent($paymentIntent); + $stripeEvent->setStatus($stripeEventStatus); + $stripeEvent->setDateAdd($stripeEventDate->format('Y-m-d H:i:s')); + $stripeEvent->setIsProcessed(false); + } if (!$stripeEvent->save()) { $msg = 'An issue appears during saving Stripe module event in database (the event probably already exists).'; @@ -367,24 +372,6 @@ private function checkEventStatus($event, $paymentIntent) $lastRegisteredEvent = new StripeEvent(); $lastRegisteredEvent = $lastRegisteredEvent->getLastRegisteredEventByPaymentIntent($paymentIntent); - if ($lastRegisteredEvent->date_add != null) { - $lastRegisteredEventDate = new DateTime($lastRegisteredEvent->date_add); - $currentEventDate = new DateTime(); - $currentEventDate = $currentEventDate->setTimestamp($event->created); - if ($lastRegisteredEventDate > $currentEventDate) { - $msg = 'This charge event come too late to be processed.'; - ProcessLoggerHandler::logInfo( - $msg, - null, - null, - 'webhook - checkEventStatus' - ); - ProcessLoggerHandler::closeLogger(); - http_response_code(400); - die($msg); - } - } - switch ($event->type) { case 'charge.succeeded': $eventStatus = StripeEvent::AUTHORIZED_STATUS; @@ -406,6 +393,24 @@ private function checkEventStatus($event, $paymentIntent) break; } + if ($lastRegisteredEvent->status != $eventStatus && $lastRegisteredEvent->date_add != null) { + $lastRegisteredEventDate = new DateTime($lastRegisteredEvent->date_add); + $currentEventDate = new DateTime(); + $currentEventDate = $currentEventDate->setTimestamp($event->created); + if ($lastRegisteredEventDate > $currentEventDate) { + $msg = 'This charge event come too late to be processed.'; + ProcessLoggerHandler::logInfo( + $msg, + null, + null, + 'webhook - checkEventStatus' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(400); + die($msg); + } + } + if ($lastRegisteredEvent->status == $eventStatus) { if ($lastRegisteredEvent->isProcessed()) { $msg = 'This Stripe module event "' .$eventStatus.'" has already been processed.'; From eb57f98a7fc4a21dab558f74d00dc01a0b1237ae Mon Sep 17 00:00:00 2001 From: afayadas Date: Thu, 14 Oct 2021 09:58:42 +0200 Subject: [PATCH 24/62] refs #31037 : update module version to 2.4.0 --- 202/build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/202/build.xml b/202/build.xml index 08d65b4..9aeafcc 100644 --- a/202/build.xml +++ b/202/build.xml @@ -5,7 +5,7 @@ - + From 9e2d4f41412a8c231b824018054b117b499b82bd Mon Sep 17 00:00:00 2001 From: afayadas Date: Thu, 14 Oct 2021 10:32:29 +0200 Subject: [PATCH 25/62] refs #31037 : add additional control test in direct flux --- controllers/front/orderSuccess.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/controllers/front/orderSuccess.php b/controllers/front/orderSuccess.php index 35ee096..536a72b 100644 --- a/controllers/front/orderSuccess.php +++ b/controllers/front/orderSuccess.php @@ -36,6 +36,9 @@ public function initContent() { parent::initContent(); + if (Configuration::get("STRIPE_RECIPE_MODE")) + sleep(3); + $payment_intent = Tools::getValue('payment_intent'); $payment_method = Tools::getValue('payment_method'); From cf090f8c3d5fe90790f68d36a00a90a635bc8351 Mon Sep 17 00:00:00 2001 From: afayadas Date: Thu, 14 Oct 2021 17:01:47 +0200 Subject: [PATCH 26/62] refs #31037 : fixing totclasslib Database component incompatibilities with PS 1.6 --- .../Definition/Field/FieldDefinition.php | 10 ++--- .../ObjectModel/ObjectModelDefinition.php | 40 +++++++++---------- .../Definition/Table/TableDefinition.php | 36 ++++++++--------- .../src/Database/ForeignKey/ForeignKey.php | 12 +++--- .../src/Database/Index/Index.php | 12 +++--- .../src/Database/Index/IndexHandler.php | 4 +- 6 files changed, 57 insertions(+), 57 deletions(-) diff --git a/vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinition.php b/vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinition.php index 8e4881f..0238c3c 100644 --- a/vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinition.php +++ b/vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinition.php @@ -57,7 +57,7 @@ public function __construct(string $name, array $definition) /** * @return string */ - public function getName(): string + public function getName() { return $this->name; } @@ -67,7 +67,7 @@ public function getName(): string * * @return FieldDefinition */ - public function setName(string $name): FieldDefinition + public function setName(string $name) { $this->name = $name; @@ -77,7 +77,7 @@ public function setName(string $name): FieldDefinition /** * @return array */ - public function getDefinition(): array + public function getDefinition() { return $this->definition; } @@ -87,7 +87,7 @@ public function getDefinition(): array * * @return FieldDefinition */ - public function setDefinition(array $definition): FieldDefinition + public function setDefinition(array $definition) { $this->definition = $definition; @@ -99,7 +99,7 @@ public function setDefinition(array $definition): FieldDefinition * * @throws \PrestaShopException */ - public function getColumn(): string + public function getColumn() { if (!empty($this->column)) { return $this->column; diff --git a/vendor/totpsclasslib/src/Database/Definition/ObjectModel/ObjectModelDefinition.php b/vendor/totpsclasslib/src/Database/Definition/ObjectModel/ObjectModelDefinition.php index d9c07e9..ade7576 100644 --- a/vendor/totpsclasslib/src/Database/Definition/ObjectModel/ObjectModelDefinition.php +++ b/vendor/totpsclasslib/src/Database/Definition/ObjectModel/ObjectModelDefinition.php @@ -133,7 +133,7 @@ public function setObjectName($objectName) /** * @return string */ - public function getTable(): string + public function getTable() { return $this->table; } @@ -143,7 +143,7 @@ public function getTable(): string * * @return ObjectModelDefinition */ - public function setTable(string $table): ObjectModelDefinition + public function setTable(string $table) { $this->table = $table; @@ -153,7 +153,7 @@ public function setTable(string $table): ObjectModelDefinition /** * @return array */ - public function getPrimary(): array + public function getPrimary() { return $this->primary; } @@ -163,7 +163,7 @@ public function getPrimary(): array * * @return ObjectModelDefinition */ - public function setPrimary(string $primary): ObjectModelDefinition + public function setPrimary(string $primary) { $this->primary = array_map(function ($primaryKey) { return trim($primaryKey); @@ -175,7 +175,7 @@ public function setPrimary(string $primary): ObjectModelDefinition /** * @return bool */ - public function isMultilang(): bool + public function isMultilang() { return $this->multilang; } @@ -185,7 +185,7 @@ public function isMultilang(): bool * * @return ObjectModelDefinition */ - public function setMultilang(bool $multilang): ObjectModelDefinition + public function setMultilang(bool $multilang) { $this->multilang = $multilang; @@ -195,7 +195,7 @@ public function setMultilang(bool $multilang): ObjectModelDefinition /** * @return bool */ - public function isMultilangShop(): bool + public function isMultilangShop() { return $this->multilangShop; } @@ -205,7 +205,7 @@ public function isMultilangShop(): bool * * @return ObjectModelDefinition */ - public function setMultilangShop(bool $multilangShop): ObjectModelDefinition + public function setMultilangShop(bool $multilangShop) { $this->multilangShop = $multilangShop; @@ -215,7 +215,7 @@ public function setMultilangShop(bool $multilangShop): ObjectModelDefinition /** * @return bool */ - public function isMultishop(): bool + public function isMultishop() { return $this->multishop; } @@ -225,7 +225,7 @@ public function isMultishop(): bool * * @return ObjectModelDefinition */ - public function setMultishop(bool $multishop): ObjectModelDefinition + public function setMultishop(bool $multishop) { $this->multishop = $multishop; @@ -235,7 +235,7 @@ public function setMultishop(bool $multishop): ObjectModelDefinition /** * @return array */ - public function getFields(): array + public function getFields() { return $this->fields; } @@ -245,7 +245,7 @@ public function getFields(): array * * @return ObjectModelDefinition */ - public function setFields(array $fields): ObjectModelDefinition + public function setFields(array $fields) { $this->fields = $fields; @@ -255,7 +255,7 @@ public function setFields(array $fields): ObjectModelDefinition /** * @return array */ - public function getAssociations(): array + public function getAssociations() { return $this->associations; } @@ -265,7 +265,7 @@ public function getAssociations(): array * * @return ObjectModelDefinition */ - public function setAssociations(array $associations): ObjectModelDefinition + public function setAssociations(array $associations) { $this->associations = $associations; @@ -275,7 +275,7 @@ public function setAssociations(array $associations): ObjectModelDefinition /** * @return Index[] */ - public function getIndexes(): array + public function getIndexes() { return $this->indexes; } @@ -285,7 +285,7 @@ public function getIndexes(): array * * @return ObjectModelDefinition */ - public function setIndexes(array $indexes): ObjectModelDefinition + public function setIndexes(array $indexes) { $this->indexes = $indexes; @@ -295,7 +295,7 @@ public function setIndexes(array $indexes): ObjectModelDefinition /** * @return string */ - public function getCharset(): string + public function getCharset() { return $this->charset; } @@ -305,7 +305,7 @@ public function getCharset(): string * * @return ObjectModelDefinition */ - public function setCharset(string $charset): ObjectModelDefinition + public function setCharset(string $charset) { $this->charset = $charset; @@ -315,7 +315,7 @@ public function setCharset(string $charset): ObjectModelDefinition /** * @return string */ - public function getCollation(): string + public function getCollation() { return $this->collation; } @@ -325,7 +325,7 @@ public function getCollation(): string * * @return ObjectModelDefinition */ - public function setCollation(string $collation): ObjectModelDefinition + public function setCollation(string $collation) { $this->collation = $collation; diff --git a/vendor/totpsclasslib/src/Database/Definition/Table/TableDefinition.php b/vendor/totpsclasslib/src/Database/Definition/Table/TableDefinition.php index 1edaa9a..642b0f5 100644 --- a/vendor/totpsclasslib/src/Database/Definition/Table/TableDefinition.php +++ b/vendor/totpsclasslib/src/Database/Definition/Table/TableDefinition.php @@ -85,7 +85,7 @@ class TableDefinition /** * @return string */ - public function getName(): string + public function getName() { return $this->name; } @@ -95,7 +95,7 @@ public function getName(): string * * @return TableDefinition */ - public function setName(string $name): TableDefinition + public function setName(string $name) { $this->name = $name; @@ -105,7 +105,7 @@ public function setName(string $name): TableDefinition /** * @return FieldDefinition[] */ - public function getFields(): array + public function getFields() { return $this->fields; } @@ -115,7 +115,7 @@ public function getFields(): array * * @return TableDefinition */ - public function setFields(array $fields): TableDefinition + public function setFields(array $fields) { $this->fields = $fields; @@ -125,7 +125,7 @@ public function setFields(array $fields): TableDefinition /** * @return string */ - public function getEngine(): string + public function getEngine() { return $this->engine; } @@ -135,7 +135,7 @@ public function getEngine(): string * * @return TableDefinition */ - public function setEngine(string $engine): TableDefinition + public function setEngine(string $engine) { $this->engine = $engine; @@ -145,7 +145,7 @@ public function setEngine(string $engine): TableDefinition /** * @return string */ - public function getCharset(): string + public function getCharset() { return $this->charset; } @@ -155,7 +155,7 @@ public function getCharset(): string * * @return TableDefinition */ - public function setCharset(string $charset): TableDefinition + public function setCharset(string $charset) { $this->charset = $charset; @@ -165,7 +165,7 @@ public function setCharset(string $charset): TableDefinition /** * @return string */ - public function getCollation(): string + public function getCollation() { return $this->collation; } @@ -175,7 +175,7 @@ public function getCollation(): string * * @return TableDefinition */ - public function setCollation(string $collation): TableDefinition + public function setCollation(string $collation) { $this->collation = $collation; @@ -185,7 +185,7 @@ public function setCollation(string $collation): TableDefinition /** * @return ForeignKey[] */ - public function getForeignKeys(): array + public function getForeignKeys() { return $this->foreignKeys; } @@ -195,7 +195,7 @@ public function getForeignKeys(): array * * @return TableDefinition */ - public function setForeignKeys(array $foreignKeys): TableDefinition + public function setForeignKeys(array $foreignKeys) { $this->foreignKeys = $foreignKeys; @@ -205,7 +205,7 @@ public function setForeignKeys(array $foreignKeys): TableDefinition /** * @return Index[] */ - public function getIndexes(): array + public function getIndexes() { return $this->indexes; } @@ -215,7 +215,7 @@ public function getIndexes(): array * * @return TableDefinition */ - public function setIndexes(array $indexes): TableDefinition + public function setIndexes(array $indexes) { $this->indexes = $indexes; @@ -225,7 +225,7 @@ public function setIndexes(array $indexes): TableDefinition /** * @return string */ - public function getAlias(): string + public function getAlias() { return $this->alias; } @@ -235,7 +235,7 @@ public function getAlias(): string * * @return TableDefinition */ - public function setAlias(string $alias): TableDefinition + public function setAlias(string $alias) { $this->alias = $alias; @@ -245,7 +245,7 @@ public function setAlias(string $alias): TableDefinition /** * @return string[] */ - public function getPrimaryKey(): array + public function getPrimaryKey() { return $this->primaryKey; } @@ -255,7 +255,7 @@ public function getPrimaryKey(): array * * @return TableDefinition */ - public function setPrimaryKey(array $primaryKey): TableDefinition + public function setPrimaryKey(array $primaryKey) { $this->primaryKey = $primaryKey; diff --git a/vendor/totpsclasslib/src/Database/ForeignKey/ForeignKey.php b/vendor/totpsclasslib/src/Database/ForeignKey/ForeignKey.php index 2368621..5cab12f 100644 --- a/vendor/totpsclasslib/src/Database/ForeignKey/ForeignKey.php +++ b/vendor/totpsclasslib/src/Database/ForeignKey/ForeignKey.php @@ -74,7 +74,7 @@ public function setTable($table) /** * @return int */ - public function getType(): int + public function getType() { return $this->type; } @@ -84,7 +84,7 @@ public function getType(): int * * @return ForeignKey */ - public function setType(int $type): ForeignKey + public function setType(int $type) { $this->type = $type; @@ -154,7 +154,7 @@ public function setField($field) /** * @return string */ - public function getOnUpdate(): string + public function getOnUpdate() { return $this->onUpdate; } @@ -164,7 +164,7 @@ public function getOnUpdate(): string * * @return ForeignKey */ - public function setOnUpdate(string $onUpdate): ForeignKey + public function setOnUpdate(string $onUpdate) { $this->onUpdate = $onUpdate; @@ -174,7 +174,7 @@ public function setOnUpdate(string $onUpdate): ForeignKey /** * @return string */ - public function getOnDelete(): string + public function getOnDelete() { return $this->onDelete; } @@ -184,7 +184,7 @@ public function getOnDelete(): string * * @return ForeignKey */ - public function setOnDelete(string $onDelete): ForeignKey + public function setOnDelete(string $onDelete) { $this->onDelete = $onDelete; diff --git a/vendor/totpsclasslib/src/Database/Index/Index.php b/vendor/totpsclasslib/src/Database/Index/Index.php index aa842d5..c73e07f 100644 --- a/vendor/totpsclasslib/src/Database/Index/Index.php +++ b/vendor/totpsclasslib/src/Database/Index/Index.php @@ -46,7 +46,7 @@ class Index /** * @return array */ - public function getFields(): array + public function getFields() { return $this->fields; } @@ -56,7 +56,7 @@ public function getFields(): array * * @return Index */ - public function setFields(array $fields): Index + public function setFields(array $fields) { $this->fields = $fields; @@ -66,7 +66,7 @@ public function setFields(array $fields): Index /** * @return string */ - public function getType(): string + public function getType() { return $this->type; } @@ -76,7 +76,7 @@ public function getType(): string * * @return Index */ - public function setType(string $type): Index + public function setType(string $type) { $this->type = $type; @@ -106,7 +106,7 @@ public function setName($name) /** * @return string */ - public function getOptions(): string + public function getOptions() { return $this->options; } @@ -116,7 +116,7 @@ public function getOptions(): string * * @return Index */ - public function setOptions(string $options): Index + public function setOptions(string $options) { $this->options = $options; diff --git a/vendor/totpsclasslib/src/Database/Index/IndexHandler.php b/vendor/totpsclasslib/src/Database/Index/IndexHandler.php index 52239f4..08a933a 100644 --- a/vendor/totpsclasslib/src/Database/Index/IndexHandler.php +++ b/vendor/totpsclasslib/src/Database/Index/IndexHandler.php @@ -80,7 +80,7 @@ public function handle() protected function getKeys() { return Db::getInstance()->executeS(" - SHOW KEYS FROM `{$this->tableDefinition->getName()}` + SHOW KEYS FROM `{$this->tableDefinition->getName()}` WHERE Key_name <> 'PRIMARY'" ); } @@ -104,7 +104,7 @@ protected function dropKey($key) /** * @return TableDefinition */ - public function getTableDefinition(): TableDefinition + public function getTableDefinition() { return $this->tableDefinition; } From 4292857c96f10f5ed52eb4afe0db6bc50cad6a85 Mon Sep 17 00:00:00 2001 From: afayadas Date: Tue, 19 Oct 2021 14:25:25 +0200 Subject: [PATCH 27/62] refs #31612 : fixing totclasslib SchemaDatabase class incompatibility with PS 1.6 --- .../Database/Definition/Schema/SchemaDefinition.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/vendor/totpsclasslib/src/Database/Definition/Schema/SchemaDefinition.php b/vendor/totpsclasslib/src/Database/Definition/Schema/SchemaDefinition.php index 9338746..918db38 100644 --- a/vendor/totpsclasslib/src/Database/Definition/Schema/SchemaDefinition.php +++ b/vendor/totpsclasslib/src/Database/Definition/Schema/SchemaDefinition.php @@ -54,14 +54,18 @@ public function __construct(ObjectModelDefinition $objectModelDefinition) public function buildTableDefinitions() { $tableDefinitionFactory = new TableDefinitionFactory($this->objectModelDefinition); - $this->tableDefinitions[] = ($tableDefinitionFactory->getTableDefinitionBuilder(TableType::MAIN))->build(); + + $tableDefinitionFactoryMain = $tableDefinitionFactory->getTableDefinitionBuilder(TableType::MAIN); + $this->tableDefinitions[] = $tableDefinitionFactoryMain->build(); if ($this->objectModelDefinition->isMultilang() || $this->objectModelDefinition->isMultilangShop()) { - $this->tableDefinitions[] = ($tableDefinitionFactory->getTableDefinitionBuilder(TableType::LANG))->build(); + $tableDefinitionFactoryLang = $tableDefinitionFactory->getTableDefinitionBuilder(TableType::LANG); + $this->tableDefinitions[] = $tableDefinitionFactoryLang->build(); } if ($this->objectModelDefinition->isMultishop()) { - $this->tableDefinitions[] = ($tableDefinitionFactory->getTableDefinitionBuilder(TableType::SHOP))->build(); + $tableDefinitionFactoryShop = $tableDefinitionFactory->getTableDefinitionBuilder(TableType::SHOP); + $this->tableDefinitions[] = $tableDefinitionFactoryShop->build(); } return $this; From 3ec472fc16bf6888356f430fc9686428a920557c Mon Sep 17 00:00:00 2001 From: afayadas Date: Tue, 19 Oct 2021 14:49:49 +0200 Subject: [PATCH 28/62] refs #31628 : fixing method call in webhook controller --- controllers/front/webhook.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/front/webhook.php b/controllers/front/webhook.php index 9131f75..316f865 100755 --- a/controllers/front/webhook.php +++ b/controllers/front/webhook.php @@ -432,7 +432,7 @@ private function checkEventStatus($event, $paymentIntent) 'webhook - checkEventStatus' ); } elseif ($lastRegisteredEvent->status != $transitionStatus[$eventStatus] || !$lastRegisteredEvent->isProcessed()) { - $msg = 'This Stripe module event "' . $eventStatus . '" cannot be processed because [Last event status: ' . $lastRegisteredEvent->status . ' | Processed : ' . ($lastRegisteredEvent->isProcessed ? 'Yes' : 'No') . '].'; + $msg = 'This Stripe module event "' . $eventStatus . '" cannot be processed because [Last event status: ' . $lastRegisteredEvent->status . ' | Processed : ' . ($lastRegisteredEvent->isProcessed() ? 'Yes' : 'No') . '].'; ProcessLoggerHandler::logInfo( $msg, 'StripeEvent', From 62ff7acef1e1b9bae20864a042ba86d9db328e2e Mon Sep 17 00:00:00 2001 From: afayadas Date: Tue, 19 Oct 2021 15:20:47 +0200 Subject: [PATCH 29/62] refs #31270 : creating new supervision page to track payment intent informations --- .../AdminStripe_officialPaymentIntent.php | 121 ++++++++++++++++++ stripe_official.php | 11 +- 2 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 controllers/admin/AdminStripe_officialPaymentIntent.php diff --git a/controllers/admin/AdminStripe_officialPaymentIntent.php b/controllers/admin/AdminStripe_officialPaymentIntent.php new file mode 100644 index 0000000..6c8cf5c --- /dev/null +++ b/controllers/admin/AdminStripe_officialPaymentIntent.php @@ -0,0 +1,121 @@ +_select = 'sp.id_cart, sp.id_payment_intent, sp.type, spi.status, o.reference'; + $this->_join = + 'INNER JOIN `'._DB_PREFIX_.'stripe_payment` sp ON (a.id_payment_intent = sp.id_payment_intent AND sp.result = 1) + INNER JOIN `'._DB_PREFIX_.'stripe_payment_intent` spi ON (sp.id_payment_intent = spi.id_payment_intent) + INNER JOIN `'._DB_PREFIX_.'orders` o ON (sp.id_cart = o.id_cart)'; + $this->_group = 'GROUP BY id_payment_intent'; + + $this->explicitSelect = true; + + $this->fields_list = [ + 'id_cart' => [ + 'title' => $this->module->l('Cart ID', 'AdminStripe_officialPaymentIntentController'), + 'filter_key' => 'sp!id_cart', + 'orderby' => false, + ], + 'id_payment_intent' => [ + 'title' => $this->module->l('Payment Intent', 'AdminStripe_officialPaymentIntentController'), + 'filter_key' => 'sp!id_payment_intent', + 'orderby' => false, + ], + 'type' => [ + 'title' => $this->module->l('Payment Method', 'AdminStripe_officialPaymentIntentController'), + 'orderby' => false, + ], + 'status' => [ + 'title' => $this->module->l('Charge Status', 'AdminStripe_officialPaymentIntentController'), + 'filter_key' => 'spi!status', + 'orderby' => false, + ], + 'reference' => [ + 'title' => $this->module->l('Order Reference', 'AdminStripe_officialPaymentIntentController'), + 'orderby' => false, + ] + ]; + } + + /** + * @see AdminController::initToolbar() + */ + public function initToolbar() + { + parent::initToolbar(); + // Remove the add new item button + unset($this->toolbar_btn['new']); + unset($this->toolbar_btn['delete']); + } + + /** + * @throws PrestaShopException + * @see AdminController::initToolbar() + */ + public function renderDetails() + { + $this->_select = null; + $this->_join = null; + $this->_group = null; + $this->_filter = null; + $this->_where = ' AND a.id_payment_intent = "' . Tools::getValue('id_payment_intent') . '"'; + $this->_orderBy = 'date_add'; + + $this->actions = []; + + $this->list_simple_header = true; + $this->explicitSelect = false; + + $this->fields_list = [ + 'id_payment_intent' => [ + 'title' => $this->module->l('Payment Intent', 'AdminStripe_officialPaymentIntentController'), + ], + 'status' => [ + 'title' => $this->module->l('Event Status', 'AdminStripe_officialPaymentIntentController'), + ], + 'is_processed' => [ + 'title' => $this->module->l('Processed', 'AdminStripe_officialPaymentIntentController'), + ], + 'date_add' => [ + 'title' => $this->module->l('Saving date', 'AdminStripe_officialPaymentIntentController'), + 'align' => 'right', + 'class' => 'fixed-width-xs', + ], + ]; + + return $this->renderList(); + } +} diff --git a/stripe_official.php b/stripe_official.php index a0a7a37..fa6af4d 100755 --- a/stripe_official.php +++ b/stripe_official.php @@ -130,7 +130,16 @@ class Stripe_official extends PaymentModule 'fr' => 'Logs', ), 'class_name' => 'AdminStripe_officialProcessLogger', - 'parent_class_name' => 'AdminAdvancedParameters', + 'parent_class_name' => 'stripe_official', + 'visible' => false, + ), + array( + 'name' => array( + 'en' => 'Paiment Intent List', + 'fr' => 'Liste des intentions de paiement', + ), + 'class_name' => 'AdminStripe_officialPaymentIntent', + 'parent_class_name' => 'stripe_official', 'visible' => false, ), ); From 5b4bcf450a97efd4d8e01d1a566d854287cbbc3d Mon Sep 17 00:00:00 2001 From: afayadas Date: Tue, 19 Oct 2021 17:25:41 +0200 Subject: [PATCH 30/62] refs #31650 : fixing sepa payment process --- classes/StripeEvent.php | 1 + controllers/front/createIntent.php | 2 +- controllers/front/orderSuccess.php | 16 +++++++++------- controllers/front/webhook.php | 26 +++++++++++++++++--------- 4 files changed, 28 insertions(+), 17 deletions(-) diff --git a/classes/StripeEvent.php b/classes/StripeEvent.php index e8b14ef..cd72cd5 100755 --- a/classes/StripeEvent.php +++ b/classes/StripeEvent.php @@ -28,6 +28,7 @@ class StripeEvent extends ObjectModel { + const CREATED_STATUS = 'CREATED'; const PENDING_STATUS = 'PENDING'; const AUTHORIZED_STATUS = 'AUTHORIZED'; const CAPTURED_STATUS = 'CAPTURED'; diff --git a/controllers/front/createIntent.php b/controllers/front/createIntent.php index 3c6b7e1..0429d9e 100644 --- a/controllers/front/createIntent.php +++ b/controllers/front/createIntent.php @@ -119,7 +119,7 @@ public function initContent() $stripeEvent = new StripeEvent(); $stripeEvent->setIdPaymentIntent($intent->id); - $stripeEvent->setStatus(StripeEvent::PENDING_STATUS); + $stripeEvent->setStatus(StripeEvent::CREATED_STATUS); $stripeEvent->setDateAdd($intent->created); $stripeEvent->setIsProcessed(1); if (!$stripeEvent->save()) { diff --git a/controllers/front/orderSuccess.php b/controllers/front/orderSuccess.php index 536a72b..e42fd76 100644 --- a/controllers/front/orderSuccess.php +++ b/controllers/front/orderSuccess.php @@ -120,12 +120,13 @@ private function registerStripeEvent($paymentIntent) $eventCharge = isset($intent->charges->data[0]) ? $intent->charges->data[0] : $intent; $transitionStatus = [ - StripeEvent::FAILED_STATUS => null, - StripeEvent::PENDING_STATUS => null, - StripeEvent::AUTHORIZED_STATUS => StripeEvent::PENDING_STATUS, - StripeEvent::CAPTURED_STATUS => StripeEvent::AUTHORIZED_STATUS, - StripeEvent::REFUNDED_STATUS => StripeEvent::CAPTURED_STATUS, - StripeEvent::EXPIRED_STATUS => StripeEvent::PENDING_STATUS, + StripeEvent::CREATED_STATUS => [null], + StripeEvent::FAILED_STATUS => [null], + StripeEvent::PENDING_STATUS => [StripeEvent::CREATED_STATUS], + StripeEvent::AUTHORIZED_STATUS => [StripeEvent::CREATED_STATUS, StripeEvent::PENDING_STATUS], + StripeEvent::CAPTURED_STATUS => [StripeEvent::AUTHORIZED_STATUS], + StripeEvent::REFUNDED_STATUS => [StripeEvent::CAPTURED_STATUS], + StripeEvent::EXPIRED_STATUS => [StripeEvent::PENDING_STATUS], ]; $lastRegisteredEvent = new StripeEvent(); @@ -163,12 +164,13 @@ private function registerStripeEvent($paymentIntent) case 'charge.expired': $stripeEventStatus = StripeEvent::EXPIRED_STATUS; break; + case 'charge.pending': default: $stripeEventStatus = StripeEvent::PENDING_STATUS; break; } - if ($lastRegisteredEvent->status != $transitionStatus[$stripeEventStatus]) { + if (!in_array($lastRegisteredEvent->status, $transitionStatus[$stripeEventStatus]) ) { ProcessLoggerHandler::logInfo( 'This Stripe module event "' .$stripeEventStatus.'" has already been processed.', 'StripeEvent', diff --git a/controllers/front/webhook.php b/controllers/front/webhook.php index 316f865..d920a9b 100755 --- a/controllers/front/webhook.php +++ b/controllers/front/webhook.php @@ -361,12 +361,13 @@ private function validProcessEvent($registeredEvent) private function checkEventStatus($event, $paymentIntent) { $transitionStatus = [ - StripeEvent::FAILED_STATUS => null, - StripeEvent::PENDING_STATUS => null, - StripeEvent::AUTHORIZED_STATUS => StripeEvent::PENDING_STATUS, - StripeEvent::CAPTURED_STATUS => StripeEvent::AUTHORIZED_STATUS, - StripeEvent::REFUNDED_STATUS => StripeEvent::CAPTURED_STATUS, - StripeEvent::EXPIRED_STATUS => StripeEvent::PENDING_STATUS, + StripeEvent::CREATED_STATUS => [null], + StripeEvent::FAILED_STATUS => [null], + StripeEvent::PENDING_STATUS => [StripeEvent::CREATED_STATUS], + StripeEvent::AUTHORIZED_STATUS => [StripeEvent::CREATED_STATUS, StripeEvent::PENDING_STATUS], + StripeEvent::CAPTURED_STATUS => [StripeEvent::AUTHORIZED_STATUS], + StripeEvent::REFUNDED_STATUS => [StripeEvent::CAPTURED_STATUS], + StripeEvent::EXPIRED_STATUS => [StripeEvent::PENDING_STATUS], ]; $lastRegisteredEvent = new StripeEvent(); @@ -388,6 +389,7 @@ private function checkEventStatus($event, $paymentIntent) case 'charge.expired': $eventStatus = StripeEvent::EXPIRED_STATUS; break; + case 'charge.pending': default: $eventStatus = StripeEvent::PENDING_STATUS; break; @@ -431,7 +433,7 @@ private function checkEventStatus($event, $paymentIntent) $lastRegisteredEvent->id, 'webhook - checkEventStatus' ); - } elseif ($lastRegisteredEvent->status != $transitionStatus[$eventStatus] || !$lastRegisteredEvent->isProcessed()) { + } elseif (in_array($lastRegisteredEvent->status, $transitionStatus[$eventStatus]) || !$lastRegisteredEvent->isProcessed()) { $msg = 'This Stripe module event "' . $eventStatus . '" cannot be processed because [Last event status: ' . $lastRegisteredEvent->status . ' | Processed : ' . ($lastRegisteredEvent->isProcessed() ? 'Yes' : 'No') . '].'; ProcessLoggerHandler::logInfo( $msg, @@ -487,14 +489,20 @@ private function handleWebhookActions($handler, $event) ); $eventType = $event->type; - $paymentMethodType = $event->data->object->payment_method_details->type ?: null; + + if (isset($event->data->object->payment_method_details->type)) + $paymentMethodType = $event->data->object->payment_method_details->type; + elseif (isset($event->data->object->payment_method_types[0])) + $paymentMethodType = $event->data->object->payment_method_types[0]; + else + $paymentMethodType = null; if (($eventType == 'charge.succeeded' && $paymentMethodType == 'card') || ($eventType == 'charge.pending' && $paymentMethodType == 'sepa_debit') || ($eventType == 'payment_intent.requires_action' - && $event->data->object->payment_method_types[0] == 'oxxo')) { + && $paymentMethodType == 'oxxo')) { ProcessLoggerHandler::logInfo( 'Payment method flow without redirection', null, From aaf737d2f31e835073b5ca803d4c6c077d84f9b6 Mon Sep 17 00:00:00 2001 From: afayadas Date: Tue, 19 Oct 2021 18:06:12 +0200 Subject: [PATCH 31/62] refs #31627 : adding waiting process during direct flow while webhook is calling in same time --- controllers/front/orderSuccess.php | 32 +++++++++++++++++------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/controllers/front/orderSuccess.php b/controllers/front/orderSuccess.php index e42fd76..591a785 100644 --- a/controllers/front/orderSuccess.php +++ b/controllers/front/orderSuccess.php @@ -89,24 +89,17 @@ public function initContent() if (!$handler->process('ValidationOrderActions')) { // Handle error ProcessLoggerHandler::logError( - 'Order creation process failed.', + 'Order creation process disrupted.', null, null, 'orderSuccess - initContent' ); ProcessLoggerHandler::closeLogger(); - - $url = Context::getContext()->link->getModuleLink( - 'stripe_official', - 'orderFailure', - array(), - true - ); } else { - $url = $this->createOrder(); + $url = $this->displayOrderConfirmation(); } } else { - $url = $this->createOrder(); + $url = $this->displayOrderConfirmation(); } Tools::redirect($url); @@ -175,7 +168,7 @@ private function registerStripeEvent($paymentIntent) 'This Stripe module event "' .$stripeEventStatus.'" has already been processed.', 'StripeEvent', $lastRegisteredEvent->id, - 'webhook - checkEventStatus' + 'orderSuccess - registerStripeEvent' ); ProcessLoggerHandler::closeLogger(); return false; @@ -205,17 +198,28 @@ private function registerStripeEvent($paymentIntent) } } - private function createOrder() + private function displayOrderConfirmation() { ProcessLoggerHandler::logInfo( - 'Create order', + 'Display order confirmation', null, null, 'orderSuccess - createOrder' ); ProcessLoggerHandler::closeLogger(); - $id_order = Order::getOrderByCartId($this->context->cart->id); + $waiting_count = 0; + while(!$id_order = Order::getOrderByCartId($this->context->cart->id) && $waiting_count < 4) { + sleep(2); + $waiting_count++; + ProcessLoggerHandler::logInfo( + 'Waiting proccess time => '.$waiting_count, + null, + null, + 'orderSuccess - displayOrderConfirmation' + ); + ProcessLoggerHandler::closeLogger(); + } if (isset($this->context->customer->secure_key)) { $secure_key = $this->context->customer->secure_key; From 79f8e0e7e65e1a2bc99231cdd6445bcd2524ab6e Mon Sep 17 00:00:00 2001 From: afayadas Date: Thu, 21 Oct 2021 16:29:40 +0200 Subject: [PATCH 32/62] refs #31649 : fixing oxxo payment process + send mail for oxxo payment + refactoring StripeEvent code --- classes/StripeEvent.php | 65 +++++++++++++++++ classes/actions/ValidationOrderActions.php | 12 ++-- controllers/front/orderConfirmationReturn.php | 15 ++-- controllers/front/orderSuccess.php | 70 ++++++------------- controllers/front/webhook.php | 34 +-------- 5 files changed, 104 insertions(+), 92 deletions(-) diff --git a/classes/StripeEvent.php b/classes/StripeEvent.php index cd72cd5..d09bde2 100755 --- a/classes/StripeEvent.php +++ b/classes/StripeEvent.php @@ -169,4 +169,69 @@ public function getEventByPaymentIntentNStatus($paymentIntent, $status) return $this; } + + public static function getStatusAssociatedToChargeType($chargeType) + { + switch ($chargeType) + { + case 'charge.succeeded': + return StripeEvent::AUTHORIZED_STATUS; + + case 'charge.captured': + return StripeEvent::CAPTURED_STATUS; + + case 'charge.refunded': + return StripeEvent::REFUNDED_STATUS; + + case 'charge.failed': + return StripeEvent::FAILED_STATUS; + + case 'charge.expired': + return StripeEvent::EXPIRED_STATUS; + + case 'charge.pending': + default: + return StripeEvent::PENDING_STATUS; + } + } + + public static function getTransitionStatusByNewStatus($newStatus) + { + switch ($newStatus) + { + case StripeEvent::PENDING_STATUS: + return [ + StripeEvent::CREATED_STATUS, + ]; + + case StripeEvent::AUTHORIZED_STATUS: + case StripeEvent::EXPIRED_STATUS: + return [ + StripeEvent::CREATED_STATUS, + StripeEvent::PENDING_STATUS, + ]; + + case StripeEvent::CAPTURED_STATUS: + return [ + StripeEvent::AUTHORIZED_STATUS, + ]; + + case StripeEvent::REFUNDED_STATUS: + return [ + StripeEvent::CAPTURED_STATUS, + ]; + + case StripeEvent::CREATED_STATUS: + case StripeEvent::FAILED_STATUS: + default: + return []; + } + } + + public static function validateTransitionStatus($currentStatus, $newStatus) + { + $transitionStatus = self::getTransitionStatusByNewStatus($newStatus); + + return in_array($currentStatus, $transitionStatus); + } } diff --git a/classes/actions/ValidationOrderActions.php b/classes/actions/ValidationOrderActions.php index 3f5ae19..927e3a5 100755 --- a/classes/actions/ValidationOrderActions.php +++ b/classes/actions/ValidationOrderActions.php @@ -472,18 +472,20 @@ public function sendMail() $orderId = Order::getOrderByCartId((int)$this->conveyor['id_cart']); $order = new Order((int)$orderId); + if (!isset($this->conveyor['voucher_url'])) + $this->conveyor['voucher_url'] = $this->conveyor['event_json']->data->object->next_action->oxxo_display_details->hosted_voucher_url; + if (!isset($this->conveyor['voucher_expire'])) + $this->conveyor['voucher_expire'] = $this->conveyor['event_json']->data->object->next_action->oxxo_display_details->expires_after; + $template_vars = array( '{name}' => $this->conveyor['payment_method']->billing_details->name, '{shop_name}' => Configuration::get('PS_SHOP_NAME'), '{order_id}' => $order->id, - '{voucher_url}' => $this->conveyor['event_json']->data->object->next_action->oxxo_display_details->hosted_voucher_url, + '{voucher_url}' => $this->conveyor['voucher_url'], '{order_ref}' => $order->reference, '{total_paid}' => Tools::displayPrice($order->total_paid, new Currency($order->id_currency)), ); - $this->conveyor['voucher_url'] = $this->conveyor['event_json']->data->object->next_action->oxxo_display_details->hosted_voucher_url; - $this->conveyor['voucher_expire'] = $this->conveyor['event_json']->data->object->next_action->oxxo_display_details->expires_after; - if ($dir_mail) { Mail::Send( $this->context->language->id, @@ -691,7 +693,7 @@ public function chargeWebhook() $this->conveyor['IdPaymentIntent'] = (isset($this->conveyor['event_json']->data->object->payment_intent)) ? $this->conveyor['event_json']->data->object->payment_intent - : $this->conveyor['event_json']->data->object->id;; + : $this->conveyor['event_json']->data->object->id; ProcessLoggerHandler::logInfo( 'chargeWebhook with IdPaymentIntent => ' . $this->conveyor['IdPaymentIntent'], null, diff --git a/controllers/front/orderConfirmationReturn.php b/controllers/front/orderConfirmationReturn.php index 3c09661..11a3d3a 100644 --- a/controllers/front/orderConfirmationReturn.php +++ b/controllers/front/orderConfirmationReturn.php @@ -54,7 +54,12 @@ public function initContent() $payment_intent ); - $payment_method = $intent->payment_method_types[0]; + if (isset($intent->payment_method_details->type)) + $payment_method = $intent->payment_method_details->type; + elseif (isset($intent->payment_method_types[0])) + $payment_method = $intent->payment_method_types[0]; + else + $payment_method = null; if (Tools::getValue('redirect_status') == 'failed') { $url = Context::getContext()->link->getModuleLink( @@ -64,19 +69,15 @@ public function initContent() true ); } else { - $datas = array( + $data = array( 'payment_intent' => $payment_intent, 'payment_method' => $payment_method ); - if ($payment_method == 'oxxo') { - $datas['voucher_url'] = $intent->next_action->oxxo_display_details->hosted_voucher_url; - } - $url = Context::getContext()->link->getModuleLink( 'stripe_official', 'orderSuccess', - $datas, + $data, true ); } diff --git a/controllers/front/orderSuccess.php b/controllers/front/orderSuccess.php index 591a785..64e529b 100644 --- a/controllers/front/orderSuccess.php +++ b/controllers/front/orderSuccess.php @@ -42,15 +42,23 @@ public function initContent() $payment_intent = Tools::getValue('payment_intent'); $payment_method = Tools::getValue('payment_method'); - if ($this->registerStripeEvent($payment_intent)) { - $handler = new ActionsHandler(); - $handler->setConveyor(array( - //'event_json' => $event, + $intent = \Stripe\PaymentIntent::retrieve($payment_intent); + + if ($this->registerStripeEvent($intent)) { + + $conveyorData = [ 'module' => $this->module, 'context' => $this->context, - //'events_states' => $events_states, 'paymentIntent' => $payment_intent, - )); + ]; + + if ($payment_method == 'oxxo') { + $conveyorData['voucher_url'] = $intent->next_action->oxxo_display_details->hosted_voucher_url; + $conveyorData['voucher_expire'] = $intent->next_action->oxxo_display_details->expires_after; + } + + $handler = new ActionsHandler(); + $handler->setConveyor($conveyorData); if ($payment_method == 'card' || $payment_method == 'sepa_debit' @@ -95,32 +103,17 @@ public function initContent() 'orderSuccess - initContent' ); ProcessLoggerHandler::closeLogger(); - } else { - $url = $this->displayOrderConfirmation(); } - } else { - $url = $this->displayOrderConfirmation(); } - Tools::redirect($url); - exit; + $this->displayOrderConfirmation(); } private function registerStripeEvent($paymentIntent) { - $intent = \Stripe\PaymentIntent::retrieve($paymentIntent); + $eventCharge = isset($paymentIntent->charges->data[0]) ? $paymentIntent->charges->data[0] : $paymentIntent; - $eventCharge = isset($intent->charges->data[0]) ? $intent->charges->data[0] : $intent; - - $transitionStatus = [ - StripeEvent::CREATED_STATUS => [null], - StripeEvent::FAILED_STATUS => [null], - StripeEvent::PENDING_STATUS => [StripeEvent::CREATED_STATUS], - StripeEvent::AUTHORIZED_STATUS => [StripeEvent::CREATED_STATUS, StripeEvent::PENDING_STATUS], - StripeEvent::CAPTURED_STATUS => [StripeEvent::AUTHORIZED_STATUS], - StripeEvent::REFUNDED_STATUS => [StripeEvent::CAPTURED_STATUS], - StripeEvent::EXPIRED_STATUS => [StripeEvent::PENDING_STATUS], - ]; + $stripeEventStatus = StripeEvent::getStatusAssociatedToChargeType($eventCharge->type); $lastRegisteredEvent = new StripeEvent(); $lastRegisteredEvent = $lastRegisteredEvent->getLastRegisteredEventByPaymentIntent($paymentIntent); @@ -141,29 +134,7 @@ private function registerStripeEvent($paymentIntent) } } - switch ($eventCharge ->type) { - case 'charge.succeeded': - $stripeEventStatus = StripeEvent::AUTHORIZED_STATUS; - break; - case 'charge.captured': - $stripeEventStatus = StripeEvent::CAPTURED_STATUS; - break; - case 'charge.refunded': - $stripeEventStatus = StripeEvent::REFUNDED_STATUS; - break; - case 'charge.failed': - $stripeEventStatus = StripeEvent::FAILED_STATUS; - break; - case 'charge.expired': - $stripeEventStatus = StripeEvent::EXPIRED_STATUS; - break; - case 'charge.pending': - default: - $stripeEventStatus = StripeEvent::PENDING_STATUS; - break; - } - - if (!in_array($lastRegisteredEvent->status, $transitionStatus[$stripeEventStatus]) ) { + if (!StripeEvent::validateTransitionStatus($lastRegisteredEvent->status, $stripeEventStatus)) { ProcessLoggerHandler::logInfo( 'This Stripe module event "' .$stripeEventStatus.'" has already been processed.', 'StripeEvent', @@ -227,7 +198,7 @@ private function displayOrderConfirmation() $secure_key = false; } - return Context::getContext()->link->getPageLink( + $url = Context::getContext()->link->getPageLink( 'order-confirmation', true, null, @@ -238,5 +209,8 @@ private function displayOrderConfirmation() 'key' => $secure_key ) ); + + Tools::redirect($url); + exit; } } diff --git a/controllers/front/webhook.php b/controllers/front/webhook.php index d920a9b..2279ff8 100755 --- a/controllers/front/webhook.php +++ b/controllers/front/webhook.php @@ -360,41 +360,11 @@ private function validProcessEvent($registeredEvent) private function checkEventStatus($event, $paymentIntent) { - $transitionStatus = [ - StripeEvent::CREATED_STATUS => [null], - StripeEvent::FAILED_STATUS => [null], - StripeEvent::PENDING_STATUS => [StripeEvent::CREATED_STATUS], - StripeEvent::AUTHORIZED_STATUS => [StripeEvent::CREATED_STATUS, StripeEvent::PENDING_STATUS], - StripeEvent::CAPTURED_STATUS => [StripeEvent::AUTHORIZED_STATUS], - StripeEvent::REFUNDED_STATUS => [StripeEvent::CAPTURED_STATUS], - StripeEvent::EXPIRED_STATUS => [StripeEvent::PENDING_STATUS], - ]; + $eventStatus = StripeEvent::getStatusAssociatedToChargeType($event->type); $lastRegisteredEvent = new StripeEvent(); $lastRegisteredEvent = $lastRegisteredEvent->getLastRegisteredEventByPaymentIntent($paymentIntent); - switch ($event->type) { - case 'charge.succeeded': - $eventStatus = StripeEvent::AUTHORIZED_STATUS; - break; - case 'charge.captured': - $eventStatus = StripeEvent::CAPTURED_STATUS; - break; - case 'charge.refunded': - $eventStatus = StripeEvent::REFUNDED_STATUS; - break; - case 'charge.failed': - $eventStatus = StripeEvent::FAILED_STATUS; - break; - case 'charge.expired': - $eventStatus = StripeEvent::EXPIRED_STATUS; - break; - case 'charge.pending': - default: - $eventStatus = StripeEvent::PENDING_STATUS; - break; - } - if ($lastRegisteredEvent->status != $eventStatus && $lastRegisteredEvent->date_add != null) { $lastRegisteredEventDate = new DateTime($lastRegisteredEvent->date_add); $currentEventDate = new DateTime(); @@ -433,7 +403,7 @@ private function checkEventStatus($event, $paymentIntent) $lastRegisteredEvent->id, 'webhook - checkEventStatus' ); - } elseif (in_array($lastRegisteredEvent->status, $transitionStatus[$eventStatus]) || !$lastRegisteredEvent->isProcessed()) { + } elseif (!StripeEvent::validateTransitionStatus($lastRegisteredEvent->status, $eventStatus) || !$lastRegisteredEvent->isProcessed()) { $msg = 'This Stripe module event "' . $eventStatus . '" cannot be processed because [Last event status: ' . $lastRegisteredEvent->status . ' | Processed : ' . ($lastRegisteredEvent->isProcessed() ? 'Yes' : 'No') . '].'; ProcessLoggerHandler::logInfo( $msg, From 14b71ec30ccf94796a6813010d7ccd4e4a8c6145 Mon Sep 17 00:00:00 2001 From: afayadas Date: Thu, 21 Oct 2021 17:06:54 +0200 Subject: [PATCH 33/62] refs #31037 : withdrawing charge.update event --- stripe_official.php | 1 - 1 file changed, 1 deletion(-) diff --git a/stripe_official.php b/stripe_official.php index fa6af4d..cca9504 100755 --- a/stripe_official.php +++ b/stripe_official.php @@ -379,7 +379,6 @@ class Stripe_official extends PaymentModule ); public static $webhook_events = array( - \Stripe\Event::CHARGE_UPDATED, \Stripe\Event::CHARGE_EXPIRED, \Stripe\Event::CHARGE_FAILED, \Stripe\Event::CHARGE_SUCCEEDED, From 62fa1d0cc15508063d4cc35b3f124702628dd988 Mon Sep 17 00:00:00 2001 From: afayadas Date: Mon, 25 Oct 2021 16:22:18 +0200 Subject: [PATCH 34/62] refs #31734 : tracking all possible issue about sepa payment call --- classes/StripeEvent.php | 25 ++++++++++++++++--- .../AdminStripe_officialPaymentIntent.php | 3 +++ controllers/front/orderSuccess.php | 12 ++++++--- controllers/front/webhook.php | 13 ++++++++++ 4 files changed, 46 insertions(+), 7 deletions(-) diff --git a/classes/StripeEvent.php b/classes/StripeEvent.php index d09bde2..9daef9d 100755 --- a/classes/StripeEvent.php +++ b/classes/StripeEvent.php @@ -52,6 +52,10 @@ class StripeEvent extends ObjectModel * @var bool $is_processed */ public $is_processed; + /** + * @var $flow_type + */ + public $flow_type = 'webhook'; /** * @var array $definition @@ -76,9 +80,14 @@ class StripeEvent extends ObjectModel 'validate' => 'isDate', ), 'is_processed' => array( - 'type' => ObjectModel::TYPE_BOOL, + 'type' => ObjectModel::TYPE_BOOL, 'validate' => 'isBool', - ) + ), + 'flow_type' => array( + 'type' => ObjectModel::TYPE_STRING, + 'validate' => 'isString', + 'size' => 30, + ), ), 'indexes' => [ [ @@ -135,6 +144,16 @@ public function setIsProcessed($is_processed) $this->is_processed = $is_processed; } + public function setFlowType($flow_type) + { + $this->flow_type = $flow_type; + } + + public function getFlowType() + { + return $this->flow_type; + } + public function getLastRegisteredEventByPaymentIntent($paymentIntent) { $query = new DbQuery(); @@ -205,6 +224,7 @@ public static function getTransitionStatusByNewStatus($newStatus) ]; case StripeEvent::AUTHORIZED_STATUS: + case StripeEvent::FAILED_STATUS: case StripeEvent::EXPIRED_STATUS: return [ StripeEvent::CREATED_STATUS, @@ -222,7 +242,6 @@ public static function getTransitionStatusByNewStatus($newStatus) ]; case StripeEvent::CREATED_STATUS: - case StripeEvent::FAILED_STATUS: default: return []; } diff --git a/controllers/admin/AdminStripe_officialPaymentIntent.php b/controllers/admin/AdminStripe_officialPaymentIntent.php index 6c8cf5c..eec7767 100644 --- a/controllers/admin/AdminStripe_officialPaymentIntent.php +++ b/controllers/admin/AdminStripe_officialPaymentIntent.php @@ -114,6 +114,9 @@ public function renderDetails() 'align' => 'right', 'class' => 'fixed-width-xs', ], + 'flow_type' => [ + 'title' => $this->module->l('Flow Type', 'AdminStripe_officialPaymentIntentController'), + ], ]; return $this->renderList(); diff --git a/controllers/front/orderSuccess.php b/controllers/front/orderSuccess.php index 64e529b..7b453eb 100644 --- a/controllers/front/orderSuccess.php +++ b/controllers/front/orderSuccess.php @@ -154,6 +154,7 @@ private function registerStripeEvent($paymentIntent) $stripeEvent->setStatus($stripeEventStatus); $stripeEvent->setDateAdd($stripeEventDate->format('Y-m-d H:i:s')); $stripeEvent->setIsProcessed(true); + $stripeEvent->setFlowType('direct'); try { return $stripeEvent->save(); @@ -179,12 +180,15 @@ private function displayOrderConfirmation() ); ProcessLoggerHandler::closeLogger(); - $waiting_count = 0; - while(!$id_order = Order::getOrderByCartId($this->context->cart->id) && $waiting_count < 4) { + for($i = 0; $i < 4; $i++) { + $id_order = Order::getOrderByCartId($this->context->cart->id); + + if ($id_order) + break; + sleep(2); - $waiting_count++; ProcessLoggerHandler::logInfo( - 'Waiting proccess time => '.$waiting_count, + 'Waiting proccess time => '.$i, null, null, 'orderSuccess - displayOrderConfirmation' diff --git a/controllers/front/webhook.php b/controllers/front/webhook.php index 2279ff8..b9f658b 100755 --- a/controllers/front/webhook.php +++ b/controllers/front/webhook.php @@ -365,6 +365,19 @@ private function checkEventStatus($event, $paymentIntent) $lastRegisteredEvent = new StripeEvent(); $lastRegisteredEvent = $lastRegisteredEvent->getLastRegisteredEventByPaymentIntent($paymentIntent); + if ($lastRegisteredEvent->id == null) { + $msg = 'This payment intent doesn\'t exist. This charge event is perhaps intended for another webhook.'; + ProcessLoggerHandler::logInfo( + $msg, + null, + null, + 'webhook - checkEventStatus' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(500); + die($msg); + } + if ($lastRegisteredEvent->status != $eventStatus && $lastRegisteredEvent->date_add != null) { $lastRegisteredEventDate = new DateTime($lastRegisteredEvent->date_add); $currentEventDate = new DateTime(); From 50472c522adc115b1e04fe34928ea22ce03d5f37 Mon Sep 17 00:00:00 2001 From: afayadas Date: Tue, 26 Oct 2021 12:04:52 +0200 Subject: [PATCH 35/62] refs #31812 : fixing fatal error about expired key when saving configuration or switching configuration mode --- classes/actions/ConfigurationActions.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/classes/actions/ConfigurationActions.php b/classes/actions/ConfigurationActions.php index 5de447f..c7f732e 100755 --- a/classes/actions/ConfigurationActions.php +++ b/classes/actions/ConfigurationActions.php @@ -51,7 +51,11 @@ public function registerKeys() && (($secretKeyTest && $mode) || ($secretKeyLive && !$mode))) { $secretKey = $mode ? $secretKeyTest : $secretKeyLive; $stripeClient = new \Stripe\StripeClient($secretKey); - $stripeClient->webhookEndpoints->delete($webhookId); + try { + $stripeClient->webhookEndpoints->delete($webhookId); + } catch (\Stripe\Exception\ApiErrorException $e) { + $this->module->errors[] = $e->getMessage(); + } Configuration::updateValue(Stripe_official::WEBHOOK_SIGNATURE, '', false, $shopGroupId, $shopId); } From 2d30ec1cf8393655c884b8563d901f158d55c5a2 Mon Sep 17 00:00:00 2001 From: afayadas Date: Tue, 26 Oct 2021 18:23:29 +0200 Subject: [PATCH 36/62] refs #31812 : fixing direct flow process + add new logs --- classes/StripeEvent.php | 6 ++ .../AdminStripe_officialPaymentIntent.php | 2 +- controllers/front/orderSuccess.php | 64 +++++++++++++++---- 3 files changed, 57 insertions(+), 15 deletions(-) diff --git a/classes/StripeEvent.php b/classes/StripeEvent.php index 9daef9d..d130c34 100755 --- a/classes/StripeEvent.php +++ b/classes/StripeEvent.php @@ -194,21 +194,27 @@ public static function getStatusAssociatedToChargeType($chargeType) switch ($chargeType) { case 'charge.succeeded': + case 'succeeded': return StripeEvent::AUTHORIZED_STATUS; case 'charge.captured': + case 'captured': return StripeEvent::CAPTURED_STATUS; case 'charge.refunded': + case 'refunded': return StripeEvent::REFUNDED_STATUS; case 'charge.failed': + case 'failed': return StripeEvent::FAILED_STATUS; case 'charge.expired': + case 'expired': return StripeEvent::EXPIRED_STATUS; case 'charge.pending': + case 'pending': default: return StripeEvent::PENDING_STATUS; } diff --git a/controllers/admin/AdminStripe_officialPaymentIntent.php b/controllers/admin/AdminStripe_officialPaymentIntent.php index eec7767..c0d07ae 100644 --- a/controllers/admin/AdminStripe_officialPaymentIntent.php +++ b/controllers/admin/AdminStripe_officialPaymentIntent.php @@ -36,7 +36,7 @@ public function __construct() $this->_select = 'sp.id_cart, sp.id_payment_intent, sp.type, spi.status, o.reference'; $this->_join = - 'INNER JOIN `'._DB_PREFIX_.'stripe_payment` sp ON (a.id_payment_intent = sp.id_payment_intent AND sp.result = 1) + 'INNER JOIN `'._DB_PREFIX_.'stripe_payment` sp ON (a.id_payment_intent = sp.id_payment_intent AND sp.result > 0) INNER JOIN `'._DB_PREFIX_.'stripe_payment_intent` spi ON (sp.id_payment_intent = spi.id_payment_intent) INNER JOIN `'._DB_PREFIX_.'orders` o ON (sp.id_cart = o.id_cart)'; $this->_group = 'GROUP BY id_payment_intent'; diff --git a/controllers/front/orderSuccess.php b/controllers/front/orderSuccess.php index 7b453eb..7b9c649 100644 --- a/controllers/front/orderSuccess.php +++ b/controllers/front/orderSuccess.php @@ -42,7 +42,24 @@ public function initContent() $payment_intent = Tools::getValue('payment_intent'); $payment_method = Tools::getValue('payment_method'); - $intent = \Stripe\PaymentIntent::retrieve($payment_intent); + try { + $intent = \Stripe\PaymentIntent::retrieve($payment_intent); + } catch (\Stripe\Exception\ApiErrorException $e) { + $intent = null; + ProcessLoggerHandler::logInfo( + 'Retrieve payment intent : ' . $e->getMessage(), + null, + null, + 'orderSuccess - registerStripeEvent' + ); + } + + ProcessLoggerHandler::logInfo( + 'Retrieve payment intent : '.$intent, + null, + null, + 'orderSuccess - registerStripeEvent' + ); if ($this->registerStripeEvent($intent)) { @@ -77,7 +94,8 @@ public function initContent() 'saveCard', 'addTentative' ); - } elseif ($payment_method == 'sofort') { + } elseif ($payment_method == 'sofort' + || $payment_method == 'fpx') { ProcessLoggerHandler::logInfo( 'Payment method flow with redirection', null, @@ -102,7 +120,6 @@ public function initContent() null, 'orderSuccess - initContent' ); - ProcessLoggerHandler::closeLogger(); } } @@ -113,10 +130,17 @@ private function registerStripeEvent($paymentIntent) { $eventCharge = isset($paymentIntent->charges->data[0]) ? $paymentIntent->charges->data[0] : $paymentIntent; - $stripeEventStatus = StripeEvent::getStatusAssociatedToChargeType($eventCharge->type); + $stripeEventStatus = StripeEvent::getStatusAssociatedToChargeType($eventCharge->status); $lastRegisteredEvent = new StripeEvent(); - $lastRegisteredEvent = $lastRegisteredEvent->getLastRegisteredEventByPaymentIntent($paymentIntent); + $lastRegisteredEvent = $lastRegisteredEvent->getLastRegisteredEventByPaymentIntent($paymentIntent->id); + + ProcessLoggerHandler::logInfo( + 'Last registered event => ID : ' . $lastRegisteredEvent->id, + null, + null, + 'orderSuccess - registerStripeEvent' + ); if ($lastRegisteredEvent->date_add != null) { $lastRegisteredEventDate = new DateTime($lastRegisteredEvent->date_add); @@ -136,7 +160,7 @@ private function registerStripeEvent($paymentIntent) if (!StripeEvent::validateTransitionStatus($lastRegisteredEvent->status, $stripeEventStatus)) { ProcessLoggerHandler::logInfo( - 'This Stripe module event "' .$stripeEventStatus.'" has already been processed.', + 'This Stripe module event "' . $stripeEventStatus . '" cannot be processed because [Last event status: ' . $lastRegisteredEvent->status . ' | Processed : ' . ($lastRegisteredEvent->isProcessed() ? 'Yes' : 'No') . '].', 'StripeEvent', $lastRegisteredEvent->id, 'orderSuccess - registerStripeEvent' @@ -149,8 +173,7 @@ private function registerStripeEvent($paymentIntent) $stripeEventDate = $stripeEventDate->setTimestamp($eventCharge->created); $stripeEvent = new StripeEvent(); - $stripeEvent = $stripeEvent->getEventByPaymentIntentNStatus($paymentIntent, $stripeEventStatus); - $stripeEvent->setIdPaymentIntent($paymentIntent); + $stripeEvent->setIdPaymentIntent($paymentIntent->id); $stripeEvent->setStatus($stripeEventStatus); $stripeEvent->setDateAdd($stripeEventDate->format('Y-m-d H:i:s')); $stripeEvent->setIsProcessed(true); @@ -160,7 +183,7 @@ private function registerStripeEvent($paymentIntent) return $stripeEvent->save(); } catch (PrestaShopException $e) { ProcessLoggerHandler::logInfo( - 'Cannot process event', + 'An issue appears during saving Stripe module event in database : ' . $e->getMessage(), null, null, 'orderSuccess - registerStripeEvent' @@ -176,15 +199,21 @@ private function displayOrderConfirmation() 'Display order confirmation', null, null, - 'orderSuccess - createOrder' + 'orderSuccess - displayOrderConfirmation' ); - ProcessLoggerHandler::closeLogger(); - for($i = 0; $i < 4; $i++) { + for($i = 1; $i < 5; $i++) { $id_order = Order::getOrderByCartId($this->context->cart->id); - if ($id_order) + if ($id_order) { + ProcessLoggerHandler::logInfo( + 'Waiting proccess order OK', + null, + null, + 'orderSuccess - displayOrderConfirmation' + ); break; + } sleep(2); ProcessLoggerHandler::logInfo( @@ -193,7 +222,6 @@ private function displayOrderConfirmation() null, 'orderSuccess - displayOrderConfirmation' ); - ProcessLoggerHandler::closeLogger(); } if (isset($this->context->customer->secure_key)) { @@ -214,6 +242,14 @@ private function displayOrderConfirmation() ) ); + ProcessLoggerHandler::logInfo( + 'Confirmation order url => '.$url, + null, + null, + 'orderSuccess - displayOrderConfirmation' + ); + ProcessLoggerHandler::closeLogger(); + Tools::redirect($url); exit; } From bda4fdd4d15d097495d827ed17d80dda0badd86b Mon Sep 17 00:00:00 2001 From: afayadas Date: Fri, 29 Oct 2021 14:38:32 +0200 Subject: [PATCH 37/62] refs #31878 : fixing issues during stripe refund and order confirmation display --- classes/StripeEvent.php | 1 + controllers/front/orderSuccess.php | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/classes/StripeEvent.php b/classes/StripeEvent.php index d130c34..9b028eb 100755 --- a/classes/StripeEvent.php +++ b/classes/StripeEvent.php @@ -244,6 +244,7 @@ public static function getTransitionStatusByNewStatus($newStatus) case StripeEvent::REFUNDED_STATUS: return [ + StripeEvent::AUTHORIZED_STATUS, StripeEvent::CAPTURED_STATUS, ]; diff --git a/controllers/front/orderSuccess.php b/controllers/front/orderSuccess.php index 7b9c649..176060f 100644 --- a/controllers/front/orderSuccess.php +++ b/controllers/front/orderSuccess.php @@ -123,7 +123,10 @@ public function initContent() } } - $this->displayOrderConfirmation(); + $stripePayment = new StripePayment(); + $stripePayment->getStripePaymentByPaymentIntent($intent->id); + + $this->displayOrderConfirmation($stripePayment->id_cart); } private function registerStripeEvent($paymentIntent) @@ -193,7 +196,7 @@ private function registerStripeEvent($paymentIntent) } } - private function displayOrderConfirmation() + private function displayOrderConfirmation($cartId) { ProcessLoggerHandler::logInfo( 'Display order confirmation', @@ -202,8 +205,8 @@ private function displayOrderConfirmation() 'orderSuccess - displayOrderConfirmation' ); - for($i = 1; $i < 5; $i++) { - $id_order = Order::getOrderByCartId($this->context->cart->id); + for($i = 1; $i <= 15; $i++) { + $id_order = (int) Order::getOrderByCartId($cartId); if ($id_order) { ProcessLoggerHandler::logInfo( @@ -235,9 +238,9 @@ private function displayOrderConfirmation() true, null, array( - 'id_cart' => (int)$this->context->cart->id, + 'id_cart' => $cartId, 'id_module' => (int)$this->module->id, - 'id_order' => (int)$id_order, + 'id_order' => $id_order, 'key' => $secure_key ) ); From 84d7c239a87bf14537515ce46f7fe0b5261af622 Mon Sep 17 00:00:00 2001 From: afayadas Date: Fri, 29 Oct 2021 16:19:13 +0200 Subject: [PATCH 38/62] refs #29698 : adding additionnals informations in payment intent metadata to allow payment in India --- controllers/front/createIntent.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/controllers/front/createIntent.php b/controllers/front/createIntent.php index 0429d9e..e42609d 100644 --- a/controllers/front/createIntent.php +++ b/controllers/front/createIntent.php @@ -54,7 +54,8 @@ public function initContent() "capture_method" => $capture_method, "metadata" => array( 'id_cart' => $this->context->cart->id - ) + ), + "description" => 'Product Purchase', ); if (!Tools::getValue('id_payment_method')) { @@ -68,6 +69,20 @@ public function initContent() $stripe_fullname = $firstname . ' ' . $lastname; } + $shippingAddress = new Address($this->context->cart->id_address_delivery); + $shippingAddressState = new State($shippingAddress->id_state); + + $datasIntent['shipping'] = [ + 'name' => $stripe_fullname, + 'address' => [ + 'line1' => $shippingAddress->address1, + 'postal_code' => $shippingAddress->postcode, + 'city' => $shippingAddress->city, + 'state' => $shippingAddressState->iso_code, + 'country' => Country::getIsoById($shippingAddress->id_country), + ], + ]; + $address = new Address($this->context->cart->id_address_invoice); $payment_method = array( From 800c4a38f213c7d1c1c550a82f8553b023bde681 Mon Sep 17 00:00:00 2001 From: afayadas Date: Fri, 29 Oct 2021 16:21:03 +0200 Subject: [PATCH 39/62] refs #31882 : adding some minor modifications in front controllers --- controllers/front/createIntent.php | 7 +++---- controllers/front/orderSuccess.php | 3 --- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/controllers/front/createIntent.php b/controllers/front/createIntent.php index e42609d..605b7a8 100644 --- a/controllers/front/createIntent.php +++ b/controllers/front/createIntent.php @@ -138,16 +138,15 @@ public function initContent() $stripeEvent->setDateAdd($intent->created); $stripeEvent->setIsProcessed(1); if (!$stripeEvent->save()) { - $msg = 'An issue appears during saving Stripe module event in database (the event probably already exists).'; ProcessLoggerHandler::logInfo( - $msg, + 'An issue appears during saving Stripe module event in database (the event probably already exists).', null, null, 'webhook - registerEvent' ); ProcessLoggerHandler::closeLogger(); http_response_code(400); - die($msg); + die('An unexpected problem has occurred. Please contact the support : https://addons.prestashop.com/en/contact-us?id_product=24922'); } } catch (Exception $e) { error_log($e->getMessage()); @@ -158,7 +157,7 @@ public function initContent() 'createIntent' ); ProcessLoggerHandler::closeLogger(); - die($e->getMessage()); + die('An unexpected problem has occurred. Please contact the support : https://addons.prestashop.com/en/contact-us?id_product=24922'); } echo Tools::jsonEncode(array( diff --git a/controllers/front/orderSuccess.php b/controllers/front/orderSuccess.php index 176060f..4122e61 100644 --- a/controllers/front/orderSuccess.php +++ b/controllers/front/orderSuccess.php @@ -36,9 +36,6 @@ public function initContent() { parent::initContent(); - if (Configuration::get("STRIPE_RECIPE_MODE")) - sleep(3); - $payment_intent = Tools::getValue('payment_intent'); $payment_method = Tools::getValue('payment_method'); From 5e2d88b9832d0545799ea73a091b671fe904a998 Mon Sep 17 00:00:00 2001 From: Yves Huynh Date: Wed, 3 Nov 2021 21:07:50 +0100 Subject: [PATCH 40/62] bugfix #31113 - fix position js stripe --- stripe_official.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stripe_official.php b/stripe_official.php index cca9504..820370b 100755 --- a/stripe_official.php +++ b/stripe_official.php @@ -1562,7 +1562,8 @@ public function hookHeader() $this->name.'-stripe-v3', 'https://js.stripe.com/v3/', array( - 'server'=>'remote' + 'server'=>'remote', + 'position' => 'head', ) ); $this->context->controller->registerJavascript( From df4317d84fec541b0e8987f0d4831906f42d3bd8 Mon Sep 17 00:00:00 2001 From: Yves Huynh Date: Fri, 5 Nov 2021 14:36:03 +0100 Subject: [PATCH 41/62] bugfix #31960 - fix retrieve order while waiting for webhook --- controllers/front/orderSuccess.php | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/controllers/front/orderSuccess.php b/controllers/front/orderSuccess.php index 4122e61..5e7ee5f 100644 --- a/controllers/front/orderSuccess.php +++ b/controllers/front/orderSuccess.php @@ -120,10 +120,7 @@ public function initContent() } } - $stripePayment = new StripePayment(); - $stripePayment->getStripePaymentByPaymentIntent($intent->id); - - $this->displayOrderConfirmation($stripePayment->id_cart); + $this->displayOrderConfirmation($intent->id); } private function registerStripeEvent($paymentIntent) @@ -193,7 +190,7 @@ private function registerStripeEvent($paymentIntent) } } - private function displayOrderConfirmation($cartId) + private function displayOrderConfirmation($id_intent) { ProcessLoggerHandler::logInfo( 'Display order confirmation', @@ -203,18 +200,21 @@ private function displayOrderConfirmation($cartId) ); for($i = 1; $i <= 15; $i++) { - $id_order = (int) Order::getOrderByCartId($cartId); + $stripePayment = new StripePayment(); + $stripePayment->getStripePaymentByPaymentIntent($id_intent); + if ($stripePayment->id_cart !== null) { + $id_order = (int) Order::getOrderByCartId($stripePayment->id_cart); - if ($id_order) { - ProcessLoggerHandler::logInfo( - 'Waiting proccess order OK', - null, - null, - 'orderSuccess - displayOrderConfirmation' - ); - break; + if ($id_order) { + ProcessLoggerHandler::logInfo( + 'Waiting proccess order OK', + null, + null, + 'orderSuccess - displayOrderConfirmation' + ); + break; + } } - sleep(2); ProcessLoggerHandler::logInfo( 'Waiting proccess time => '.$i, @@ -235,7 +235,7 @@ private function displayOrderConfirmation($cartId) true, null, array( - 'id_cart' => $cartId, + 'id_cart' => $stripePayment->id_cart, 'id_module' => (int)$this->module->id, 'id_order' => $id_order, 'key' => $secure_key From 113e6fc3fe3fab3a62f90a28c9c5104d26b23d9e Mon Sep 17 00:00:00 2001 From: Yves Huynh Date: Wed, 10 Nov 2021 16:27:17 +0100 Subject: [PATCH 42/62] bugfix #32038 - downgrade classlib for php 5.6 --- 202/classlib.yml | 2 +- classes/StripeEvent.php | 17 +- .../src/Actions/ActionsHandler.php | 73 +-- .../src/Actions/DefaultActions.php | 23 +- .../src/Database/Action/ActionFactory.php | 54 -- .../src/Database/Action/ActionInterface.php | 38 -- .../src/Database/Action/ActionType.php | 33 -- .../src/Database/Action/InstallAction.php | 87 --- .../Action/Table/AbstractTableAction.php | 38 -- .../Action/Table/CreateTableAction.php | 113 ---- .../Action/Table/DeleteTableAction.php | 42 -- .../Action/Table/TableActionFactory.php | 57 -- .../Database/Action/Table/TableActionType.php | 35 -- .../Action/Table/UpdateTableAction.php | 120 ----- .../src/Database/Action/UninstallAction.php | 73 --- .../src/Database/DbObjectHandler.php | 31 -- .../Definition/Field/FieldDefinition.php | 127 ----- .../Field/FieldDefinitionColumnBuilder.php | 98 ---- .../ObjectModel/ObjectModelDefinition.php | 441 --------------- .../Definition/Schema/SchemaDefinition.php | 98 ---- .../Table/AbstractTableDefinitionBuilder.php | 76 --- .../Table/LangTableDefinitionBuilder.php | 122 ----- .../Table/MainTableDefinitionBuilder.php | 82 --- .../Table/ShopTableDefinitionBuilder.php | 97 ---- .../Definition/Table/TableDefinition.php | 266 --------- .../Table/TableDefinitionFactory.php | 70 --- .../Database/Definition/Table/TableType.php | 35 -- .../src/Database/ForeignKey/ForeignKey.php | 249 --------- .../Database/ForeignKey/ForeignKeyHandler.php | 112 ---- .../Database/ForeignKey/ReferenceOption.php | 39 -- .../src/Database/Index/Index.php | 193 ------- .../src/Database/Index/IndexField.php | 51 -- .../src/Database/Index/IndexHandler.php | 111 ---- .../src/Database/Index/IndexType.php | 37 -- .../src/Database/ObjectModelExtension.php | 79 --- .../Database/Repository/ActionRepository.php | 43 -- vendor/totpsclasslib/src/Db/DbSchema.php | 74 +++ vendor/totpsclasslib/src/Db/DbTable.php | 387 +++++++++++++ .../src/Db/DbTableDefinitionModel.php | 284 ++++++++++ .../src/Db/DbTableDefinitionRelation.php | 385 +++++++++++++ .../src/Db/ObjectModelDefinition.php | 510 ++++++++++++++++++ .../src/Db/ObjectModelExtension.php | 120 +++++ .../Extensions/AbstractModuleExtension.php | 126 +---- .../Classes/ProcessLoggerObjectModel.php | 66 +-- .../Admin/AdminProcessLoggerController.php | 153 +++--- .../ProcessLogger/ProcessLoggerExtension.php | 26 +- .../ProcessLogger/ProcessLoggerHandler.php | 122 ++--- .../Classes/ProcessMonitorObjectModel.php | 124 ----- .../ProcessMonitor/ProcessMonitorHandler.php | 205 ------- .../totpsclasslib/src/Hook/AbstractHook.php | 76 --- .../src/Hook/AbstractHookDispatcher.php | 150 ------ .../src/Install/AbstractInstaller.php | 131 ++--- .../src/Install/ExtensionInstaller.php | 59 +- .../src/Install/ModuleInstaller.php | 62 +-- vendor/totpsclasslib/src/Module.php | 311 ----------- vendor/totpsclasslib/src/Registry.php | 37 +- .../src/Utils/Translate/TranslateTrait.php | 66 --- 57 files changed, 2043 insertions(+), 4693 deletions(-) delete mode 100644 vendor/totpsclasslib/src/Database/Action/ActionFactory.php delete mode 100644 vendor/totpsclasslib/src/Database/Action/ActionInterface.php delete mode 100644 vendor/totpsclasslib/src/Database/Action/ActionType.php delete mode 100644 vendor/totpsclasslib/src/Database/Action/InstallAction.php delete mode 100644 vendor/totpsclasslib/src/Database/Action/Table/AbstractTableAction.php delete mode 100644 vendor/totpsclasslib/src/Database/Action/Table/CreateTableAction.php delete mode 100644 vendor/totpsclasslib/src/Database/Action/Table/DeleteTableAction.php delete mode 100644 vendor/totpsclasslib/src/Database/Action/Table/TableActionFactory.php delete mode 100644 vendor/totpsclasslib/src/Database/Action/Table/TableActionType.php delete mode 100644 vendor/totpsclasslib/src/Database/Action/Table/UpdateTableAction.php delete mode 100644 vendor/totpsclasslib/src/Database/Action/UninstallAction.php delete mode 100644 vendor/totpsclasslib/src/Database/DbObjectHandler.php delete mode 100644 vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinition.php delete mode 100644 vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinitionColumnBuilder.php delete mode 100644 vendor/totpsclasslib/src/Database/Definition/ObjectModel/ObjectModelDefinition.php delete mode 100644 vendor/totpsclasslib/src/Database/Definition/Schema/SchemaDefinition.php delete mode 100644 vendor/totpsclasslib/src/Database/Definition/Table/AbstractTableDefinitionBuilder.php delete mode 100644 vendor/totpsclasslib/src/Database/Definition/Table/LangTableDefinitionBuilder.php delete mode 100644 vendor/totpsclasslib/src/Database/Definition/Table/MainTableDefinitionBuilder.php delete mode 100644 vendor/totpsclasslib/src/Database/Definition/Table/ShopTableDefinitionBuilder.php delete mode 100644 vendor/totpsclasslib/src/Database/Definition/Table/TableDefinition.php delete mode 100644 vendor/totpsclasslib/src/Database/Definition/Table/TableDefinitionFactory.php delete mode 100644 vendor/totpsclasslib/src/Database/Definition/Table/TableType.php delete mode 100644 vendor/totpsclasslib/src/Database/ForeignKey/ForeignKey.php delete mode 100644 vendor/totpsclasslib/src/Database/ForeignKey/ForeignKeyHandler.php delete mode 100644 vendor/totpsclasslib/src/Database/ForeignKey/ReferenceOption.php delete mode 100644 vendor/totpsclasslib/src/Database/Index/Index.php delete mode 100644 vendor/totpsclasslib/src/Database/Index/IndexField.php delete mode 100644 vendor/totpsclasslib/src/Database/Index/IndexHandler.php delete mode 100644 vendor/totpsclasslib/src/Database/Index/IndexType.php delete mode 100644 vendor/totpsclasslib/src/Database/ObjectModelExtension.php delete mode 100644 vendor/totpsclasslib/src/Database/Repository/ActionRepository.php create mode 100644 vendor/totpsclasslib/src/Db/DbSchema.php create mode 100644 vendor/totpsclasslib/src/Db/DbTable.php create mode 100644 vendor/totpsclasslib/src/Db/DbTableDefinitionModel.php create mode 100644 vendor/totpsclasslib/src/Db/DbTableDefinitionRelation.php create mode 100644 vendor/totpsclasslib/src/Db/ObjectModelDefinition.php create mode 100644 vendor/totpsclasslib/src/Db/ObjectModelExtension.php delete mode 100644 vendor/totpsclasslib/src/Extensions/ProcessMonitor/Classes/ProcessMonitorObjectModel.php delete mode 100644 vendor/totpsclasslib/src/Extensions/ProcessMonitor/ProcessMonitorHandler.php delete mode 100644 vendor/totpsclasslib/src/Hook/AbstractHook.php delete mode 100644 vendor/totpsclasslib/src/Hook/AbstractHookDispatcher.php delete mode 100644 vendor/totpsclasslib/src/Module.php delete mode 100644 vendor/totpsclasslib/src/Utils/Translate/TranslateTrait.php diff --git a/202/classlib.yml b/202/classlib.yml index fb413bf..822ebb0 100755 --- a/202/classlib.yml +++ b/202/classlib.yml @@ -1 +1 @@ -version: develop +version: release/2.1.1 diff --git a/classes/StripeEvent.php b/classes/StripeEvent.php index 9b028eb..b13379e 100755 --- a/classes/StripeEvent.php +++ b/classes/StripeEvent.php @@ -1,7 +1,4 @@ ObjectModel::TYPE_STRING, 'validate' => 'isString', 'size' => 30, + 'unique' => true, ), 'date_add' => array( 'type' => ObjectModel::TYPE_DATE, @@ -89,19 +87,6 @@ class StripeEvent extends ObjectModel 'size' => 30, ), ), - 'indexes' => [ - [ - 'fields' => [ - [ - 'column' => 'id_payment_intent', - ], - [ - 'column' => 'status', - ] - ], - 'type' => IndexType::UNIQUE, - ], - ], ); public function setIdPaymentIntent($id_payment_intent) diff --git a/vendor/totpsclasslib/src/Actions/ActionsHandler.php b/vendor/totpsclasslib/src/Actions/ActionsHandler.php index 7db5980..a68a50a 100644 --- a/vendor/totpsclasslib/src/Actions/ActionsHandler.php +++ b/vendor/totpsclasslib/src/Actions/ActionsHandler.php @@ -20,40 +20,34 @@ * @author 202-ecommerce * @copyright Copyright (c) 202-ecommerce * @license Commercial license - * - * @version develop + * @version release/2.1.1 */ namespace Stripe_officialClasslib\Actions; -use Hook; -use Module; -use ObjectModel; -use Tools; +use \Tools; /** * Actions Handler */ class ActionsHandler { - const PROCESS_OVERRIDE_HOOK = 'actionStripe_officialActionsHandler'; - /** - * @var ObjectModel + * @var ObjectModel $modelObject */ protected $modelObject; /** * Values conveyored by the classes * - * @var array + * @var array $conveyor */ - protected $conveyor = []; + protected $conveyor = array(); /** * List of actions * - * @var array + * @var array $actions */ protected $actions; @@ -61,7 +55,6 @@ class ActionsHandler * Set an modelObject * * @param ObjectModel $modelObject - * * @return $this */ public function setModelObject($modelObject) @@ -75,7 +68,6 @@ public function setModelObject($modelObject) * Set the conveyor * * @param array $conveyorData - * * @return $this */ public function setConveyor($conveyorData) @@ -99,68 +91,53 @@ public function getConveyor() * Call sevral actions * * @param mixed $actions - * * @return $this */ public function addActions($actions) { $this->actions = func_get_args(); - return $this; } /** * Process the action call back of cross modules * - * @param string $className Name of the actions chain / Namespaced classname - * + * @param string $chain Name of the actions chain * @return bool - * - * @throws \Exception */ - public function process($className) + public function process($chain) { - if (!class_exists($className)) { - $className = Tools::ucfirst($className) . 'Actions'; - if (!preg_match('/^[a-zA-Z]+$/', $className)) { - throw new \Exception($className . '" class name not valid "'); - } - include_once _PS_MODULE_DIR_ . 'stripe_official/classes/actions/' . $className . '.php'; - - $overridePath = _PS_OVERRIDE_DIR_ . 'modules/stripe_official/classes/actions/' . $className . '.php'; - if (file_exists($overridePath)) { - $className .= 'Override'; - include_once $overridePath; - } + $className = Tools::ucfirst($chain).'Actions'; + if (!preg_match("/^[a-zA-Z]+$/", $className)) { + throw new \Exception($className .'" class name not valid "'); } - - $moduleId = Module::getModuleIdByName('stripe_official'); - /** @var array $hookResult */ - $hookResult = Hook::exec(self::PROCESS_OVERRIDE_HOOK, ['className' => $className], $moduleId, true, false); - if (!empty($hookResult) && !empty($hookResult['stripe_official'])) { - $className = $hookResult['stripe_official']; + include_once _PS_MODULE_DIR_.'stripe_official/classes/actions/'.$className.'.php'; + + $overridePath = _PS_OVERRIDE_DIR_.'modules/stripe_official/classes/actions/'.$className.'.php'; + if (file_exists($overridePath)) { + $className .= 'Override'; + include_once $overridePath; } - + if (class_exists($className)) { - /** @var DefaultActions $classAction */ - $classAction = new $className(); + /** @var Stripe_officialDefaultActions $classAction */ + $classAction = new $className; $classAction->setModelObject($this->modelObject); $classAction->setConveyor($this->conveyor); - + foreach ($this->actions as $action) { - if (!is_callable([$classAction, $action], false, $callableName)) { + if (!is_callable(array($classAction, $action), false, $callable_name)) { continue; } - if (!call_user_func_array([$classAction, $action], [])) { + if (!call_user_func_array(array($classAction, $action), array())) { $this->setConveyor($classAction->getConveyor()); - return false; } } - + $this->setConveyor($classAction->getConveyor()); } else { - throw new \Exception($className . '" class not defined "'); + throw new \Exception($className .'" class not defined "'); } return true; diff --git a/vendor/totpsclasslib/src/Actions/DefaultActions.php b/vendor/totpsclasslib/src/Actions/DefaultActions.php index 7e19271..32dce04 100644 --- a/vendor/totpsclasslib/src/Actions/DefaultActions.php +++ b/vendor/totpsclasslib/src/Actions/DefaultActions.php @@ -20,13 +20,12 @@ * @author 202-ecommerce * @copyright Copyright (c) 202-ecommerce * @license Commercial license - * - * @version develop + * @version release/2.1.1 */ namespace Stripe_officialClasslib\Actions; -use Translate; +use \Translate; /** * DefaultActions @@ -34,22 +33,21 @@ class DefaultActions { /** - * @var \ObjectModel + * @var \ObjectModel $modelObject */ protected $modelObject; /** * Values conveyored by the classes * - * @var array + * @var array $conveyor */ - protected $conveyor = []; + protected $conveyor = array(); /** * Set the modelObject * * @param \ObjectModel $modelObject - * * @return $this */ public function setModelObject($modelObject) @@ -63,7 +61,6 @@ public function setModelObject($modelObject) * Set the conveyor * * @param array $conveyorData - * * @return $this */ public function setConveyor($conveyorData) @@ -87,28 +84,24 @@ public function getConveyor() * Call next action call back of cross modules * * @param mixed $action Name of the actions chain - * * @return bool */ protected function forward($action) { - if (!is_callable([$this, $action], false)) { - echo $action . ' not defined'; + if (!is_callable(array($this, $action), false)) { + echo $action.' not defined'; exit; } - if (!call_user_func_array([$this, $action], [])) { + if (!call_user_func_array(array($this, $action), array())) { return false; } - return true; } /** * Translation function; needed so PS will properly parse the file - * * @param string $string the string to translate * @param string $source the file with the translation; should always be the current file - * * @return mixed|string */ protected function l($string, $source) diff --git a/vendor/totpsclasslib/src/Database/Action/ActionFactory.php b/vendor/totpsclasslib/src/Database/Action/ActionFactory.php deleted file mode 100644 index 4fd492c..0000000 --- a/vendor/totpsclasslib/src/Database/Action/ActionFactory.php +++ /dev/null @@ -1,54 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Action; - -use Stripe_officialClasslib\Database\Action\ActionInterface; -use Stripe_officialClasslib\Database\Action\ActionType; -use Stripe_officialClasslib\Database\Action\InstallAction; -use Stripe_officialClasslib\Database\Action\UninstallAction; -use PrestaShopException; - -class ActionFactory -{ - /** - * @param string $actionType - * - * @return ActionInterface - * - * @throws PrestaShopException - */ - public function getAction(string $actionType) - { - switch ($actionType) { - case ActionType::INSTALL: - return new InstallAction(); - case ActionType::UNINSTALL: - return new UninstallAction(); - default: - throw new PrestaShopException('Database not found action'); - } - } -} diff --git a/vendor/totpsclasslib/src/Database/Action/ActionInterface.php b/vendor/totpsclasslib/src/Database/Action/ActionInterface.php deleted file mode 100644 index becdb45..0000000 --- a/vendor/totpsclasslib/src/Database/Action/ActionInterface.php +++ /dev/null @@ -1,38 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Action; - -use Stripe_officialClasslib\Database\Definition\ObjectModel\ObjectModelDefinition; - -interface ActionInterface -{ - /** - * @param ObjectModelDefinition $objectModelDefinition - * - * @return bool - */ - public function performAction(ObjectModelDefinition $objectModelDefinition); -} diff --git a/vendor/totpsclasslib/src/Database/Action/ActionType.php b/vendor/totpsclasslib/src/Database/Action/ActionType.php deleted file mode 100644 index 8759d03..0000000 --- a/vendor/totpsclasslib/src/Database/Action/ActionType.php +++ /dev/null @@ -1,33 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Action; - -class ActionType -{ - const INSTALL = 'INSTALL'; - - const UNINSTALL = 'UNINSTALL'; -} diff --git a/vendor/totpsclasslib/src/Database/Action/InstallAction.php b/vendor/totpsclasslib/src/Database/Action/InstallAction.php deleted file mode 100644 index b398120..0000000 --- a/vendor/totpsclasslib/src/Database/Action/InstallAction.php +++ /dev/null @@ -1,87 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Action; - -use Stripe_officialClasslib\Database\Action\Table\TableActionFactory; -use Stripe_officialClasslib\Database\Action\Table\TableActionType; -use Stripe_officialClasslib\Database\Definition\ObjectModel\ObjectModelDefinition; -use Stripe_officialClasslib\Database\Definition\Schema\SchemaDefinition; -use Stripe_officialClasslib\Database\Definition\Table\TableDefinition; -use Stripe_officialClasslib\Database\Repository\ActionRepository; -use Stripe_officialClasslib\Registry; - -class InstallAction implements ActionInterface -{ - /** - * @var ActionRepository - */ - protected $actionRepository; - - /** - * @var TableActionFactory - */ - protected $tableActionFactory; - - public function __construct() - { - $this->actionRepository = new ActionRepository(); - $this->tableActionFactory = new TableActionFactory(); - } - - /** - * @param ObjectModelDefinition $objectModelDefinition - * - * @return bool - * - * @throws \PrestaShopException - */ - public function performAction(ObjectModelDefinition $objectModelDefinition) - { - $schemaDefinition = new SchemaDefinition($objectModelDefinition); - $schemaDefinition->buildTableDefinitions(); - - $tableDefinitions = $schemaDefinition->getTableDefinitions(); - foreach ($tableDefinitions as $tableDefinition) { - if (!$this->actionRepository->isTableExist($tableDefinition->getName())) { - $this->tableActionFactory->getTableAction(TableActionType::CREATE)->handle($tableDefinition); - } - $this->tableActionFactory->getTableAction(TableActionType::UPDATE)->handle($tableDefinition); - $this->addTableToRegistry($tableDefinition); - } - - return true; - } - - protected function addTableToRegistry(TableDefinition $tableDefinition) - { - $tables = Registry::get('tables'); - if (empty($tables)) { - $tables = []; - } - - Registry::set('tables', array_merge($tables, [$tableDefinition])); - } -} diff --git a/vendor/totpsclasslib/src/Database/Action/Table/AbstractTableAction.php b/vendor/totpsclasslib/src/Database/Action/Table/AbstractTableAction.php deleted file mode 100644 index c5ccce4..0000000 --- a/vendor/totpsclasslib/src/Database/Action/Table/AbstractTableAction.php +++ /dev/null @@ -1,38 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Action\Table; - -use Stripe_officialClasslib\Database\Definition\Table\TableDefinition; - -abstract class AbstractTableAction -{ - /** - * @param TableDefinition $tableDefinition - * - * @return bool - */ - abstract public function handle(TableDefinition $tableDefinition); -} diff --git a/vendor/totpsclasslib/src/Database/Action/Table/CreateTableAction.php b/vendor/totpsclasslib/src/Database/Action/Table/CreateTableAction.php deleted file mode 100644 index c0e7a25..0000000 --- a/vendor/totpsclasslib/src/Database/Action/Table/CreateTableAction.php +++ /dev/null @@ -1,113 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Action\Table; - -use Stripe_officialClasslib\Database\Definition\Field\FieldDefinition; -use Stripe_officialClasslib\Database\Definition\Table\TableDefinition; -use Db; - -class CreateTableAction extends AbstractTableAction -{ - /** - * @param TableDefinition $tableDefinition - * - * @return bool - */ - public function handle(TableDefinition $tableDefinition) - { - $result = true; - - $result &= $this->installTable($tableDefinition); - $result &= $this->createPrimaryKey($tableDefinition); - - return $result; - } - - protected function installTable(TableDefinition $tableDefinition) - { - $columns = array_map(function (FieldDefinition $fieldDefinition) { - return $fieldDefinition->getColumn(); - }, $tableDefinition->getFields()); - - return Db::getInstance()->execute("CREATE TABLE IF NOT EXISTS `{$tableDefinition->getName()}` (" . - implode(', ', array_merge($columns, $this->getPrimaryKeySql($tableDefinition))) . - ") ENGINE={$tableDefinition->getEngine()} CHARSET={$tableDefinition->getCharset()} COLLATE={$tableDefinition->getCollation()};"); - } - - protected function createPrimaryKey(TableDefinition $tableDefinition) - { - if (count($tableDefinition->getPrimaryKey()) == 1) { - return true; - } - - if ($this->hasPrimaryKey($tableDefinition)) { - $this->dropPrimaryKey($tableDefinition); - } - - return $this->addPrimaryKey($tableDefinition); - } - - protected function hasPrimaryKey(TableDefinition $tableDefinition) - { - $hasKey = Db::getInstance()->getValue( - "SELECT EXISTS( - SELECT * - FROM INFORMATION_SCHEMA.COLUMNS - WHERE TABLE_NAME='" . $tableDefinition->getName() . "' - AND TABLE_SCHEMA = '" . _DB_NAME_ . "' - AND COLUMN_KEY = 'PRI' - );", false); - - return !empty($hasKey); - } - - protected function dropPrimaryKey(TableDefinition $tableDefinition) - { - return Db::getInstance()->execute( - "ALTER TABLE {$tableDefinition->getName()} - DROP PRIMARY KEY; - ", false); - } - - protected function addPrimaryKey(TableDefinition $tableDefinition) - { - $pkName = 'PK_' . strtoupper($tableDefinition->getName()); - $pkFields = implode(', ', $tableDefinition->getPrimaryKey()); - - return Db::getInstance()->execute( - "ALTER TABLE {$tableDefinition->getName()} - ADD CONSTRAINT $pkName PRIMARY KEY ($pkFields)", false); - } - - protected function getPrimaryKeySql(TableDefinition $tableDefinition) - { - if (count($tableDefinition->getPrimaryKey()) > 1) { - return []; - } - - return ["PRIMARY KEY ({$tableDefinition->getPrimaryKey()[0]})"]; - } -} diff --git a/vendor/totpsclasslib/src/Database/Action/Table/DeleteTableAction.php b/vendor/totpsclasslib/src/Database/Action/Table/DeleteTableAction.php deleted file mode 100644 index 97927dc..0000000 --- a/vendor/totpsclasslib/src/Database/Action/Table/DeleteTableAction.php +++ /dev/null @@ -1,42 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Action\Table; - -use Stripe_officialClasslib\Database\Definition\Table\TableDefinition; -use Db; - -class DeleteTableAction extends AbstractTableAction -{ - /** - * @param TableDefinition $tableDefinition - * - * @return bool - */ - public function handle(TableDefinition $tableDefinition) - { - return Db::getInstance()->execute("DROP TABLE IF EXISTS `{$tableDefinition->getName()}`;"); - } -} diff --git a/vendor/totpsclasslib/src/Database/Action/Table/TableActionFactory.php b/vendor/totpsclasslib/src/Database/Action/Table/TableActionFactory.php deleted file mode 100644 index a3d1904..0000000 --- a/vendor/totpsclasslib/src/Database/Action/Table/TableActionFactory.php +++ /dev/null @@ -1,57 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Action\Table; - -use Stripe_officialClasslib\Database\Action\Table\AbstractTableAction; -use Stripe_officialClasslib\Database\Action\Table\CreateTableAction; -use Stripe_officialClasslib\Database\Action\Table\DeleteTableAction; -use Stripe_officialClasslib\Database\Action\Table\TableActionType; -use Stripe_officialClasslib\Database\Action\Table\UpdateTableAction; -use PrestaShopException; - -class TableActionFactory -{ - /** - * @param $tableAction - * - * @return AbstractTableAction - * - * @throws PrestaShopException - */ - public function getTableAction($tableAction) - { - switch ($tableAction) { - case TableActionType::CREATE: - return new CreateTableAction(); - case TableActionType::UPDATE: - return new UpdateTableAction(); - case TableActionType::DELETE: - return new DeleteTableAction(); - default: - throw new PrestaShopException("Unknown table action $tableAction"); - } - } -} diff --git a/vendor/totpsclasslib/src/Database/Action/Table/TableActionType.php b/vendor/totpsclasslib/src/Database/Action/Table/TableActionType.php deleted file mode 100644 index 5c05498..0000000 --- a/vendor/totpsclasslib/src/Database/Action/Table/TableActionType.php +++ /dev/null @@ -1,35 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Action\Table; - -class TableActionType -{ - const CREATE = 'CREATE'; - - const DELETE = 'DELETE'; - - const UPDATE = 'UPDATE'; -} diff --git a/vendor/totpsclasslib/src/Database/Action/Table/UpdateTableAction.php b/vendor/totpsclasslib/src/Database/Action/Table/UpdateTableAction.php deleted file mode 100644 index e34d4e0..0000000 --- a/vendor/totpsclasslib/src/Database/Action/Table/UpdateTableAction.php +++ /dev/null @@ -1,120 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Action\Table; - -use Stripe_officialClasslib\Database\Definition\Field\FieldDefinition; -use Stripe_officialClasslib\Database\Definition\Table\TableDefinition; -use Stripe_officialClasslib\Database\Index\IndexHandler; -use Db; - -class UpdateTableAction extends AbstractTableAction -{ - /** - * @param TableDefinition $tableDefinition - * - * @return bool - */ - public function handle(TableDefinition $tableDefinition) - { - $result = true; - - $result &= $this->modifyColumns($tableDefinition); - $result &= $this->handleIndexes($tableDefinition); - - return $result; - } - - protected function modifyColumns(TableDefinition $tableDefinition) - { - $tableColumns = $this->getTableColumns($tableDefinition); - - $columns = array_map(function (FieldDefinition $fieldDefinition) { - return $fieldDefinition->getColumn(); - }, $tableDefinition->getFields()); - - foreach ($tableColumns as &$col) { - $col['modelDef'] = '`' . $col['Field'] . '` ' . strtoupper($col['Type']) . ' '; - if ('NO' === $col['Null']) { - $col['modelDef'] .= 'NOT NULL '; - } - if (false === empty($col['Extra'])) { - $col['modelDef'] .= strtoupper($col['Extra']); - } - } - - $alterToSkip = []; - $alterToExecute = []; - $alters = []; - - foreach ($columns as $key => $column) { - foreach ($tableColumns as $tableColumn) { - if (trim($column) === trim($tableColumn['modelDef'])) { - $alterToSkip[$key] = true; - } elseif (false !== strpos($column, '`' . $tableColumn['Field'] . '`')) { - $alterToExecute[$key] = 'MODIFY'; - $alters[$key] = "ALTER TABLE `{$tableDefinition->getName()}` MODIFY $column;"; - } - } - if (empty($alterToExecute[$key]) && empty($alterToSkip[$key])) { - $alterToExecute[$key]['action'] = 'ADD ' . $column; - $alters[$key] = "ALTER TABLE `{$tableDefinition->getName()}` ADD $column;"; - } - } - - $result = true; - foreach ($alters as $alter) { - $result &= Db::getInstance()->execute($alter, false); - } - - $tableDefinitionColumns = array_map(function (FieldDefinition $fieldDefinition) { - return $fieldDefinition->getName(); - }, $tableDefinition->getFields()); - - $currentTableColumns = array_column($tableColumns, 'Field'); - $columnsToDelete = array_diff($currentTableColumns, $tableDefinitionColumns); - - foreach ($columnsToDelete as $columnToDelete) { - Db::getInstance()->execute(" - ALTER TABLE `{$tableDefinition->getName()}` - DROP COLUMN {$columnToDelete};" - ); - } - - return $result; - } - - protected function handleIndexes(TableDefinition $tableDefinition) - { - $indexHandler = new IndexHandler($tableDefinition); - - return $indexHandler->handle(); - } - - protected function getTableColumns(TableDefinition $tableDefinition) - { - return Db::getInstance()->executeS("SHOW COLUMNS FROM `{$tableDefinition->getName()}`"); - } -} diff --git a/vendor/totpsclasslib/src/Database/Action/UninstallAction.php b/vendor/totpsclasslib/src/Database/Action/UninstallAction.php deleted file mode 100644 index 2c17c0b..0000000 --- a/vendor/totpsclasslib/src/Database/Action/UninstallAction.php +++ /dev/null @@ -1,73 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Action; - -use Stripe_officialClasslib\Database\Action\Table\TableActionFactory; -use Stripe_officialClasslib\Database\Action\Table\TableActionType; -use Stripe_officialClasslib\Database\Definition\ObjectModel\ObjectModelDefinition; -use Stripe_officialClasslib\Database\Definition\Schema\SchemaDefinition; -use Stripe_officialClasslib\Database\Repository\ActionRepository; - -class UninstallAction implements ActionInterface -{ - /** - * @var ActionRepository - */ - protected $actionRepository; - - /** - * @var TableActionFactory - */ - protected $tableActionFactory; - - public function __construct() - { - $this->actionRepository = new ActionRepository(); - $this->tableActionFactory = new TableActionFactory(); - } - - /** - * @param ObjectModelDefinition $objectModelDefinition - * - * @return bool - * - * @throws \PrestaShopException - */ - public function performAction(ObjectModelDefinition $objectModelDefinition) - { - $schemaDefinition = new SchemaDefinition($objectModelDefinition); - $schemaDefinition->buildTableDefinitions(); - - $tableDefinitions = $schemaDefinition->filterTableByAction(TableActionType::DELETE); - foreach ($tableDefinitions as $tableDefinition) { - if ($this->actionRepository->isTableExist($tableDefinition->getName())) { - $this->tableActionFactory->getTableAction(TableActionType::DELETE)->handle($tableDefinition); - } - } - - return true; - } -} diff --git a/vendor/totpsclasslib/src/Database/DbObjectHandler.php b/vendor/totpsclasslib/src/Database/DbObjectHandler.php deleted file mode 100644 index ec407d5..0000000 --- a/vendor/totpsclasslib/src/Database/DbObjectHandler.php +++ /dev/null @@ -1,31 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database; - -interface DbObjectHandler -{ - public function handle(); -} diff --git a/vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinition.php b/vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinition.php deleted file mode 100644 index 0238c3c..0000000 --- a/vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinition.php +++ /dev/null @@ -1,127 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Definition\Field; - -use Stripe_officialClasslib\Database\Definition\Field\FieldDefinitionColumnBuilder; - -class FieldDefinition -{ - /** - * @var string - */ - private $name; - - /** - * @var array - */ - private $definition; - - /** - * @var string - */ - private $column; - - /** - * @param string $name - * @param array $definition - */ - public function __construct(string $name, array $definition) - { - $this->name = $name; - $this->definition = $definition; - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @param string $name - * - * @return FieldDefinition - */ - public function setName(string $name) - { - $this->name = $name; - - return $this; - } - - /** - * @return array - */ - public function getDefinition() - { - return $this->definition; - } - - /** - * @param array $definition - * - * @return FieldDefinition - */ - public function setDefinition(array $definition) - { - $this->definition = $definition; - - return $this; - } - - /** - * @return string - * - * @throws \PrestaShopException - */ - public function getColumn() - { - if (!empty($this->column)) { - return $this->column; - } - - $this->column = (new FieldDefinitionColumnBuilder())->buildFieldDefinition($this); - - return $this->column; - } - - public function isLangField() - { - return !empty($this->getDefinition()['lang']); - } - - public function isShopField() - { - return !empty($this->getDefinition()['shop']); - } - - public function isShopLangBoth() - { - return $this->isShopField() && $this->getDefinition()['shop'] == 'both'; - } -} diff --git a/vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinitionColumnBuilder.php b/vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinitionColumnBuilder.php deleted file mode 100644 index 6d7e75e..0000000 --- a/vendor/totpsclasslib/src/Database/Definition/Field/FieldDefinitionColumnBuilder.php +++ /dev/null @@ -1,98 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Definition\Field; - -use ObjectModel; -use Tools; - -class FieldDefinitionColumnBuilder -{ - public function buildFieldDefinition(FieldDefinition $fieldDefinition) - { - $name = $fieldDefinition->getName(); - $constraints = $fieldDefinition->getDefinition(); - $column = "`$name` "; - if (empty($constraints['values'])) { - switch ($constraints['type']) { - case ObjectModel::TYPE_BOOL: - $column .= 'TINYINT(1) UNSIGNED'; - break; - case ObjectModel::TYPE_DATE: - $column .= 'DATETIME'; - break; - case ObjectModel::TYPE_FLOAT: - $column .= 'DECIMAL' . ( - isset($constraints['size'], $constraints['scale']) - ? "({$constraints['size']},{$constraints['scale']})" - : '' - ); - break; - case ObjectModel::TYPE_HTML: - $length = isset($constraints['size']) ? $constraints['size'] : null; - $length = isset($length['max']) ? $length['max'] : $length; - if ($length >= 65535) { - $column .= $length ? "TEXT($length)" : 'TEXT'; - } else { - $column .= 'MEDIUMTEXT'; - } - break; - case ObjectModel::TYPE_INT: - $column .= 'INT(10)' . ( - !empty($constraints['validate']) - && strpos(Tools::strtolower($constraints['validate']), 'unsigned') - ? ' UNSIGNED' - : ' SIGNED' - ); - break; - case ObjectModel::TYPE_STRING: - $length = isset($constraints['size']) ? $constraints['size'] : 255; - $length = isset($length['max']) ? $length['max'] : $length; - $column .= "VARCHAR($length)"; - break; - default: - throw new \PrestaShopException("Missing type constraint definition for field $name"); - } - } - - if (!empty($constraints['values'])) { - $column .= " ENUM('" . implode("','", $constraints['values']) . "')"; - } - - if (empty($constraints['allow_null']) || isset($constraints['default']) || !empty($constraints['required'])) { - $column .= ' NOT NULL'; - } - - if (isset($constraints['default'])) { - $column .= " DEFAULT '" . addslashes($constraints['default']) . "'"; - } - - if (!empty($constraints['primary'])) { - $column .= ' AUTO_INCREMENT'; - } - - return $column; - } -} diff --git a/vendor/totpsclasslib/src/Database/Definition/ObjectModel/ObjectModelDefinition.php b/vendor/totpsclasslib/src/Database/Definition/ObjectModel/ObjectModelDefinition.php deleted file mode 100644 index ade7576..0000000 --- a/vendor/totpsclasslib/src/Database/Definition/ObjectModel/ObjectModelDefinition.php +++ /dev/null @@ -1,441 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Definition\ObjectModel; - -use Stripe_officialClasslib\Database\Definition\Field\FieldDefinition; -use Stripe_officialClasslib\Database\ForeignKey\ForeignKey; -use Stripe_officialClasslib\Database\Index\Index; - -class ObjectModelDefinition -{ - //region Fields - - /** - * @var string - */ - private $objectName; - - /** - * @var string - */ - private $table; - - /** - * @var array - */ - private $primary; - - /** - * @var bool - */ - private $multilang = false; - - /** - * @var bool - */ - private $multilangShop = false; - - /** - * @var bool - */ - private $multishop = false; - - /** - * @var FieldDefinition[] - */ - private $fields = []; - - /** - * @var array - */ - private $associations = []; - - /** - * @var Index[] - */ - private $indexes = []; - - /** - * @var string - */ - private $charset = 'utf8'; - - /** - * @var string - */ - private $collation = 'utf8_general_ci'; - - /** - * @var string - */ - private $engine = _MYSQL_ENGINE_; - - /** - * @var string - */ - private $dbPrefix = _DB_PREFIX_; - - //endregion - - //region Getters/Setters - - /** - * @param string $objectName - */ - public function __construct(string $objectName) - { - $this->objectName = $objectName; - } - - /** - * @return string - */ - public function getObjectName() - { - return $this->objectName; - } - - /** - * @param string $objectName - * - * @return ObjectModelDefinition - */ - public function setObjectName($objectName) - { - $this->objectName = $objectName; - - return $this; - } - - /** - * @return string - */ - public function getTable() - { - return $this->table; - } - - /** - * @param string $table - * - * @return ObjectModelDefinition - */ - public function setTable(string $table) - { - $this->table = $table; - - return $this; - } - - /** - * @return array - */ - public function getPrimary() - { - return $this->primary; - } - - /** - * @param string $primary - * - * @return ObjectModelDefinition - */ - public function setPrimary(string $primary) - { - $this->primary = array_map(function ($primaryKey) { - return trim($primaryKey); - }, explode(',', $primary)); - - return $this; - } - - /** - * @return bool - */ - public function isMultilang() - { - return $this->multilang; - } - - /** - * @param bool $multilang - * - * @return ObjectModelDefinition - */ - public function setMultilang(bool $multilang) - { - $this->multilang = $multilang; - - return $this; - } - - /** - * @return bool - */ - public function isMultilangShop() - { - return $this->multilangShop; - } - - /** - * @param bool $multilangShop - * - * @return ObjectModelDefinition - */ - public function setMultilangShop(bool $multilangShop) - { - $this->multilangShop = $multilangShop; - - return $this; - } - - /** - * @return bool - */ - public function isMultishop() - { - return $this->multishop; - } - - /** - * @param bool $multishop - * - * @return ObjectModelDefinition - */ - public function setMultishop(bool $multishop) - { - $this->multishop = $multishop; - - return $this; - } - - /** - * @return array - */ - public function getFields() - { - return $this->fields; - } - - /** - * @param array $fields - * - * @return ObjectModelDefinition - */ - public function setFields(array $fields) - { - $this->fields = $fields; - - return $this; - } - - /** - * @return array - */ - public function getAssociations() - { - return $this->associations; - } - - /** - * @param array $associations - * - * @return ObjectModelDefinition - */ - public function setAssociations(array $associations) - { - $this->associations = $associations; - - return $this; - } - - /** - * @return Index[] - */ - public function getIndexes() - { - return $this->indexes; - } - - /** - * @param Index[] $indexes - * - * @return ObjectModelDefinition - */ - public function setIndexes(array $indexes) - { - $this->indexes = $indexes; - - return $this; - } - - /** - * @return string - */ - public function getCharset() - { - return $this->charset; - } - - /** - * @param string $charset - * - * @return ObjectModelDefinition - */ - public function setCharset(string $charset) - { - $this->charset = $charset; - - return $this; - } - - /** - * @return string - */ - public function getCollation() - { - return $this->collation; - } - - /** - * @param string $collation - * - * @return ObjectModelDefinition - */ - public function setCollation(string $collation) - { - $this->collation = $collation; - - return $this; - } - - /** - * @return string - */ - public function getEngine() - { - return $this->engine; - } - - /** - * @param string $engine - * - * @return ObjectModelDefinition - */ - public function setEngine($engine) - { - $this->engine = $engine; - - return $this; - } - - /** - * @return string - */ - public function getDbPrefix() - { - return $this->dbPrefix; - } - - /** - * @param string $dbPrefix - * - * @return ObjectModelDefinition - */ - public function setDbPrefix($dbPrefix) - { - $this->dbPrefix = $dbPrefix; - - return $this; - } - - //endregion - - /** - * @param array $definition - * - * @return $this - * - * @throws \PrestaShopException - */ - public function build($definition) - { - $this->setTable($definition['table']) - ->setPrimary($definition['primary']); - - if (isset($definition['charset'])) { - $this->setCharset($definition['charset']); - } - - if (isset($definition['collation'])) { - $this->setCollation($definition['collation']); - } - - if (isset($definition['engine'])) { - $this->setEngine($definition['engine']); - } - - if (isset($definition['multilang'])) { - $this->setMultilang($definition['multilang']); - } - - if (isset($definition['multishop'])) { - $this->setMultishop($definition['multishop']); - } - - if (isset($definition['multilang_shop'])) { - $this->setMultilangShop($definition['multilang_shop']); - } - - if (isset($definition['indexes'])) { - $indexes = []; - foreach ($definition['indexes'] as $index) { - $indexes[] = Index::build($index, $this->dbPrefix . $definition['table']); - } - $this->setIndexes($indexes); - } - - if (isset($definition['fields'])) { - $fields = []; - foreach ($definition['fields'] as $field => $description) { - $fieldDefinition = new FieldDefinition($field, $description); - $fields[] = $fieldDefinition; - } - $this->setFields($fields); - } - - if (isset($definition['associations'])) { - $associations = []; - foreach ($definition['associations'] as $name => $association) { - $foreignKey = (new ForeignKey())->build($this->getDbPrefix() . $definition['table'], $association); - $associations[] = $foreignKey; - } - $this->setAssociations($associations); - } - - return $this; - } -} diff --git a/vendor/totpsclasslib/src/Database/Definition/Schema/SchemaDefinition.php b/vendor/totpsclasslib/src/Database/Definition/Schema/SchemaDefinition.php deleted file mode 100644 index 918db38..0000000 --- a/vendor/totpsclasslib/src/Database/Definition/Schema/SchemaDefinition.php +++ /dev/null @@ -1,98 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Definition\Schema; - -use Stripe_officialClasslib\Database\Action\Table\TableActionType; -use Stripe_officialClasslib\Database\Definition\ObjectModel\ObjectModelDefinition; -use Stripe_officialClasslib\Database\Definition\Table\TableDefinition; -use Stripe_officialClasslib\Database\Definition\Table\TableDefinitionFactory; -use Stripe_officialClasslib\Database\Definition\Table\TableType; - -class SchemaDefinition -{ - /** - * @var ObjectModelDefinition - */ - private $objectModelDefinition; - - /** - * @var TableDefinition[] - */ - private $tableDefinitions = []; - - /** - * @param ObjectModelDefinition $objectModelDefinition - */ - public function __construct(ObjectModelDefinition $objectModelDefinition) - { - $this->objectModelDefinition = $objectModelDefinition; - } - - public function buildTableDefinitions() - { - $tableDefinitionFactory = new TableDefinitionFactory($this->objectModelDefinition); - - $tableDefinitionFactoryMain = $tableDefinitionFactory->getTableDefinitionBuilder(TableType::MAIN); - $this->tableDefinitions[] = $tableDefinitionFactoryMain->build(); - - if ($this->objectModelDefinition->isMultilang() || $this->objectModelDefinition->isMultilangShop()) { - $tableDefinitionFactoryLang = $tableDefinitionFactory->getTableDefinitionBuilder(TableType::LANG); - $this->tableDefinitions[] = $tableDefinitionFactoryLang->build(); - } - - if ($this->objectModelDefinition->isMultishop()) { - $tableDefinitionFactoryShop = $tableDefinitionFactory->getTableDefinitionBuilder(TableType::SHOP); - $this->tableDefinitions[] = $tableDefinitionFactoryShop->build(); - } - - return $this; - } - - /** - * @return array - */ - public function getTableDefinitions() - { - return $this->tableDefinitions; - } - - public function filterTableByAction($actionType) - { - if ($actionType != TableActionType::DELETE) { - return $this->getTableDefinitions(); - } - - $langShopsTables = array_filter($this->getTableDefinitions(), function (TableDefinition $tableDefinition) { - return $tableDefinition->getAlias() != 'm'; - }); - - $mainTables = array_filter($this->getTableDefinitions(), function (TableDefinition $tableDefinition) { - return $tableDefinition->getAlias() == 'm'; - }); - - return array_merge($langShopsTables, $mainTables); - } -} diff --git a/vendor/totpsclasslib/src/Database/Definition/Table/AbstractTableDefinitionBuilder.php b/vendor/totpsclasslib/src/Database/Definition/Table/AbstractTableDefinitionBuilder.php deleted file mode 100644 index 040e434..0000000 --- a/vendor/totpsclasslib/src/Database/Definition/Table/AbstractTableDefinitionBuilder.php +++ /dev/null @@ -1,76 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Definition\Table; - -use Stripe_officialClasslib\Database\Definition\ObjectModel\ObjectModelDefinition; - -abstract class AbstractTableDefinitionBuilder -{ - /** - * @var ObjectModelDefinition - */ - protected $objectModelDefinition; - - /** - * @param ObjectModelDefinition $objectModelDefinition - */ - public function __construct(ObjectModelDefinition $objectModelDefinition) - { - $this->objectModelDefinition = $objectModelDefinition; - } - - /** - * @return TableDefinition - */ - public function build() - { - $tableDefinition = new TableDefinition(); - - $this->buildCommonFields($tableDefinition) - ->buildSpecificFields($tableDefinition); - - return $tableDefinition; - } - - protected function buildCommonFields(TableDefinition $tableDefinition) - { - $tableDefinition->setCharset($this->objectModelDefinition->getCharset()) - ->setCollation($this->objectModelDefinition->getCollation()) - ->setEngine($this->objectModelDefinition->getEngine()) - ->setFields($this->getColumns()); - - return $this; - } - - /** - * @param TableDefinition $tableDefinition - * - * @return AbstractTableDefinitionBuilder - */ - abstract protected function buildSpecificFields(TableDefinition $tableDefinition); - - abstract protected function getColumns(); -} diff --git a/vendor/totpsclasslib/src/Database/Definition/Table/LangTableDefinitionBuilder.php b/vendor/totpsclasslib/src/Database/Definition/Table/LangTableDefinitionBuilder.php deleted file mode 100644 index 74d622b..0000000 --- a/vendor/totpsclasslib/src/Database/Definition/Table/LangTableDefinitionBuilder.php +++ /dev/null @@ -1,122 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Definition\Table; - -use Stripe_officialClasslib\Database\Definition\Field\FieldDefinition; -use Stripe_officialClasslib\Database\ForeignKey\ForeignKey; -use Language; -use ObjectModel; -use Shop; - -class LangTableDefinitionBuilder extends AbstractTableDefinitionBuilder -{ - protected function getColumns() - { - $fields = []; - - foreach ($this->objectModelDefinition->getPrimary() as $primaryKey) { - $fields[] = new FieldDefinition($primaryKey, [ - 'type' => ObjectModel::TYPE_INT, - 'validate' => 'isUnsignedId', - 'required' => true, - ]); - } - - $fields[] = new FieldDefinition('id_lang', [ - 'type' => ObjectModel::TYPE_INT, - 'validate' => 'isInt', - 'required' => true, - ]); - - if ($this->objectModelDefinition->isMultilangShop()) { - $fields[] = new FieldDefinition('id_shop', [ - 'type' => ObjectModel::TYPE_INT, - 'validate' => 'isInt', - 'required' => true, - ]); - } - - $fieldsDefinitions = array_filter($this->objectModelDefinition->getFields(), function (FieldDefinition $fieldDefinition) { - return !empty($fieldDefinition->getDefinition()['lang']); - }); - - return array_merge($fields, $fieldsDefinitions); - } - - /** - * @param TableDefinition $tableDefinition - * - * @return AbstractTableDefinitionBuilder - */ - protected function buildSpecificFields(TableDefinition $tableDefinition) - { - $primaryKey = array_merge( - $this->objectModelDefinition->getPrimary(), - ['id_lang'] - ); - if ($this->objectModelDefinition->isMultilangShop()) { - $primaryKey[] = 'id_shop'; - } - $tableDefinition->setName($this->objectModelDefinition->getDbPrefix() . $this->objectModelDefinition->getTable() . '_lang') - ->setAlias('l') - ->setPrimaryKey($primaryKey) - ->setForeignKeys($this->getForeignKeys()); - - return $this; - } - - protected function getForeignKeys() - { - $foreignKeys = []; - - foreach ($this->objectModelDefinition->getPrimary() as $mainPrimaryKey) { - $foreignKeys[] = (new ForeignKey())->build($this->objectModelDefinition->getDbPrefix() . $this->objectModelDefinition->getTable() . '_lang', [ - 'type' => ObjectModel::HAS_ONE, - 'object' => $this->objectModelDefinition->getObjectName(), - 'association' => $this->objectModelDefinition->getTable(), - 'field' => $mainPrimaryKey, - ]); - } - - $foreignKeys[] = (new ForeignKey())->build($this->objectModelDefinition->getDbPrefix() . $this->objectModelDefinition->getTable() . '_lang', [ - 'type' => ObjectModel::HAS_ONE, - 'object' => Language::class, - 'association' => Language::$definition['table'], - 'field' => 'id_lang', - ]); - - if ($this->objectModelDefinition->isMultilangShop()) { - $foreignKeys[] = (new ForeignKey())->build($this->objectModelDefinition->getDbPrefix() . $this->objectModelDefinition->getTable() . '_lang', [ - 'type' => ObjectModel::HAS_ONE, - 'object' => Shop::class, - 'association' => Shop::$definition['table'], - 'field' => 'id_shop', - ]); - } - - return $foreignKeys; - } -} diff --git a/vendor/totpsclasslib/src/Database/Definition/Table/MainTableDefinitionBuilder.php b/vendor/totpsclasslib/src/Database/Definition/Table/MainTableDefinitionBuilder.php deleted file mode 100644 index 01aefa3..0000000 --- a/vendor/totpsclasslib/src/Database/Definition/Table/MainTableDefinitionBuilder.php +++ /dev/null @@ -1,82 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Definition\Table; - -use Stripe_officialClasslib\Database\Definition\Field\FieldDefinition; -use ObjectModel; - -class MainTableDefinitionBuilder extends AbstractTableDefinitionBuilder -{ - protected function getColumns() - { - $fields = []; - - if (count($this->objectModelDefinition->getPrimary()) == 1) { - $fields[] = new FieldDefinition($this->objectModelDefinition->getPrimary()[0], [ - 'type' => ObjectModel::TYPE_INT, - 'validate' => 'isUnsignedId', - 'required' => true, - 'primary' => true, - ]); - } else { - foreach ($this->objectModelDefinition->getPrimary() as $primaryKey) { - $keyFound = false; - foreach ($this->objectModelDefinition->getFields() as $fieldDefinition) { - if ($fieldDefinition->getName() == $primaryKey) { - $keyFound = true; - break; - } - } - if (!$keyFound) { - throw new \PrestaShopException(sprintf('Primary key %s not found in field definitions', $primaryKey)); - } - } - } - - $fieldsDefinitions = array_filter($this->objectModelDefinition->getFields(), function (FieldDefinition $fieldDefinition) { - return (empty($fieldDefinition->getDefinition()['lang']) && empty($fieldDefinition->getDefinition()['shop'])) - || (isset($fieldDefinition->getDefinition()['shop']) && $fieldDefinition->getDefinition()['shop'] == 'both'); - }); - - return array_merge($fields, $fieldsDefinitions); - } - - /** - * @param TableDefinition $tableDefinition - * - * @return AbstractTableDefinitionBuilder - */ - protected function buildSpecificFields(TableDefinition $tableDefinition) - { - $tableDefinition->setName($this->objectModelDefinition->getDbPrefix() . $this->objectModelDefinition->getTable()) - ->setAlias('m') - ->setIndexes($this->objectModelDefinition->getIndexes()) - ->setPrimaryKey($this->objectModelDefinition->getPrimary()) - ->setForeignKeys($this->objectModelDefinition->getAssociations()); - - return $this; - } -} diff --git a/vendor/totpsclasslib/src/Database/Definition/Table/ShopTableDefinitionBuilder.php b/vendor/totpsclasslib/src/Database/Definition/Table/ShopTableDefinitionBuilder.php deleted file mode 100644 index c81cd53..0000000 --- a/vendor/totpsclasslib/src/Database/Definition/Table/ShopTableDefinitionBuilder.php +++ /dev/null @@ -1,97 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Definition\Table; - -use Stripe_officialClasslib\Database\Definition\Field\FieldDefinition; -use Stripe_officialClasslib\Database\ForeignKey\ForeignKey; -use ObjectModel; -use Shop; - -class ShopTableDefinitionBuilder extends AbstractTableDefinitionBuilder -{ - protected function getColumns() - { - $fields = []; - - foreach ($this->objectModelDefinition->getPrimary() as $primaryKey) { - $fields[] = new FieldDefinition($primaryKey, [ - 'type' => ObjectModel::TYPE_INT, - 'validate' => 'isUnsignedId', - 'required' => true, - ]); - } - - $fields[] = new FieldDefinition('id_shop', [ - 'type' => ObjectModel::TYPE_INT, - 'validate' => 'isInt', - 'required' => true, - ]); - - $fieldsDefinitions = array_filter($this->objectModelDefinition->getFields(), function (FieldDefinition $fieldDefinition) { - return !empty($fieldDefinition->getDefinition()['shop']); - }); - - return array_merge($fields, $fieldsDefinitions); - } - - /** - * @param TableDefinition $tableDefinition - * - * @return AbstractTableDefinitionBuilder - */ - protected function buildSpecificFields(TableDefinition $tableDefinition) - { - $tableDefinition->setName($this->objectModelDefinition->getDbPrefix() . $this->objectModelDefinition->getTable() . '_shop') - ->setAlias('s') - ->setPrimaryKey(array_merge($this->objectModelDefinition->getPrimary(), ['id_shop'])) - ->setForeignKeys($this->getForeignKeys()); - - return $this; - } - - protected function getForeignKeys() - { - $foreignKeys = []; - - foreach ($this->objectModelDefinition->getPrimary() as $primaryMainKey) { - $foreignKeys[] = (new ForeignKey())->build($this->objectModelDefinition->getDbPrefix() . $this->objectModelDefinition->getTable() . '_shop', [ - 'type' => ObjectModel::HAS_ONE, - 'object' => $this->objectModelDefinition->getObjectName(), - 'association' => $this->objectModelDefinition->getTable(), - 'field' => $primaryMainKey, - ]); - } - - $foreignKeys[] = (new ForeignKey())->build($this->objectModelDefinition->getDbPrefix() . $this->objectModelDefinition->getTable() . '_shop', [ - 'type' => ObjectModel::HAS_ONE, - 'object' => Shop::class, - 'association' => Shop::$definition['table'], - 'field' => 'id_shop', - ]); - - return $foreignKeys; - } -} diff --git a/vendor/totpsclasslib/src/Database/Definition/Table/TableDefinition.php b/vendor/totpsclasslib/src/Database/Definition/Table/TableDefinition.php deleted file mode 100644 index 642b0f5..0000000 --- a/vendor/totpsclasslib/src/Database/Definition/Table/TableDefinition.php +++ /dev/null @@ -1,266 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Definition\Table; - -use Stripe_officialClasslib\Database\Definition\Field\FieldDefinition; -use Stripe_officialClasslib\Database\ForeignKey\ForeignKey; -use Stripe_officialClasslib\Database\Index\Index; - -class TableDefinition -{ - //region Fields - - /** - * @var string - */ - private $name; - - /** - * @var string - */ - private $alias; - - /** - * @var FieldDefinition[] - */ - private $fields; - - /** - * @var string - */ - private $engine; - - /** - * @var string - */ - private $charset; - - /** - * @var string - */ - private $collation; - - /** - * @var ForeignKey[] - */ - private $foreignKeys; - - /** - * @var array - */ - private $primaryKey; - - /** - * @var Index[] - */ - private $indexes = []; - - //endregion - - //region Getters/Setters - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @param string $name - * - * @return TableDefinition - */ - public function setName(string $name) - { - $this->name = $name; - - return $this; - } - - /** - * @return FieldDefinition[] - */ - public function getFields() - { - return $this->fields; - } - - /** - * @param FieldDefinition[] $fields - * - * @return TableDefinition - */ - public function setFields(array $fields) - { - $this->fields = $fields; - - return $this; - } - - /** - * @return string - */ - public function getEngine() - { - return $this->engine; - } - - /** - * @param string $engine - * - * @return TableDefinition - */ - public function setEngine(string $engine) - { - $this->engine = $engine; - - return $this; - } - - /** - * @return string - */ - public function getCharset() - { - return $this->charset; - } - - /** - * @param string $charset - * - * @return TableDefinition - */ - public function setCharset(string $charset) - { - $this->charset = $charset; - - return $this; - } - - /** - * @return string - */ - public function getCollation() - { - return $this->collation; - } - - /** - * @param string $collation - * - * @return TableDefinition - */ - public function setCollation(string $collation) - { - $this->collation = $collation; - - return $this; - } - - /** - * @return ForeignKey[] - */ - public function getForeignKeys() - { - return $this->foreignKeys; - } - - /** - * @param ForeignKey[] $foreignKeys - * - * @return TableDefinition - */ - public function setForeignKeys(array $foreignKeys) - { - $this->foreignKeys = $foreignKeys; - - return $this; - } - - /** - * @return Index[] - */ - public function getIndexes() - { - return $this->indexes; - } - - /** - * @param Index[] $indexes - * - * @return TableDefinition - */ - public function setIndexes(array $indexes) - { - $this->indexes = $indexes; - - return $this; - } - - /** - * @return string - */ - public function getAlias() - { - return $this->alias; - } - - /** - * @param string $alias - * - * @return TableDefinition - */ - public function setAlias(string $alias) - { - $this->alias = $alias; - - return $this; - } - - /** - * @return string[] - */ - public function getPrimaryKey() - { - return $this->primaryKey; - } - - /** - * @param array $primaryKey - * - * @return TableDefinition - */ - public function setPrimaryKey(array $primaryKey) - { - $this->primaryKey = $primaryKey; - - return $this; - } - - //endregion -} diff --git a/vendor/totpsclasslib/src/Database/Definition/Table/TableDefinitionFactory.php b/vendor/totpsclasslib/src/Database/Definition/Table/TableDefinitionFactory.php deleted file mode 100644 index 1bfd12d..0000000 --- a/vendor/totpsclasslib/src/Database/Definition/Table/TableDefinitionFactory.php +++ /dev/null @@ -1,70 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Definition\Table; - -use Stripe_officialClasslib\Database\Definition\ObjectModel\ObjectModelDefinition; -use Stripe_officialClasslib\Database\Definition\Table\AbstractTableDefinitionBuilder; -use Stripe_officialClasslib\Database\Definition\Table\LangTableDefinitionBuilder; -use Stripe_officialClasslib\Database\Definition\Table\MainTableDefinitionBuilder; -use Stripe_officialClasslib\Database\Definition\Table\ShopTableDefinitionBuilder; -use PrestaShopException; - -class TableDefinitionFactory -{ - /** - * @var ObjectModelDefinition - */ - protected $objectModelDefinition; - - /** - * @param ObjectModelDefinition $objectModelDefinition - */ - public function __construct(ObjectModelDefinition $objectModelDefinition) - { - $this->objectModelDefinition = $objectModelDefinition; - } - - /** - * @param $type - * - * @return AbstractTableDefinitionBuilder - * - * @throws PrestaShopException - */ - public function getTableDefinitionBuilder($type) - { - switch ($type) { - case TableType::MAIN: - return new MainTableDefinitionBuilder($this->objectModelDefinition); - case TableType::LANG: - return new LangTableDefinitionBuilder($this->objectModelDefinition); - case TableType::SHOP: - return new ShopTableDefinitionBuilder($this->objectModelDefinition); - default: - throw new PrestaShopException('Table builder not found'); - } - } -} diff --git a/vendor/totpsclasslib/src/Database/Definition/Table/TableType.php b/vendor/totpsclasslib/src/Database/Definition/Table/TableType.php deleted file mode 100644 index 2e77e0e..0000000 --- a/vendor/totpsclasslib/src/Database/Definition/Table/TableType.php +++ /dev/null @@ -1,35 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Definition\Table; - -class TableType -{ - const MAIN = 'MAIN'; - - const LANG = 'LANG'; - - const SHOP = 'SHOP'; -} diff --git a/vendor/totpsclasslib/src/Database/ForeignKey/ForeignKey.php b/vendor/totpsclasslib/src/Database/ForeignKey/ForeignKey.php deleted file mode 100644 index 5cab12f..0000000 --- a/vendor/totpsclasslib/src/Database/ForeignKey/ForeignKey.php +++ /dev/null @@ -1,249 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\ForeignKey; - -use Stripe_officialClasslib\Database\ForeignKey\ReferenceOption; -use ObjectModel; -use PrestaShopException; - -class ForeignKey -{ - //region Fields - - private $table; - - private $type = ObjectModel::HAS_MANY; - - private $association; - - private $object; - - private $field; - - private $onUpdate = ReferenceOption::CASCADE; - - private $onDelete = ReferenceOption::CASCADE; - - //endregion - - //region Get-Set - - /** - * @return mixed - */ - public function getTable() - { - return $this->table; - } - - /** - * @param mixed $table - * - * @return ForeignKey - */ - public function setTable($table) - { - $this->table = $table; - - return $this; - } - - /** - * @return int - */ - public function getType() - { - return $this->type; - } - - /** - * @param int $type - * - * @return ForeignKey - */ - public function setType(int $type) - { - $this->type = $type; - - return $this; - } - - /** - * @return mixed - */ - public function getObject() - { - return $this->object; - } - - /** - * @param mixed $object - * - * @return ForeignKey - */ - public function setObject($object) - { - $this->object = $object; - - return $this; - } - - /** - * @return mixed - */ - public function getAssociation() - { - return $this->association; - } - - /** - * @param mixed $association - * - * @return ForeignKey - */ - public function setAssociation($association) - { - $this->association = $association; - - return $this; - } - - /** - * @return mixed - */ - public function getField() - { - return $this->field; - } - - /** - * @param mixed $field - * - * @return ForeignKey - */ - public function setField($field) - { - $this->field = $field; - - return $this; - } - - /** - * @return string - */ - public function getOnUpdate() - { - return $this->onUpdate; - } - - /** - * @param string $onUpdate - * - * @return ForeignKey - */ - public function setOnUpdate(string $onUpdate) - { - $this->onUpdate = $onUpdate; - - return $this; - } - - /** - * @return string - */ - public function getOnDelete() - { - return $this->onDelete; - } - - /** - * @param string $onDelete - * - * @return ForeignKey - */ - public function setOnDelete(string $onDelete) - { - $this->onDelete = $onDelete; - - return $this; - } - - //endregion - - public function getForeignKey() - { - $object = $this->getObject(); - $objectTable = _DB_PREFIX_ . $object::$definition['table']; - - return " - ALTER TABLE {$this->getTable()} - ADD FOREIGN KEY ({$this->getField()}) - REFERENCES {$objectTable} ({$object::$definition['primary']}) - ON DELETE {$this->getOnDelete()} - ON UPDATE {$this->getOnUpdate()} - "; - } - - /** - * @return ForeignKey - * - * @throws PrestaShopException - */ - public function build($table, $association) - { - $this->setTable($table); - - if ($association['association']) { - $this->setAssociation($association['association']); - } - - if (isset($association['type'])) { - $this->setType($association['type']); - } - - if (isset($association['object'])) { - $this->setObject($association['object']); - } else { - throw new PrestaShopException('Association should have an associated object'); - } - - if (isset($association['field'])) { - $this->setField($association['field']); - } else { - throw new PrestaShopException('Association should have an associated field'); - } - - if (isset($association['on_delete'])) { - $this->setOnDelete($association['on_delete']); - } - - if (isset($association['on_update'])) { - $this->setOnUpdate($association['on_update']); - } - - return $this; - } -} diff --git a/vendor/totpsclasslib/src/Database/ForeignKey/ForeignKeyHandler.php b/vendor/totpsclasslib/src/Database/ForeignKey/ForeignKeyHandler.php deleted file mode 100644 index ef29702..0000000 --- a/vendor/totpsclasslib/src/Database/ForeignKey/ForeignKeyHandler.php +++ /dev/null @@ -1,112 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\ForeignKey; - -use Stripe_officialClasslib\Database\DbObjectHandler; -use Stripe_officialClasslib\Database\Definition\Table\TableDefinition; -use Db; -use PrestaShopLogger; - -class ForeignKeyHandler implements DbObjectHandler -{ - /** - * @var TableDefinition - */ - protected $tableDefinition; - - /** - * @param TableDefinition $tableDefinition - */ - public function __construct(TableDefinition $tableDefinition) - { - $this->tableDefinition = $tableDefinition; - } - - /** - * @return bool - */ - public function handle() - { - if (empty($this->tableDefinition->getForeignKeys())) { - return true; - } - - $keys = $this->getKeys(); - - $keyNames = array_column($keys, 'CONSTRAINT_NAME'); - $keyNames = array_unique($keyNames); - - foreach ($keyNames as $key) { - $this->dropKey($key); - } - - foreach ($this->tableDefinition->getForeignKeys() as $foreignKey) { - $foreignKeySql = $foreignKey->getForeignKey(); - if (empty($foreignKeySql)) { - continue; - } - - try { - Db::getInstance()->execute($foreignKeySql); - } catch (\Exception $e) { - PrestaShopLogger::addLog( - 'Add foreign key : ' . $e->getMessage(), - 3, - null, - self::class - ); - } - } - - return true; - } - - protected function getKeys() - { - return Db::getInstance()->executeS(" - SELECT CONSTRAINT_NAME - FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE - WHERE REFERENCED_TABLE_SCHEMA = '" . _DB_NAME_ . "' - AND TABLE_NAME = '" . $this->tableDefinition->getName() . "'; - "); - } - - protected function dropKey($key) - { - try { - Db::getInstance()->execute(" - ALTER TABLE `{$this->tableDefinition->getName()}` DROP FOREIGN KEY `$key`;" - ); - } catch (\Exception $e) { - PrestaShopLogger::addLog( - "Drop foreign key : `$key` " . $e->getMessage(), - 3, - null, - self::class - ); - } - } -} diff --git a/vendor/totpsclasslib/src/Database/ForeignKey/ReferenceOption.php b/vendor/totpsclasslib/src/Database/ForeignKey/ReferenceOption.php deleted file mode 100644 index 1b1bc33..0000000 --- a/vendor/totpsclasslib/src/Database/ForeignKey/ReferenceOption.php +++ /dev/null @@ -1,39 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\ForeignKey; - -class ReferenceOption -{ - const RESTRICT = 'RESTRICT'; - - const CASCADE = 'CASCADE'; - - const SET_NULL = 'SET NULL'; - - const NO_ACTION = 'NO ACTION'; - - const SET_DEFAULT = 'SET DEFAULT'; -} diff --git a/vendor/totpsclasslib/src/Database/Index/Index.php b/vendor/totpsclasslib/src/Database/Index/Index.php deleted file mode 100644 index c73e07f..0000000 --- a/vendor/totpsclasslib/src/Database/Index/Index.php +++ /dev/null @@ -1,193 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Index; - -use Stripe_officialClasslib\Database\Index\IndexField; -use Stripe_officialClasslib\Database\Index\IndexType; - -class Index -{ - /** - * @var array - */ - private $fields = []; - - private $type = IndexType::STANDARD; - - private $name; - - private $options = ''; - - private $table; - - /** - * @return array - */ - public function getFields() - { - return $this->fields; - } - - /** - * @param array $fields - * - * @return Index - */ - public function setFields(array $fields) - { - $this->fields = $fields; - - return $this; - } - - /** - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * @param string $type - * - * @return Index - */ - public function setType(string $type) - { - $this->type = $type; - - return $this; - } - - /** - * @return mixed - */ - public function getName() - { - return $this->name; - } - - /** - * @param mixed $name - * - * @return Index - */ - public function setName($name) - { - $this->name = $name; - - return $this; - } - - /** - * @return string - */ - public function getOptions() - { - return $this->options; - } - - /** - * @param string $options - * - * @return Index - */ - public function setOptions(string $options) - { - $this->options = $options; - - return $this; - } - - /** - * @return mixed - */ - public function getTable() - { - return $this->table; - } - - /** - * @param mixed $table - * - * @return Index - */ - public function setTable($table) - { - $this->table = $table; - - return $this; - } - - public function getIndex() - { - if (empty($this->getFields()) || empty($this->getTable())) { - return null; - } - - $type = $this->getType(); - $columns = implode(', ', array_map(function ($field) { - return $field->getColumn(); - }, $this->getFields())); - $name = $this->getName(); - if (empty($name)) { - $name = 'ix_' . preg_replace('/[^A-Za-z0-9\-_]/', '', $columns); - } - $options = $this->getOptions(); - $table = $this->getTable(); - - return "CREATE $type INDEX $name ON $table ($columns) $options"; - } - - public static function build($index, $table) - { - $indexObj = new Index(); - $indexObj->setTable($table); - - if (!empty($index['type'])) { - $indexObj->setType($index['type']); - } - - if (!empty($index['name'])) { - $indexObj->setName($index['name']); - } - - if (!empty($index['options'])) { - $indexObj->setOptions($index['options']); - } - - if (!empty($index['fields'])) { - $fields = []; - foreach ($index['fields'] as $field) { - $fields[] = (new IndexField())->setColumn($field['column']); - } - $indexObj->setFields($fields); - } - - return $indexObj; - } -} diff --git a/vendor/totpsclasslib/src/Database/Index/IndexField.php b/vendor/totpsclasslib/src/Database/Index/IndexField.php deleted file mode 100644 index 423582c..0000000 --- a/vendor/totpsclasslib/src/Database/Index/IndexField.php +++ /dev/null @@ -1,51 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Index; - -class IndexField -{ - private $column; - - /** - * @return mixed - */ - public function getColumn() - { - return $this->column; - } - - /** - * @param mixed $column - * - * @return IndexField - */ - public function setColumn($column) - { - $this->column = $column; - - return $this; - } -} diff --git a/vendor/totpsclasslib/src/Database/Index/IndexHandler.php b/vendor/totpsclasslib/src/Database/Index/IndexHandler.php deleted file mode 100644 index 08a933a..0000000 --- a/vendor/totpsclasslib/src/Database/Index/IndexHandler.php +++ /dev/null @@ -1,111 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Index; - -use Stripe_officialClasslib\Database\DbObjectHandler; -use Stripe_officialClasslib\Database\Definition\Table\TableDefinition; -use Db; -use PrestaShopLogger; - -class IndexHandler implements DbObjectHandler -{ - /** - * @var TableDefinition - */ - protected $tableDefinition; - - /** - * @param TableDefinition $tableDefinition - */ - public function __construct(TableDefinition $tableDefinition) - { - $this->tableDefinition = $tableDefinition; - } - - public function handle() - { - $keys = $this->getKeys(); - - $keyNames = array_column($keys, 'Key_name'); - $keyNames = array_unique($keyNames); - - foreach ($keyNames as $key) { - $this->dropKey($key); - } - - foreach ($this->tableDefinition->getIndexes() as $index) { - $indexSql = $index->getIndex(); - if (empty($indexSql)) { - continue; - } - - try { - Db::getInstance()->execute($indexSql); - } catch (\Exception $e) { - PrestaShopLogger::addLog( - 'Add index : ' . $e->getMessage(), - 3, - null, - IndexHandler::class - ); - } - } - - return true; - } - - protected function getKeys() - { - return Db::getInstance()->executeS(" - SHOW KEYS FROM `{$this->tableDefinition->getName()}` - WHERE Key_name <> 'PRIMARY'" - ); - } - - protected function dropKey($key) - { - try { - Db::getInstance()->execute(" - ALTER TABLE `{$this->tableDefinition->getName()}` DROP KEY `$key`;" - ); - } catch (\Exception $e) { - PrestaShopLogger::addLog( - 'Drop index : ' . $e->getMessage(), - 3, - null, - IndexHandler::class - ); - } - } - - /** - * @return TableDefinition - */ - public function getTableDefinition() - { - return $this->tableDefinition; - } -} diff --git a/vendor/totpsclasslib/src/Database/Index/IndexType.php b/vendor/totpsclasslib/src/Database/Index/IndexType.php deleted file mode 100644 index e358ad3..0000000 --- a/vendor/totpsclasslib/src/Database/Index/IndexType.php +++ /dev/null @@ -1,37 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Index; - -class IndexType -{ - const STANDARD = ''; - - const UNIQUE = 'UNIQUE'; - - const FULLTEXT = 'FULLTEXT'; - - const SPATIAL = 'SPATIAL'; -} diff --git a/vendor/totpsclasslib/src/Database/ObjectModelExtension.php b/vendor/totpsclasslib/src/Database/ObjectModelExtension.php deleted file mode 100644 index 4ac5427..0000000 --- a/vendor/totpsclasslib/src/Database/ObjectModelExtension.php +++ /dev/null @@ -1,79 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database; - -use Stripe_officialClasslib\Database\Action\ActionFactory; -use Stripe_officialClasslib\Database\Action\ActionType; -use Stripe_officialClasslib\Database\Definition\ObjectModel\ObjectModelDefinition; -use ObjectModel; - -class ObjectModelExtension -{ - /** - * @var ObjectModelDefinition - */ - private $objectModelDefinition; - - /** - * @var ActionFactory - */ - private $actionFactory; - - /** - * @param string $objectModel - * - * @throws \PrestaShopException - */ - public function __construct(string $objectModel) - { - $this->objectModelDefinition = (new ObjectModelDefinition($objectModel))->build($objectModel::$definition); - $this->actionFactory = new ActionFactory(); - } - - /** - * @return bool - * - * @throws \PrestaShopException - */ - public function install() - { - return $this->actionFactory - ->getAction(ActionType::INSTALL) - ->performAction($this->objectModelDefinition); - } - - /** - * @return bool - * - * @throws \PrestaShopException - */ - public function uninstall() - { - return $this->actionFactory - ->getAction(ActionType::UNINSTALL) - ->performAction($this->objectModelDefinition); - } -} diff --git a/vendor/totpsclasslib/src/Database/Repository/ActionRepository.php b/vendor/totpsclasslib/src/Database/Repository/ActionRepository.php deleted file mode 100644 index eb4455c..0000000 --- a/vendor/totpsclasslib/src/Database/Repository/ActionRepository.php +++ /dev/null @@ -1,43 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * @version develop - */ - -namespace Stripe_officialClasslib\Database\Repository; - -use Db; - -class ActionRepository -{ - public function isTableExist(string $tableName) - { - $tableExist = Db::getInstance()->executeS("SHOW TABLES LIKE '$tableName'"); - - return !empty($tableExist); - } - - public function getTableColumns(string $tableName) - { - return Db::getInstance()->executeS("SHOW COLUMNS FROM `$tableName`"); - } -} diff --git a/vendor/totpsclasslib/src/Db/DbSchema.php b/vendor/totpsclasslib/src/Db/DbSchema.php new file mode 100644 index 0000000..f0803b3 --- /dev/null +++ b/vendor/totpsclasslib/src/Db/DbSchema.php @@ -0,0 +1,74 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version release/2.1.1 + */ + +namespace Stripe_officialClasslib\Db; + +class DbSchema +{ + /** + * @var Stripe_officialClasslib\Db\ObjectModelDefinition + */ + protected $def; + + /** + * Table (internal) ID + * + * @var string + */ + protected $id; + + /** + * Register Stripe_officialClasslib\Db\ObjectModelDefinition and table (internal) ID + * @param Stripe_officialClasslib\Db\ObjectModelDefinition $def + * @param string $id + */ + public function __construct($def, $id) + { + $this->def = $def; + $this->id = $id; + } + + /** + * Map table properties + * @param Stripe_officialClasslib\Db\DbTable $table + * @return Stripe_officialClasslib\Db\DbTable + */ + public function map($table) + { + return $table + ->setName($this->def->getName($this->id)) + ->setEngine($this->def->getEngine($this->id)) + ->setCharset($this->def->getCharset($this->id)) + ->setCollation($this->def->getCollation($this->id)) + ->setColumns($this->def->getColumns($this->id)) + ->setKeyPrimary($this->def->getKeyPrimary($this->id)) + ->setKeysSimple($this->def->getKeysSimple($this->id)) + ->setKeysUnique($this->def->getKeysUnique($this->id)) + ->setKeysFulltext($this->def->getKeysFulltext($this->id)) + // @todo: fix foreign key with lang table not InnoDb + //->setKeysForeign($this->def->getKeysForeign($this->id)) + ; + } +} diff --git a/vendor/totpsclasslib/src/Db/DbTable.php b/vendor/totpsclasslib/src/Db/DbTable.php new file mode 100644 index 0000000..f5410f4 --- /dev/null +++ b/vendor/totpsclasslib/src/Db/DbTable.php @@ -0,0 +1,387 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version release/2.1.1 + */ + +namespace Stripe_officialClasslib\Db; + +use \Tools; + +class DbTable +{ + /** + * Key identifiers. + * + * @var int + */ + const PRIMARY = 1; + const FOREIGN = 2; + const UNIQUE = 3; + const FULLTEXT = 4; + + /** @var Db */ + protected $db; + /** @var string */ + protected $name; + /** @var string */ + protected $engine; + /** @var string */ + protected $charset; + /** @var string */ + protected $collation; + /** @var array */ + protected $columns; + /** @var array */ + protected $schema; + /** @var array */ + protected $keys; + + /** + * Register Db + * @param Db $db + */ + public function __construct($db) + { + $this->db = $db; + } + + /** + * Hydrate properties + * @param Stripe_officialClasslib\Db\DbSchema $schema + * @return Stripe_officialClasslib\Db\DbTable + */ + public function hydrate($schema) + { + $this->schema = $schema; + + return $schema->map($this); + } + + /** + * Create table + * @return bool + */ + public function create() + { + $tableExists = $this->db->executeS("SHOW TABLES LIKE '$this->name'"); + if ($tableExists == false) { + $keys = array(); + foreach ($this->keys as $modelDef) { + if (strpos($modelDef, 'FOREIGN KEY') === 0) { + continue; + } + $keys[] = $modelDef; + } + $result = $this->db->execute("CREATE TABLE IF NOT EXISTS `$this->name` (". + implode(', ', array_merge($this->columns, $keys)). + ") ENGINE=$this->engine CHARSET=$this->charset COLLATE=$this->collation;"); + if ($result == true) { + $this->alterKeys(); + } + return $result; + } + // table exists + $alter = $this->alterFields(); + + if (!empty($alter)) { + return $this->db->execute($alter); + } + $this->alterKeys(); + + return true; + } + + /** + * Alter table fields + * @return string + */ + private function alterFields() + { + $describe = $this->db->executeS("SHOW COLUMNS FROM `$this->name`"); + + foreach ($describe as $key => $col) { + $describe[$key]['modelDef'] = '`'.$col['Field'].'` '.Tools::strtoupper($col['Type']).' '; + if ('NO' === $col['Null']) { + $describe[$key]['modelDef'] .= 'NOT NULL '; + } + if (false === empty($col['Extra'])) { + $describe[$key]['modelDef'] .= Tools::strtoupper($col['Extra']); + } + } + + $alterToSkip = array(); + $alterToExecute = array(); + $alters = array(); + foreach ($this->columns as $key => $column) { + foreach ($describe as $col) { + if (trim($column) === trim($col['modelDef'])) { + $alterToSkip[$key] = true; + } elseif (false !== strpos($column, '`' . $col['Field'] . '`')) { + $alterToExecute[$key] = 'MODIFY'; + $alters[$key] = "ALTER TABLE `$this->name` MODIFY $column;"; + } + } + if (empty($alterToExecute[$key]) && empty($alterToSkip[$key])) { + $alterToExecute[$key]['action'] = 'ADD '.$column; + $alters[$key] = "ALTER TABLE `$this->name` ADD $column;"; + } + } + + return implode("\r\n", $alters); + } + + /** + * Alter table keys + * @return string + */ + private function alterKeys() + { + $describe = $this->db->executeS("SHOW KEYS FROM `$this->name`"); + + foreach ($describe as $k => $key) { + if ($key['Key_name'] != 'PRIMARY') { + try { + $this->db->execute("ALTER TABLE `$this->name` DROP KEY `".$key['Key_name']."`; "); + } catch (\Exception $e) { + continue; + } + } + } + + if (version_compare(_PS_VERSION_, '1.7', '>')) { + $i = 0; + foreach ($this->keys as $modelDef) { + if (strpos($modelDef, 'FOREIGN KEY') === 0) { + $i++; + try { + $this->db->execute("ALTER TABLE `$this->name` DROP FOREIGN KEY `".$this->name . "_ibfk_$i`;"); + } catch (\Exception $e) { + continue; + } + } + } + } + + foreach ($this->keys as $modelDef) { + if (strpos($modelDef, 'PRIMARY KEY') === 0) { + continue; + } + try { + if (strpos($modelDef, 'FOREIGN KEY') === 0 && version_compare(_PS_VERSION_, '1.7', '<')) { + continue; + } + $this->db->execute("ALTER TABLE `$this->name` ADD ".$modelDef.";"); + } catch (\Exception $e) { + continue; + } + } + + return true; + } + + /** + * Drop table + * @return bool + */ + public function drop() + { + return $this->db->execute("DROP TABLE IF EXISTS `$this->name`;"); + } + + /** + * @param string $name + * @return Stripe_officialClasslib\Db\DbTable + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * @param string $engine + * @return Stripe_officialClasslib\Db\DbTable + */ + public function setEngine($engine) + { + $this->engine = $engine; + + return $this; + } + + /** + * @param string $charset + * @return Stripe_officialClasslib\Db\DbTable + */ + public function setCharset($charset) + { + $this->charset = $charset; + + return $this; + } + + /** + * @param string $collation + * @return Stripe_officialClasslib\Db\DbTable + */ + public function setCollation($collation) + { + $this->collation = $collation; + + return $this; + } + + /** + * @param array $columns + * @return Stripe_officialClasslib\Db\DbTable + */ + public function setColumns($columns) + { + $this->columns = $columns; + + return $this; + } + + /** + * @param array $columns + * @return Stripe_officialClasslib\Db\DbTable + */ + public function setKeyPrimary($columns) + { + return $this->setKey($columns, static::PRIMARY); + } + + /** + * @param array $keys + * @return Stripe_officialClasslib\Db\DbTable + */ + public function setKeysForeign($keys) + { + foreach ($keys as $columns) { + $this->setKeyForeign($columns); + } + + return $this; + } + + /** + * @param array $columns + * @return Stripe_officialClasslib\Db\DbTable + */ + public function setKeyForeign($columns) + { + return $this->setKey($columns, static::FOREIGN); + } + + /** + * @param array $keys + * @return Stripe_officialClasslib\Db\DbTable + */ + public function setKeysUnique($keys) + { + return $this->setKeyUnique(array_keys($keys)); + } + + /** + * @param array $columns + * @return Stripe_officialClasslib\Db\DbTable + */ + public function setKeyUnique($columns) + { + return $this->setKey($columns, static::UNIQUE); + } + + /** + * @param array $keys + * @return Stripe_officialClasslib\Db\DbTable + */ + public function setKeysFulltext($keys) + { + return $this->setKeyFulltext(array_keys($keys)); + } + + /** + * @param array $columns + * @return Stripe_officialClasslib\Db\DbTable + */ + public function setKeyFulltext($columns) + { + return $this->setKey($columns, static::FULLTEXT); + } + + /** + * @param array $keys + * @return Stripe_officialClasslib\Db\DbTable + */ + public function setKeysSimple($keys) + { + return $this->setKeySimple(array_keys($keys)); + } + + /** + * @param array $columns + * @return Stripe_officialClasslib\Db\DbTable + */ + public function setKeySimple($columns) + { + return $this->setKey($columns); + } + + /** + * @param array $columns + * @param int|null $type + * @return Stripe_officialClasslib\Db\DbTable + */ + protected function setKey($columns, $type = null) + { + // Empty columns may be returned by `array_filter`s. + if (empty($columns)) { + return $this; + } + + $name = implode('_', $columns); + $columns = implode('`, `', $columns); + switch ($type) { + case static::PRIMARY: + $this->keys[] = "PRIMARY KEY (`$columns`)"; + break; + case static::FOREIGN: + list($table, $columns) = explode('.', $name); + $this->keys[] = "FOREIGN KEY (`$columns`) REFERENCES $table (`$columns`) + ON UPDATE CASCADE ON DELETE CASCADE"; + break; + case static::UNIQUE: + $this->keys[] = "UNIQUE KEY (`$columns`)"; + break; + case static::FULLTEXT: + $this->keys[] = "FULLTEXT KEY (`$columns`)"; + break; + default: + $this->keys[] = "KEY (`$columns`)"; + break; + } + + return $this; + } +} diff --git a/vendor/totpsclasslib/src/Db/DbTableDefinitionModel.php b/vendor/totpsclasslib/src/Db/DbTableDefinitionModel.php new file mode 100644 index 0000000..a9d42eb --- /dev/null +++ b/vendor/totpsclasslib/src/Db/DbTableDefinitionModel.php @@ -0,0 +1,284 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version release/2.1.1 + */ + +namespace Stripe_officialClasslib\Db; + +use Stripe_officialClasslib\Db\ObjectModelDefinition; +use Stripe_officialClasslib\Db\DbTableDefinitionRelation; + +use \ObjectModel; + +class DbTableDefinitionModel +{ + /** + * Internal ID. + */ + const ID = 'm'; + + /** + * @var Stripe_officialClasslib\Db\ObjectModelDefinition + */ + protected $def; + + /** + * Register Stripe_officialClasslib\Db\ObjectModelDefinition + * @param Stripe_officialClasslib\Db\ObjectModelDefinition $def + */ + public function __construct($def) + { + $this->def = $def; + } + + /** + * @return string + */ + public function getName() + { + return ObjectModelDefinition::DB_PREFIX . $this->def->get('table'); + } + + /** + * @return string + */ + public function getPrimary() + { + return $this->def->get('primary'); + } + + /** + * @return string + */ + public function getEngine() + { + return !empty($this->def->get('engine')) ? $this->def->get('engine') : ObjectModelDefinition::ENGINE; + } + + /** + * @return string + */ + public function getCharset() + { + return !empty($this->def->get('charset')) ? + $this->def->get('charset') : ObjectModelDefinition::CHARSET; + } + + /** + * @return string + */ + public function getCollation() + { + return !empty($this->def->get('collation')) ? + $this->def->get('collation') : ObjectModelDefinition::COLLATION; + } + + /** + * @return array + */ + public function getColumns() + { + return $this->def->getColumnsFromFields( + $this->getFields() + ); + } + + /** + * @return array + */ + public function getKeyPrimary() + { + return array( + $this->getPrimary() + ); + } + + /** + * @return array + */ + public function getKeysForeign() + { + $ids = $this->def->getIdsSingleRelations(); + $relations = $this->def->getRelations($ids); + + return array_map(function (DbTableDefinitionRelation $relation) { + return array("{$relation->getName()}.{$relation->getPrimary()}"); + }, $relations); + } + + /** + * @return array + */ + public function getKeysSimple() + { + return array_filter( + $this->getFieldsCommon(), + array( + $this->def, + 'isFieldSimpleKey' + ) + ); + } + + /** + * @return array + */ + public function getKeysUnique() + { + return array_filter( + $this->getFieldsCommon(), + array( + $this->def, + 'isFieldUniqueKey' + ) + ); + } + + /** + * @return array + */ + public function getKeysFulltext() + { + return array_filter( + $this->getFieldsCommon(), + array( + $this->def, + 'isFieldFulltextKey' + ) + ); + } + + /** + * @param string $relation + * @return bool + */ + public function has($relation) + { + switch ($relation) { + case DbTableDefinitionRelation::ID_LANG: + return $this->def->get('multilang'); + case DbTableDefinitionRelation::ID_SHOP: + return $this->def->get('multishop'); + default: + return isset($this->def->get('associations')[$relation]); + } + } + + /** + * @param string $relation + * @return bool + */ + public function hasMany($relation) + { + return $this->has($relation) + && ObjectModel::HAS_MANY === $this->def->getRelation($relation)->getType(); + } + + /** + * @param string $relation + * @return bool + */ + public function hasSingle($relation) + { + return $this->has($relation) + && ObjectModel::HAS_ONE === $this->def->getRelation($relation)->getType(); + } + + /** + * @return array + */ + protected function getFields() + { + return array_merge( + $this->getFieldPrimary(), + $this->getFieldsCommon() + ); + } + + /** + * @return array + */ + protected function getFieldPrimary() + { + return array( + $this->getPrimary() => ObjectModelDefinition::PRIMARY_KEY_FIELD + ); + } + + /** + * @return array + */ + protected function getFieldsCommon() + { + return array_filter( + $this->def->get('fields'), + array( + $this, + 'hasField' + ) + ); + } + + /** + * Wether or not this table has a given field + * @param array $field + * @return bool + */ + protected function hasField($field) + { + return !$this->isFieldMultilang($field) + && !$this->isFieldMultishop($field) + || $this->isFieldMultishopShared($field); + } + + /** + * Wether or not given field is multilang + * @param array $field + * @return bool + */ + protected function isFieldMultilang($field) + { + return !empty($field['lang']); + } + + /** + * Wether or not given field is multishop + * @param array $field + * @return bool + */ + protected function isFieldMultishop($field) + { + return !empty($field['shop']); + } + + /** + * Wether or not given multishop field is shared with this table + * @param array $field + * @return bool + */ + protected function isFieldMultishopShared($field) + { + return !empty($field['shop']) + && 'both' === $field['shop']; + } +} diff --git a/vendor/totpsclasslib/src/Db/DbTableDefinitionRelation.php b/vendor/totpsclasslib/src/Db/DbTableDefinitionRelation.php new file mode 100644 index 0000000..bf1493f --- /dev/null +++ b/vendor/totpsclasslib/src/Db/DbTableDefinitionRelation.php @@ -0,0 +1,385 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version release/2.1.1 + */ + +namespace Stripe_officialClasslib\Db; + +use Stripe_officialClasslib\Db\ObjectModelDefinition; +use Stripe_officialClasslib\Db\DbTableDefinitionRelation; + +use \ObjectModel; + +class DbTableDefinitionRelation +{ + /** + * Internal IDs. + */ + const ID_LANG = 'l'; + const ID_SHOP = 's'; + + /** + * Internal table ID. + * + * @var string + */ + protected $id; + + /** + * @var stripe_officialObjectModelDefinition + */ + protected $def; + + /** + * Register stripe_officialObjectModelDefinition and the internal ID + * @param stripe_officialObjectModelDefinition $def + * @param string $id + */ + public function __construct($def, $id) + { + $this->id = $id; + $this->def = $def; + } + + /** + * Get key value from stripe_officialObjectModel::$definition['associations'][$this->id] + * @param string $key + * @return array|null + */ + public function get($key) + { + switch ($key) { + case 'fields': + return isset($this->def->get('associations')[$this->id][$key]) ? + $this->def->get('associations')[$this->id][$key] : array(); + default: + return isset($this->def->get('associations')[$this->id][$key]) ? + $this->def->get('associations')[$this->id][$key] : null; + } + } + + /** + * @return string + */ + public function getName() + { + switch ($this->id) { + case static::ID_LANG: + return $this->def->getModel()->getName().'_lang'; + case static::ID_SHOP: + return $this->def->getModel()->getName().'_shop'; + default: + return ObjectModelDefinition::DB_PREFIX.$this->get('association'); + } + } + + /** + * @return string + */ + public function getPrimary() + { + switch ($this->id) { + case static::ID_LANG: + return 'id_lang'; + case static::ID_SHOP: + return 'id_shop'; + default: + return (string)$this->get('field'); + } + } + + /** + * @return string + */ + public function getEngine() + { + return !empty($this->get('engine')) ? (string)$this->get('engine') : ObjectModelDefinition::ENGINE; + } + + /** + * @return string + */ + public function getCharset() + { + return !empty($this->get('charset')) ? (string)$this->get('charset') : ObjectModelDefinition::CHARSET; + } + + /** + * @return string + */ + public function getCollation() + { + return !empty($this->get('collation')) ? + (string)$this->get('collation') : ObjectModelDefinition::COLLATION; + } + + /** + * @return array + */ + public function getColumns() + { + return $this->def->getColumnsFromFields( + $this->getFields() + ); + } + + /** + * @return array + */ + public function getKeyPrimary() + { + $primary = array( + $this->def->getModel()->getPrimary(), + $this->getPrimary(), + ); + + if ($this->hasMany('shop')) { + $primary[] = 'id_shop'; + } + + if ($this->hasMany('lang')) { + $primary[] = 'id_lang'; + } + + return $primary; + } + + /** + * @return array + */ + public function getKeysForeign() + { + $model_table_1 = $this->def->getModel()->getName(); + $model_primary_1 = $this->def->getModel()->getPrimary(); + $model_table_2 = $this->getForeignTable(); + $model_primary_2 = $this->getPrimary(); + + $foreign = array( + array("$model_table_1.$model_primary_1"), + array("$model_table_2.$model_primary_2"), + ); + + if ($this->hasMany('shop')) { + $foreign[] = array(_DB_PREFIX_.'shop.id_shop'); + } + + if ($this->hasMany('lang')) { + $foreign[] = array(_DB_PREFIX_.'lang.id_lang'); + } + + return $foreign; + } + + /** + * @return array + */ + public function getKeysSimple() + { + switch ($this->id) { + case DbTableDefinitionRelation::ID_LANG: + case DbTableDefinitionRelation::ID_SHOP: + return array(); + default: + return array_filter( + $this->get('fields'), + array( + $this->def, + 'isFieldSimpleKey' + ) + ); + } + } + + /** + * @return array + */ + public function getKeysUnique() + { + switch ($this->id) { + case DbTableDefinitionRelation::ID_LANG: + case DbTableDefinitionRelation::ID_SHOP: + return array(); + default: + return array_filter( + $this->getFieldsCommon(), + array( + $this->def, + 'isFieldUniqueKey' + ) + ); + } + } + + /** + * @return array + */ + public function getKeysFulltext() + { + switch ($this->id) { + case DbTableDefinitionRelation::ID_LANG: + case DbTableDefinitionRelation::ID_SHOP: + return array(); + default: + return array_filter( + $this->getFieldsCommon(), + array( + $this->def, + 'isFieldFulltextKey' + ) + ); + } + } + + /** + * @return int + */ + public function getType() + { + switch ($this->id) { + case DbTableDefinitionRelation::ID_LANG: + case DbTableDefinitionRelation::ID_SHOP: + return ObjectModel::HAS_MANY; + default: + return (int)$this->get('type'); + } + } + + /** + * Get relation fields + * @return array + */ + protected function getFields() + { + return array_merge( + $this->getFieldsPrimary(), + $this->getFieldsCommon() + ); + } + + /** + * Get relation primary fields + * @return array + */ + protected function getFieldsPrimary() + { + $fields = array( + $this->def->getModel()->getPrimary() => ObjectModelDefinition::KEY_FIELD, + $this->getPrimary() => ObjectModelDefinition::KEY_FIELD, + ); + + if ($this->hasMany('shop')) { + $fields['id_shop'] = ObjectModelDefinition::KEY_FIELD; + } + + if ($this->hasMany('lang')) { + $fields['id_lang'] = ObjectModelDefinition::KEY_FIELD; + } + + return $fields; + } + + /** + * Get relation common fields + * @return array + */ + protected function getFieldsCommon() + { + switch ($this->id) { + case DbTableDefinitionRelation::ID_LANG: + case DbTableDefinitionRelation::ID_SHOP: + return array_filter( + $this->def->get('fields'), + array( + $this, + 'hasField' + ), + ARRAY_FILTER_USE_BOTH + ); + default: + return $this->get('fields'); + } + } + + /** + * Get relation foreign table + * @return string + */ + protected function getForeignTable() + { + switch ($this->id) { + case DbTableDefinitionRelation::ID_LANG: + return _DB_PREFIX_ . 'lang'; + case DbTableDefinitionRelation::ID_SHOP: + return _DB_PREFIX_ . 'shop'; + default: + return _DB_PREFIX_ . $this->getForeignModelTableName(); + } + } + + /** + * Get table name of foreign relation model + * @return string + */ + protected function getForeignModelTableName() + { + /** @var \ObjectModel $class */ + $class = $this->get('object'); + + $classDefinition = $class::$definition; //static definition \ObjectModel named $class + + return $classDefinition['table']; + } + + /** + * Wether or not this table has a 'OneToMany' relation + * @param string $relation + * @return bool + */ + protected function hasMany($relation) + { + switch ($this->id) { + case DbTableDefinitionRelation::ID_LANG: + return !empty($this->def->get("multilang_$relation")); + default: + return !empty($this->get("multi$relation")); + } + } + + /** + * Wether or not this table has a given field + * @param array $field + * @param string $name + * @return bool + */ + protected function hasField($field, $name) + { + switch ($this->id) { + case DbTableDefinitionRelation::ID_LANG: + return !empty($field['lang']); + case DbTableDefinitionRelation::ID_SHOP: + return !empty($field['shop']); + default: + return isset($this->get('fields')[$name]); + } + } +} diff --git a/vendor/totpsclasslib/src/Db/ObjectModelDefinition.php b/vendor/totpsclasslib/src/Db/ObjectModelDefinition.php new file mode 100644 index 0000000..d982140 --- /dev/null +++ b/vendor/totpsclasslib/src/Db/ObjectModelDefinition.php @@ -0,0 +1,510 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version release/2.1.1 + */ + +namespace Stripe_officialClasslib\Db; + +use Stripe_officialClasslib\Db\DbTableDefinitionModel; +use Stripe_officialClasslib\Db\DbTableDefinitionRelation; +use Stripe_officialClasslib\Db\DbSchema; + +use \ObjectModel; +use \Tools; + +class ObjectModelDefinition +{ + /** + * Defaults. + */ + const CHARSET = 'utf8'; + const COLLATION = 'utf8_general_ci'; + const ENGINE = _MYSQL_ENGINE_; + const DB_PREFIX = _DB_PREFIX_; + /** + * Primary key field description. + */ + const PRIMARY_KEY_FIELD = array( + 'type' => ObjectModel::TYPE_INT, + 'validate' => 'isUnsignedId', + 'required' => true, + 'primary' => true, + ); + /** + * (Simple) Key field description. + */ + const KEY_FIELD = array( + 'type' => ObjectModel::TYPE_INT, + 'validate' => 'isUnsignedId', + 'required' => true, + ); + + /** + * ObjectModel::$definition. + * + * @var array + */ + protected $def; + + /** + * @var DbTableDefinitionModel + */ + protected $model; + + /** + * @var array of Stripe_officialClasslib\Db\DbTableDefinitionRelation + */ + protected $relations; + + /** + * Register ObjectModel::$definition as a collection data source + * @param array $def + */ + public function __construct($def) + { + $this->def = $def; + // Prestashop doesn't define shop association when fetching definition. + if ($this->get('multishop')) { + $this->def['associations'][DbTableDefinitionRelation::ID_SHOP] = array( + 'type' => ObjectModel::HAS_MANY, + 'field' => $this->get('primary'), + ); + } + } + + /** + * @param string $key + * @return array|bool|mixed|null + */ + public function get($key) + { + switch ($key) { + case 'table': + case 'primary': + return $this->def[$key]; + case 'fields': + case 'associations': + return isset($this->def[$key]) ? $this->def[$key] : array(); + case 'multilang': + case 'multilang_shop': + case 'multishop': + return isset($this->def[$key]) ? $this->def[$key] : false; + default: + return isset($this->def[$key]) ? $this->def[$key] : null; + } + } + + /** + * @return array + */ + public function getSchemas() + { + return array_map( + array( + $this, + 'getSchema' + ), + $this->getIds() + ); + } + + /** + * @param string $id + * @return Stripe_officialClasslib\Db\DbSchema + */ + public function getSchema($id) + { + return new DbSchema($this, $id); + } + + /** + * @return DbTableDefinitionModel + */ + public function getModel() + { + return isset($this->model) ? $this->model : $this->model = new DbTableDefinitionModel($this); + } + + /** + * @param array $ids + * @return array + */ + public function getRelations($ids) + { + return array_map( + array( + $this, + 'getRelation' + ), + $ids + ); + } + + /** + * @param string $id + * @return Stripe_officialClasslib\Db\DbTableDefinitionRelation + */ + public function getRelation($id) + { + return isset($this->relations[$id]) ? + $this->relations[$id] : $this->relations[$id] = new DbTableDefinitionRelation($this, $id); + } + + /** + * @return array + */ + public function getIds() + { + return array_unique(array_merge( + array($this->getIdModel()), + $this->getIdsMultiRelations() + )); + } + + /** + * @return string + */ + public function getIdModel() + { + return DbTableDefinitionModel::ID; + } + + /** + * @param int|null $type + * @return array + */ + public function getIdsRelations($type = null) + { + switch ($type) { + // OneToOne and ManyToOne. + case ObjectModel::HAS_ONE: + return array_filter( + $this->getIdsRelations(), + array( + $this->getModel(), + 'hasSingle' + ) + ); + // ManyToMany. + case ObjectModel::HAS_MANY: + return array_filter( + $this->getIdsRelations(), + array( + $this->getModel(), + 'hasMany' + ) + ); + // All potential relations. + default: + return array_merge( + array( + DbTableDefinitionRelation::ID_LANG, + DbTableDefinitionRelation::ID_SHOP + ), + array_keys($this->get('associations')) + ); + } + } + + /** + * @return array + */ + public function getIdsMultiRelations() + { + return $this->getIdsRelations(ObjectModel::HAS_MANY); + } + + /** + * @return array + */ + public function getIdsSingleRelations() + { + return $this->getIdsRelations(ObjectModel::HAS_ONE); + } + + /** + * @return array + */ + public function getNames() + { + return array_map( + array( + $this, + 'getName' + ), + $this->getIds() + ); + } + + /** + * @param string $id + * @return string + */ + public function getName($id) + { + switch ($id) { + case DbTableDefinitionModel::ID: + return $this->getModel()->getName(); + default: + return $this->getRelation($id)->getName(); + } + } + + /** + * @param string $id + * @return string + */ + public function getEngine($id) + { + switch ($id) { + case DbTableDefinitionModel::ID: + return $this->getModel()->getEngine(); + default: + return $this->getRelation($id)->getEngine(); + } + } + + /** + * @param string $id + * @return string + */ + public function getCharset($id) + { + switch ($id) { + case DbTableDefinitionModel::ID: + return $this->getModel()->getCharset(); + default: + return $this->getRelation($id)->getCharset(); + } + } + + /** + * @param string $id + * @return string + */ + public function getCollation($id) + { + switch ($id) { + case DbTableDefinitionModel::ID: + return $this->getModel()->getCollation(); + default: + return $this->getRelation($id)->getCollation(); + } + } + + /** + * @param string $id + * @return array + */ + public function getColumns($id) + { + switch ($id) { + case DbTableDefinitionModel::ID: + return $this->getModel()->getColumns(); + default: + return $this->getRelation($id)->getColumns(); + } + } + + /** + * @param array $fields + * @return array + */ + public function getColumnsFromFields($fields) + { + return array_map( + array( + $this, + 'getColumnFromField' + ), + array_keys($fields), + $fields + ); + } + + /** + * @param string $name + * @param array $constraints + * @return string + * @throws \PrestaShopException + */ + public function getColumnFromField($name, $constraints) + { + $description = "`$name` "; + if (empty($constraints['values'])) { + switch ($constraints['type']) { + case ObjectModel::TYPE_BOOL: + $description .= 'TINYINT(1) UNSIGNED'; + break; + case ObjectModel::TYPE_DATE: + $description .= 'DATETIME'; + break; + case ObjectModel::TYPE_FLOAT: + $description .= 'DECIMAL'.( + isset($constraints['size'], $constraints['scale']) + ? "({$constraints['size']},{$constraints['scale']})" + : '' + ); + break; + case ObjectModel::TYPE_HTML: + /* Not compatible with PS 1.6; not very useful anyway... + case ObjectModel::TYPE_SQL: + */ + $length = isset($constraints['size']) ? $constraints['size'] : null; + $length = isset($length['max']) ? $length['max'] : $length; + if ($length >= 65535) { + $description .= $length ? "TEXT($length)" : 'TEXT'; + } else { + $description .= 'MEDIUMTEXT'; + } + break; + case ObjectModel::TYPE_INT: + $description .= 'INT(10)'.( + !empty($constraints['validate']) + && strpos(Tools::strtolower($constraints['validate']), 'unsigned') + ? ' UNSIGNED' + : ' SIGNED' + ); + break; + case ObjectModel::TYPE_STRING: + $length = isset($constraints['size']) ? $constraints['size'] : 255; + $length = isset($length['max']) ? $length['max'] : $length; + $description .= "VARCHAR($length)"; + break; + default: + throw new \PrestaShopException("Missing type constraint definition for field $name"); + } + } + if (!empty($constraints['values'])) { + $description .= " ENUM('".implode("','", $constraints['values'])."')"; + } + if (empty($constraints['allow_null']) || isset($constraints['default']) || !empty($constraints['required'])) { + $description .= ' NOT NULL'; + } + if (isset($constraints['default'])) { + $description .= " DEFAULT '".addslashes($constraints['default'])."'"; + } + if (!empty($constraints['primary'])) { + $description .= ' AUTO_INCREMENT'; + } + + return $description; + } + + /** + * @param string $id + * @return array + */ + public function getKeyPrimary($id) + { + switch ($id) { + case DbTableDefinitionModel::ID: + return $this->getModel()->getKeyPrimary(); + default: + return $this->getRelation($id)->getKeyPrimary(); + } + } + + /** + * @param string $id + * @return array + */ + public function getKeysForeign($id) + { + switch ($id) { + case DbTableDefinitionModel::ID: + return $this->getModel()->getKeysForeign(); + default: + return $this->getRelation($id)->getKeysForeign(); + } + } + + /** + * @param string $id + * @return array + */ + public function getKeysSimple($id) + { + switch ($id) { + case DbTableDefinitionModel::ID: + return $this->getModel()->getKeysSimple(); + default: + return $this->getRelation($id)->getKeysSimple(); + } + } + + /** + * @param string $id + * @return array + */ + public function getKeysUnique($id) + { + switch ($id) { + case DbTableDefinitionModel::ID: + return $this->getModel()->getKeysUnique(); + default: + return $this->getRelation($id)->getKeysUnique(); + } + } + + /** + * @param string $id + * @return array + */ + public function getKeysFulltext($id) + { + switch ($id) { + case DbTableDefinitionModel::ID: + return $this->getModel()->getKeysFulltext(); + default: + return $this->getRelation($id)->getKeysFulltext(); + } + } + + /** + * @param array $field + * @return bool + */ + public function isFieldSimpleKey($field) + { + return !empty($field['key']); + } + + /** + * @param array $field + * @return bool + */ + public function isFieldUniqueKey($field) + { + return !empty($field['unique']); + } + + /** + * @param array $field + * @return bool + */ + public function isFieldFulltextKey($field) + { + return !empty($field['fulltext']); + } +} diff --git a/vendor/totpsclasslib/src/Db/ObjectModelExtension.php b/vendor/totpsclasslib/src/Db/ObjectModelExtension.php new file mode 100644 index 0000000..05aa2f2 --- /dev/null +++ b/vendor/totpsclasslib/src/Db/ObjectModelExtension.php @@ -0,0 +1,120 @@ + + * ........................................................................... + * + * @author 202-ecommerce + * @copyright Copyright (c) 202-ecommerce + * @license Commercial license + * @version release/2.1.1 + */ + +namespace Stripe_officialClasslib\Db; + +use Stripe_officialClasslib\Db\ObjectModelDefinition; +use Stripe_officialClasslib\Db\DbTableDefinitionModel; +use Stripe_officialClasslib\Db\DbTableDefinitionRelation; +use Stripe_officialClasslib\Db\DbSchema; +use Stripe_officialClasslib\Db\DbTable; + +class ObjectModelExtension +{ + /** + * @var \ObjectModel + */ + protected $om; + + /** + * @var Db + */ + protected $db; + + /** + * Register ObjectModel and Db + * @param \ObjectModel $om + * @param Db $db + */ + public function __construct($om, $db) + { + $this->om = $om; + $this->db = $db; + } + + /** + * @return bool + */ + public function install() + { + $schemas = $this->getObjectModelDefinition()->getSchemas(); + + return $this->createTables($schemas); + } + + /** + * @return bool + */ + public function uninstall() + { + $names = $this->getObjectModelDefinition()->getNames(); + + return $this->dropTables(array_reverse($names)); + } + + /** + * @return Stripe_officialClasslib\Db\ObjectModelDefinition (as an array collection object) + */ + protected function getObjectModelDefinition() + { + return new ObjectModelDefinition($this->om->getDefinition($this->om)); + } + + /** + * @param array $schemas + * @return bool + */ + protected function createTables($schemas) + { + return array_product(array_map(array($this, 'createTable'), $schemas)); + } + + /** + * @param Stripe_officialClasslib\Db\DbSchema $schema + * @return bool + */ + protected function createTable($schema) + { + return (new DbTable($this->db))->hydrate($schema)->create(); + } + + /** + * @param array $names + * @return bool + */ + protected function dropTables(array $names) + { + return array_product(array_map(array($this, 'dropTable'), $names)); + } + + /** + * @param string $name + * @return bool + */ + protected function dropTable($name) + { + return (new DbTable($this->db))->setName($name)->drop(); + } +} diff --git a/vendor/totpsclasslib/src/Extensions/AbstractModuleExtension.php b/vendor/totpsclasslib/src/Extensions/AbstractModuleExtension.php index d197e6b..2ebf1a6 100644 --- a/vendor/totpsclasslib/src/Extensions/AbstractModuleExtension.php +++ b/vendor/totpsclasslib/src/Extensions/AbstractModuleExtension.php @@ -1,71 +1,28 @@ - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - */ - namespace Stripe_officialClasslib\Extensions; -use Stripe_officialClasslib\Hook\AbstractHookDispatcher; -use Stripe_officialClasslib\Module; - abstract class AbstractModuleExtension { //region Fields public $name; - /** - * @var Module - */ public $module; - public $objectModels = []; + public $objectModels = array(); - public $hooks = []; + public $hooks = array(); - public $extensionAdminControllers = []; + public $extensionAdminControllers = array(); - public $controllers = []; + public $controllers = array(); - public $cronTasks = []; - - /** - * @var AbstractHookDispatcher - */ - protected $hookDispatcher = null; + public $cronTasks = array(); //TODO //endregion - public function __construct($module = null) - { - $this->module = $module; - } - /** - * Set the module object for the extension - * * @param Module $module - * - * @return AbstractModuleExtension */ public function setModule($module) { @@ -73,75 +30,4 @@ public function setModule($module) return $this; } - - /** - * Fetch Smarty template - * - * @todo Maybe this method should belong to classlib Module class - * so we'd have a unified way of calling the fetch method - * doing `$this->module->fetch(...)` - * - * @param string $templatePath - * @param null $cache_id - * @param null $compile_id - * - * @return mixed|string - * - * @throws \SmartyException - */ - public function fetch($templatePath, $cache_id = null, $compile_id = null) - { - if (version_compare(_PS_VERSION_, '1.7', '>')) { - return $this->module->fetch($templatePath, $cache_id, $compile_id); - } - - return \Context::getContext()->smarty->fetch($templatePath, $cache_id, $compile_id); - } - - /** - * Do shmth while each initialisation of extension, must be overrided in nested classes - * - * @return void - */ - public function initExtension() - { - } - - /** - * Do smth during the installation process - * - * @return bool - */ - public function install() - { - return true; - } - - /** - * Do smth during the uninstall action - * - * @return bool - */ - public function uninstall() - { - return true; - } - - /** - * Helps to manage hooks and widgets - * - * @return AbstractHookDispatcher - */ - public function getHookDispatcher() - { - return $this->hookDispatcher; - } - - /** - * @return array - */ - public function getExtensionAdminControllers() - { - return $this->extensionAdminControllers; - } -} +} \ No newline at end of file diff --git a/vendor/totpsclasslib/src/Extensions/ProcessLogger/Classes/ProcessLoggerObjectModel.php b/vendor/totpsclasslib/src/Extensions/ProcessLogger/Classes/ProcessLoggerObjectModel.php index 364ef95..3b05a13 100644 --- a/vendor/totpsclasslib/src/Extensions/ProcessLogger/Classes/ProcessLoggerObjectModel.php +++ b/vendor/totpsclasslib/src/Extensions/ProcessLogger/Classes/ProcessLoggerObjectModel.php @@ -20,13 +20,12 @@ * @author 202-ecommerce * @copyright Copyright (c) 202-ecommerce * @license Commercial license - * - * @version develop + * @version release/2.1.1 */ namespace Stripe_officialClasslib\Extensions\ProcessLogger\Classes; -use ObjectModel; +use \ObjectModel; class ProcessLoggerObjectModel extends ObjectModel { @@ -36,7 +35,7 @@ class ProcessLoggerObjectModel extends ObjectModel /** @var string Message to display */ public $msg; - /** @var string level (success|error|info|deprecated) */ + /** @var string level (success|failed|info) */ public $level; /** @var string Name of ObjectModel associated if needed */ @@ -56,44 +55,45 @@ class ProcessLoggerObjectModel extends ObjectModel /** * @see \ObjectModel::$definition */ - public static $definition = [ - 'table' => 'stripe_official_processlogger', - 'primary' => 'id_stripe_official_processlogger', - 'fields' => [ - 'name' => [ - 'type' => ObjectModel::TYPE_STRING, + public static $definition = array( + 'table' => 'stripe_official_processlogger', + 'primary' => 'id_stripe_official_processlogger', + 'fields' => array( + 'name' => array( + 'type' => ObjectModel::TYPE_STRING, 'validate' => 'isGenericName', - 'size' => 100, - ], - 'msg' => [ - 'type' => ObjectModel::TYPE_HTML, + 'size' => 100, + ), + 'msg' => array( + 'type' => ObjectModel::TYPE_HTML, 'validate' => 'isGenericName', - ], - 'level' => [ - 'type' => ObjectModel::TYPE_STRING, + 'size' => 255, + ), + 'level' => array( + 'type' => ObjectModel::TYPE_STRING, 'validate' => 'isGenericName', - 'size' => 10, - ], - 'object_name' => [ - 'type' => ObjectModel::TYPE_STRING, + 'size' => 10, + ), + 'object_name' => array( + 'type' => ObjectModel::TYPE_STRING, 'validate' => 'isGenericName', - 'size' => 100, - ], - 'object_id' => [ + 'size' => 100, + ), + 'object_id' => array( 'type' => ObjectModel::TYPE_INT, 'validate' => 'isUnsigned', 'allow_null' => true, - ], - 'id_session' => [ + ), + 'id_session' => array( 'type' => ObjectModel::TYPE_STRING, 'validate' => 'isString', 'allow_null' => true, - ], - 'date_add' => [ - 'type' => ObjectModel::TYPE_DATE, - 'validate' => 'isDate', + ), + 'date_add' => array( + 'type' => ObjectModel::TYPE_DATE, + 'validate' => 'isDate', 'copy_post' => false, - ], - ], - ]; + ), + ), + ); } diff --git a/vendor/totpsclasslib/src/Extensions/ProcessLogger/Controllers/Admin/AdminProcessLoggerController.php b/vendor/totpsclasslib/src/Extensions/ProcessLogger/Controllers/Admin/AdminProcessLoggerController.php index bce7788..75de75a 100644 --- a/vendor/totpsclasslib/src/Extensions/ProcessLogger/Controllers/Admin/AdminProcessLoggerController.php +++ b/vendor/totpsclasslib/src/Extensions/ProcessLogger/Controllers/Admin/AdminProcessLoggerController.php @@ -20,21 +20,20 @@ * @author 202-ecommerce * @copyright Copyright (c) 202-ecommerce * @license Commercial license - * - * @version develop + * @version release/2.1.1 */ namespace Stripe_officialClasslib\Extensions\ProcessLogger\Controllers\Admin; use Stripe_officialClasslib\Extensions\ProcessLogger\Classes\ProcessLoggerObjectModel; -use Configuration; -use Db; -use Shop; -use Tools; + +use \Db; +use \Tools; +use \Configuration; class AdminProcessLoggerController extends \ModuleAdminController { - /** @var bool Active bootstrap for Prestashop 1.6 */ + /** @var bool $bootstrap Active bootstrap for Prestashop 1.6 */ public $bootstrap = true; /** @var \Module Instance of your module automatically set by ModuleAdminController */ @@ -49,10 +48,10 @@ class AdminProcessLoggerController extends \ModuleAdminController /** @var string|false Object identifier inside the associated table */ public $identifier = 'id_stripe_official_processlogger'; - /** @var string Default ORDER BY clause when is not defined */ + /** @var string Default ORDER BY clause when $_orderBy is not defined */ protected $_defaultOrderBy = 'id_stripe_official_processlogger'; - /** @var string Default ORDER WAY clause when is not defined */ + /** @var string Default ORDER WAY clause when $_orderWay is not defined */ protected $_defaultOrderWay = 'DESC'; /** @var bool List content lines are clickable if true */ @@ -69,110 +68,106 @@ public function __construct() $this->addRowAction('delete'); - $this->bulk_actions = [ - 'delete' => [ + $this->bulk_actions = array( + 'delete' => array( 'text' => $this->module->l('Delete selected', 'AdminProcessLoggerController'), 'confirm' => $this->module->l( 'Would you like to delete the selected items?', 'AdminProcessLoggerController' ), - ], - ]; + ) + ); - $this->fields_list = [ - 'id_stripe_official_processlogger' => [ - 'title' => $this->module->l('ID', 'AdminProcessLoggerController'), - 'align' => 'center', - 'class' => 'fixed-width-xs', + $this->fields_list = array( + 'id_stripe_official_processlogger' => array( + 'title' => $this->module->l('ID', 'AdminProcessLoggerController'), + 'align' => 'center', + 'class' => 'fixed-width-xs', 'search' => true, - ], - 'name' => [ + ), + 'name' => array( 'title' => $this->module->l('Name', 'AdminProcessLoggerController'), - ], - 'msg' => [ + ), + 'msg' => array( 'title' => $this->module->l('Message', 'AdminProcessLoggerController'), - ], - 'level' => [ - 'title' => $this->module->l('Level', 'AdminProcessLoggerController'), + ), + 'level' => array( + 'title' => $this->module->l('Level', 'AdminProcessLoggerController'), 'callback' => 'getLevel', - ], - 'object_name' => [ + ), + 'object_name' => array( 'title' => $this->module->l('Object Name', 'AdminProcessLoggerController'), - ], - 'object_id' => [ - 'title' => $this->module->l('Object ID', 'AdminProcessLoggerController'), + ), + 'object_id' => array( + 'title' => $this->module->l('Object ID', 'AdminProcessLoggerController'), 'callback' => 'getObjectId', - ], - 'id_session' => [ + ), + 'id_session' => array( 'title' => $this->module->l('Session ID', 'AdminProcessLoggerController'), - ], - 'date_add' => [ + ), + 'date_add' => array( 'title' => $this->module->l('Date', 'AdminProcessLoggerController'), - ], - ]; + ), + ); - $this->fields_options = [ - 'processLogger' => [ - 'image' => '../img/admin/cog.gif', - 'title' => $this->module->l('Process Logger Settings', 'AdminProcessLoggerController'), + $this->fields_options = array( + 'processLogger' => array( + 'image' => '../img/admin/cog.gif', + 'title' => $this->module->l('Process Logger Settings', 'AdminProcessLoggerController'), 'description' => $this->module->l( 'Here you can change the default configuration for this Process Logger', 'AdminProcessLoggerController' ), - 'fields' => [ - 'STRIPE_OFFICIAL_EXTLOGS_ERASING_DISABLED' => [ - 'title' => $this->module->l( + 'fields' => array( + 'STRIPE_OFFICIAL_EXTLOGS_ERASING_DISABLED' => array( + 'title' => $this->module->l( 'Disable auto erasing', 'AdminProcessLoggerController' ), - 'hint' => $this->module->l( + 'hint' => $this->module->l( 'If disabled, logs will be automatically erased after the delay', 'AdminProcessLoggerController' ), - 'validation' => 'isBool', - 'cast' => 'intval', - 'type' => 'bool', - ], - 'STRIPE_OFFICIAL_EXTLOGS_ERASING_DAYSMAX' => [ - 'title' => $this->module->l( + 'validation' => 'isBool', + 'cast' => 'intval', + 'type' => 'bool', + ), + 'STRIPE_OFFICIAL_EXTLOGS_ERASING_DAYSMAX' => array( + 'title' => $this->module->l( 'Auto erasing delay (in days)', 'AdminProcessLoggerController' ), - 'hint' => $this->module->l( + 'hint' => $this->module->l( 'Choose the number of days you want to keep logs in database', 'AdminProcessLoggerController' ), - 'validation' => 'isInt', - 'cast' => 'intval', - 'type' => 'text', + 'validation' => 'isInt', + 'cast' => 'intval', + 'type' => 'text', 'defaultValue' => 5, - ], - ], - 'submit' => [ + ), + ), + 'submit' => array( 'title' => $this->module->l('Save', 'AdminProcessLoggerController'), - 'name' => 'submitSaveConf', - ], - ], - ]; + 'name' => 'submitSaveConf'), + ), + ); } /** - * @param string $echo Value of field - * @param array $tr All data of the row - * + * @param $echo string Value of field + * @param $tr array All data of the row * @return string */ public function getObjectId($echo, $tr) { unset($tr); - return empty($echo) ? '' : $echo; } /** - * @param string $echo Value of field - * @param array $tr All data of the row - * + * @param $echo string Value of field + * @param $tr array All data of the row * @return string */ public function getLevel($echo, $tr) @@ -180,19 +175,15 @@ public function getLevel($echo, $tr) unset($tr); switch ($echo) { case 'info': - $echo = '' . $echo . ''; + $echo = ''.$echo.''; break; case 'success': - $echo = '' . $echo . ''; + $echo = ''.$echo.''; break; case 'error': - $echo = '' . $echo . ''; - break; - case 'deprecated': - $echo = '' . $echo . ''; + $echo = ''.$echo.''; break; } - return $echo; } @@ -214,13 +205,13 @@ public function initToolbar() parent::initToolbar(); // Remove the add new item button unset($this->toolbar_btn['new']); - $this->toolbar_btn['delete'] = [ + $this->toolbar_btn['delete'] = array( 'short' => 'Erase', 'desc' => $this->module->l('Erase all'), - 'js' => 'if (confirm(\'' . - $this->module->l('Are you sure?', 'AdminProcessLoggerController') . - '\')) document.location = \'' . self::$currentIndex . '&token=' . $this->token . '&action=erase\';', - ]; + 'js' => 'if (confirm(\''. + $this->module->l('Are you sure?', 'AdminProcessLoggerController'). + '\')) document.location = \''.self::$currentIndex.'&token='.$this->token.'&action=erase\';' + ); } /** @@ -254,7 +245,7 @@ public function saveConfiguration() foreach ($shops as $shop) { $extlogs_erasing_daysmax = Tools::getValue('STRIPE_OFFICIAL_EXTLOGS_ERASING_DAYSMAX'); $extlogs_erasing_disabled = Tools::getValue('STRIPE_OFFICIAL_EXTLOGS_ERASING_DISABLED'); - + Configuration::updateValue( 'STRIPE_OFFICIAL_EXTLOGS_ERASING_DISABLED', ($extlogs_erasing_disabled ? true : false), diff --git a/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerExtension.php b/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerExtension.php index 9e04ecd..520e36d 100644 --- a/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerExtension.php +++ b/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerExtension.php @@ -20,33 +20,31 @@ * @author 202-ecommerce * @copyright Copyright (c) 202-ecommerce * @license Commercial license - * - * @version develop + * @version release/2.1.1 */ - namespace Stripe_officialClasslib\Extensions\ProcessLogger; use Stripe_officialClasslib\Extensions\AbstractModuleExtension; -use Stripe_officialClasslib\Extensions\ProcessLogger\Classes\ProcessLoggerObjectModel; use Stripe_officialClasslib\Extensions\ProcessLogger\Controllers\Admin\AdminProcessLoggerController; +use Stripe_officialClasslib\Extensions\ProcessLogger\Classes\ProcessLoggerObjectModel; class ProcessLoggerExtension extends AbstractModuleExtension { public $name = 'process_logger'; - public $extensionAdminControllers = [ - [ - 'name' => [ + public $extensionAdminControllers = array( + array( + 'name' => array( 'en' => 'Logger Stripe_official', 'fr' => 'Logger Stripe_official', - ], + ), 'class_name' => 'AdminStripe_officialProcessLogger', 'parent_class_name' => 'stripe_official', 'visible' => true, - ], - ]; + ), + ); - public $objectModels = [ - ProcessLoggerObjectModel::class, - ]; -} + public $objectModels = array( + ProcessLoggerObjectModel::class + ); +} \ No newline at end of file diff --git a/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerHandler.php b/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerHandler.php index 027c8a5..74aca04 100644 --- a/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerHandler.php +++ b/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerHandler.php @@ -20,35 +20,32 @@ * @author 202-ecommerce * @copyright Copyright (c) 202-ecommerce * @license Commercial license - * - * @version develop + * @version release/2.1.1 */ namespace Stripe_officialClasslib\Extensions\ProcessLogger; -use Stripe_officialClasslib\Extensions\ProcessMonitor\ProcessMonitorHandler; -use Configuration; -use Db; -use Hook; -use Tools; +use \Db; +use \Configuration; +use \Hook; class ProcessLoggerHandler { /** - * @var ProcessMonitorHandler - * Instance of ProcessMonitorHandler + * @var Stripe_officialClasslib\Extensions\ProcessMonitor\ProcessMonitorHandler + * Instance of ProcessMonitorHandler */ private static $process; /** * @var array logs */ - private static $logs = []; + private static $logs = array(); /** * Set process name and remove oldest logs * - * @param ProcessMonitorHandler|null $process + * @param Stripe_officialClasslib\Extensions\ProcessMonitor\ProcessMonitorHandler|null $process */ public static function openLogger($process = null) { @@ -58,9 +55,6 @@ public static function openLogger($process = null) /** * @param string|null $msg - * - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException */ public static function closeLogger($msg = null) { @@ -79,15 +73,15 @@ public static function closeLogger($msg = null) */ public static function addLog($msg, $objectModel = null, $objectId = null, $name = null, $level = 'info') { - self::$logs[] = [ + self::$logs[] = array( 'name' => pSQL($name), 'msg' => pSQL($msg), 'level' => pSQL($level), 'object_name' => pSQL($objectModel), 'object_id' => (int)$objectId, - 'date_add' => date('Y-m-d H:i:s'), + 'date_add' => date("Y-m-d H:i:s"), 'id_session' => self::getSessionId(), - ]; + ); if (100 === count(self::$logs)) { self::saveLogsInDb(); @@ -136,54 +130,38 @@ public static function logInfo($msg, $objectModel = null, $objectId = null, $nam self::addLog($msg, $objectModel, $objectId, $name, 'info'); } - /** - * @param string $msg - * @param string|null $objectModel - * @param int|null $objectId - * @param string $name - */ - public static function logDeprecated($msg, $objectModel = null, $objectId = null, $name = 'default') - { - if (self::$process != null) { - $name = self::$process->getProcessName(); - } - self::addLog($msg, $objectModel, $objectId, $name, 'deprecated'); - } - /** * @return bool - * - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException */ public static function saveLogsInDb() { $result = true; if (false === empty(self::$logs) && self::getSkippingHooksResult()) { + Hook::exec( - 'actionProcessLoggerSave', - [ - 'logs' => &self::$logs, - ], - null, - true + 'actionProcessLoggerSave', + array( + 'logs' => &self::$logs, + ), + null, + true ); Hook::exec( - 'actionStripe_officialProcessLoggerSave', - [ - 'logs' => &self::$logs, - ], - null, - true + 'actionStripe_officialProcessLoggerSave', + array( + 'logs' => &self::$logs, + ), + null, + true ); - + $result = Db::getInstance()->insert( 'stripe_official_processlogger', self::$logs ); if ($result) { - self::$logs = []; + self::$logs = array(); } } @@ -229,34 +207,32 @@ public static function getAutoErasingDelayInDays() return (int)$numberOfDays; } - + /** * Executes the hooks used to skip a ProcessLogger save. This will return * false if any module hooked to either 'actionSkipProcessLoggerSave' or * 'actionSkipStripe_officialProcessLoggerSave' returns false (weak comparison) - * + * * @return bool - * - * @throws \PrestaShopException */ - protected static function getSkippingHooksResult() - { + protected static function getSkippingHooksResult() { + if (Hook::getIdByName('actionSkipProcessLoggerSave')) { $hookProcessLoggerReturnArray = Hook::exec( - 'actionSkipProcessLoggerSave', - [ - 'logs' => self::$logs, - ], - null, - true + 'actionSkipProcessLoggerSave', + array( + 'logs' => self::$logs, + ), + null, + true ); if (!is_array($hookProcessLoggerReturnArray)) { return false; } - + if (!empty($hookProcessLoggerReturnArray)) { - $hookReturn = array_reduce($hookProcessLoggerReturnArray, function ($and, $hookReturn) { + $hookReturn = array_reduce($hookProcessLoggerReturnArray, function($and, $hookReturn) { return $and && (bool)$hookReturn; }); if (!$hookReturn) { @@ -264,23 +240,23 @@ protected static function getSkippingHooksResult() } } } - + if (Hook::getIdByName('actionSkipStripe_officialProcessLoggerSave')) { $hookModuleProcessLoggerReturnArray = Hook::exec( - 'actionSkipStripe_officialProcessLoggerSave', - [ - 'logs' => self::$logs, - ], - null, - true + 'actionSkipStripe_officialProcessLoggerSave', + array( + 'logs' => self::$logs, + ), + null, + true ); if (!is_array($hookModuleProcessLoggerReturnArray)) { return false; } - + if (!empty($hookModuleProcessLoggerReturnArray)) { - $hookReturn = array_reduce($hookModuleProcessLoggerReturnArray, function ($and, $hookReturn) { + $hookReturn = array_reduce($hookModuleProcessLoggerReturnArray, function($and, $hookReturn) { return $and && (bool)$hookReturn; }); if (!$hookReturn) { @@ -288,13 +264,13 @@ protected static function getSkippingHooksResult() } } } - + return true; } protected static function getSessionId() { - $values = []; + $values = array(); $remoteAddr = Tools::getRemoteAddr(); $values[] = $remoteAddr; if (!empty($_SERVER['REQUEST_TIME'])) { diff --git a/vendor/totpsclasslib/src/Extensions/ProcessMonitor/Classes/ProcessMonitorObjectModel.php b/vendor/totpsclasslib/src/Extensions/ProcessMonitor/Classes/ProcessMonitorObjectModel.php deleted file mode 100644 index fb1f170..0000000 --- a/vendor/totpsclasslib/src/Extensions/ProcessMonitor/Classes/ProcessMonitorObjectModel.php +++ /dev/null @@ -1,124 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * - * @version develop - */ - -namespace Stripe_officialClasslib\Extensions\ProcessMonitor\Classes; - -use Stripe_officialClasslib\Database\Index\IndexType; -use Db; -use DbQuery; -use ObjectModel; - -class ProcessMonitorObjectModel extends ObjectModel -{ - /** @var string name of process */ - public $name; - - /** @var int PHP's process ID associated with process */ - public $pid = null; - - /** @var string Some useful data about process execution */ - public $data; - - /** @var float */ - public $duration = 0; - - /** @var string Date */ - public $last_update; - - /** @var bool Boolean */ - public $active = true; - - /** - * @see ObjectModel::$definition - */ - public static $definition = [ - 'table' => 'stripe_official_processmonitor', - 'primary' => 'id_stripe_official_processmonitor', - 'fields' => [ - 'name' => [ - 'type' => ObjectModel::TYPE_STRING, - 'validate' => 'isGenericName', - 'size' => 100, - 'required' => true, - ], - 'pid' => [ - 'type' => ObjectModel::TYPE_INT, - 'validate' => 'isUnsignedId', - 'allow_null' => true, - ], - 'data' => [ - 'type' => ObjectModel::TYPE_STRING, - ], - 'duration' => [ - 'type' => ObjectModel::TYPE_FLOAT, - 'validate' => 'isUnsignedFloat', - 'size' => 10, - 'scale' => 6, - ], - 'active' => [ - 'type' => ObjectModel::TYPE_BOOL, - 'validate' => 'isBool', - 'required' => true, - ], - 'last_update' => [ - 'type' => ObjectModel::TYPE_DATE, - ], - ], - 'indexes' => [ - [ - 'fields' => [ - [ - 'column' => 'name', - ], - ], - 'type' => IndexType::UNIQUE, - ], - ], - ]; - - /** - * @param string $name - * - * @return mixed - */ - public function findOneByName($name) - { - $query = new DbQuery(); - $query->select('*'); - $query->from(self::$definition['table'], 'p'); - $query->where('p.name = \'' . pSQL($name) . '\''); - - $data = Db::getInstance()->getRow($query); - - if (empty($data)) { - return $this; - } - - $this->hydrate($data); - - return $this; - } -} diff --git a/vendor/totpsclasslib/src/Extensions/ProcessMonitor/ProcessMonitorHandler.php b/vendor/totpsclasslib/src/Extensions/ProcessMonitor/ProcessMonitorHandler.php deleted file mode 100644 index 8508ba0..0000000 --- a/vendor/totpsclasslib/src/Extensions/ProcessMonitor/ProcessMonitorHandler.php +++ /dev/null @@ -1,205 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * - * @version develop - */ - -namespace Stripe_officialClasslib\Extensions\ProcessMonitor; - -use Stripe_officialClasslib\Extensions\ProcessMonitor\Classes\ProcessMonitorObjectModel; -use Db; -use ObjectModel; -use Tools; - -class ProcessMonitorHandler -{ - /** - * @var ProcessMonitorObjectModel - */ - protected $process; - - /** - * @var float microtime - */ - public $startTime; - - /** - * @var string - */ - protected $date_upd; - - /** - * Lock process - * - * @param string $name - * - * @return bool|mixed - * - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException - */ - public function lock($name) - { - $this->startTime = $this->microtimeFloat(); - $processMonitorObjectModel = new ProcessMonitorObjectModel(); - $this->process = $processMonitorObjectModel->findOneByName($name); - if (empty($this->process->id)) { - $this->process = new ProcessMonitorObjectModel(); - $this->process->name = $name; - $this->process->data = Tools::jsonEncode([]); - $this->process->date_add = date('Y-m-d H:i:s'); - } - if (!empty($this->process->pid)) { - $last_update = new \DateTime($this->process->last_update); - $data_now = new \DateTime('NOW'); - $diff = $data_now->diff($last_update); - $hours = $diff->h; - $hours = $hours + ($diff->days * 24); - if ($hours < 1) { - return false; - } - } - - $this->process->last_update = date('Y-m-d H:i:s'); - $this->process->pid = getmypid(); - - $this->date_upd = date('Y-m-d H:i:s'); - - /** - * We can't use the ObjectModel's "save", "add" or "update" methods. - * PS will natively call ObjectModel hooks, using the class name of the - * ObjectModel. On PS 1.6, the namespace is not escaped from the class name, - * resulting in an invalid hook name, e.g. : - * actionObjectShoppingfeedClasslib\Extensions\ProcessMonitor\ProcessMonitorObjectModelUpdateBefore - */ - $definition = ObjectModel::getDefinition($this->process); - if (empty($this->process->id)) { - Db::getInstance()->insert( - $definition['table'], - $this->process->getFields(), - false - ); - $this->process->id = Db::getInstance()->Insert_ID(); - } else { - Db::getInstance()->update( - $definition['table'], - $this->process->getFields(), - '`' . pSQL($definition['primary']) . '` = ' . (int)$this->process->id, - 0, - false - ); - } - - return Tools::jsonDecode($this->process->data, true); - } - - /** - * UnLock process - * - * @param array $data - * - * @return bool - * - * @throws \PrestaShopException - */ - public function unlock($data = []) - { - if (empty($this->process)) { - return false; - } - - if (false === empty($data)) { - $this->process->data = Tools::jsonEncode($data); - } - $this->process->last_update = date('Y-m-d H:i:s'); - $endTime = $this->microtimeFloat(); - $duration = number_format(($endTime - $this->startTime), 3); - $this->process->duration = $duration; - $this->process->pid = null; - - /** - * We can't use the ObjectModel's "save", "add" or "update" methods. - * PS will natively call ObjectModel hooks, using the class name of the - * ObjectModel. On PS 1.6, the namespace is not escaped from the class name, - * resulting in an invalid hook name, e.g. : - * actionObjectShoppingfeedClasslib\Extensions\ProcessMonitor\ProcessMonitorObjectModelUpdateBefore - */ - $definition = ObjectModel::getDefinition($this->process); - - return Db::getInstance()->update( - $definition['table'], - $this->process->getFields(), - '`' . pSQL($definition['primary']) . '` = ' . (int)$this->process->id, - 0, - false - ); - } - - /** - * Get microtime in float value - * - * @return float - */ - public function microtimeFloat() - { - list($usec, $sec) = explode(' ', microtime()); - - return (float)$usec + (float)$sec; - } - - /** - * @return string|null - */ - public function getProcessObjectModelName() - { - if (empty($this->process)) { - return null; - } - - return get_class($this->process); - } - - /** - * @return int|null - */ - public function getProcessObjectModelId() - { - if (empty($this->process)) { - return null; - } - - return (int)$this->process->id; - } - - /** - * @return string|null - */ - public function getProcessName() - { - if (empty($this->process)) { - return null; - } - - return $this->process->name; - } -} diff --git a/vendor/totpsclasslib/src/Hook/AbstractHook.php b/vendor/totpsclasslib/src/Hook/AbstractHook.php deleted file mode 100644 index 92268db..0000000 --- a/vendor/totpsclasslib/src/Hook/AbstractHook.php +++ /dev/null @@ -1,76 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * - * @version develop - */ - -namespace Stripe_officialClasslib\Hook; - -use Stripe_officialClasslib\Extensions\AbstractModuleExtension; -use Stripe_officialClasslib\Module; -use Stripe_officialClasslib\Utils\Translate\TranslateTrait; - -abstract class AbstractHook -{ - use TranslateTrait; - - const AVAILABLE_HOOKS = []; - - /** - * @var Module - */ - protected $module; - - /** - * AbstractExtensionHook constructor. - * - * @param Module $module - */ - public function __construct($module) - { - $this->module = $module; - } - - /** - * Get all available hooks for current object - * - * @return array - */ - public function getAvailableHooks() - { - return static::AVAILABLE_HOOKS; - } - - /** - * Remove first 4 letters of hook function and replace the first letter by lower case - * TODO maybe we should delete this function, because it isn't used - * - * @param string $functionName - * - * @return string - */ - protected function getHookNameFromFunction($functionName) - { - return lcfirst(substr($functionName, 4, strlen($functionName))); - } -} diff --git a/vendor/totpsclasslib/src/Hook/AbstractHookDispatcher.php b/vendor/totpsclasslib/src/Hook/AbstractHookDispatcher.php deleted file mode 100644 index 75a97a1..0000000 --- a/vendor/totpsclasslib/src/Hook/AbstractHookDispatcher.php +++ /dev/null @@ -1,150 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * - * @version develop - */ - -namespace Stripe_officialClasslib\Hook; - -use Stripe_officialClasslib\Hook\AbstractHook; -use Stripe_officialClasslib\Module; - -abstract class AbstractHookDispatcher -{ - protected $hookClasses = []; - - protected $widgetClasses = []; - - private $defaultHooks = [ - 'actionStripe_officialCacheClean', - ]; - - /** - * List of available hooks - * - * @var string[] - */ - protected $availableHooks = []; - - /** - * Hook classes - */ - protected $hooks = []; - - protected $widgets = []; - - /** - * Module - * - * @var Module - */ - protected $module; - - /** - * Init hooks - * - * @param Module $module - */ - public function __construct($module) - { - $this->module = $module; - $this->availableHooks = array_merge($this->availableHooks, $this->defaultHooks); - - foreach ($this->hookClasses as $hookClass) { - /** @var AbstractHook $hook */ - $hook = new $hookClass($this->module); - $this->availableHooks = array_merge($this->availableHooks, $hook->getAvailableHooks()); - $this->hooks[] = $hook; - } - - foreach ($this->widgetClasses as $widgetClass) { - /** @var AbstractWidget $widgetClass */ - $widget = new $widgetClass($this->module); - $this->widgets[] = $widget; - } - } - - /** - * Get available hooks - * - * @return string[] - */ - public function getAvailableHooks() - { - return $this->availableHooks; - } - - /** - * Find hook or widget and dispatch it - * - * @param string $hookName - * @param array $params - * - * @return mixed|void - */ - public function dispatch($hookName, array $params = []) - { - $hookName = preg_replace('~^hook~', '', $hookName); - $hookName = lcfirst($hookName); - - if (!empty($hookName)) { - foreach ($this->hooks as $hook) { - if (is_callable([$hook, $hookName])) { - return call_user_func([$hook, $hookName], $params); - } - } - } - - foreach ($this->widgets as $widget) { - if (!isset($params['action'])) { - continue; - } - - if (is_callable([$widget, $params['action']])) { - return call_user_func([$widget, $params['action']], $hookName, $params); - } - } - - return null; - } - - /** - * Get hook classes - * - * @return array - */ - public function getHookClasses() - { - return $this->hookClasses; - } - - /** - * Get widget classes - * - * @return array - */ - public function getWidgetClasses() - { - return $this->widgetClasses; - } -} diff --git a/vendor/totpsclasslib/src/Install/AbstractInstaller.php b/vendor/totpsclasslib/src/Install/AbstractInstaller.php index 30cbc42..a2246ab 100644 --- a/vendor/totpsclasslib/src/Install/AbstractInstaller.php +++ b/vendor/totpsclasslib/src/Install/AbstractInstaller.php @@ -1,46 +1,22 @@ - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * - * @version develop - */ namespace Stripe_officialClasslib\Install; -use Stripe_officialClasslib\Database\ForeignKey\ForeignKeyHandler; -use Stripe_officialClasslib\Database\ObjectModelExtension; -use Stripe_officialClasslib\Module; -use Stripe_officialClasslib\Registry; -use Db; -use DbQuery; -use Language; -use Tab; + +use \Configuration; +use \Db; +use \DbQuery; +use \Language; +use \Tab; +use \Tools; +use Stripe_officialClasslib\Db\ObjectModelExtension; abstract class AbstractInstaller { //region Fields /** - * @var Module + * @var \Stripe_official */ protected $module; @@ -68,28 +44,24 @@ public function __construct($module) /** * Get hooks used in module/extension - * * @return array */ abstract public function getHooks(); /** * Get admin controllers used in module/extension - * * @return array */ abstract public function getAdminControllers(); /** * Get object models used in module/extension - * * @return array */ abstract public function getObjectModels(); /** - * @param Module $module - * + * @param \Stripe_official $module * @return $this */ public function setModule($module) @@ -101,7 +73,6 @@ public function setModule($module) /** * @return bool - * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -116,7 +87,6 @@ public function install() /** * @return bool - * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -129,14 +99,11 @@ public function uninstall() } //TODO - /** * Used only if merchant choose to keep data on modal in Prestashop 1.6 * - * @param Module $module - * + * @param Stripe_official $module * @return bool - * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -153,7 +120,6 @@ public function reset($module) /** * Register hooks used by our module - * * @return bool */ public function registerHooks() @@ -162,16 +128,14 @@ public function registerHooks() return true; } - return array_product(array_map([$this->module, 'registerHook'], $this->getHooks())); + return array_product(array_map(array($this->module, 'registerHook'), $this->getHooks())); } //TODO - /** * Clear hooks used by our module * * @return bool - * * @throws \PrestaShopException */ public function clearHookUsed() @@ -186,7 +150,7 @@ public function clearHookUsed() if (false === is_array($this->getHooks())) { // If $module->hooks is not defined or is not an array - $this->hooks = []; + $this->hooks = array(); } foreach ($this->getHooks() as $hook) { @@ -211,7 +175,6 @@ public function clearHookUsed() * Retrieve hooks used by our module * * @return array - * * @throws \PrestaShopDatabaseException */ public function getHooksUsed() @@ -226,7 +189,7 @@ public function getHooksUsed() $results = Db::getInstance()->executeS($query); if (empty($results)) { - return []; + return array(); } return array_column($results, 'name'); @@ -236,7 +199,6 @@ public function getHooksUsed() * Add Tabs for our ModuleAdminController * * @return bool - * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -249,16 +211,8 @@ public function installAdminControllers() return $result; } - Tab::disableCache(); - (new Tab())->cleanPositions(0); // fix parent tab positions - foreach ($this->getAdminControllers() as $tabData) { - if ($tabId = Tab::getIdFromClassName($tabData['class_name'])) { - $tabObj = new Tab($tabId); - if (isset($tabData['position'])) { - $tabObj->updatePosition('- 1', $tabData['position']); - $tabObj->cleanPositions($tabObj->id_parent); - } + if (Tab::getIdFromClassName($tabData['class_name'])) { $result &= true; continue; } @@ -268,7 +222,7 @@ public function installAdminControllers() $parentClassName = 'AdminPreferences'; } /** 3 levels available on 1.7+ */ - $defaultTabLevel1 = ['SELL', 'IMPROVE', 'CONFIGURE', 'DEFAULT']; + $defaultTabLevel1 = array('SELL', 'IMPROVE', 'CONFIGURE', 'DEFAULT'); if (in_array($parentClassName, $defaultTabLevel1) && version_compare(_PS_VERSION_, '1.7', '<')) { continue; } @@ -303,10 +257,6 @@ public function installAdminControllers() $tab->icon = $tabData['icon']; // For Prestashop 1.7 } $result &= (bool)$tab->add(); - if (isset($tabData['position'])) { - $tab->updatePosition('- 1', $tabData['position']); - $tab->cleanPositions($tab->id_parent); - } } return $result; @@ -316,7 +266,6 @@ public function installAdminControllers() * Delete Tabs of our ModuleAdminController * * @return bool - * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -325,7 +274,7 @@ public function uninstallModuleAdminControllers() $query = new DbQuery(); $query->select('*'); $query->from('tab'); - $query->where('module = \'' . pSQL($this->module->name) . '\''); + $query->where('module = \''.pSQL($this->module->name).'\''); $tabs = Db::getInstance()->executeS($query); @@ -338,7 +287,6 @@ public function uninstallModuleAdminControllers() $tab = new Tab((int)$tabData['id_tab']); $result &= (bool)$tab->delete(); } - return $result; } @@ -353,30 +301,14 @@ public function installObjectModels() return true; } - $installResult = array_product(array_map([$this, 'installObjectModel'], $this->getObjectModels())); - - $installResult &= $this->setCheckForeignKey(false); - - if (!empty(Registry::get('tables'))) { - $tables = Registry::get('tables'); - foreach ($tables as $tableDefinition) { - $foreignKeyHandler = new ForeignKeyHandler($tableDefinition); - $installResult &= $foreignKeyHandler->handle(); - } - } - - $installResult &= $this->setCheckForeignKey(true); - - return $installResult; + return array_product(array_map(array($this, 'installObjectModel'), $this->getObjectModels())); } /** * Install model * * @param string $objectModelClassName - * * @return bool - * * @throws \Exception */ public function installObjectModel($objectModelClassName) @@ -385,7 +317,13 @@ public function installObjectModel($objectModelClassName) throw new \Exception('Installer error : ModelObject "' . $objectModelClassName . '" not found'); } - $objectModelExtended = new ObjectModelExtension($objectModelClassName); + /** @var \ObjectModel $objectModel */ + $objectModel = new $objectModelClassName(); + + $objectModelExtended = new ObjectModelExtension( + $objectModel, + Db::getInstance() + ); return $objectModelExtended->install(); } @@ -401,18 +339,14 @@ public function uninstallObjectModels() return true; } - return $this->setCheckForeignKey(false) - && array_product(array_map([$this, 'uninstallObjectModel'], $this->getObjectModels())) - && $this->setCheckForeignKey(true); + return array_product(array_map(array($this, 'uninstallObjectModel'), $this->getObjectModels())); } /** * Uninstall model * * @param string $objectModelClassName - * * @return bool - * * @throws \Exception */ public function uninstallObjectModel($objectModelClassName) @@ -421,13 +355,14 @@ public function uninstallObjectModel($objectModelClassName) throw new \Exception('Installer error : ModelObject "' . $objectModelClassName . '" not found'); } - $objectModelExtended = new ObjectModelExtension($objectModelClassName); + /** @var \ObjectModel $objectModel */ + $objectModel = new $objectModelClassName(); - return $objectModelExtended->uninstall(); - } + $objectModelExtended = new ObjectModelExtension( + $objectModel, + Db::getInstance() + ); - private function setCheckForeignKey(bool $check) - { - return Db::getInstance()->Execute('SET FOREIGN_KEY_CHECKS = ' . (int)$check); + return $objectModelExtended->uninstall(); } } diff --git a/vendor/totpsclasslib/src/Install/ExtensionInstaller.php b/vendor/totpsclasslib/src/Install/ExtensionInstaller.php index 32eefee..c161b05 100644 --- a/vendor/totpsclasslib/src/Install/ExtensionInstaller.php +++ b/vendor/totpsclasslib/src/Install/ExtensionInstaller.php @@ -1,40 +1,18 @@ - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * - * @version develop - */ namespace Stripe_officialClasslib\Install; -use Stripe_officialClasslib\Database\ObjectModelExtension; + +use \Module; +use \Db; +use \DbQuery; +use \PrestaShopDatabaseException; +use \PrestaShopException; +use \Tab; +use \Language; +use Stripe_officialClasslib\Db\ObjectModelExtension; use Stripe_officialClasslib\Extensions\AbstractModuleExtension; -use Db; -use DbQuery; -use Language; -use Module; -use PrestaShopDatabaseException; -use PrestaShopException; -use Tab; + class ExtensionInstaller extends AbstractInstaller { @@ -53,21 +31,11 @@ public function __construct($module, $extension = null) $this->extension = $extension; } - public function install() - { - return parent::install() && $this->extension->install(); - } - - public function uninstall() - { - return parent::uninstall() && $this->extension->uninstall(); - } //region Get-Set /** * @return array - * * @throws PrestaShopException */ public function getHooks() @@ -81,7 +49,6 @@ public function getHooks() /** * @return array - * * @throws PrestaShopException */ public function getAdminControllers() @@ -90,12 +57,11 @@ public function getAdminControllers() throw new PrestaShopException('Extension is null, can\'t get extension\'s admin controllers'); } - return $this->extension->getExtensionAdminControllers(); + return $this->extension->extensionAdminControllers; } /** * @return array - * * @throws PrestaShopException */ public function getObjectModels() @@ -117,7 +83,6 @@ public function getExtension() /** * @param AbstractModuleExtension $extension - * * @return ExtensionInstaller */ public function setExtension($extension) @@ -128,4 +93,4 @@ public function setExtension($extension) } //endregion -} +} \ No newline at end of file diff --git a/vendor/totpsclasslib/src/Install/ModuleInstaller.php b/vendor/totpsclasslib/src/Install/ModuleInstaller.php index f7c6421..9512823 100644 --- a/vendor/totpsclasslib/src/Install/ModuleInstaller.php +++ b/vendor/totpsclasslib/src/Install/ModuleInstaller.php @@ -1,45 +1,20 @@ - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * - * @version develop - */ namespace Stripe_officialClasslib\Install; +use \Configuration; +use \Db; +use \DbQuery; +use \Language; +use \OrderState; +use \Tools; use Stripe_officialClasslib\Install\AbstractInstaller; use Stripe_officialClasslib\Install\ExtensionInstaller; -use Configuration; -use Db; -use DbQuery; -use Language; -use OrderState; -use Tools; class ModuleInstaller extends AbstractInstaller { /** * @return bool - * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -54,7 +29,6 @@ public function install() /** * @return bool - * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -70,7 +44,6 @@ public function uninstall() /** * @return bool - * * @throws \Exception */ public function checkPhpVersion() @@ -82,7 +55,11 @@ public function checkPhpVersion() $phpVersion = Tools::checkPhpVersion(); if (Tools::version_compare($phpVersion, $this->module->php_version_required, '<')) { - throw new \Exception(sprintf('[%s] This module requires at least PHP %s or newer versions.', $this->module->name, $this->module->php_version_required)); + throw new \Exception(sprintf( + '[%s] This module requires at least PHP %s or newer versions.', + $this->module->name, + $this->module->php_version_required + )); } return true; @@ -92,7 +69,6 @@ public function checkPhpVersion() * Uninstall Configuration (with or without language management) * * @return bool - * * @throws \PrestaShopDatabaseException */ public function uninstallConfiguration() @@ -122,7 +98,6 @@ public function uninstallConfiguration() * Register Order State : create new order state for this module * * @return bool - * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -161,7 +136,6 @@ public function registerOrderStates() * Unregister Order State : mark them as deleted * * @return bool - * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -209,14 +183,12 @@ public function installExtensions() return true; } - return array_product(array_map([$this, 'installExtension'], $this->module->extensions)); + return array_product(array_map(array($this, 'installExtension'), $this->module->extensions)); } /** - * @param string $extensionName - * + * @param $extensionName * @return bool - * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -234,14 +206,12 @@ public function uninstallExtensions() return true; } - return array_product(array_map([$this, 'uninstallExtension'], $this->module->extensions)); + return array_product(array_map(array($this, 'uninstallExtension'), $this->module->extensions)); } /** - * @param string $extensionName - * + * @param $extensionName * @return bool - * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ @@ -273,4 +243,4 @@ public function getObjectModels() } //endregion -} +} \ No newline at end of file diff --git a/vendor/totpsclasslib/src/Module.php b/vendor/totpsclasslib/src/Module.php deleted file mode 100644 index ab3c07a..0000000 --- a/vendor/totpsclasslib/src/Module.php +++ /dev/null @@ -1,311 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * - * @version develop - */ - -namespace Stripe_officialClasslib; - -use Stripe_officialClasslib\Extensions\AbstractModuleExtension; -use Stripe_officialClasslib\Hook\AbstractHookDispatcher; -use Stripe_officialClasslib\Install\ModuleInstaller; -use PrestaShop\PrestaShop\Core\Module\WidgetInterface; -use ReflectionClass; -use Tools; - -class Module extends \Module -{ - //region Fields - - /** - * List of objectModel used in this Module - * - * @var array - */ - public $objectModels = []; - - /** - * List of hooks used in this Module - * - * @var array - */ - public $hooks = []; - - /** - * @var array - */ - public $extensions = []; - - /** - * @var AbstractHookDispatcher - */ - protected $hookDispatcher = null; - - /** - * List of AdminControllers used in this Module - * - * @var array - */ - public $moduleAdminControllers = []; - - /** - * @var string - */ - public $secure_key; - - /** - * @var array - */ - public $cronTasks = []; - - //endregion - - /** - * Module constructor. - */ - public function __construct() - { - parent::__construct(); - foreach ($this->extensions as $extensionName) { - /** @var AbstractModuleExtension $extension */ - $extension = new $extensionName(); - $extension->setModule($this); - $extension->initExtension(); - $this->hooks = array_merge($this->hooks, $extension->hooks); - } - } - - /** - * Install Module - * - * @return bool - * - * @throws \PrestaShopException - */ - public function install() - { - $installer = new ModuleInstaller($this); - - $isPhpVersionCompliant = false; - - try { - $isPhpVersionCompliant = $installer->checkPhpVersion(); - } catch (\Exception $e) { - $this->_errors[] = Tools::displayError($e->getMessage()); - } - - return $isPhpVersionCompliant && parent::install() && $installer->install(); - } - - /** - * Uninstall Module - * - * @return bool - * - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException - */ - public function uninstall() - { - $installer = new ModuleInstaller($this); - - return parent::uninstall() && $installer->uninstall(); - } - - /** - * @TODO Reset Module only if merchant choose to keep data on modal - * - * @return bool - * - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException - */ - public function reset() - { - $installer = new ModuleInstaller($this); - - return $installer->reset($this); - } - - /** - * Handle module extension hook call - * - * @param string $hookName - * @param array $params - * - * @return array|bool|string - */ - public function handleExtensionsHook($hookName, $params) - { - $result = false; - $hookDispatcher = $this->getHookDispatcher(); - - // execute module hooks - if ($hookDispatcher != null) { - $moduleHookResult = $hookDispatcher->dispatch($hookName, $params); - if ($moduleHookResult != null) { - $result = $moduleHookResult; - } - } - - //execute extension's hooks - if (!isset($this->extensions) || empty($this->extensions)) { - if (!$result) { - return false; - } - } - - foreach ($this->extensions as $extension) { - /** @var AbstractModuleExtension $extension */ - $extension = new $extension($this); - $hookResult = null; - if (is_callable([$extension, $hookName])) { - $hookResult = $extension->{$hookName}($params); - //TODO - } elseif (is_callable([$extension, 'getHookDispatcher']) && $extension->getHookDispatcher() != null) { - $hookResult = $extension->getHookDispatcher()->dispatch($hookName, $params); - } - if ($hookResult != null) { - if ($result === false) { - $result = $hookResult; - } elseif (is_array($hookResult) && $result !== false) { - $result = array_merge($result, $hookResult); - } else { - $result .= $hookResult; - } - } - } - - return $result; - } - - /** - * Handle module widget call - * - * @param string $action - * @param string $method - * @param string $hookName - * @param array $configuration - * - * @return bool - * - * @throws \ReflectionException - * - * @deprecated use render widget function - */ - public function handleWidget($action, $method, $hookName, $configuration) - { - if (!isset($this->extensions) || empty($this->extensions)) { - return false; - } - - foreach ($this->extensions as $extension) { - /** @var AbstractModuleExtension $extension */ - $extension = new $extension(); - if (!($extension instanceof WidgetInterface)) { - continue; - } - $extensionClass = (new ReflectionClass($extension))->getShortName(); - if ($extensionClass != $action) { - continue; - } - $extension->setModule($this); - if (is_callable([$extension, $method])) { - return $extension->{$method}($hookName, $configuration); - } - } - - return false; - } - - /** - * @param string $hookName - * @param array $configuration - * - * @return bool - * - * @throws \ReflectionException - */ - public function renderWidget($hookName, array $configuration) - { - $hookDispatcher = $this->getHookDispatcher(); - // render module widgets - if ($hookDispatcher != null) { - $moduleWidgetResult = $hookDispatcher->dispatch($hookName, $configuration); - if ($moduleWidgetResult != null) { - return $moduleWidgetResult; - } - } - - // render extensions widget if module widget isn't found - if (!isset($this->extensions) || empty($this->extensions)) { - return false; - } - - foreach ($this->extensions as $extension) { - /** @var AbstractModuleExtension $extension */ - $extension = new $extension($this); - - if (is_callable([$extension, 'getHookDispatcher']) && $extension->getHookDispatcher() != null) { - $extensionWidgetResult = $extension->getHookDispatcher()->dispatch($hookName, $configuration); - if (is_null($extensionWidgetResult)) { - continue; - } - - return $extensionWidgetResult; - } - } - - //if we want to use an old approach - return $this->handleWidget($configuration['action'], __FUNCTION__, $hookName, $configuration); - } - - /** - * @param string $hookName - * @param array $configuration - * - * @return array|bool - */ - public function getWidgetVariables($hookName, array $configuration) - { - return []; - } - - /** - * Get the current module hook/widget dispatcher - * - * @return AbstractHookDispatcher|null - */ - public function getHookDispatcher() - { - return $this->hookDispatcher; - } - - /** - * @return string|null - */ - public function getPath() - { - return $this->_path; - } -} diff --git a/vendor/totpsclasslib/src/Registry.php b/vendor/totpsclasslib/src/Registry.php index 390cc6d..73b94f7 100644 --- a/vendor/totpsclasslib/src/Registry.php +++ b/vendor/totpsclasslib/src/Registry.php @@ -20,8 +20,7 @@ * @author 202-ecommerce * @copyright Copyright (c) 202-ecommerce * @license Commercial license - * - * @version develop + * @version release/2.1.1 */ namespace Stripe_officialClasslib; @@ -31,36 +30,35 @@ */ class Registry { + /** - * @var Registry Instance of this class + * @var Stripe_officialClasslib\Registry $_registry Instance of this class */ private static $_registry = null; /** - * @var array + * @var array $values */ - private $values = []; - + private $values = array(); + /** * Get instance of this class * - * @return Registry + * @return Stripe_officialClasslib\Registry */ public static function getInstance() { if (self::$_registry === null) { - self::$_registry = new Registry(); + self::$_registry = new Registry; } - return self::$_registry; } - + /** * Get a variable in the Registry * * @param string $index - * - * @return mixed + * @return bool */ public static function get($index) { @@ -68,27 +66,25 @@ public static function get($index) if (!$instance->offsetExists($index)) { return false; } - return $instance->values[$index]; } - + /** * Set a variable in the Registry * * @param string $index - * @param string|array $value + * @param string $value */ public static function set($index, $value) { $instance = self::getInstance(); - $instance->values[$index] = $value; + $instance->values[$index]= $value; } /** * Check if var exist in the registry * * @param string $index - * * @return bool */ public static function isRegistered($index) @@ -96,7 +92,6 @@ public static function isRegistered($index) if (self::$_registry === null) { return false; } - return self::$_registry->offsetExists($index); } @@ -104,7 +99,6 @@ public static function isRegistered($index) * Check if offsetExists * * @param string $index - * * @return bool */ public function offsetExists($index) @@ -112,10 +106,9 @@ public function offsetExists($index) if (false === isset($this->values)) { return false; } - return array_key_exists($index, $this->values); } - + /** * Increment a counter in the Registry * @@ -131,7 +124,7 @@ public static function increment($index, $value = 1) $instance->values[$index] = $value; } } - + /** * Decrement a counter in the Registry * diff --git a/vendor/totpsclasslib/src/Utils/Translate/TranslateTrait.php b/vendor/totpsclasslib/src/Utils/Translate/TranslateTrait.php deleted file mode 100644 index fb79e90..0000000 --- a/vendor/totpsclasslib/src/Utils/Translate/TranslateTrait.php +++ /dev/null @@ -1,66 +0,0 @@ - - * ........................................................................... - * - * @author 202-ecommerce - * @copyright Copyright (c) 202-ecommerce - * @license Commercial license - * - * @version develop - */ - -namespace Stripe_officialClasslib\Utils\Translate; - -use Translate; - -trait TranslateTrait -{ - /** - * Translation method for classes that use this trait - * - * @param string $textToTranslate - * @param string $class - * @param bool $addslashes - * @param bool $htmlentities - * - * @return mixed - */ - protected function l($textToTranslate, $class = '', $addslashes = false, $htmlentities = true) - { - if (empty($class) === true) { - $class = $this->getClassShortName(); - } - - return Translate::getModuleTranslation('stripe_official', $textToTranslate, $class); - } - - /** - * @return string - * - * @throws \ReflectionException - */ - protected function getClassShortName() - { - return (new \ReflectionClass($this))->getShortName(); - } - - protected function trans($id, array $parameters = [], $domain = null, $locale = null) - { - return \Context::getContext()->getTranslator()->trans($id, $parameters, $domain, $locale); - } -} From 18285776da3f8a58284fa92396a23bd22d8f2997 Mon Sep 17 00:00:00 2001 From: Yves Huynh Date: Wed, 10 Nov 2021 16:31:14 +0100 Subject: [PATCH 43/62] feature #32038 - update .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5d838a2..6a3fa31 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -/vendor +/vendor/* !/vendor/totpsclasslib /node_modules /views/css From eb6aa5712b809ee3dae3257fa98423e8816dc0a4 Mon Sep 17 00:00:00 2001 From: Yves Huynh Date: Wed, 10 Nov 2021 16:31:39 +0100 Subject: [PATCH 44/62] bugfix #32038 - fix admin ProcessLogger --- controllers/admin/AdminStripe_officialProcessLogger.php | 1 + 1 file changed, 1 insertion(+) diff --git a/controllers/admin/AdminStripe_officialProcessLogger.php b/controllers/admin/AdminStripe_officialProcessLogger.php index bdea932..1cd1b2f 100644 --- a/controllers/admin/AdminStripe_officialProcessLogger.php +++ b/controllers/admin/AdminStripe_officialProcessLogger.php @@ -23,6 +23,7 @@ * * @version develop */ +require_once dirname(__FILE__) . '/../../vendor/autoload.php'; use Stripe_officialClasslib\Extensions\ProcessLogger\Controllers\Admin\AdminProcessLoggerController; From 2a5a029909258b80b95e934cc4f93c733f016b3e Mon Sep 17 00:00:00 2001 From: Yves Huynh Date: Fri, 12 Nov 2021 19:57:45 +0100 Subject: [PATCH 45/62] bugfix #31940 - fix class to process to save configuration --- stripe_official.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stripe_official.php b/stripe_official.php index 820370b..adb0305 100755 --- a/stripe_official.php +++ b/stripe_official.php @@ -828,7 +828,7 @@ public function getContent() 'registerWebhookSignature' ); - $handler->process('ConfigurationActions'); + $handler->process('Configuration'); } $shopGroupId = Stripe_official::getShopGroupIdContext(); From 60ff97434b4f070c7ff6a9d00a8ae7b64fa88e55 Mon Sep 17 00:00:00 2001 From: Yves Huynh Date: Fri, 12 Nov 2021 20:13:10 +0100 Subject: [PATCH 46/62] bugfix #31940 - fix class to process to validate order --- controllers/front/orderSuccess.php | 2 +- controllers/front/validation.php | 2 +- controllers/front/webhook.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/front/orderSuccess.php b/controllers/front/orderSuccess.php index 5e7ee5f..6928e64 100644 --- a/controllers/front/orderSuccess.php +++ b/controllers/front/orderSuccess.php @@ -109,7 +109,7 @@ public function initContent() ); } - if (!$handler->process('ValidationOrderActions')) { + if (!$handler->process('ValidationOrder')) { // Handle error ProcessLoggerHandler::logError( 'Order creation process disrupted.', diff --git a/controllers/front/validation.php b/controllers/front/validation.php index 1c4b691..d541499 100644 --- a/controllers/front/validation.php +++ b/controllers/front/validation.php @@ -90,7 +90,7 @@ public function initContent() } // Process actions chain - if ($handler->process('ValidationOrderActions')) { + if ($handler->process('ValidationOrder')) { // Retrieve and use resulting data $returnValues = $handler->getConveyor(); } else { diff --git a/controllers/front/webhook.php b/controllers/front/webhook.php index b9f658b..4cc29c1 100755 --- a/controllers/front/webhook.php +++ b/controllers/front/webhook.php @@ -524,7 +524,7 @@ private function handleWebhookActions($handler, $event) } // Process actions chain - if (!$handler->process('ValidationOrderActions')) { + if (!$handler->process('ValidationOrder')) { // Handle error ProcessLoggerHandler::logError( 'Webhook actions process failed.', From 1d621d0f373138a7af9dd3ade916059a02da9a85 Mon Sep 17 00:00:00 2001 From: Yves Huynh Date: Fri, 12 Nov 2021 20:16:51 +0100 Subject: [PATCH 47/62] bugfix #31940 - fix namespace ProcessLogger --- .../src/Extensions/ProcessLogger/ProcessLoggerHandler.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerHandler.php b/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerHandler.php index 74aca04..69b62d5 100644 --- a/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerHandler.php +++ b/vendor/totpsclasslib/src/Extensions/ProcessLogger/ProcessLoggerHandler.php @@ -25,9 +25,10 @@ namespace Stripe_officialClasslib\Extensions\ProcessLogger; -use \Db; -use \Configuration; -use \Hook; +use Db; +use Configuration; +use Hook; +use Tools; class ProcessLoggerHandler { From 0231930d4d94a11870c6f873b210eb8c0c02e736 Mon Sep 17 00:00:00 2001 From: Yves Huynh Date: Mon, 15 Nov 2021 14:00:25 +0100 Subject: [PATCH 48/62] bugfix #32014 - fix paiyment method with giropay --- controllers/front/orderSuccess.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controllers/front/orderSuccess.php b/controllers/front/orderSuccess.php index 6928e64..5f746fb 100644 --- a/controllers/front/orderSuccess.php +++ b/controllers/front/orderSuccess.php @@ -76,7 +76,8 @@ public function initContent() if ($payment_method == 'card' || $payment_method == 'sepa_debit' - || $payment_method == 'oxxo') { + || $payment_method == 'oxxo' + || $payment_method == 'giropay') { ProcessLoggerHandler::logInfo( 'Payment method flow without redirection', null, From d723f8de83c582c20f031ded9660441be94e3ae0 Mon Sep 17 00:00:00 2001 From: Yves Huynh Date: Mon, 15 Nov 2021 16:14:26 +0100 Subject: [PATCH 49/62] bugfix #32014 - fix paiyment method with giropay --- controllers/front/orderSuccess.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/front/orderSuccess.php b/controllers/front/orderSuccess.php index 5f746fb..a7c8e5a 100644 --- a/controllers/front/orderSuccess.php +++ b/controllers/front/orderSuccess.php @@ -76,8 +76,7 @@ public function initContent() if ($payment_method == 'card' || $payment_method == 'sepa_debit' - || $payment_method == 'oxxo' - || $payment_method == 'giropay') { + || $payment_method == 'oxxo') { ProcessLoggerHandler::logInfo( 'Payment method flow without redirection', null, @@ -93,7 +92,8 @@ public function initContent() 'addTentative' ); } elseif ($payment_method == 'sofort' - || $payment_method == 'fpx') { + || $payment_method == 'fpx' + || $payment_method == 'giropay') { ProcessLoggerHandler::logInfo( 'Payment method flow with redirection', null, From 9ea1897592be0ea8cfee571dc43c41d6bd234412 Mon Sep 17 00:00:00 2001 From: afayadas Date: Wed, 17 Nov 2021 14:36:43 +0100 Subject: [PATCH 50/62] refs #31511 : fixing duplicate orders and payment error while multishop webhooks are enable --- classes/StripeEvent.php | 1 - classes/actions/ValidationOrderActions.php | 12 +----------- .../admin/AdminStripe_officialPaymentIntent.php | 8 ++++++-- controllers/front/webhook.php | 15 +++++++++++++++ stripe_official.php | 7 ++++++- 5 files changed, 28 insertions(+), 15 deletions(-) diff --git a/classes/StripeEvent.php b/classes/StripeEvent.php index b13379e..f2c21c1 100755 --- a/classes/StripeEvent.php +++ b/classes/StripeEvent.php @@ -71,7 +71,6 @@ class StripeEvent extends ObjectModel 'type' => ObjectModel::TYPE_STRING, 'validate' => 'isString', 'size' => 30, - 'unique' => true, ), 'date_add' => array( 'type' => ObjectModel::TYPE_DATE, diff --git a/classes/actions/ValidationOrderActions.php b/classes/actions/ValidationOrderActions.php index 927e3a5..5b355e6 100755 --- a/classes/actions/ValidationOrderActions.php +++ b/classes/actions/ValidationOrderActions.php @@ -365,16 +365,6 @@ public function createOrder() $idOrder = Order::getOrderByCartId((int)$this->conveyor['id_cart']); $order = new Order($idOrder); - // Check if order is split - $splitOrder = Order::getByReference($order->reference); - if ($splitOrder->count() > 1) { - $total_paid_real = 0; - foreach ($splitOrder->getResults() as $result) { - $total_paid_real += $result->total_paid; - } - $order->total_paid = $total_paid_real; - } - // capture payment for card if no catch and authorize enabled $intent = \Stripe\PaymentIntent::retrieve($this->conveyor['paymentIntent']); ProcessLoggerHandler::logInfo( @@ -394,7 +384,7 @@ public function createOrder() $currency = new Currency($order->id_currency, $this->context->language->id, $this->context->shop->id); - $amount = $this->module->isZeroDecimalCurrency($currency->iso_code) ? $order->total_paid : $order->total_paid * 100; + $amount = $this->module->isZeroDecimalCurrency($currency->iso_code) ? $order->getTotalPaid() : $order->getTotalPaid() * 100; if (!$this->module->captureFunds($amount, $this->conveyor['paymentIntent'])) { ProcessLoggerHandler::closeLogger(); diff --git a/controllers/admin/AdminStripe_officialPaymentIntent.php b/controllers/admin/AdminStripe_officialPaymentIntent.php index c0d07ae..d28276f 100644 --- a/controllers/admin/AdminStripe_officialPaymentIntent.php +++ b/controllers/admin/AdminStripe_officialPaymentIntent.php @@ -34,16 +34,20 @@ public function __construct() { parent::__construct(); - $this->_select = 'sp.id_cart, sp.id_payment_intent, sp.type, spi.status, o.reference'; + $this->_select = 'o.id_order, sp.id_cart, sp.id_payment_intent, sp.type, spi.status, o.reference'; $this->_join = 'INNER JOIN `'._DB_PREFIX_.'stripe_payment` sp ON (a.id_payment_intent = sp.id_payment_intent AND sp.result > 0) INNER JOIN `'._DB_PREFIX_.'stripe_payment_intent` spi ON (sp.id_payment_intent = spi.id_payment_intent) INNER JOIN `'._DB_PREFIX_.'orders` o ON (sp.id_cart = o.id_cart)'; - $this->_group = 'GROUP BY id_payment_intent'; $this->explicitSelect = true; $this->fields_list = [ + 'id_order' => [ + 'title' => $this->module->l('Order ID', 'AdminStripe_officialPaymentIntentController'), + 'filter_key' => 'o!id_order', + 'orderby' => false, + ], 'id_cart' => [ 'title' => $this->module->l('Cart ID', 'AdminStripe_officialPaymentIntentController'), 'filter_key' => 'sp!id_cart', diff --git a/controllers/front/webhook.php b/controllers/front/webhook.php index 4cc29c1..2c692d9 100755 --- a/controllers/front/webhook.php +++ b/controllers/front/webhook.php @@ -132,6 +132,21 @@ public function postProcess() // Construct event charge $event = $this->constructEvent($input, $sig_header, $endpoint_secret); + // Check if shop is the good one + $cart = new Cart($event->data->object->metadata->id_cart); + if ($cart->id_shop_group != Stripe_official::getShopGroupIdContext() + || $cart->id_shop != Stripe_official::getShopIdContext()) { + ProcessLoggerHandler::logInfo( + $msg = 'This cart does not come from this shop', + 'Cart', + $cart->id, + 'ValidationOrderActions - createOrder' + ); + http_response_code(400); + echo $msg; + exit; + } + // Retrieve payment intent if ($event->type == 'payment_intent.requires_action') { $paymentIntent = $event->data->object->id; diff --git a/stripe_official.php b/stripe_official.php index adb0305..5d2be72 100755 --- a/stripe_official.php +++ b/stripe_official.php @@ -491,7 +491,12 @@ public function install() } $installer = new Stripe_officialClasslib\Install\ModuleInstaller($this); - $installer->install(); + + if ($installer->install() + && !Db::getInstance()->executeS("SHOW KEYS FROM `" . _DB_PREFIX_ . "stripe_event` WHERE Key_name = 'ix_id_payment_intentstatus'")) { + $sql = "ALTER TABLE `" . _DB_PREFIX_ . "stripe_event` ADD UNIQUE `ix_id_payment_intentstatus` (`id_payment_intent`, `status`);"; + Db::getInstance()->execute($sql); + } $shopGroupId = Stripe_official::getShopGroupIdContext(); $shopId = Stripe_official::getShopIdContext(); From 5d6cd7dc45a1676efbf2bb4b9291462c6d0c18fe Mon Sep 17 00:00:00 2001 From: afayadas Date: Wed, 17 Nov 2021 14:37:10 +0100 Subject: [PATCH 51/62] refs #30923 : fixing order state changing issue which is canceled when catch and authorize enabled --- classes/actions/ValidationOrderActions.php | 34 ++++++++++++++-------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/classes/actions/ValidationOrderActions.php b/classes/actions/ValidationOrderActions.php index 5b355e6..bf4b11e 100755 --- a/classes/actions/ValidationOrderActions.php +++ b/classes/actions/ValidationOrderActions.php @@ -803,28 +803,38 @@ public function chargeWebhook() $history->addWithemail(); } elseif ($event_type == 'charge.refunded') { - if ($this->conveyor['event_json']->data->object->amount_refunded !== $this->conveyor['event_json']->data->object->amount_captured - || $this->conveyor['event_json']->data->object->amount_refunded !== $this->conveyor['event_json']->data->object->amount) { - $order->setCurrentState(Configuration::get('PS_CHECKOUT_STATE_PARTIAL_REFUND')); + if ($order->getCurrentState() != Configuration::get('PS_OS_PAYMENT')) { + $order->setCurrentState(Configuration::get('PS_OS_CANCELED')); ProcessLoggerHandler::logInfo( - 'Partial refund of payment => '.$this->conveyor['event_json']->data->object->id, + 'Order canceled', null, null, 'ValidationOrderActions - chargeWebhook' ); } else { - $order->setCurrentState(Configuration::get('PS_OS_REFUND')); - ProcessLoggerHandler::logInfo( - 'Full refund of payment => '.$this->conveyor['event_json']->data->object->id, - null, - null, - 'ValidationOrderActions - chargeWebhook' - ); + if ($this->conveyor['event_json']->data->object->amount_refunded !== $this->conveyor['event_json']->data->object->amount_captured + || $this->conveyor['event_json']->data->object->amount_refunded !== $this->conveyor['event_json']->data->object->amount) { + $order->setCurrentState(Configuration::get('PS_CHECKOUT_STATE_PARTIAL_REFUND')); + ProcessLoggerHandler::logInfo( + 'Partial refund of payment => ' . $this->conveyor['event_json']->data->object->id, + null, + null, + 'ValidationOrderActions - chargeWebhook' + ); + } else { + $order->setCurrentState(Configuration::get('PS_OS_REFUND')); + ProcessLoggerHandler::logInfo( + 'Full refund of payment => ' . $this->conveyor['event_json']->data->object->id, + null, + null, + 'ValidationOrderActions - chargeWebhook' + ); + } } } ProcessLoggerHandler::logInfo( - 'setCurrentState for '.$event_type, + 'Set Order State to ' . $order->getCurrentOrderState()->name . 'for ' . $event_type, 'Order', $id_order, 'ValidationOrderActions - chargeWebhook' From dddea84815c7152cd5bb5fdff6f8446ee2e8a4ff Mon Sep 17 00:00:00 2001 From: afayadas Date: Thu, 18 Nov 2021 17:07:54 +0100 Subject: [PATCH 52/62] refs #32135 : fix default shop value and default shop group value returning by stripe method --- stripe_official.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/stripe_official.php b/stripe_official.php index 5d2be72..6bd0296 100755 --- a/stripe_official.php +++ b/stripe_official.php @@ -1274,11 +1274,10 @@ public function cleanModuleCache() */ public static function getShopIdContext() { - if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE')) { return Context::getContext()->shop->id; } - return null; + return Configuration::get('PS_SHOP_DEFAULT'); } /** @@ -1288,11 +1287,10 @@ public static function getShopIdContext() */ public static function getShopGroupIdContext() { - if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE')) { return Context::getContext()->shop->id_shop_group; } - return null; + return Configuration::get('PS_SHOP_DEFAULT'); } /** From 488a95a4a7d7e3f97931aead9e671be51a0a165b Mon Sep 17 00:00:00 2001 From: afayadas Date: Fri, 19 Nov 2021 18:03:00 +0100 Subject: [PATCH 53/62] refs #32135 : fix Ideal issue payment and other payment with redirection --- _dev/js/payments.js | 5 +- classes/StripeIdempotencyKey.php | 4 + controllers/front/createIntent.php | 307 +++++++++++++----- views/templates/front/payment_form_alipay.tpl | 3 + .../front/payment_form_bancontact.tpl | 3 + views/templates/front/payment_form_eps.tpl | 3 + views/templates/front/payment_form_fpx.tpl | 3 + .../templates/front/payment_form_giropay.tpl | 3 + views/templates/front/payment_form_ideal.tpl | 3 + views/templates/front/payment_form_p24.tpl | 3 + .../front/payment_form_sepa_debit.tpl | 3 + views/templates/front/payment_form_sofort.tpl | 3 + 12 files changed, 254 insertions(+), 89 deletions(-) diff --git a/_dev/js/payments.js b/_dev/js/payments.js index 37fe690..a5ff9a1 100644 --- a/_dev/js/payments.js +++ b/_dev/js/payments.js @@ -303,7 +303,7 @@ $(function(){ disableSubmit(disableText, stripe_message.processing); createPaymentIntent(payment, id_payment_method, false); - if (paymentIntentDatas.intent.status != 'succeeded') { + if (paymentIntentDatas && paymentIntentDatas.intent.status != 'succeeded') { if (payment === 'card') { if (typeof id_payment_method == 'undefined') { // card payment via stripe form @@ -542,7 +542,8 @@ $(function(){ saveCard = datas.saveCard; }, error: function(err) { - console.log(err.responseText); + paymentIntentDatas = false; + console.log(err.responseText); var error = { 'message': err.responseText } diff --git a/classes/StripeIdempotencyKey.php b/classes/StripeIdempotencyKey.php index c0c5776..b120123 100644 --- a/classes/StripeIdempotencyKey.php +++ b/classes/StripeIdempotencyKey.php @@ -121,6 +121,10 @@ public function getByIdPaymentIntent($id_payment_intent) return $this; } + /** + * @throws PrestaShopException + * @throws \Stripe\Exception\ApiErrorException + */ public function createNewOne($id_cart, $datasIntent) { $idempotency_key = $id_cart.'_'.uniqid(); diff --git a/controllers/front/createIntent.php b/controllers/front/createIntent.php index 605b7a8..5139211 100644 --- a/controllers/front/createIntent.php +++ b/controllers/front/createIntent.php @@ -34,46 +34,62 @@ public function initContent() { parent::initContent(); - try { - if ($this->context->cart->id == null) { - throw new Exception("cart ID is empty", 1); - } + ProcessLoggerHandler::logInfo( + '[ Intent Creation Beginning ]', + null, + null, + 'createIntent - intiContent' + ); - if (Tools::getValue('payment_option') == 'card') { - $capture_method = 'manual'; - } else { - $capture_method = 'automatic'; - } + $amount = Tools::ps_round(Tools::getValue('amount')); + $currency = Tools::getValue('currency'); + $paymentOption = Tools::getValue('payment_option'); + $paymentMethodId = Tools::getValue('id_payment_method'); + + $intentData = $this->constructIntentData($amount, $currency, $paymentOption, $paymentMethodId); + + $cardData = $this->constructCardData($paymentMethodId); + + $intent = $this->createIdempotencyKey($intentData); + + $this->registerStripeEvent($intent); + + ProcessLoggerHandler::logInfo( + '[ Intent Creation Ending ]', + null, + null, + 'createIntent - intiContent' + ); + ProcessLoggerHandler::closeLogger(); + + echo Tools::jsonEncode(array( + 'intent' => $intent, + 'cardPayment' => $cardData['cardPayment'], + 'saveCard' => $cardData['save_card'] + )); + exit; + } + + private function constructIntentData($amount, $currency, $paymentOption, $paymentMethodId) + { + try { + $captureMethod = ($paymentOption == 'card') ? 'manual' : 'automatic'; + $customerFullName = $this->getCustomerFullNameContext(); - $amount = Tools::ps_round(Tools::getValue('amount')); + $shippingAddress = new Address($this->context->cart->id_address_delivery); + $shippingAddressState = new State($shippingAddress->id_state); - $datasIntent = array( + $intentData = array( "amount" => $amount, - "currency" => Tools::getValue('currency'), - "payment_method_types" => array(Tools::getValue('payment_option')), - "capture_method" => $capture_method, - "metadata" => array( + "currency" => $currency, + "payment_method_types" => [$paymentOption], + "capture_method" => $captureMethod, + "metadata" => [ 'id_cart' => $this->context->cart->id - ), + ], "description" => 'Product Purchase', - ); - - if (!Tools::getValue('id_payment_method')) { - if (version_compare(_PS_VERSION_, '1.7', '>=')) { - $firstname = str_replace('"', '\\"', $this->context->customer->firstname); - $lastname = str_replace('"', '\\"', $this->context->customer->lastname); - $stripe_fullname = $firstname . ' ' . $lastname; - } else { - $firstname = str_replace('\'', '\\\'', $this->context->customer->firstname); - $lastname = str_replace('\'', '\\\'', $this->context->customer->lastname); - $stripe_fullname = $firstname . ' ' . $lastname; - } - - $shippingAddress = new Address($this->context->cart->id_address_delivery); - $shippingAddressState = new State($shippingAddress->id_state); - - $datasIntent['shipping'] = [ - 'name' => $stripe_fullname, + 'shipping' => [ + 'name' => $customerFullName, 'address' => [ 'line1' => $shippingAddress->address1, 'postal_code' => $shippingAddress->postcode, @@ -81,90 +97,207 @@ public function initContent() 'state' => $shippingAddressState->iso_code, 'country' => Country::getIsoById($shippingAddress->id_country), ], - ]; - - $address = new Address($this->context->cart->id_address_invoice); - - $payment_method = array( - 'billing_details' => array( - 'address' => array( - 'city' => $address->city, - 'country' => Country::getIsoById($address->id_country), - 'line1' => $address->address1, - 'line2' => $address->address2, - 'postal_code' => $address->postcode - ), - 'email' => $this->context->customer->email, - 'name' => $stripe_fullname - ) - ); - } else { - $payment_method = Tools::getValue('id_payment_method'); + ], + ); + + if ($paymentMethodId) { $stripeAccount = \Stripe\Account::retrieve(); $stripeCustomer = new StripeCustomer(); $customer = $stripeCustomer->getCustomerById($this->context->customer->id, $stripeAccount->id); - $datasIntent['customer'] = $customer->stripe_customer_key; + $intentData['customer'] = $customer->stripe_customer_key; } - $cardPayment = array( - 'payment_method' => $payment_method, + ProcessLoggerHandler::logInfo( + 'Intent Data => '.Tools::jsonEncode($intentData), + null, + null, + 'createIntent - constructIntentData' + ); + + return $intentData; + } catch (\Stripe\Exception\ApiErrorException $e) { + ProcessLoggerHandler::logError( + "Retrieve Stripe Account Error => ".$e->getMessage(), + null, + null, + 'createIntent' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(400); + die('An unexpected problem has occurred. Please contact the support : https://addons.prestashop.com/en/contact-us?id_product=24922'); + } catch (PrestaShopDatabaseException $e) { + ProcessLoggerHandler::logError( + "Retrieve Prestashop State Error => ".$e->getMessage(), + null, + null, + 'createIntent' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(400); + die('An unexpected problem has occurred. Please contact the support : https://addons.prestashop.com/en/contact-us?id_product=24922'); + } catch (PrestaShopException $e) { + ProcessLoggerHandler::logError( + "Retrieve Prestashop State Error => ".$e->getMessage(), + null, + null, + 'createIntent' ); - $saveCard = false; - - if (((Tools::getValue('card_form_payment') == 'true' && Tools::getValue('save_card_form') == 'true') - || (Tools::getValue('card_form_payment') == 'true' && Tools::getValue('stripe_auto_save_card') == 'true') - && (!Tools::getValue('id_payment_method') || Tools::getValue('payment_request') == 'true') - && Tools::getValue('payment_option') == 'card')) { - $cardPayment['setup_future_usage'] = 'on_session'; - $saveCard = true; - } elseif (Tools::getValue('payment_option') != 'card') { - $stripe_validation_return_url = $this->context->link->getModuleLink( - 'stripe_official', - 'orderConfirmationReturn', - array( - 'id_cart' => $this->context->cart->id + ProcessLoggerHandler::closeLogger(); + http_response_code(400); + die('An unexpected problem has occurred. Please contact the support : https://addons.prestashop.com/en/contact-us?id_product=24922'); + } + } + + private function constructCardData($paymentMethodId) + { + if (!$paymentMethodId) { + $address = new Address($this->context->cart->id_address_invoice); + + $payment_method = array( + 'billing_details' => array( + 'address' => array( + 'city' => $address->city, + 'country' => Country::getIsoById($address->id_country), + 'line1' => $address->address1, + 'line2' => $address->address2, + 'postal_code' => $address->postcode ), - true - ); - $cardPayment['return_url'] = $stripe_validation_return_url; - } + 'email' => $this->context->customer->email, + 'name' => $this->getCustomerFullNameContext() + ) + ); + } else { + $payment_method = $paymentMethodId; + } + + $cardData['cardPayment']['payment_method'] = $payment_method; + $cardData['save_card'] = false; + + if (((Tools::getValue('card_form_payment') == 'true' && Tools::getValue('save_card_form') == 'true') + || (Tools::getValue('card_form_payment') == 'true' && Tools::getValue('stripe_auto_save_card') == 'true') + && (!Tools::getValue('id_payment_method') || Tools::getValue('payment_request') == 'true') + && Tools::getValue('payment_option') == 'card')) { + $cardData['cardPayment']['setup_future_usage'] = 'on_session'; + $cardData['save_card'] = true; + } elseif (Tools::getValue('payment_option') != 'card') { + $stripe_validation_return_url = $this->context->link->getModuleLink( + 'stripe_official', + 'orderConfirmationReturn', + array( + 'id_cart' => $this->context->cart->id + ), + true + ); + $cardData['cardPayment']['return_url'] = $stripe_validation_return_url; + } + + ProcessLoggerHandler::logInfo( + 'Card Payment => '.Tools::jsonEncode($cardData), + null, + null, + 'createIntent - constructCardPaymentData' + ); + + return $cardData; + } + private function createIdempotencyKey($intentData) + { + try { $stripeIdempotencyKey = new StripeIdempotencyKey(); - $intent = $stripeIdempotencyKey->createNewOne($this->context->cart->id, $datasIntent); + $intent = $stripeIdempotencyKey->createNewOne($this->context->cart->id, $intentData); + + ProcessLoggerHandler::logInfo( + 'Intent => '.$intent, + null, + null, + 'createIntent - initContent' + ); + return $intent; + } catch (\Stripe\Exception\ApiErrorException $e) { + ProcessLoggerHandler::logError( + "Create Stripe Intent Error => ".$e->getMessage(), + null, + null, + 'createIntent' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(400); + die($e->getMessage()); + } catch (PrestaShopException $e) { + ProcessLoggerHandler::logError( + "Save Stripe Idempotency Key Error => ".$e->getMessage(), + null, + null, + 'createIntent' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(400); + die('An unexpected problem has occurred. Please contact the support : https://addons.prestashop.com/en/contact-us?id_product=24922'); + } catch (PrestaShopException $e) { + ProcessLoggerHandler::logError( + "Save Stripe Payment Intent Error => ".$e->getMessage(), + null, + null, + 'createIntent' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(400); + die('An unexpected problem has occurred. Please contact the support : https://addons.prestashop.com/en/contact-us?id_product=24922'); + } + } + + private function registerStripeEvent($intent) + { + try { $stripeEvent = new StripeEvent(); $stripeEvent->setIdPaymentIntent($intent->id); $stripeEvent->setStatus(StripeEvent::CREATED_STATUS); $stripeEvent->setDateAdd($intent->created); $stripeEvent->setIsProcessed(1); - if (!$stripeEvent->save()) { + + if ($stripeEvent->save()) { + ProcessLoggerHandler::logInfo( + 'Register created Stripe event status for payment intent '.$intent->id, + 'StripeEvent', + $stripeEvent->id, + 'createIntent - registerStripeEvent' + ); + } else { ProcessLoggerHandler::logInfo( 'An issue appears during saving Stripe module event in database (the event probably already exists).', null, null, - 'webhook - registerEvent' + 'createIntent - registerStripeEvent' ); ProcessLoggerHandler::closeLogger(); http_response_code(400); die('An unexpected problem has occurred. Please contact the support : https://addons.prestashop.com/en/contact-us?id_product=24922'); } - } catch (Exception $e) { - error_log($e->getMessage()); + } catch (PrestaShopException $e) { ProcessLoggerHandler::logError( - "cart ID is empty", + "An issue appears during saving Stripe module event in database", null, null, - 'createIntent' + 'createIntent - registerStripeEvent' ); ProcessLoggerHandler::closeLogger(); + http_response_code(400); die('An unexpected problem has occurred. Please contact the support : https://addons.prestashop.com/en/contact-us?id_product=24922'); } + } - echo Tools::jsonEncode(array( - 'intent' => $intent, - 'cardPayment' => $cardPayment, - 'saveCard' => $saveCard - )); - exit; + private function getCustomerFullNameContext() + { + if (version_compare(_PS_VERSION_, '1.7', '>=')) { + $firstname = str_replace('"', '\\"', $this->context->customer->firstname); + $lastname = str_replace('"', '\\"', $this->context->customer->lastname); + } else { + $firstname = str_replace('\'', '\\\'', $this->context->customer->firstname); + $lastname = str_replace('\'', '\\\'', $this->context->customer->lastname); + } + + return $firstname . ' ' . $lastname; } } diff --git a/views/templates/front/payment_form_alipay.tpl b/views/templates/front/payment_form_alipay.tpl index 70371ea..9d3276c 100755 --- a/views/templates/front/payment_form_alipay.tpl +++ b/views/templates/front/payment_form_alipay.tpl @@ -24,6 +24,9 @@
    +
    + {if isset($stripeError)}

    {$stripeError|escape:'htmlall':'UTF-8'}

    {/if} +
    {if isset($prestashop_version) && $prestashop_version == '1.6'}
    diff --git a/views/templates/front/payment_form_bancontact.tpl b/views/templates/front/payment_form_bancontact.tpl index a564a66..4a0d79b 100644 --- a/views/templates/front/payment_form_bancontact.tpl +++ b/views/templates/front/payment_form_bancontact.tpl @@ -24,6 +24,9 @@ +
    + {if isset($stripeError)}

    {$stripeError|escape:'htmlall':'UTF-8'}

    {/if} +
    {if isset($prestashop_version) && $prestashop_version == '1.6'}
    diff --git a/views/templates/front/payment_form_eps.tpl b/views/templates/front/payment_form_eps.tpl index 1cd1e87..55d0d7b 100644 --- a/views/templates/front/payment_form_eps.tpl +++ b/views/templates/front/payment_form_eps.tpl @@ -24,6 +24,9 @@ +
    + {if isset($stripeError)}

    {$stripeError|escape:'htmlall':'UTF-8'}

    {/if} +
    {if isset($prestashop_version) && $prestashop_version == '1.6'}
    diff --git a/views/templates/front/payment_form_fpx.tpl b/views/templates/front/payment_form_fpx.tpl index d181b1e..a8358e8 100644 --- a/views/templates/front/payment_form_fpx.tpl +++ b/views/templates/front/payment_form_fpx.tpl @@ -24,6 +24,9 @@ +
    + {if isset($stripeError)}

    {$stripeError|escape:'htmlall':'UTF-8'}

    {/if} +
    {if isset($prestashop_version) && $prestashop_version == '1.7'}
    diff --git a/views/templates/front/payment_form_giropay.tpl b/views/templates/front/payment_form_giropay.tpl index 6d475d0..7294034 100644 --- a/views/templates/front/payment_form_giropay.tpl +++ b/views/templates/front/payment_form_giropay.tpl @@ -24,6 +24,9 @@ +
    + {if isset($stripeError)}

    {$stripeError|escape:'htmlall':'UTF-8'}

    {/if} +
    {if isset($prestashop_version) && $prestashop_version == '1.6'}
    diff --git a/views/templates/front/payment_form_ideal.tpl b/views/templates/front/payment_form_ideal.tpl index ea7e28d..50673a2 100644 --- a/views/templates/front/payment_form_ideal.tpl +++ b/views/templates/front/payment_form_ideal.tpl @@ -24,6 +24,9 @@ +
    + {if isset($stripeError)}

    {$stripeError|escape:'htmlall':'UTF-8'}

    {/if} +
    {if isset($prestashop_version) && $prestashop_version == '1.7'}
    diff --git a/views/templates/front/payment_form_p24.tpl b/views/templates/front/payment_form_p24.tpl index b9fb005..a6f6e32 100644 --- a/views/templates/front/payment_form_p24.tpl +++ b/views/templates/front/payment_form_p24.tpl @@ -24,6 +24,9 @@ +
    + {if isset($stripeError)}

    {$stripeError|escape:'htmlall':'UTF-8'}

    {/if} +
    {if isset($prestashop_version) && $prestashop_version == '1.6'}
    diff --git a/views/templates/front/payment_form_sepa_debit.tpl b/views/templates/front/payment_form_sepa_debit.tpl index 1187051..7fa87a8 100644 --- a/views/templates/front/payment_form_sepa_debit.tpl +++ b/views/templates/front/payment_form_sepa_debit.tpl @@ -24,6 +24,9 @@ +
    + {if isset($stripeError)}

    {$stripeError|escape:'htmlall':'UTF-8'}

    {/if} +
    {if isset($prestashop_version) && $prestashop_version == '1.7'}
    diff --git a/views/templates/front/payment_form_sofort.tpl b/views/templates/front/payment_form_sofort.tpl index 0d94217..4b11eaf 100644 --- a/views/templates/front/payment_form_sofort.tpl +++ b/views/templates/front/payment_form_sofort.tpl @@ -24,6 +24,9 @@ +
    + {if isset($stripeError)}

    {$stripeError|escape:'htmlall':'UTF-8'}

    {/if} +
    {if isset($prestashop_version) && $prestashop_version == '1.6'}
    From 5a9d691a0adce97c9d64093f2859376a50ee0fdf Mon Sep 17 00:00:00 2001 From: afayadas Date: Mon, 22 Nov 2021 11:09:44 +0100 Subject: [PATCH 54/62] refs #32139 : fix Sofort issue payment with order state changing --- classes/StripeEvent.php | 4 +++- controllers/front/orderSuccess.php | 11 +++++++++++ controllers/front/webhook.php | 13 +++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/classes/StripeEvent.php b/classes/StripeEvent.php index f2c21c1..99a1ba5 100755 --- a/classes/StripeEvent.php +++ b/classes/StripeEvent.php @@ -199,8 +199,10 @@ public static function getStatusAssociatedToChargeType($chargeType) case 'charge.pending': case 'pending': - default: return StripeEvent::PENDING_STATUS; + + default: + return false; } } diff --git a/controllers/front/orderSuccess.php b/controllers/front/orderSuccess.php index a7c8e5a..7ef8392 100644 --- a/controllers/front/orderSuccess.php +++ b/controllers/front/orderSuccess.php @@ -130,6 +130,17 @@ private function registerStripeEvent($paymentIntent) $stripeEventStatus = StripeEvent::getStatusAssociatedToChargeType($eventCharge->status); + if (!$stripeEventStatus) { + ProcessLoggerHandler::logInfo( + 'Charge event does not need to be processed : '.$eventCharge->status, + null, + null, + 'webhook - checkEventStatus' + ); + ProcessLoggerHandler::closeLogger(); + return false; + } + $lastRegisteredEvent = new StripeEvent(); $lastRegisteredEvent = $lastRegisteredEvent->getLastRegisteredEventByPaymentIntent($paymentIntent->id); diff --git a/controllers/front/webhook.php b/controllers/front/webhook.php index 2c692d9..bf80b22 100755 --- a/controllers/front/webhook.php +++ b/controllers/front/webhook.php @@ -377,6 +377,19 @@ private function checkEventStatus($event, $paymentIntent) { $eventStatus = StripeEvent::getStatusAssociatedToChargeType($event->type); + if (!$eventStatus) { + $msg = 'Charge event does not need to be processed : '.$event->type; + ProcessLoggerHandler::logInfo( + $msg, + null, + null, + 'webhook - checkEventStatus' + ); + ProcessLoggerHandler::closeLogger(); + http_response_code(200); + die($msg); + } + $lastRegisteredEvent = new StripeEvent(); $lastRegisteredEvent = $lastRegisteredEvent->getLastRegisteredEventByPaymentIntent($paymentIntent); From 058532f90e6526dade3d45ab571bcdf3d737f6aa Mon Sep 17 00:00:00 2001 From: afayadas Date: Mon, 22 Nov 2021 15:20:47 +0100 Subject: [PATCH 55/62] refs #31958 : change some http response code to prevent webhook endpoint error --- classes/actions/ValidationOrderActions.php | 2 +- controllers/front/webhook.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/classes/actions/ValidationOrderActions.php b/classes/actions/ValidationOrderActions.php index bf4b11e..869262b 100755 --- a/classes/actions/ValidationOrderActions.php +++ b/classes/actions/ValidationOrderActions.php @@ -714,7 +714,7 @@ public function chargeWebhook() 'ValidationOrderActions - chargeWebhook' ); ProcessLoggerHandler::closeLogger(); - http_response_code(400); + http_response_code(200); return false; } } diff --git a/controllers/front/webhook.php b/controllers/front/webhook.php index bf80b22..95a183f 100755 --- a/controllers/front/webhook.php +++ b/controllers/front/webhook.php @@ -142,7 +142,7 @@ public function postProcess() $cart->id, 'ValidationOrderActions - createOrder' ); - http_response_code(400); + http_response_code(200); echo $msg; exit; } @@ -353,7 +353,7 @@ private function validProcessEvent($registeredEvent) $msg, null, null, - 'webhook - registerEvent' + 'webhook - validProcessEvent' ); ProcessLoggerHandler::closeLogger(); http_response_code(400); @@ -365,7 +365,7 @@ private function validProcessEvent($registeredEvent) $msg, null, null, - 'webhook - registerEvent' + 'webhook - validProcessEvent' ); ProcessLoggerHandler::closeLogger(); http_response_code(400); @@ -402,7 +402,7 @@ private function checkEventStatus($event, $paymentIntent) 'webhook - checkEventStatus' ); ProcessLoggerHandler::closeLogger(); - http_response_code(500); + http_response_code(200); die($msg); } @@ -419,7 +419,7 @@ private function checkEventStatus($event, $paymentIntent) 'webhook - checkEventStatus' ); ProcessLoggerHandler::closeLogger(); - http_response_code(400); + http_response_code(200); die($msg); } } From 683febb2395b76665f044d0b2c2c31b64d60e734 Mon Sep 17 00:00:00 2001 From: afayadas Date: Mon, 22 Nov 2021 17:20:10 +0100 Subject: [PATCH 56/62] refs #32126 : fix http error 500 on order page in PS 1.6 --- stripe_official.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stripe_official.php b/stripe_official.php index 6bd0296..eda69ea 100755 --- a/stripe_official.php +++ b/stripe_official.php @@ -1671,7 +1671,7 @@ public function hookHeader() */ public function hookPayment($params) { - if (!$this->active) { + if (!self::isWellConfigured() || !$this->active) { return; } From 5a3aef913c4a32196d1b4008c0d678c9de511fb3 Mon Sep 17 00:00:00 2001 From: afayadas Date: Mon, 22 Nov 2021 17:43:45 +0100 Subject: [PATCH 57/62] refs #32188 : fix OXXO issue payment with order creation --- classes/StripeEvent.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/classes/StripeEvent.php b/classes/StripeEvent.php index 99a1ba5..9b68a81 100755 --- a/classes/StripeEvent.php +++ b/classes/StripeEvent.php @@ -32,6 +32,7 @@ class StripeEvent extends ObjectModel const REFUNDED_STATUS = 'REFUNDED'; const FAILED_STATUS = 'FAILED'; const EXPIRED_STATUS = 'EXPIRED'; + const REQUIRES_ACTION_STATUS = 'REQUIRES_ACTION'; /** * @var string $id_payment_intent @@ -199,7 +200,11 @@ public static function getStatusAssociatedToChargeType($chargeType) case 'charge.pending': case 'pending': - return StripeEvent::PENDING_STATUS; + return StripeEvent::PENDING_STATUS; + + case 'payment_intent.requires_action': + case 'requires_action': + return StripeEvent::REQUIRES_ACTION_STATUS; default: return false; @@ -210,9 +215,15 @@ public static function getTransitionStatusByNewStatus($newStatus) { switch ($newStatus) { + case StripeEvent::REQUIRES_ACTION_STATUS: + return [ + StripeEvent::CREATED_STATUS, + ]; + case StripeEvent::PENDING_STATUS: return [ StripeEvent::CREATED_STATUS, + StripeEvent::REQUIRES_ACTION_STATUS, ]; case StripeEvent::AUTHORIZED_STATUS: @@ -220,6 +231,7 @@ public static function getTransitionStatusByNewStatus($newStatus) case StripeEvent::EXPIRED_STATUS: return [ StripeEvent::CREATED_STATUS, + StripeEvent::REQUIRES_ACTION_STATUS, StripeEvent::PENDING_STATUS, ]; From c28567735ce154fa1034812a16287612187d2121 Mon Sep 17 00:00:00 2001 From: afayadas Date: Mon, 22 Nov 2021 18:07:31 +0100 Subject: [PATCH 58/62] refs #30690 : fix OXXO issue with payment button display --- views/templates/front/payment_form_oxxo.tpl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/views/templates/front/payment_form_oxxo.tpl b/views/templates/front/payment_form_oxxo.tpl index e57500e..6846ab0 100755 --- a/views/templates/front/payment_form_oxxo.tpl +++ b/views/templates/front/payment_form_oxxo.tpl @@ -37,4 +37,8 @@
    + + {if isset($prestashop_version) && $prestashop_version == '1.6'} + + {/if} From 36ce204898acc1e93f865e8e70efb9ef53033304 Mon Sep 17 00:00:00 2001 From: afayadas Date: Wed, 24 Nov 2021 11:48:16 +0100 Subject: [PATCH 59/62] refs #32135 : fix error 500 with id order and current order state in direct and indirect flow --- classes/actions/ValidationOrderActions.php | 4 +++- controllers/front/orderSuccess.php | 1 + controllers/front/webhook.php | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/classes/actions/ValidationOrderActions.php b/classes/actions/ValidationOrderActions.php index 869262b..85326b0 100755 --- a/classes/actions/ValidationOrderActions.php +++ b/classes/actions/ValidationOrderActions.php @@ -833,8 +833,10 @@ public function chargeWebhook() } } + $currentOrderState = $order->getCurrentOrderState()->name[(int)Configuration::get('PS_LANG_DEFAULT')]; + ProcessLoggerHandler::logInfo( - 'Set Order State to ' . $order->getCurrentOrderState()->name . 'for ' . $event_type, + 'Set Order State to ' . $currentOrderState . 'for ' . $event_type, 'Order', $id_order, 'ValidationOrderActions - chargeWebhook' diff --git a/controllers/front/orderSuccess.php b/controllers/front/orderSuccess.php index 7ef8392..4343c37 100644 --- a/controllers/front/orderSuccess.php +++ b/controllers/front/orderSuccess.php @@ -211,6 +211,7 @@ private function displayOrderConfirmation($id_intent) 'orderSuccess - displayOrderConfirmation' ); + $id_order = 0; for($i = 1; $i <= 15; $i++) { $stripePayment = new StripePayment(); $stripePayment->getStripePaymentByPaymentIntent($id_intent); diff --git a/controllers/front/webhook.php b/controllers/front/webhook.php index 95a183f..4b38835 100755 --- a/controllers/front/webhook.php +++ b/controllers/front/webhook.php @@ -142,6 +142,7 @@ public function postProcess() $cart->id, 'ValidationOrderActions - createOrder' ); + ProcessLoggerHandler::closeLogger(); http_response_code(200); echo $msg; exit; From f759b5f41b2979de3621a011e3dcae5ffbfce8e4 Mon Sep 17 00:00:00 2001 From: afayadas Date: Wed, 24 Nov 2021 12:20:10 +0100 Subject: [PATCH 60/62] refs #32063 : fix issue during module installation --- upgrade/Upgrade-2.3.6.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/upgrade/Upgrade-2.3.6.php b/upgrade/Upgrade-2.3.6.php index 614b443..a649ab8 100755 --- a/upgrade/Upgrade-2.3.6.php +++ b/upgrade/Upgrade-2.3.6.php @@ -54,7 +54,7 @@ function upgrade_module_2_3_6($module) $refundId = Configuration::get(Stripe_official::REFUND_ID); $refundMode = Configuration::get(Stripe_official::REFUND_MODE); $minimumAmount3ds = Configuration::get(Stripe_official::MINIMUM_AMOUNT_3DS); - $partialRefundState = Configuration::get(Stripe_official::PARTIAL_REFUND_STATE); + $partialRefundState = Configuration::get('STRIPE_PARTIAL_REFUND_STATE'); $refundAmount = Configuration::get(Stripe_official::REFUND_AMOUNT); $enableIdeal = Configuration::get(Stripe_official::ENABLE_IDEAL); @@ -105,7 +105,7 @@ function upgrade_module_2_3_6($module) Configuration::updateValue(Stripe_official::REFUND_ID, $refundId, false, $shopGroupId, $shopId); Configuration::updateValue(Stripe_official::REFUND_MODE, $refundMode, false, $shopGroupId, $shopId); Configuration::updateValue(Stripe_official::MINIMUM_AMOUNT_3DS, $minimumAmount3ds, false, $shopGroupId, $shopId); - Configuration::updateValue(Stripe_official::PARTIAL_REFUND_STATE, $partialRefundState, false, $shopGroupId, $shopId); + Configuration::updateValue('STRIPE_PARTIAL_REFUND_STATE', $partialRefundState, false, $shopGroupId, $shopId); Configuration::updateValue(Stripe_official::REFUND_AMOUNT, $refundAmount, false, $shopGroupId, $shopId); Configuration::updateValue(Stripe_official::ENABLE_IDEAL, $enableIdeal, false, $shopGroupId, $shopId); From 410f9adc0345c379677301d360c2fc1f44f67cc4 Mon Sep 17 00:00:00 2001 From: afayadas Date: Wed, 24 Nov 2021 15:26:28 +0100 Subject: [PATCH 61/62] refs #32186 : fix fpx payment issue with buy button display + add missing payment logo --- views/img/alipay.png | Bin 0 -> 1705 bytes views/img/eps.png | Bin 0 -> 3437 bytes views/img/fpx.png | Bin 0 -> 4374 bytes views/img/oxxo.png | Bin 0 -> 4352 bytes views/img/p24.png | Bin 0 -> 1921 bytes views/templates/front/payment_form_fpx.tpl | 20 ++++++++++++-------- 6 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 views/img/alipay.png create mode 100644 views/img/eps.png create mode 100644 views/img/fpx.png create mode 100644 views/img/oxxo.png create mode 100644 views/img/p24.png diff --git a/views/img/alipay.png b/views/img/alipay.png new file mode 100644 index 0000000000000000000000000000000000000000..2ea86f25087100013ecfaadbe9b57d4aa0ca36de GIT binary patch literal 1705 zcmV;a23GlrP)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBU&CrLy>RCt{2TWf3-RTLhoh?uAmG10{L4-*sr_`?SeO|(G}jS=yO z8iSB18jTu6jT%X8!Ni!DnE0aF?y?jqn9>v|??SPSP;4nJLJKXlLMuD7%kH-O>^_g@ z%x-DB-8;K8J2SU5dy+3{y1O&y`{vy9xHBUN84ach7U$D~Ra%ee5G>M=U=`!|H(VVc zUq!EAwV#wZl#9hOr<|<9{+M79TlkaE9W639MYBrpBl+kgaMl>e+#DaU$@6y5G^C4= z4Ew2jarrxMG!DV?rX=3|%L}WHCh>8z zS1zN3&s%)(JCCEl2C;NV-h5z&(t1o9hO0E0#u(5vDuhpPwjT| z6X3lgUaI4%J*upB!>mTkl(nD;q&6U>Hv{p<*MZl7mr3vf5~ z_A$oj;0Wpv{*zsRQXFzv_T9;VKIh?0l7$&I2`(|(W-6BtZoAA!fFcaLCwIBwYaBo8 z2f{Gmi$NroEbj4C9q;wVpvfKv>)9ZDilghoy&jnTyShGoWfMF39l*Sxo7ifu$cI?= z`n>E;PRZ!1b$g;vekKU7HVncYRqWaQS`@iQVfXl1J(8aq0Uq7%f-Vo+A+3V6UyjI; zG#AI%qA>~W%|`as@4(+o({s6H`@*urgAk65?_bIJ6V3>fbq1jn36vmyIvs!-Y+Ab9 zQRa;gC9?-&upW=M7_aU{A3MrkJ~*f!`D_Bba%gZI84`ksK2WWkfNt63fF<=F_zlC| zsjvm6*68XN=}BHmfP1h8d&8sb>56N~ywfpvym-I^wHO_&nx3mI)^qJ=6JS%%=%BN$ zHv}_vxN%9Me%s*(&#*QndU2Fqi@ia%2+Ugm>cFBY9~=G)>(gsmND)do=Q^8C0@VJS z96)ODz($cD!8IF{2Oc%%!tuDQD+tBA-EuFXSpX_!WUDX|j27S*tSUwr4NFvo7GdI? zp%fXJ{@ItR!z-{MF_Qe+<31*VDAr%CU1z!th2ya0dP{ z_7X?Lux>((SVjTp=HrMht=F&hyd4LiLj%erzUfeoy7_f(xvA39Zs#n(y<>J_D6>9P zlYis!5|$~t`>SMXmK-%h6iNO_eo8PqLE3N}F*kN@FYMRWhCW>Df;|_N%N)%Z?=)#k zxU(>+QN$|UbJQdNg=_jCvlod_Kc21OptgA_PHpskr5hn++`ys&k<$yIh(cm8BgY z+T>V=;YDk$9!KT|dl(Ml`rmp&wV$o>A8*l#uxm~~zxuI<*00000NkvXXu0mjfAdn<4 literal 0 HcmV?d00001 diff --git a/views/img/eps.png b/views/img/eps.png new file mode 100644 index 0000000000000000000000000000000000000000..52f66b6f492b8150399aa864cc536d4762a27bb3 GIT binary patch literal 3437 zcmV-z4U+PSP))d24kaZe zkd~GP*Sc|0QBhzp7%n+*Ka6|g5pLouDp0DN;PwE+;hz+EpuvB^YB#%3h8!Xz%G@L_J^pSr>3p}7{i3NxES`V4fWuC!tULL%Lgob+Uoe=>WF_^#UZ` zOK>-gCSW3T_JF6YV*;fM&ygZ1=Ia@RK0X0wpNodjIHb7@ zS-}ioZAXvb3f55rp)m-Ql6o1z+Gz)u{d)BY(!SxqSQnVv2h$NvQWxAHO-f!+1#)!( zr=5wy7*ABcY&xNoAafjL&~l)TbyZ(?AY?+E_F0&;MaK`x5j=)C=pcQ0z{8fH=a7_Q zz2SI8*#FR0_U%X46$nfD+t#FWVL9Xw`wpD*6i1}~7H~534tA^?q{tR24cH3aio(C4 zlaxQj7p^?yuK&CfOr8C*2a^zEWWrHZ%@!=+ur85G`+Zoa(+LuZgo-aI_WjkPgF`UzA3%Im7)49xh z(I}~@+7ugR3Nl>r$y{V+C%Y7cu&}V0?CcTurlh3IiURF6t>>Ag_XaB zA=2+n^7HbR{&?1`e}sgD#Mx{%R1OR!oLzcgk*@STVZ!(a?p?TGA2G(i|M=Y8$Mfl)S0e>(BJ| z_MWe+tJ}A6)21nnjZM2n8l$vBPL6JoZ%~{+V{w2^o84~2YuX6JfX$4IGvc?&*LUzt zpj?0zWj;?+ON>&8$oXJ6=3@omWvE~DLT-`Hig7 zbqx&-#X(Y^v-n`~^9vU&n2rxFb>XbX#>S3E4N;?|ueVq%P2u6;X~YK9i=+pBet!k- zGXxZFB*gjh}yC|F*XFa=qSA85~gu`mRkx}rKhLeN`g8lCJ=?=xQJvKN|)2e z2CO9cScph=d8^2N0Ydj^3I~NI&`<}$io^WgYoK;$qoN{jBCrTF6iFje-eV*%{vF%4 zZTo3%ZtfB^TMvhXgbwvlz0VymJ%-Yw6BsC(+_}`d3`i5W0@nYhGpnhJ!{gu}q2C#DOzMv#mE6%27BkRby=Cbcw z$-a6)Jotui;OQRTZkWMkJroAAXdm5!)>wEtoNN8;xB*{HJC4hSZ>Z0u@B_ zxlv1YLFGr)&{0YIFl|~_3STb$D;$0)0+i8g5bv5eDh9yP77*_qO+XX0fo4n`6lM%L zxkIF`L@fd<(q3vo*R(!}f|J*H#ndt8c0JGWLvg@vyxN^>wW4v;`a{%p7dsaNu|nQFo9PDtu5k`z}Rz%plH`$zU+z^H#j~ z?Wt2AQfN${K5gZg(W8HBwOHte!r=9l6EFnMo;+E$0>kMYwA|3s(*u-R15+i1h*+|7 zd!nB_6sMQuIe6icm7-8Aib(PGVAUfyMjJSV0Wt)^Zd>f$JcVA;%%3;!bIjG#h>}Fl z9XogZtfi&ppik_?RA``7D7rgziBb4~skq-XP-+gc0Ol~6Os$ksJ!8OoV(RVl#$EIj zMMXtu&Anuot`>@)c@`#rng9{8t{|Y(+R_k+(D1-(xc(VH-U8OKl9dENuyahN-e!Er z=6*eg)oP&ahX_9k5#O4{CCy(eq=(?_;Tm?XU>+OwtE*XP#ZTuqtZCO?R<-%MTWF=3 zJ_8r3(G&a*{!g3qf8im}4@^e4s6v<6*xA`xc~x(durYRdbr6580m#hExYO-+xtd#A zjwL20-aIlp`)>3T@!z>jiA;2TC~#8B9zn*<;d!1lzMC>LXJLv|Q9lU&j#TQi*&b_x zy1`v@CL|6?98>;n`3AL0H4NQjB--fQVZ(;yHMcaE8jalzBeO>=?7E<@?(OMmO-oCg zifpOu=xDEsiH;f7-qCR)Qmsx#FAy3ZA3v_Pu6DabDhVBtl{FVlRz`JA&8HC&;lo>7 z&zB}94#`!i)Wh)lDRpP+ik2-~X3o*+Zj;KS(f?Ht=-suqwDqP)LAaEq3Z){_X0sc$ z+KibFhuwrTWG^i(U5)j`l8lUuJG(l&8f8*xBm$F!1=O23;E<_Pru>m+dT8>{oQC>_ zg9y%@Xtm2?Vq$cZqD>}q7qUSe9~XBMo*$0)9UZNSPNC)ava+&wbvoTb^dPd;Yu2p9 zYrP?zJ$p8$F4Lfwq6XV&H93Fsq(cb_2@V<#} zcuXvmymCRS&~AbDQ6CyGUeiU_63CwW87~T-kPziktVSam8=Ln3M}PqUJVL5aDz`l+ P00000NkvXXu0mjf!bg{^ literal 0 HcmV?d00001 diff --git a/views/img/fpx.png b/views/img/fpx.png new file mode 100644 index 0000000000000000000000000000000000000000..61fc9f9a5cfc357589f4acbeafd07c9d2002c1ba GIT binary patch literal 4374 zcmV+x5$W!UP)AyCg-O5sw>Fi`LH#7iZBoF_{bw-~&ZJ!ttTPQFoFsQ_4xr!EfrD$HW zLN!*vrfBMaJyPqPTMlzGAtUMJjX1yI{e64~dx&4Bk+h7*R-^nEp2Gsz8LPy`CW-Xi zsf}J<{oT@xkbj{>Q&ax4v7^2JF=P7JeNa#hd01RrAq@U*{c)vAWe0;G@^pzrM(geF zyx~kzOgN9rY1Lq4RQ$(rdrl_t`Mf`sNT<`Qs%q-@{}?{NpgXU)ROo%|QAL!V0^7y} z27@M*D>?>-MDH#rEO{-?V&HTrfM;UDWub74C~Q)nA{`kg&qfgng(eOPrE=iG#EY9p z`iI_3zHz@7ksm$EOFU(=-y(RDR-SEPVaiTT&ksF+@lKCcURhYehLOZrT8d1yeL|M~ z)fXeeKO5_l%P@e0=1|~|<|a(8`VDXat^t#mjaUKOmr+jjMW%%?HJ-T<@3k!eIhJerGE(wp@h&ps#H^!WT8k!`Y znl+@!w% zzHbW7XtM^Be~R+VKq$rbZ9Z9Nip{?eTvz#>{K0>O|beo{6R zKS@6{jITD}v%$0X{nxn*rb0ebV~sS7f7M980cX9vdR77l!*S16+b$M@Hf_qNMUX9M z6`jv!Re8dVW32hCRtjv8DQP`z1&7v-aM(rexpeDP6CE{kIxsNB(n4fz03W;H+4d{v zwoSxpy%rUSRhx?hmHqp=mcA{`fR(-!4G@u==gyh1@t5nVO zpS>v~t1ygM8yP=bx8vq*N9Gqlt2mODQ4pxLLSor~fJDe7w&ID`^J~o){PH*fILOzZ zv4YSTHkH0|Sf@EW7URX^k$xYg1^5qHsOvI%`1tu7;N#n1q<*k!g)cd|PXt<8rgJpt zUTEAp0&aaz>()eRsp*fu4_hAlGk&wRZj3sGs2i#uy_v8wYHhMO1~}N=kQ-MwDWtOo zw4d>@qgl0n=exFt#*Z2s>XngQ^sRQa^zd;tc-n37$COtp0B%-Y+tBN`yBQ^IVV;>t zm<10geT6(5@=T3k@L@&v%YXPW9Khf1C0v&)3iajTnv&=>A;B8YGSRdtpeVLL&yD99 zf++gnxQA16E1Tn)3_8<*8>_~+Scb-qbJ_|kG^ha324V2*_1ED}9{Tu5CQnh+ucwYj z4}k(?+WVMn`+$kd?t&_`*Nv`HiOgUh#M*}q?K9&iKMT>kOBXS>6;%=_#%VEo3Bi{ja zd!h71=}Nett^&zIAV3@m4)jkpBu_l6owdb7g`!PVDSoTmnOMJ(kfeGIzhnLlDJu0Q zl_iMyTFwXyRJwfFDSl6ESg>Q)4yrahN^mgo!WJHn(@H0V3*Nb#9)Td`X)t$oX=f4( zcaDWS({-&8*R;wex$nx$MS*bVy{~X*?!1NDV$c!85SD=oJp?66Ga|Zb-H~Cyo#{|Y zrIGR!qP^17qg$=HnV=3B_|NeHzUTbM_}n7_udTcoL2w14vbz@B(S{VVM1dR)_2DmB z9=p4DFJ~_>j+bzUxn)e(_=$%y2h~XxlgUPdZgPx3LxJ{e8SP?mZ+s8y2l|~8=DsF6 zVI4Xjs2^C!QC(B7Le9Dbc-U+tPuy?F;;%D@v91diXBBmM<>;>IA? zJ78%{9V(N*WZ_pkp+w2~3%^cg-ru)MXqkt}~>osB}V4>uI1fa{XkFq<^44 z?vYoD)|0G8CmrgF2DhPMx*-ciZg~lo@q?iqkv80s@mB!zZRB;_xTls`5GsQ#X2pPy z-0E#@EamvUl-$$H$aX^cW~~Ct>Q6e~f+AOv>_k^98n>oBDrpE=cA?-KaxXKhNQgu| z9u3+U!a?Mg#mFs#fE`NOzwx1UW8J)1WGc86IBm>Pos8y;dk?210vTGy0j0Y^`BB7Z+jeS zLv9Q}PB8`tfnQ{&ny=+?WN@G`tT({Fza+nS*{)H)-A!Li2i|LVB*E}fj6KHC*fsg} zcGO8Db(>oHlhev8YdS})*|*ssaRNSGtZbA=oyn|PY3%Mc+_(ZbI0HENT7nMVSWVJ6 zWFdr8sG$Hl_}5KimGD>Pksmkt4euWad8H<;qxbRbmI(+dYfA?6Y7Uw{cGB#O^of0V9&SC1@JAAGhB=zwIQpf_5ah1D$X&0Q{A-IyJ<4yuB=DzW z#zy0J;*}}zQK7-dQXPDh>ue{fwOHc%VW(ZYwuiox3Vdzu41CN7J_f)w^&|5fKrutl;Ay%Bhto?+7`}tnUZf?dodDYZi$Fl7@z+ z94?oWx^7kQVqi%F?HxYa#KiZ<-{j8kkM~M^uf+FCd>56Na_bNNxQWZ=j0sr0d%@xz zQ*v^jwBjpkq7!zFpB(pGdo-_#F=SiU%k-RI`kE}Xz5PxSM~L_hfF4?-MamV)!h8@YhWg_4{pf! z8xAx!O1wPWoi86faW(c)TE6R=$Qf(!oQs^8f-BueR>ruX~Y}GyZ-*Yiw$2{@CuW4iAGuqC<}!T~6 zFitCqVh}Bpe7hF&;9(vL%%c|bVBxuadt0l=WWxr(`KU{F+bhyC3O=3n{l>Y+4zBvj zt$Ua9lG3UU)>dYv%!-QYftbjkpW>Dc{dB~D)KzQupWnIr9~%QEEmtZP%889l&CJlb zUqpc$R`5-@6jD7ZGrO?QhRuoL$T=l8HkNm12Kuj$+k0w5adEj|e8A94o7c~Y#KZ^@ zmyp+%n6SXoQk0RO|5UVQ{eegj^^SAD`+Pr?=#zBv`bT^d9?jXwer*T4c26Us;wQip zd^_5Ia1__d$f%zJWimw&#zDt8wvx$g+IDyqWaLt*tmN#ejU&AJyUEa(962pfOcj^M zQ9~I{(VGs1DwRsdKE1nLz?l7znnsA9lzoiF=|;X7lgkxM7K^DQZz?g5y6Dw2XDwL~ z7hYce+|Jh4>H!wu$+MEm5Q<5W-SQhyc31lj?R>++<2FFC+$T@UI*lFey^f(t<>*X` z;*xFl@`~p?l}fDyf3z9o0_dsCDQ(@*X<9* z*{5AQ3&Dw`YyOW?^RzoEWCh8~?pr9f;-_WakmF-9IAU?xf6&zGPG~=IkhgnoPTrH@ z=#!bAQLqf;{p_AyVgH2NxIwN1o@bJJ7{|Em9Pyl?gFO$U&Q>~u;YdES)9x(6-ALZ4 z3Ys=%vZaOSF~y*_$8)ZYjfI!*V9(^lqnBeIKFS>#9O$2daad2E`sp^DEijJ+jNfW? z^!{&go?vcn%4=w79$8UU>*YJdGp}DC*Fz}oJ2ub%PmHNBXxiuqB5%Uy+Hp8YjIFKB ze?^BEX3gDn)^E&$lY94_+5Y9k;aiXoKW9>m8oq#=A(tsEu;Uq{L+$M_#< z=23ug();&y&BM7G&?3ZqQ<@r^%LII0DXd(Kq5|BB(Pn4Fka2jPi+Tc_r!pZZKXp7N z2rfK1D_iU|CuICj(NQ61)~-L`$)MADG&-GFQW=-SR$)L@IA7`9+4d2qBbSG!ravazT?;T*#-+Ia;uv6&$dKK{3duFZCTed{9+hQ7wd(Rl@y##+b8E7GV4Zn8!k# zAK-df@VEZg09$wA4L-2aD=9Z0(qUjijJHJxScLSUzMkJXIoiuzT^-J5WEP}-`_1Un z|L6YQVd)QXVeK9K@1Xp)B680-V`LC?IHGo+{L;ho>k9}lW`FmX{zrfT0Qpgo;m=8a QD*ylh07*qoM6N<$f^9FF1ONa4 literal 0 HcmV?d00001 diff --git a/views/img/oxxo.png b/views/img/oxxo.png new file mode 100644 index 0000000000000000000000000000000000000000..cf36adc0490ca75a5e6e9e099589b0fd014e6804 GIT binary patch literal 4352 zcmV+b5&!OqP)0Szj zmhNn#K3Bj6#m6ElDu{?1ASfRQf(Qr-K2cCakwyAcL=h3(P+0^K0dYmaT|sQ2l(H4N zZ)x`X&N(*?ncTE#`+R@+biOYiG?{y6=FIQ>&hMNVDb8YuojW=!x9|D!LuCmhMF9nZ zHOcS)iuZ3N$oGF_`?HNHsl9joSg~>Diu|#9GVG0)wi#}p=>1yS<2Nq{*`SX)RGIZl~T|VZ||Ye;K>F>usQmFoPUz32h&%9Ta1}Hs?9)@9`iSbglM4Q1E$4ZgtRg)z*UL;tL_| z=_i957tvhv)z?t5bsJcJ{uP|3OTc5Zo$+_6d8_5#IvMn?ipr42#lXjdC@we1VFr-G z!*Lu56sJ=ioa`KK1X&-1UA+D19lGdfaF>^WWWaam_1;Yi6&xh+I32if56ET{xY0mz zxQWMakzs3UAa-DX$b8{BkRu~Czt`;g42~~c47K0=03K^S1A*o#o5J~D1^-s;cJMfy zJa-w_D@k(G#+CHCMt20|1bFJKIGG5Dx%^Uy?tM9!yLAD5d_2%|v`~9t5!8IW2dX~# z6l?{Dc~Chl%x5^ovyA1b!(fTD*V!A-G)Y%qj2EN)&{+qTg0$;Tn0 zdp9V3=Uq7Q>{8~#W*Hd!xT?{x{r(AAE1qXy2x~-x9h*BJPQCmpC=LgEmbqJ3i0;!H zEEin}#*Qf#jT z_gu3$-TQEIX)f50od7*<2zwfCK+0o}K+@PTzP=Tkwm`wS`*?#S zUE_T3!37a&I;~v=5f@$H`@Uf81SsG50qD%;kcM?5I80qSLFaXAK^GS%vH*JRp>Y$T z>f@cfS>YM!kUV(;#N99mBvW{kudd&>A5JXE#kFh(3BklbX#kXJT$kJ!T6E|-Suf>6 z`m#kK4a<+=4knJc9lCzFkx@c!sCeIJXp<=PjlFIlq|BMc!9{6=8rTid1=9$zeukwM z);<}j#>K{OD&l+W4$#NNLPqXltzpZ{A^*EIJ~cr#IU$}=G<2{yKlG65Pd^8pC6eia=p~qeDUMJ8Bswy6=`6mZwhj)C83#4r z?BV$(jk*Ie&`>&DcS~E`kQ*U;)d~h9dAonpjg4J?go+IxK;5_BF;5v0NgSa3G-7PuK2V3j!G5F&Z21Q{AXzT$CA=@{vP-~u z`~=kEduaFlIWm6m4Ujs2u4WELX3T=J_cuc7kxw$h)C(`%chDMPc7Mi1^1j(CO{hLAHo;sW|rqD12ZB zBq8e4(bYN1fA$6Bj~K)GCI@F)M^!a){Afs>H%GHMMGrj!rN#7 z`C>P}vufuqFn8_*;n`V!QB?;qeXfA&FL#6O;2|)kc3?L%v`rEwUb*EXI6QeO#9VbH z%Bf`>=%^Vxrh);-src|C{*I_94mmx2(bL`x%Wrd*y#OZ`EycxKSZ)z5MPq#MZzZp+ zf`a>|fUB~S1E$Vs6xK@;ts2);``!19dfAVk%}77x=+T6F+-Q$)bmFeK>#s$~i^N~} zz=N#)47kgZEC;P~=+JNyN*Hokq6+_(FzhCLXN=G74o{wjeZCjD3E!Rh{8BJ?KMOf> zJ{Zx(gvgBYr*P^FMh^u?$!rqGxZ_r6H(?w&i%&r$%Dwa@&v20PZ{c(a z8IsyS{7pBCS{J>b=#j_JkSd6RN-VSi*`nr)ui(hcS;B9I;jO{b^TlI?r)%Q+D!BkJsXFD zcH{-;p)rz$e#f6#gn`iQqnD;~Fdf>2P+E=2hkuLdcNKb&njpz)WOXAV+JGr1OXyhk z-o_SXLNdBh?VfMJb|6pqKH{9SS%mX|h;j!8u|xOV3$C(q@p;-r|M75MLF8{TU^_Z*>L-S8XF_QlFQ{lWuk?RF+sOkuij5nwoN^^5Hd5 z9p>%@yl8u)?>qYFT&Vo$W6)Dz^Lh>~N;ZZ=(d;=a$(l@g%gW#&dWo~R7&FK4Gv0?m zn7G})S%2Nf`o1M#l5n%Eza8LU>Wed|B!? z6o^oov((bUJ5daRNwM4f=7!XRob96p&dMmm@S6ZdK`N9eo)(UX@ACHmb))Jv)q5Jx zh=@)YazoJ9ME1A{CD$mHaY5H*3`5;{ge6?i&DpaTDtGK;FVVycTvJ2P@c{tmthBV; zMy^k_g$9l8t)(aqHL+2Ri;><{QYs*h9x&x(tHq4wf)*!DgPFRD8Iir{sBku-cnj4O zd`zei8f&Rf%t2Xo4JQ=>7jvRf4GF`CLAyy4f<8-uvHi3uoB;-zsCQ0h8c9f^4n=7` zm?%A`x`n^wbCp-{ha{%l;AW1~r=gxQDgV?C^X--l=0SZIdEo_MLMDMCHAACLxZW$kNeAgm7lH+|MM`kkz*LOE|3_WY3(}r_s>%7ZpD`8X)?nTUVRP`k zbwB3^p5@guY*bqlH%q> zKt}EoFs7uasHD6f=i)3rjp_XRB9-*M3{oDO&GEpEU{e~Y*10Mxz;a1X==hXa`*32W zT7j8lL)IprNdgRDJ6s6GFRl=)T$sspdTTY86PZ)c#VG%$!U(x49i5m^TV}t$lFN00 z8nXoTC?SjxM>;wK-5kQiB6<0`_c1M92Kt0}aF&$7!Mn%fL`77Uta+1Bnep5rFrC#^ zTofXZiZP_03#UJX8QngO6r@^&gbKlfX?{b%KK1e{a2z|Xsn%t$Tn^zGX`D*a8fmSB ze3f2g^tv&Svt}h{mVvbo2YG{+0)@g2BNMqK3v+wgMNL%8;nnd`@?fk1<`&8$NYM{H7$=NbnHt+vez*-2qw#9ZgS|s`X-*<&k$T*b z?A0%$AzQS*o zUOl)jZQb`98-k2q^UYqSu&7IW301DbY{T42xWV41DnJahwI& z10-7TGkz=Q`}+qB;*^zY0d#&vk}DC_fhM&@SFieHmx`c9aM3>TMNZYb2Y!k4;|vm7`dv4bW*l{BkaF=5FZ98He1N`+V&q{uPL~9 zvU=ERG-}on{D3l`qE8E8ZoT4iFn8?&1`Is3SU&wdQp9dixsy(R3)CE*&cECqNPYBS zXcH*8NI|^uHWc1Joio5txjfMn>E_Ps-{u5`4>&h&<^U$?4Sbr=cv9ox=QIDk1Y)nh zPDI=IN$gp|*`eKm{q11N&W7kdSAgZ>3owgJ#c|D?d68FI_tEL^XMEyK{H`-cXjEzg zEi`FdVUko}al5#X!}k^_uci}XzPF&Ddxi5t$>3q_+d~?1SoDB?+WP@?axn64*0sXX zP*VoRu`QSMfJDs5$lXt^Sjl%Gn)AHJ>Eh%5^k)}v@S^9*u(m@5>J@+>cMkZT1+ABA z5VTh8M_}Q*8%~G!-a>ez!0;LOyNu2ujT?+Q8iEI{Ahawkl?QKLa#gPIb z6zj|;_+Pe$8#fY)UWe4mTaHw5=YSFx+C7~|kE{Am|JS%ssVHujqSz_)Fberz@mI8*fn>z5M)#`bjH(`;(5@U{Afh>ZlWgV%Xo;_W!^!RRcTqpZ!w1 z_1d0^Lu%_?s>S~{ZmY*sRB-~4COvH3Q@UNZdwV= z2u-8|Yc?C3gqbpisV$^GBuu2#DrT*PV%FNQDRUT_OxSXIommbkYFI@Fr<_IJkLP;d zd%yR2o*vKhP~Q8GXZP>^UBCOj?(6+*dg)Ltnmp$uiZ| z)$`}icXV{@)Txu3o7={X8$W&e#CStP! zSD@|Nw{N@!3`W1*wQH9`NDF$|zkh#1#Tto;iAD`}?%c^+@H%|>aJ^SSK|unE8#iv~ zd1>=|1L^1I*QHCBrlzKY2M-!GIDGgpzwO$!8#QW_-dU%mrO`=GPcJMi)ceX}ChFe3 z`{>c52MrozZ*LF3+_`h7yu6&PE9&9*`Sa(%%joAoRyv(Kch-)lq@)ZUJh-H!WYeZi z;;xlmk_W3-uU@ohQSaWp)nH>|ZYn(P@kaG*>?gyQ4lU0q%6bdBiFn>UXo#nP+X( zohyDr=E~9TParu3%J~j#he!HQ$^(dD67m znl)>LuHD_;Wn}8qsh~~#gQ!VlqZrkmwbo1M!d&Inv13Qs2FsYXynp|`(Di@;10Ftn z2t1%9Mqq>W>(?JWdK5?~W5|+0I&7YqVcE8A+sdoAZ{K$7)=l)Ax3@Q)ACWd4OY#ni zW@j*^X)hr{i49po{gD3Fty|frq4C(UW5odJ^!fAW#{V{fxVD+g>P8pSHd|X;=>S9@ zA0Il)mMzQ5$}(!~;NSpb;1D6i32m5Z5?8Vf{K%uZUXBYTelGBRtqbMvC1dQ)W(Jl8%~`%1rHm( z+Prx)jtaa0=&)hKNbvUU+gsrxVV2akKy9cTmv;B=U0+{cy%G;s%Ue`BXZ`&*H7%=~ z8%ruRI^4s<1D$sD>Q&B^428f00s@e|7{G{<)SNZs@{4L3N)ZCKES8iO7?Hd)+%yFc zHZ>v&TmN4JoFIM^CQJY{fq{Wi)48KuzkdD9nKMd(w@|Yz08sH?y4K2n!q~L=bB#(( z5o%R0k>8=Ap+8^G#s(qc@9$6lz<~ovNlCxoOSq6_z$m{WAGt}Y8`h*rlT;xl@wGy; zLx&Ec1Q=YnaG|HCC;gn9oa4uji#+`xuZozMTxwvtE($6E|wc3Zt>XA&_KLbtXP3%eSJN5J;*gOG7U zN=%)Xmxn8vnVB5Qf&~juOi!OaML=-zm^N*ixJ4K!1OyL$R(B@ssew0d-n?+(0^U$X zgM))}b?wrnOZbhfptmrEw5*_ddItizMi4o3@998sOtY%mmgVB7u$Eak&yPiTtG~)vHO@EYO!K5`yUL>}(_;H!>$DCoo46%$YMM zEG!J32V}@LyaAMWCTEIFVKY2(&^0wR-~?#`cyN~kp)L?hqImi8Wg^OniKdpl;j}IL zW=0c7ynOj`t|@2Fo|W=XLFXz1fG%FVIC0{{s;a6bOO|jG=dQ!)@Qar~IXpa^Fo3`E z^76vMLNp3N0tS2tHhT5yg+tZV)nrV5em)`wdCCZIXP>yvTELeO0E{0h%%bf1Q~& -

    - {l s='Pay by FPX' mod='stripe_official'} - {l s='Pay by FPX' mod='stripe_official'} -

    -
    - - + {l s='Pay by FPX' mod='stripe_official'} + +
    +

    + +

    +
    {/if} + {if $stripe_reinsurance_enabled == 'on'} +
    + +
    + {/if} From ab33036f6dbb2d3ea76a3486237d4508bc10d965 Mon Sep 17 00:00:00 2001 From: afayadas Date: Wed, 24 Nov 2021 16:34:09 +0100 Subject: [PATCH 62/62] refs #32186 : fix alipay payment issue with buy button display --- _dev/js/payments.js | 8 ++++---- views/templates/front/payment_form_alipay.tpl | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/_dev/js/payments.js b/_dev/js/payments.js index a5ff9a1..38770be 100644 --- a/_dev/js/payments.js +++ b/_dev/js/payments.js @@ -292,11 +292,11 @@ $(function(){ cardFormPayment = false; } - if (typeof stripe_compliance != 'undefined' && $('#uniform-cgv').find('input#cgv').prop("checked") !== true) { + /*if (typeof stripe_compliance != 'undefined' && $('#uniform-cgv').find('input#cgv').prop("checked") !== true) { var error = { "message" : stripe_message.accept_cgv }; updateError($submitButtons, error); return false; - } + }*/ } // Disable the Pay button to prevent multiple click events. @@ -547,7 +547,7 @@ $(function(){ var error = { 'message': err.responseText } - updateError($('#stripe-'+payment+'element'), error); + updateError($('#stripe-'+payment+'-element'), error); } }); } @@ -647,7 +647,7 @@ $(function(){ // Update error message function updateError(element, error) { const $error = $(".stripe-payment-form:visible .stripe-error-message"); - var elementError = $(element).siblings('.stripe-error-message'); + var elementError = $(element).find('.stripe-error-message'); var disableElement = $(element).siblings('.stripe-submit-button'); if (error) { if (stripe_ps_version == '1.6') { diff --git a/views/templates/front/payment_form_alipay.tpl b/views/templates/front/payment_form_alipay.tpl index 9d3276c..96d5823 100755 --- a/views/templates/front/payment_form_alipay.tpl +++ b/views/templates/front/payment_form_alipay.tpl @@ -22,7 +22,7 @@ * @license Commercial license *} -
    +
    {if isset($stripeError)}

    {$stripeError|escape:'htmlall':'UTF-8'}

    {/if} @@ -32,7 +32,7 @@

    {l s='Pay by Alipay' mod='stripe_official'} - {l s='Pay by Alipay' mod='stripe_official'} +

    {/if}