Skip to content

Commit 472b234

Browse files
author
meow12
authored
feat(iam and payments): phone users, kevin payments (#81)
* feat(iam and payments): phone users, kevin payments allow to register users by phone, added kevin payment provider * Update payments.js
1 parent 32913fa commit 472b234

File tree

3 files changed

+107
-0
lines changed

3 files changed

+107
-0
lines changed

src/components/iam.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,66 @@ export async function registerGuest({
131131
return response;
132132
}
133133

134+
export async function registerPhoneUser({
135+
secretKey,
136+
phone,
137+
email,
138+
displayName,
139+
firstName,
140+
lastName,
141+
meta,
142+
language,
143+
timeZone,
144+
subscribeToNews,
145+
country,
146+
countryCode,
147+
area,
148+
city,
149+
address,
150+
address2,
151+
company,
152+
companyCode,
153+
postalCode,
154+
gender,
155+
birthDate,
156+
}) {
157+
const response = await server.loadJson(
158+
`${Config.apiUrl}${Endpoints.PROJECT.MEMBERSHIP.USERS.REGISTER_PHONE_USER}`,
159+
{
160+
method: 'POST',
161+
headers: {
162+
'X-CM-ProjectId': Config.projectId,
163+
Authorization: `Bearer ${secretKey || Config.secretKey}`,
164+
Accept: 'application/json',
165+
'Content-Type': 'application/json',
166+
},
167+
body: JSON.stringify({
168+
phone,
169+
email,
170+
displayName,
171+
firstName,
172+
lastName,
173+
meta: objectOrStringToString(meta),
174+
language,
175+
timeZone,
176+
subscribeToNews,
177+
country,
178+
countryCode,
179+
area,
180+
city,
181+
address,
182+
address2,
183+
company,
184+
companyCode,
185+
postalCode,
186+
gender,
187+
birthDate,
188+
}),
189+
}
190+
);
191+
return response;
192+
}
193+
134194
export async function invite({
135195
secretKey,
136196
email,

src/components/payments.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,48 @@ export async function createStripeTransaction({
152152
return response;
153153
}
154154

155+
export async function startKevinAuthentication({secretKey, bankId}) {
156+
const response = await server.loadJson(
157+
`${Config.apiUrl}${Endpoints.PROJECT.PAYMENTS.AUTHENTICATION.AUTHENTICATE_KEVIN}`,
158+
{
159+
method: 'POST',
160+
headers: {
161+
'X-CM-ProjectId': Config.projectId,
162+
Authorization: `Bearer ${secretKey || Config.secretKey}`,
163+
Accept: 'application/json',
164+
'Content-Type': 'application/json',
165+
},
166+
body: JSON.stringify({
167+
bankId,
168+
}),
169+
}
170+
);
171+
172+
return response;
173+
}
174+
175+
export async function createKevinTransaction({secretKey, orderId, bankId}) {
176+
const response = await server.loadJson(
177+
`${Config.apiUrl}${Endpoints.PROJECT.PAYMENTS.TRANSACTIONS.CREATE_KEVIN(
178+
orderId
179+
)}`,
180+
{
181+
method: 'POST',
182+
headers: {
183+
'X-CM-ProjectId': Config.projectId,
184+
Authorization: `Bearer ${secretKey || Config.secretKey}`,
185+
Accept: 'application/json',
186+
'Content-Type': 'application/json',
187+
},
188+
body: JSON.stringify({
189+
bankId,
190+
}),
191+
}
192+
);
193+
194+
return response;
195+
}
196+
155197
export async function createCustomer({
156198
secretKey,
157199
accountId,

src/routes.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export const CONFIG = {
107107
USERS: {
108108
REGISTER: '/v2/membership/users/register',
109109
REGISTER_GUEST: '/v2/membership/users/register/guest',
110+
REGISTER_PHONE_USER: '/v2/membership/users/register/phone',
110111
INVITE: '/v2/membership/users/invite',
111112
UPDATE: (id) => `/v2/membership/users/${id}`,
112113
UPDATE_PROFILE: '/v2/membership/users/profile',
@@ -151,10 +152,14 @@ export const CONFIG = {
151152
GET_ALL: '/v2/payments/orders',
152153
CREATE: '/v2/payments/orders',
153154
},
155+
AUTHENTICATION: {
156+
AUTHENTICATE_KEVIN: '/v2/payments/auth/kevin',
157+
},
154158
TRANSACTIONS: {
155159
CREATE_PAYSERA: (orderId) =>
156160
`/v2/payments/orders/${orderId}/paysera/pay`,
157161
CREATE_STRIPE: (orderId) => `/v2/payments/orders/${orderId}/stripe/pay`,
162+
CREATE_KEVIN: (orderId) => `/v2/payments/orders/${orderId}/kevin/pay`,
158163
},
159164
DISCOUNTS: {
160165
CREATE_DISCOUNT: '/v2/payments/discounts',

0 commit comments

Comments
 (0)