From 4857a04acd9c01dc4e9294369345e337915d540a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 24 Jan 2021 13:37:05 +0100 Subject: [PATCH 1/4] ADD new payment method for stripe still in development (work for support more payment modes) --- htdocs/stripe/admin/stripe.php | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index c304a00ce3f..9198277e2f7 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -387,6 +387,21 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code print ''; } +// Activate Bancontact +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code +{ + print ''; + print $langs->trans("STRIPE_BANCONTACT").''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_BANCONTACT'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_BANCONTACT", $arrval, $conf->global->STRIPE_BANCONTACT); + } + print '   '.$langs->trans("ExampleOnlyForBECustomers").''; + print ''; +} + // Activate iDEAL if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code { @@ -402,6 +417,36 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code print ''; } +// Activate Giropay +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code +{ + print ''; + print $langs->trans("STRIPE_GIROPAY").''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_GIROPAY'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_GIROPAY", $arrval, $conf->global->STRIPE_GIROPAY); + } + print '   '.$langs->trans("ExampleOnlyForDECustomers").''; + print ''; +} + +// Activate Sofort +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code +{ + print ''; + print $langs->trans("STRIPE_SOFORT").''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_SOFORT'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_SOFORT", $arrval, $conf->global->STRIPE_SOFORT); + } + print '   '.$langs->trans("ExampleOnlyForATBEDEITNLESCustomers").''; + print ''; +} + // Warehouse for automatic decrement //if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // warehouse to reduce stock for online payment //{ From 4765d7fb4f78a7b784b80787e803edb07855e88d Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 24 Jan 2021 13:38:03 +0100 Subject: [PATCH 2/4] Update stripe.class.php --- htdocs/stripe/class/stripe.class.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index db225196ea7..6c508e4f974 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2018-2021 Thibault FOUCART * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -409,7 +409,10 @@ class Stripe extends CommonObject // list of payment method types $paymentmethodtypes = array("card"); if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) $paymentmethodtypes[] = "sepa_debit"; //&& ($object->thirdparty->isInEEC()) - if (!empty($conf->global->STRIPE_IDEAL)) $paymentmethodtypes[] = "ideal"; //&& ($object->thirdparty->isInEEC()) + if (!empty($conf->global->STRIPE_BANCONTACT)) $paymentmethodtypes[] = "bancontact"; + if (!empty($conf->global->STRIPE_IDEAL)) $paymentmethodtypes[] = "ideal"; + if (!empty($conf->global->STRIPE_GIROPAY)) $paymentmethodtypes[] = "giropay"; + if (!empty($conf->global->STRIPE_SOFORT)) $paymentmethodtypes[] = "sofort"; $dataforintent = array( "confirm" => $confirmnow, // Do not confirm immediatly during creation of intent @@ -430,8 +433,9 @@ class Stripe extends CommonObject if ($off_session) { unset($dataforintent['setup_future_usage']); - $dataforintent["off_session"] = true; + $dataforintent["setup_future_usage"] = "off_session"; } + if (!empty($conf->global->STRIPE_GIROPAY)) unset($dataforintent['setup_future_usage']); if (!is_null($payment_method)) { $dataforintent["payment_method"] = $payment_method; @@ -578,7 +582,10 @@ class Stripe extends CommonObject // list of payment method types $paymentmethodtypes = array("card"); if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) $paymentmethodtypes[] = "sepa_debit"; //&& ($object->thirdparty->isInEEC()) - // iDEAL not supported with setupIntent + if (!empty($conf->global->STRIPE_BANCONTACT)) $paymentmethodtypes[] = "bancontact"; + if (!empty($conf->global->STRIPE_IDEAL)) $paymentmethodtypes[] = "ideal"; + // Giropay not possible for setup intent + if (!empty($conf->global->STRIPE_SOFORT)) $paymentmethodtypes[] = "sofort"; $dataforintent = array( "confirm" => $confirmnow, // Do not confirm immediatly during creation of intent From 25de39368557aa69d046a9d5f3748a3e17d4bc17 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 24 Jan 2021 13:38:23 +0100 Subject: [PATCH 3/4] Update stripe.php --- htdocs/stripe/admin/stripe.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 9198277e2f7..efa8472ce78 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2017 Olivier Geffroy * Copyright (C) 2017 Saasprov - * Copyright (C) 2018-2019 Thibault FOUCART + * Copyright (C) 2018-2021 Thibault FOUCART * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify From c9dd854c2c12aabc6aaa63c7852538f3d5e41424 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 24 Jan 2021 12:40:36 +0000 Subject: [PATCH 4/4] Fixing style errors. --- htdocs/stripe/class/stripe.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 6c508e4f974..97d45a49a1f 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -409,10 +409,10 @@ class Stripe extends CommonObject // list of payment method types $paymentmethodtypes = array("card"); if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) $paymentmethodtypes[] = "sepa_debit"; //&& ($object->thirdparty->isInEEC()) - if (!empty($conf->global->STRIPE_BANCONTACT)) $paymentmethodtypes[] = "bancontact"; - if (!empty($conf->global->STRIPE_IDEAL)) $paymentmethodtypes[] = "ideal"; - if (!empty($conf->global->STRIPE_GIROPAY)) $paymentmethodtypes[] = "giropay"; - if (!empty($conf->global->STRIPE_SOFORT)) $paymentmethodtypes[] = "sofort"; + if (!empty($conf->global->STRIPE_BANCONTACT)) $paymentmethodtypes[] = "bancontact"; + if (!empty($conf->global->STRIPE_IDEAL)) $paymentmethodtypes[] = "ideal"; + if (!empty($conf->global->STRIPE_GIROPAY)) $paymentmethodtypes[] = "giropay"; + if (!empty($conf->global->STRIPE_SOFORT)) $paymentmethodtypes[] = "sofort"; $dataforintent = array( "confirm" => $confirmnow, // Do not confirm immediatly during creation of intent @@ -435,7 +435,7 @@ class Stripe extends CommonObject unset($dataforintent['setup_future_usage']); $dataforintent["setup_future_usage"] = "off_session"; } - if (!empty($conf->global->STRIPE_GIROPAY)) unset($dataforintent['setup_future_usage']); + if (!empty($conf->global->STRIPE_GIROPAY)) unset($dataforintent['setup_future_usage']); if (!is_null($payment_method)) { $dataforintent["payment_method"] = $payment_method; @@ -582,10 +582,10 @@ class Stripe extends CommonObject // list of payment method types $paymentmethodtypes = array("card"); if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) $paymentmethodtypes[] = "sepa_debit"; //&& ($object->thirdparty->isInEEC()) - if (!empty($conf->global->STRIPE_BANCONTACT)) $paymentmethodtypes[] = "bancontact"; - if (!empty($conf->global->STRIPE_IDEAL)) $paymentmethodtypes[] = "ideal"; - // Giropay not possible for setup intent - if (!empty($conf->global->STRIPE_SOFORT)) $paymentmethodtypes[] = "sofort"; + if (!empty($conf->global->STRIPE_BANCONTACT)) $paymentmethodtypes[] = "bancontact"; + if (!empty($conf->global->STRIPE_IDEAL)) $paymentmethodtypes[] = "ideal"; + // Giropay not possible for setup intent + if (!empty($conf->global->STRIPE_SOFORT)) $paymentmethodtypes[] = "sofort"; $dataforintent = array( "confirm" => $confirmnow, // Do not confirm immediatly during creation of intent