[FIX] payment_stripe: partner info is not mandatory
Before this commit, when accessing the payment page with arbitrary amount (/website_payment/pay?reference=Testinvoice&amount=150.0¤cy_id=6&country_id=) A traceback was thrown because the keys concerning the partner were not present in the dictionary that prepares the values for the form that we send to Stripe Considering that those info are not mandatory for stripe (although not very good practice -- the more info the better to verify an identity) we ignore them if not present After this commit, the public route works fine OPW 1832164 closes #23948
This commit is contained in:
@@ -40,16 +40,16 @@ class PaymentAcquirerStripe(models.Model):
|
||||
stripe_tx_values = dict(tx_values)
|
||||
temp_stripe_tx_values = {
|
||||
'company': self.company_id.name,
|
||||
'amount': tx_values.get('amount'),
|
||||
'currency': tx_values.get('currency') and tx_values.get('currency').name or '',
|
||||
'currency_id': tx_values.get('currency') and tx_values.get('currency').id or '',
|
||||
'address_line1': tx_values['partner_address'],
|
||||
'address_city': tx_values['partner_city'],
|
||||
'address_country': tx_values['partner_country'] and tx_values['partner_country'].name or '',
|
||||
'email': tx_values['partner_email'],
|
||||
'address_zip': tx_values['partner_zip'],
|
||||
'name': tx_values['partner_name'],
|
||||
'phone': tx_values['partner_phone'],
|
||||
'amount': tx_values['amount'], # Mandatory
|
||||
'currency': tx_values['currency'].name, # Mandatory anyway
|
||||
'currency_id': tx_values['currency'].id, # same here
|
||||
'address_line1': tx_values.get('partner_address'), # Any info of the partner is not mandatory
|
||||
'address_city': tx_values.get('partner_city'),
|
||||
'address_country': tx_values.get('partner_country') and tx_values.get('partner_country').name or '',
|
||||
'email': tx_values.get('partner_email'),
|
||||
'address_zip': tx_values.get('partner_zip'),
|
||||
'name': tx_values.get('partner_name'),
|
||||
'phone': tx_values.get('partner_phone'),
|
||||
}
|
||||
|
||||
temp_stripe_tx_values['returndata'] = stripe_tx_values.pop('return_url', '')
|
||||
|
||||
Reference in New Issue
Block a user