The Reserve Bank of India (RBI) issued a directive (amended subsequently
in December 2020 and March 2021) that introduces additional security
measures for recurring payments on India-issued cards. These measures
include:
- Banks must register cardholders and create an e-mandate through a
one-time process, using additional factor authentication (AFA)
like 3D Secure (3DS).
- Banks must alert cardholders at least 24 hours before charges take
place and give them the ability to opt out of transactions.
- Recurring transactions over 15,000 INR (or equivalent in other
currencies) must go through AFA each time.
Stripe has worked with a partner platform to support that, but we must
manipulate the PaymentIntent and SetupIntent objects directly through
their dedicated API, which the Checkout API does not allow. Therefore,
we must now integrate with the Elements API and implement a direct
payment flow instead of the current payment with a redirection flow
powered by the Checkout API.
After this commit, Stripe will create an e-Mandate for every
Indian-based card newly saved in Odoo.
task-3322020
closes odoo/odoo#123573
Related: odoo/documentation#4719
Related: odoo/upgrade#4748
Related: odoo/enterprise#42196
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
120 lines
2.8 KiB
Python
120 lines
2.8 KiB
Python
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
API_VERSION = '2019-05-16' # The API version of Stripe implemented in this module
|
|
|
|
# Stripe proxy URL
|
|
PROXY_URL = 'https://stripe.api.odoo.com/api/stripe/'
|
|
|
|
# The payment methods for which Stripe supports tokenization.
|
|
# See https://stripe.com/docs/payments/payment-methods/integration-options.
|
|
PAYMENT_METHODS_TOKENIZATION_SUPPORT = {
|
|
'acss_debit': True,
|
|
'affirm': False,
|
|
'afterpay_clearpay': False,
|
|
'alipay': False,
|
|
'apple_pay': True,
|
|
'au_becs_debit': True,
|
|
'bacs_debit': False, # Stripe doesn't support saving BACS with setupIntent.
|
|
'bancontact': True,
|
|
'blik': False,
|
|
'boleto': True,
|
|
'card': True,
|
|
'cashapp': True,
|
|
'customer_balance': False,
|
|
'eps': False,
|
|
'fpx': False,
|
|
'giropay': False,
|
|
'google_pay': True,
|
|
'grabpay': False,
|
|
'ideal': True,
|
|
'klarna': False,
|
|
'konbini': False,
|
|
'link': True,
|
|
'mobilepay': False,
|
|
'oxxo': False,
|
|
'p24': False,
|
|
'paynow': False,
|
|
'paypal': True,
|
|
'promptpay': False,
|
|
'sepa_debit': True,
|
|
'sofort': True,
|
|
'us_bank_account': True,
|
|
'wechat_pay': False,
|
|
'zip': False,
|
|
}
|
|
|
|
# Mapping of transaction states to Stripe objects ({Payment,Setup}Intent, Refund) statuses.
|
|
# For each object's exhaustive status list, see:
|
|
# https://stripe.com/docs/api/payment_intents/object#payment_intent_object-status
|
|
# https://stripe.com/docs/api/setup_intents/object#setup_intent_object-status
|
|
# https://stripe.com/docs/api/refunds/object#refund_object-status
|
|
STATUS_MAPPING = {
|
|
'draft': ('requires_confirmation', 'requires_action'),
|
|
'pending': ('processing', 'pending'),
|
|
'authorized': ('requires_capture',),
|
|
'done': ('succeeded',),
|
|
'cancel': ('canceled',),
|
|
'error': ('requires_payment_method', 'failed',),
|
|
}
|
|
|
|
# Events which are handled by the webhook
|
|
HANDLED_WEBHOOK_EVENTS = [
|
|
'payment_intent.processing',
|
|
'payment_intent.amount_capturable_updated',
|
|
'payment_intent.succeeded',
|
|
'payment_intent.payment_failed',
|
|
'setup_intent.succeeded',
|
|
'charge.refunded', # A refund has been issued.
|
|
'charge.refund.updated', # The refund status has changed, possibly from succeeded to failed.
|
|
]
|
|
|
|
# The countries supported by Stripe. See https://stripe.com/global page.
|
|
SUPPORTED_COUNTRIES = {
|
|
'AE',
|
|
'AT',
|
|
'AU',
|
|
'BE',
|
|
'BG',
|
|
'BR',
|
|
'CA',
|
|
'CH',
|
|
'CY',
|
|
'CZ',
|
|
'DE',
|
|
'DK',
|
|
'EE',
|
|
'ES',
|
|
'FI',
|
|
'FR',
|
|
'GB',
|
|
'GI', # Beta
|
|
'GR',
|
|
'HK',
|
|
'HR', # Beta
|
|
'HU',
|
|
'ID', # Beta
|
|
'IE',
|
|
'IT',
|
|
'JP',
|
|
'LI', # Beta
|
|
'LT',
|
|
'LU',
|
|
'LV',
|
|
'MT',
|
|
'MX',
|
|
'MY',
|
|
'NL',
|
|
'NO',
|
|
'NZ',
|
|
'PH', # Beta
|
|
'PL',
|
|
'PT',
|
|
'RO',
|
|
'SE',
|
|
'SG',
|
|
'SI',
|
|
'SK',
|
|
'TH', # Beta
|
|
'US',
|
|
}
|