Skip to content

Commit 9a4992f

Browse files
author
meow12
authored
feat(payments): additional kevin methods (#84)
additional kevin methods
1 parent 818ea18 commit 9a4992f

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

src/components/payments.js

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ export async function completeKevinAuthentication({
198198
return response;
199199
}
200200

201-
export async function createKevinTransaction({secretKey, orderId, bankId}) {
201+
export async function createKevinTransaction({
202+
secretKey,
203+
orderId,
204+
paymentMethodId,
205+
}) {
202206
const response = await server.loadJson(
203207
`${Config.apiUrl}${Endpoints.PROJECT.PAYMENTS.TRANSACTIONS.CREATE_KEVIN(
204208
orderId
@@ -212,7 +216,27 @@ export async function createKevinTransaction({secretKey, orderId, bankId}) {
212216
'Content-Type': 'application/json',
213217
},
214218
body: JSON.stringify({
215-
bankId,
219+
paymentMethodId,
220+
}),
221+
}
222+
);
223+
224+
return response;
225+
}
226+
227+
export async function checkKevinPaymentStatus({secretKey, paymentId}) {
228+
const response = await server.loadJson(
229+
`${Config.apiUrl}${Endpoints.PROJECT.PAYMENTS.TRANSACTIONS.CHECK_KEVIN_STATUS}`,
230+
{
231+
method: 'POST',
232+
headers: {
233+
'X-CM-ProjectId': Config.projectId,
234+
Authorization: `Bearer ${secretKey || Config.secretKey}`,
235+
Accept: 'application/json',
236+
'Content-Type': 'application/json',
237+
},
238+
body: JSON.stringify({
239+
paymentId,
216240
}),
217241
}
218242
);

src/routes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ export const CONFIG = {
161161
`/v2/payments/orders/${orderId}/paysera/pay`,
162162
CREATE_STRIPE: (orderId) => `/v2/payments/orders/${orderId}/stripe/pay`,
163163
CREATE_KEVIN: (orderId) => `/v2/payments/orders/${orderId}/kevin/pay`,
164+
CHECK_KEVIN_STATUS: '/v2/payments/orders/kevin/payment/status',
164165
},
165166
DISCOUNTS: {
166167
CREATE_DISCOUNT: '/v2/payments/discounts',

0 commit comments

Comments
 (0)