From 991c1b4f139da7873ee85d5d0b72a9e8e862c6ff Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 12 Nov 2021 13:20:58 +0100 Subject: [PATCH 1/3] ADD Klarna provider with Stripe --- htdocs/stripe/class/stripe.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 9324d7d3a5d..d60b084ff39 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -409,6 +409,9 @@ class Stripe extends CommonObject if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) { $paymentmethodtypes[] = "sepa_debit"; //&& ($object->thirdparty->isInEEC()) } + if (!empty($conf->global->STRIPE_KLARNA)) { + $paymentmethodtypes[] = "klarna"; + } if (!empty($conf->global->STRIPE_BANCONTACT)) { $paymentmethodtypes[] = "bancontact"; } @@ -450,7 +453,9 @@ class Stripe extends CommonObject if (!empty($conf->global->STRIPE_GIROPAY)) { unset($dataforintent['setup_future_usage']); } - + if (!empty($conf->global->STRIPE_KLARNA)) { + unset($dataforintent['setup_future_usage']); + } if (!is_null($payment_method)) { $dataforintent["payment_method"] = $payment_method; $description .= ' - '.$payment_method; @@ -602,6 +607,9 @@ class Stripe extends CommonObject if (!empty($conf->global->STRIPE_BANCONTACT)) { $paymentmethodtypes[] = "bancontact"; } + if (!empty($conf->global->STRIPE_KLARNA)) { + $paymentmethodtypes[] = "klarna"; + } if (!empty($conf->global->STRIPE_IDEAL)) { $paymentmethodtypes[] = "ideal"; } From 97d2722c4ce36f2b7a962bccb28687d8b9f2ef57 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 12 Nov 2021 13:21:40 +0100 Subject: [PATCH 2/3] Update stripe.php --- htdocs/stripe/admin/stripe.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 06f417e48df..77c8d9a03b2 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -390,6 +390,20 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code print ''; } +// Activate Klarna +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code + print ''; + print $langs->trans("STRIPE_KLARNA").''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_KLARNA'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_KLARNA", $arrval, $conf->global->STRIPE_KLARNA); + } + print '   '.$langs->trans("ExampleOnlyForKlarnaCustomers").''; + print ''; +} + // Activate Bancontact if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code print ''; From daadcf2fc36662aeb8985771fbbe26c90aedaa2d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 12 Nov 2021 12:23:40 +0000 Subject: [PATCH 3/3] Fixing style errors. --- htdocs/stripe/class/stripe.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index d60b084ff39..a520e83f0ee 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -411,7 +411,7 @@ class Stripe extends CommonObject } if (!empty($conf->global->STRIPE_KLARNA)) { $paymentmethodtypes[] = "klarna"; - } + } if (!empty($conf->global->STRIPE_BANCONTACT)) { $paymentmethodtypes[] = "bancontact"; } @@ -609,7 +609,7 @@ class Stripe extends CommonObject } if (!empty($conf->global->STRIPE_KLARNA)) { $paymentmethodtypes[] = "klarna"; - } + } if (!empty($conf->global->STRIPE_IDEAL)) { $paymentmethodtypes[] = "ideal"; }