[FIX] payment_stripe: iDEAL payments

closes odoo/odoo#50546

X-original-commit: 29b3b67a168b905a72be36ef14ff428c9771a40a
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
This commit is contained in:
Damien Bouvy
2020-05-04 09:12:37 +00:00
parent db1cabc7ee
commit 3b80166e6d
+8 -2
View File
@@ -40,7 +40,7 @@ class PaymentAcquirerStripe(models.Model):
base_url = self.get_base_url()
stripe_session_data = {
'payment_method_types[]': 'card',
'payment_method_types[0]': 'card',
'line_items[][amount]': int(tx_values['amount'] if tx_values['currency'].name in INT_CURRENCIES else float_round(tx_values['amount'] * 100, 2)),
'line_items[][currency]': tx_values['currency'].name,
'line_items[][quantity]': 1,
@@ -51,6 +51,9 @@ class PaymentAcquirerStripe(models.Model):
'payment_intent_data[description]': tx_values['reference'],
'customer_email': tx_values.get('partner_email') or tx_values.get('billing_partner_email'),
}
if tx_values.get('billing_partner_country').code.lower() == 'nl' and tx_values.get('currency').name.lower() == 'eur':
# enable iDEAL for NL-based customers (€ payments only)
stripe_session_data['payment_method_types[1]'] = 'ideal'
tx_values['session_id'] = self._create_stripe_session(stripe_session_data)
return tx_values
@@ -104,7 +107,10 @@ class PaymentAcquirerStripe(models.Model):
@api.model
def stripe_s2s_form_process(self, data):
last4 = data.get('card', {}).get('last4')
if not data.get('card'):
# can't save the token if it's not a card (e.g. iDEAL)
return self.env['payment.token']
last4 = data.get('card').get('last4')
if not last4:
# PM was created with a setup intent, need to get last4 digits through
# yet another call -_-