diff --git a/src/components/payments.js b/src/components/payments.js index 6a32e0d..0642f59 100644 --- a/src/components/payments.js +++ b/src/components/payments.js @@ -198,7 +198,11 @@ export async function completeKevinAuthentication({ return response; } -export async function createKevinTransaction({secretKey, orderId, bankId}) { +export async function createKevinTransaction({ + secretKey, + orderId, + paymentMethodId, +}) { const response = await server.loadJson( `${Config.apiUrl}${Endpoints.PROJECT.PAYMENTS.TRANSACTIONS.CREATE_KEVIN( orderId @@ -212,7 +216,27 @@ export async function createKevinTransaction({secretKey, orderId, bankId}) { 'Content-Type': 'application/json', }, body: JSON.stringify({ - bankId, + paymentMethodId, + }), + } + ); + + return response; +} + +export async function checkKevinPaymentStatus({secretKey, paymentId}) { + const response = await server.loadJson( + `${Config.apiUrl}${Endpoints.PROJECT.PAYMENTS.TRANSACTIONS.CHECK_KEVIN_STATUS}`, + { + method: 'POST', + headers: { + 'X-CM-ProjectId': Config.projectId, + Authorization: `Bearer ${secretKey || Config.secretKey}`, + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + paymentId, }), } ); diff --git a/src/routes.js b/src/routes.js index 09bb550..b8775d9 100644 --- a/src/routes.js +++ b/src/routes.js @@ -161,6 +161,7 @@ export const CONFIG = { `/v2/payments/orders/${orderId}/paysera/pay`, CREATE_STRIPE: (orderId) => `/v2/payments/orders/${orderId}/stripe/pay`, CREATE_KEVIN: (orderId) => `/v2/payments/orders/${orderId}/kevin/pay`, + CHECK_KEVIN_STATUS: '/v2/payments/orders/kevin/payment/status', }, DISCOUNTS: { CREATE_DISCOUNT: '/v2/payments/discounts',