From ca69c82273a8a0df8f4b895d01b56e6e8a4416cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 21 Jun 2024 14:29:26 +0200 Subject: [PATCH] Add Stripe pull button to payment This may be useful if events have been missed. --- modules/account_payment_stripe/CHANGELOG | 1 + modules/account_payment_stripe/payment.py | 12 ++++++++++++ modules/account_payment_stripe/payment.xml | 6 ++++++ modules/account_payment_stripe/view/payment_form.xml | 1 + 4 files changed, 20 insertions(+) diff --git a/modules/account_payment_stripe/CHANGELOG b/modules/account_payment_stripe/CHANGELOG index ad4600d84e..140b9876e6 100644 --- a/modules/account_payment_stripe/CHANGELOG +++ b/modules/account_payment_stripe/CHANGELOG @@ -1,3 +1,4 @@ +* Add Stripe pull button to payment * Warn when changing credential Version 7.2.0 - 2024-04-29 diff --git a/modules/account_payment_stripe/payment.py b/modules/account_payment_stripe/payment.py index e0475b1a6e..48840a26d4 100644 --- a/modules/account_payment_stripe/payment.py +++ b/modules/account_payment_stripe/payment.py @@ -250,6 +250,13 @@ class Payment(StripeCustomerMethodMixin, CheckoutMixin, metaclass=PoolMeta): | ~Eval('stripe_capture_needed')), 'depends': ['state', 'stripe_capture_needed'], }, + 'stripe_do_pull': { + 'invisible': ( + ~Eval('stripe_charge_id') + & ~Eval('stripe_payment_intent_id')), + 'depends': [ + 'stripe_charge_id', 'stripe_payment_intent_id'], + }, }) @classmethod @@ -652,6 +659,11 @@ class Payment(StripeCustomerMethodMixin, CheckoutMixin, metaclass=PoolMeta): stripe.error.APIConnectionError) as e: logger.warning(str(e)) + @classmethod + @ModelView.button + def stripe_do_pull(cls, payments): + cls.stripe_pull(payments) + @classmethod def stripe_pull(cls, payments): "Update payments with Stripe charges" diff --git a/modules/account_payment_stripe/payment.xml b/modules/account_payment_stripe/payment.xml index 86ec4974c3..be4eec4c86 100644 --- a/modules/account_payment_stripe/payment.xml +++ b/modules/account_payment_stripe/payment.xml @@ -215,6 +215,12 @@ this repository contains the full copyright notices and license terms. --> Stripe Capture + + account.payment + stripe_do_pull + Stripe Pull + + account.payment.stripe.customer form diff --git a/modules/account_payment_stripe/view/payment_form.xml b/modules/account_payment_stripe/view/payment_form.xml index f914ad7bba..2be1ba186f 100644 --- a/modules/account_payment_stripe/view/payment_form.xml +++ b/modules/account_payment_stripe/view/payment_form.xml @@ -5,6 +5,7 @@ this repository contains the full copyright notices and license terms. -->