diff --git a/app/controllers/api/stripe_controller.rb b/app/controllers/api/stripe_controller.rb index 533332663..b4924af97 100644 --- a/app/controllers/api/stripe_controller.rb +++ b/app/controllers/api/stripe_controller.rb @@ -30,7 +30,7 @@ class API::StripeController < API::PaymentsController currency: Setting.get('stripe_currency'), confirmation_method: 'manual', confirm: true, - customer: current_user.payment_gateway_object.gateway_object_id + customer: cart.customer.payment_gateway_object.gateway_object_id }, { api_key: Setting.get('stripe_secret_key') } ) elsif params[:payment_intent_id].present? diff --git a/app/frontend/src/javascript/components/payment/abstract-payment-modal.tsx b/app/frontend/src/javascript/components/payment/abstract-payment-modal.tsx index 5fe8d739a..b5e06d90f 100644 --- a/app/frontend/src/javascript/components/payment/abstract-payment-modal.tsx +++ b/app/frontend/src/javascript/components/payment/abstract-payment-modal.tsx @@ -46,6 +46,7 @@ interface AbstractPaymentModalProps { formClassName?: string, title?: string, preventCgv?: boolean, + preventScheduleInfo?: boolean, modalSize?: ModalSize, } @@ -55,7 +56,7 @@ interface AbstractPaymentModalProps { * This component must not be called directly but must be extended for each implemented payment gateway * @see https://reactjs.org/docs/composition-vs-inheritance.html */ -export const AbstractPaymentModal: React.FC = ({ isOpen, toggleModal, afterSuccess, cart, currentUser, schedule, customer, logoFooter, GatewayForm, formId, className, formClassName, title, preventCgv, modalSize }) => { +export const AbstractPaymentModal: React.FC = ({ isOpen, toggleModal, afterSuccess, cart, currentUser, schedule, customer, logoFooter, GatewayForm, formId, className, formClassName, title, preventCgv, preventScheduleInfo, modalSize }) => { // customer's wallet const [wallet, setWallet] = useState(null); // server-computed price with all details @@ -129,10 +130,10 @@ export const AbstractPaymentModal: React.FC = ({ isOp } /** - * Check if we are currently creating a payment schedule + * Check if we must display the info box about the payment schedule */ - const isPaymentSchedule = (): boolean => { - return schedule !== undefined; + const hasPaymentScheduleInfo = (): boolean => { + return schedule !== undefined && !preventScheduleInfo; } /** @@ -202,7 +203,7 @@ export const AbstractPaymentModal: React.FC = ({ isOp {hasErrors() &&
{errors}
} - {isPaymentSchedule() &&
+ {hasPaymentScheduleInfo() &&
} {hasCgv() &&
@@ -233,5 +234,6 @@ export const AbstractPaymentModal: React.FC = ({ isOp AbstractPaymentModal.defaultProps = { title: 'app.shared.payment.online_payment', preventCgv: false, + preventScheduleInfo: false, modalSize: ModalSize.medium }; diff --git a/app/frontend/src/javascript/components/payment/local-payment/local-payment-form.tsx b/app/frontend/src/javascript/components/payment/local-payment/local-payment-form.tsx index 220d489ad..a031b6e8f 100644 --- a/app/frontend/src/javascript/components/payment/local-payment/local-payment-form.tsx +++ b/app/frontend/src/javascript/components/payment/local-payment/local-payment-form.tsx @@ -103,10 +103,12 @@ export const LocalPaymentForm: React.FC = ({ onSubmit, onSucce {!paymentSchedule &&

{t('app.admin.local_payment.about_to_cash')}

} {paymentSchedule &&
+