diff --git a/src/components/payments.js b/src/components/payments.js index df897c7..6a32e0d 100644 --- a/src/components/payments.js +++ b/src/components/payments.js @@ -173,6 +173,31 @@ export async function startKevinAuthentication({secretKey, accountId, bankId}) { return response; } +export async function completeKevinAuthentication({ + secretKey, + requestId, + authorizationCode, +}) { + const response = await server.loadJson( + `${Config.apiUrl}${Endpoints.PROJECT.PAYMENTS.AUTHENTICATION.AUTHENTICATE_KEVIN_TOKEN}`, + { + method: 'POST', + headers: { + 'X-CM-ProjectId': Config.projectId, + Authorization: `Bearer ${secretKey || Config.secretKey}`, + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + requestId, + authorizationCode, + }), + } + ); + + return response; +} + export async function createKevinTransaction({secretKey, orderId, bankId}) { const response = await server.loadJson( `${Config.apiUrl}${Endpoints.PROJECT.PAYMENTS.TRANSACTIONS.CREATE_KEVIN( diff --git a/src/routes.js b/src/routes.js index 0ea554b..09bb550 100644 --- a/src/routes.js +++ b/src/routes.js @@ -154,6 +154,7 @@ export const CONFIG = { }, AUTHENTICATION: { AUTHENTICATE_KEVIN: '/v2/payments/auth/kevin', + AUTHENTICATE_KEVIN_TOKEN: '/v2/payments/auth/kevin/token', }, TRANSACTIONS: { CREATE_PAYSERA: (orderId) =>