1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-30 19:52:20 +01:00

Merge branch 'hotfix' for release 4.7.12

This commit is contained in:
Sylvain 2021-06-09 19:33:27 +02:00
commit ccc99e9288
4 changed files with 16 additions and 4 deletions

View File

@ -1,5 +1,9 @@
# Changelog Fab-manager # Changelog Fab-manager
## v4.7.12 2021 June 09
- Fix a bug: unable to process stripe payments
## v4.7.11 2021 May 26 ## v4.7.11 2021 May 26
- Updated ffi to 1.15.1 - Updated ffi to 1.15.1

View File

@ -3,7 +3,7 @@ import { AxiosResponse } from 'axios';
import { CartItems, IntentConfirmation, PaymentConfirmation, UpdateCardResponse } from '../models/payment'; import { CartItems, IntentConfirmation, PaymentConfirmation, UpdateCardResponse } from '../models/payment';
export default class PaymentAPI { export default class PaymentAPI {
static async confirm (stp_payment_method_id: string, cart_items: CartItems): Promise<PaymentConfirmation> { static async confirmMethod (stp_payment_method_id: string, cart_items: CartItems): Promise<PaymentConfirmation> {
const res: AxiosResponse = await apiClient.post(`/api/payments/confirm_payment`, { const res: AxiosResponse = await apiClient.post(`/api/payments/confirm_payment`, {
payment_method_id: stp_payment_method_id, payment_method_id: stp_payment_method_id,
cart_items cart_items
@ -11,6 +11,14 @@ export default class PaymentAPI {
return res?.data; return res?.data;
} }
static async confirmIntent (stp_payment_intent_id: string, cart_items: CartItems): Promise<PaymentConfirmation> {
const res: AxiosResponse = await apiClient.post(`/api/payments/confirm_payment`, {
payment_intent_id: stp_payment_intent_id,
cart_items
});
return res?.data;
}
static async setupIntent (user_id: number): Promise<IntentConfirmation> { static async setupIntent (user_id: number): Promise<IntentConfirmation> {
const res: AxiosResponse = await apiClient.get(`/api/payments/setup_intent/${user_id}`); const res: AxiosResponse = await apiClient.get(`/api/payments/setup_intent/${user_id}`);
return res?.data; return res?.data;

View File

@ -52,7 +52,7 @@ export const StripeForm: React.FC<StripeFormProps> = ({ onSubmit, onSuccess, onE
try { try {
if (!paymentSchedule) { if (!paymentSchedule) {
// process the normal payment pipeline, including SCA validation // process the normal payment pipeline, including SCA validation
const res = await PaymentAPI.confirm(paymentMethod.id, cartItems); const res = await PaymentAPI.confirmMethod(paymentMethod.id, cartItems);
await handleServerConfirmation(res); await handleServerConfirmation(res);
} else { } else {
// we start by associating the payment method with the user // we start by associating the payment method with the user
@ -107,7 +107,7 @@ export const StripeForm: React.FC<StripeFormProps> = ({ onSubmit, onSuccess, onE
// The card action has been handled // The card action has been handled
// The PaymentIntent can be confirmed again on the server // The PaymentIntent can be confirmed again on the server
try { try {
const confirmation = await PaymentAPI.confirm(result.paymentIntent.id, cartItems); const confirmation = await PaymentAPI.confirmIntent(result.paymentIntent.id, cartItems);
await handleServerConfirmation(confirmation); await handleServerConfirmation(confirmation);
} catch (e) { } catch (e) {
onError(e); onError(e);

View File

@ -1,6 +1,6 @@
{ {
"name": "fab-manager", "name": "fab-manager",
"version": "4.7.11", "version": "4.7.12",
"description": "Fab-manager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.", "description": "Fab-manager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.",
"keywords": [ "keywords": [
"fablab", "fablab",