diff --git a/src/components/iam.js b/src/components/iam.js index 83a6939..5f6c019 100644 --- a/src/components/iam.js +++ b/src/components/iam.js @@ -131,6 +131,66 @@ export async function registerGuest({ return response; } +export async function registerPhoneUser({ + secretKey, + phone, + email, + displayName, + firstName, + lastName, + meta, + language, + timeZone, + subscribeToNews, + country, + countryCode, + area, + city, + address, + address2, + company, + companyCode, + postalCode, + gender, + birthDate, +}) { + const response = await server.loadJson( + `${Config.apiUrl}${Endpoints.PROJECT.MEMBERSHIP.USERS.REGISTER_PHONE_USER}`, + { + method: 'POST', + headers: { + 'X-CM-ProjectId': Config.projectId, + Authorization: `Bearer ${secretKey || Config.secretKey}`, + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + phone, + email, + displayName, + firstName, + lastName, + meta: objectOrStringToString(meta), + language, + timeZone, + subscribeToNews, + country, + countryCode, + area, + city, + address, + address2, + company, + companyCode, + postalCode, + gender, + birthDate, + }), + } + ); + return response; +} + export async function invite({ secretKey, email, diff --git a/src/components/payments.js b/src/components/payments.js index ab629e6..f6ccb48 100644 --- a/src/components/payments.js +++ b/src/components/payments.js @@ -152,6 +152,48 @@ export async function createStripeTransaction({ return response; } +export async function startKevinAuthentication({secretKey, bankId}) { + const response = await server.loadJson( + `${Config.apiUrl}${Endpoints.PROJECT.PAYMENTS.AUTHENTICATION.AUTHENTICATE_KEVIN}`, + { + method: 'POST', + headers: { + 'X-CM-ProjectId': Config.projectId, + Authorization: `Bearer ${secretKey || Config.secretKey}`, + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + bankId, + }), + } + ); + + return response; +} + +export async function createKevinTransaction({secretKey, orderId, bankId}) { + const response = await server.loadJson( + `${Config.apiUrl}${Endpoints.PROJECT.PAYMENTS.TRANSACTIONS.CREATE_KEVIN( + orderId + )}`, + { + method: 'POST', + headers: { + 'X-CM-ProjectId': Config.projectId, + Authorization: `Bearer ${secretKey || Config.secretKey}`, + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + bankId, + }), + } + ); + + return response; +} + export async function createCustomer({ secretKey, accountId, diff --git a/src/routes.js b/src/routes.js index 23e8470..0ea554b 100644 --- a/src/routes.js +++ b/src/routes.js @@ -107,6 +107,7 @@ export const CONFIG = { USERS: { REGISTER: '/v2/membership/users/register', REGISTER_GUEST: '/v2/membership/users/register/guest', + REGISTER_PHONE_USER: '/v2/membership/users/register/phone', INVITE: '/v2/membership/users/invite', UPDATE: (id) => `/v2/membership/users/${id}`, UPDATE_PROFILE: '/v2/membership/users/profile', @@ -151,10 +152,14 @@ export const CONFIG = { GET_ALL: '/v2/payments/orders', CREATE: '/v2/payments/orders', }, + AUTHENTICATION: { + AUTHENTICATE_KEVIN: '/v2/payments/auth/kevin', + }, TRANSACTIONS: { CREATE_PAYSERA: (orderId) => `/v2/payments/orders/${orderId}/paysera/pay`, CREATE_STRIPE: (orderId) => `/v2/payments/orders/${orderId}/stripe/pay`, + CREATE_KEVIN: (orderId) => `/v2/payments/orders/${orderId}/kevin/pay`, }, DISCOUNTS: { CREATE_DISCOUNT: '/v2/payments/discounts',