1) Add default filter to list view of payment methods. 2) Raise UserError when the user activates a PM linked to only disabled providers. 3) Activate default PMs with the activation of the provider. 4) Disable PMs linked to only disabled providers. 5) Add multi editing to list view of PMs. task-3557315 closes odoo/odoo#139641 closes odoo/odoo#140084 Related: odoo/enterprise#49551 Related: odoo/enterprise#49729 Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
105 lines
2.4 KiB
Python
105 lines
2.4 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 codes of the payment methods to activate when Stripe is activated.
|
|
DEFAULT_PAYMENT_METHODS_CODES = [
|
|
# Primary payment methods.
|
|
'card',
|
|
'paypal',
|
|
'bancontact',
|
|
'ideal',
|
|
# Brand payment methods.
|
|
'visa',
|
|
'mastercard',
|
|
'amex',
|
|
'discover',
|
|
]
|
|
|
|
# Mapping of payment method codes to Stripe codes.
|
|
PAYMENT_METHODS_MAPPING = {
|
|
'ach_direct_debit': 'us_bank_account',
|
|
'bacs_direct_debit': 'bacs_debit',
|
|
'becs_direct_debit': 'au_becs_debit',
|
|
'afterpay': 'afterpay_clearpay',
|
|
'clearpay': 'afterpay_clearpay',
|
|
}
|
|
|
|
# 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',
|
|
}
|