Skip to content

Commit

Permalink
BP-3082 Add financial warning for the use of BNPL methods (#33)
Browse files Browse the repository at this point in the history
* BP-3082 Add financial warning for the use of BNPL methods

* fix pipe

* Apply logo changes from media repository

---------

Co-authored-by: Ivascu Madalin <madalin.ivascu@arnia.ro>
Co-authored-by: harli91 <harli91@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 2, 2023
1 parent 2c036db commit b4afb4d
Show file tree
Hide file tree
Showing 7 changed files with 623 additions and 292 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/icons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
cd Media
cp -R "Payment methods/SVG/." ${{ github.workspace }}/Views/frontend/_resources/images/payments/
cd ${{ github.workspace }}/Views/frontend/_resources/images/payments/
rm -f ideal-qr.svg knaken.svg paylink.svg paybybank.svg pos.svg alipay.svg buckaroovoucher.svg creditclick.svg tinka.svg vouchers.svg wechatpay.svg payperemail.svg belfius.svg in3.svg trustly.svg
rm -f ideal-qr.svg knaken.svg paylink.svg paybybank.svg pos.svg alipay.svg buckaroovoucher.svg creditclick.svg tinka.svg vouchers.svg wechatpay.svg payperemail.svg belfius.svg in3.svg trustly.svg mbway.svg multibanco.svg pos-nfc.svg riverty.svg
- name: Copy creditcards icons
run: |
cd Media
Expand Down
5 changes: 5 additions & 0 deletions Components/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ public function creditcardUseEncrypt()
return $this->get('buckaroo_creditcard_handling', 'redirect') == 'encrypt';
}

public function getShowFinancialWarningMethods()
{
return $this->get('buckaroo_financial_warning', ['all']);
}

/**
* Whether to use pay or authorize/capture method for Afterpay
* true = pay
Expand Down
58 changes: 58 additions & 0 deletions Resources/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,64 @@
</store>
</element>

<element type="combo" scope="shop">
<name>buckaroo_financial_warning</name>
<label lang="de">Consumer Financial Warning</label>
<label lang="en">Consumer Financial Warning</label>
<label lang="nl">Financiële Waarschuwing</label>
<value>all</value>
<description lang="de">Due to the regulations for BNPL methods in The Netherlands you’ll have to warn customers about using a BNPL plan because it can be easy to get into debt. When enabled a warning will be showed in the checkout. Please note that this setting only applies for customers in The Netherlands.</description>
<description lang="en">Due to the regulations for BNPL methods in The Netherlands you’ll have to warn customers about using a BNPL plan because it can be easy to get into debt. When enabled a warning will be showed in the checkout. Please note that this setting only applies for customers in The Netherlands.</description>
<description lang="nl">Vanwege de voorschriften voor achteraf betaalmethoden in Nederland dien je klanten te waarschuwen voor het gebruik van een achteraf betaalmethode omdat het gemakkelijk kan leiden tot schulden. Wanneer deze functie is ingeschakeld, wordt er een waarschuwing weergegeven tijdens het afrekenen. Let op dat deze instelling alleen van toepassing is op klanten in Nederland.</description>
<store>
<option>
<value>all</value>
<label lang="de">All</label>
<label lang="en">All</label>
<label lang="nl">All</label>
</option>
<option>
<value>buckaroo_klarna</value>
<label lang="de">Klarna</label>
<label lang="en">Klarna</label>
<label lang="nl">Klarna</label>
</option>
<option>
<value>buckaroo_afterpayacceptgiro</value>
<label lang="de">Riverty | AfterPay Eenmalige Machtiging</label>
<label lang="en">Riverty | AfterPay Eenmalige Machtiging</label>
<label lang="nl">Riverty | AfterPay Eenmalige Machtiging</label>
</option>
<option>
<value>buckaroo_afterpaydigiaccept</value>
<label lang="de">Riverty | AfterPay Digitale Factuur</label>
<label lang="en">Riverty | AfterPay Digitale Factuur</label>
<label lang="nl">Riverty | AfterPay Digitale Factuur</label>
</option>
<option>
<value>buckaroo_afterpayb2bdigiaccept</value>
<label lang="de">Riverty | AfterPay Digitale Factuur B2B</label>
<label lang="en">Riverty | AfterPay Digitale Factuur B2B</label>
<label lang="nl">Riverty | AfterPay Digitale Factuur B2B</label>
</option>
<option>
<value>buckaroo_afterpaynew</value>
<label lang="de">Riverty | AfterPay</label>
<label lang="en">Riverty | AfterPay</label>
<label lang="nl">Riverty | AfterPay</label>
</option>
<option>
<value>buckaroo_billink</value>
<label lang="de">Billink - achteraf betalen</label>
<label lang="en">Billink - achteraf betalen</label>
<label lang="nl">Billink - achteraf betalen</label>
</option>
</store>
<options>
<multiSelect>true</multiSelect>
</options>
</element>

<element type="select" scope="shop">
<name>buckaroo_ideal_env</name>
<label lang="de">iDEAL</label>
Expand Down
22 changes: 22 additions & 0 deletions Subscriber/CheckoutSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,33 @@ public function onCheckout(Enlight_Event_EventArgs $args)
'paymentKey' => $paymentKey,
'paymentFee' => Helpers::floatToPrice($paymentFee),
'isEncrypted' => $isEncrypted,
'showFinancialWarning' => $this->canShowFinancialWarning($config, $paymentData['name']),
'buckarooExtraFields' => (!empty($userId)) ? $this->loadExtraFields() : null,
'vatId' => $this->session->sOrderVariables['sUserData']['billingaddress']['vatId'] ? $this->session->sOrderVariables['sUserData']['billingaddress']['vatId'] : ''
]);
}

private function canShowFinancialWarning($config, $paymentName)
{
$showOnMethods = $config->getShowFinancialWarningMethods();

$isAll = is_array($showOnMethods) && count($showOnMethods) === 1 && end($showOnMethods) === 'all';

return in_array($paymentName, [
'buckaroo_klarna',
'buckaroo_afterpayacceptgiro',
'buckaroo_afterpaydigiaccept',
'buckaroo_afterpayb2bdigiaccept',
'buckaroo_afterpaynew',
'buckaroo_billink',
]) && (
$isAll || (
is_array($showOnMethods) &&
in_array($paymentName, $showOnMethods)
)
);
}

/**
* @return array
*/
Expand Down
Loading

0 comments on commit b4afb4d

Please sign in to comment.