|
1 | | -import { responseMessage, responseStatus } from './constants/message-response.constant' |
| 1 | +import { responseStatus } from './constants/message-response.constant' |
2 | 2 | import { API_ENDPOINT, METHOD } from './constants/variable.constant' |
3 | 3 | import { IPaytrail } from './interfaces/IPayTrail.interface' |
4 | 4 | import { |
@@ -350,32 +350,26 @@ export class PaytrailClient extends Paytrail implements IPaytrail { |
350 | 350 | } as any |
351 | 351 | } |
352 | 352 |
|
353 | | - try { |
354 | | - const payload = { |
355 | | - checkoutRedirectSuccessUrl: addCardFormRequest.checkoutRedirectSuccessUrl, |
356 | | - checkoutRedirectCancelUrl: addCardFormRequest.checkoutRedirectCancelUrl, |
357 | | - language: addCardFormRequest.language |
358 | | - } |
359 | | - const headers = this.getHeaders(METHOD.POST, null, null, payload) |
360 | | - |
361 | | - // Signature override for add-card-form: Sign Method + Path + Body |
362 | | - // Headers are NOT included in this signature calculation |
363 | | - |
364 | | - const signature = Signature.calculateCustomHmac( |
365 | | - this.secretKey as string, |
366 | | - 'POST', |
367 | | - '/tokenization/addcard-form', |
368 | | - convertObjectKeys(payload) |
369 | | - ) |
370 | | - headers['signature'] = signature |
| 353 | + const payload = { |
| 354 | + checkoutRedirectSuccessUrl: addCardFormRequest.checkoutRedirectSuccessUrl, |
| 355 | + checkoutRedirectCancelUrl: addCardFormRequest.checkoutRedirectCancelUrl, |
| 356 | + language: addCardFormRequest.language |
| 357 | + } |
| 358 | + const headers = this.getHeaders(METHOD.POST, null, null, payload) |
371 | 359 |
|
372 | | - const data = await api.tokenPayments.createAddCardFormRequest(payload, headers) |
| 360 | + // Signature override for add-card-form: Sign Method + Path + Body |
| 361 | + // Headers are NOT included in this signature calculation |
373 | 362 |
|
374 | | - return data as any |
| 363 | + const signature = Signature.calculateCustomHmac( |
| 364 | + this.secretKey as string, |
| 365 | + 'POST', |
| 366 | + '/tokenization/addcard-form', |
| 367 | + convertObjectKeys(payload) |
| 368 | + ) |
| 369 | + headers['signature'] = signature |
375 | 370 |
|
376 | | - return data as any |
377 | | - } catch (error) { |
378 | | - throw error |
379 | | - } |
| 371 | + const data = await api.tokenPayments.createAddCardFormRequest(payload, headers) |
| 372 | + |
| 373 | + return data as any |
380 | 374 | } |
381 | 375 | } |
0 commit comments