Skip to content

Commit f1a5e31

Browse files
author
meow12
authored
refactor(payments): decta transactions (#92)
allow decta transactions
1 parent 6bc951e commit f1a5e31

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/components/payments.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,34 @@ export async function checkKevinPaymentStatus({secretKey, paymentId}) {
246246
return response;
247247
}
248248

249+
export async function createDectaTransaction({
250+
secretKey,
251+
orderId,
252+
customerId,
253+
chargeCard,
254+
}) {
255+
const response = await server.loadJson(
256+
`${Config.apiUrl}${Endpoints.PROJECT.PAYMENTS.TRANSACTIONS.CREATE_DECTA(
257+
orderId
258+
)}`,
259+
{
260+
method: 'POST',
261+
headers: {
262+
'X-CM-ProjectId': Config.projectId,
263+
Authorization: `Bearer ${secretKey || Config.secretKey}`,
264+
Accept: 'application/json',
265+
'Content-Type': 'application/json',
266+
},
267+
body: JSON.stringify({
268+
customerId,
269+
chargeCard,
270+
}),
271+
}
272+
);
273+
274+
return response;
275+
}
276+
249277
export async function createCustomer({
250278
secretKey,
251279
accountId,

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+
CREATE_DECTA: (orderId) => `/v2/payments/orders/${orderId}/decta/pay`,
164165
CHECK_KEVIN_STATUS: '/v2/payments/orders/kevin/payment/status',
165166
},
166167
DISCOUNTS: {

0 commit comments

Comments
 (0)