@commercetools/connect-payments-sdk 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/api/hooks/jwt-auth.hook.d.ts +0 -1
- package/dist/api/hooks/oauth2-auth.hook.d.ts +0 -1
- package/dist/api/hooks/session-header-auth.hook.d.ts +0 -1
- package/dist/api/hooks/session-query-param-auth.hook.d.ts +0 -1
- package/dist/api/hooks/types/hook.type.d.ts +0 -1
- package/dist/commercetools/services/ct-payment.service.js +11 -3
- package/dist/fetch/decorators/base.decorator.d.ts +0 -2
- package/dist/fetch/decorators/monitoring.decorator.d.ts +0 -2
- package/dist/fetch/types/fetch.type.d.ts +0 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -24,7 +24,11 @@ class DefaultPaymentService {
|
|
|
24
24
|
for (let retries = 0; retries < maxRetries; retries++) {
|
|
25
25
|
const payment = await this.getPayment({ id: opts.id });
|
|
26
26
|
const actions = this.consolidateUpdateActions(payment, opts);
|
|
27
|
-
this.logger.info({ paymentId: payment.id, actions }, 'Updating payment with actions');
|
|
27
|
+
this.logger.info({ paymentId: payment.id, paymentVersion: payment.version, actions, retries }, 'Updating payment with actions');
|
|
28
|
+
if (actions.length === 0) {
|
|
29
|
+
this.logger.info({ paymentId: payment.id, paymentVersion: payment.version, retries }, 'Update payment skipped, no actions to perform');
|
|
30
|
+
return payment;
|
|
31
|
+
}
|
|
28
32
|
try {
|
|
29
33
|
const updatedPayment = await this.ctAPI.payment.updatePayment({
|
|
30
34
|
resource: {
|
|
@@ -37,10 +41,14 @@ class DefaultPaymentService {
|
|
|
37
41
|
}
|
|
38
42
|
catch (e) {
|
|
39
43
|
err = e;
|
|
40
|
-
if (e instanceof ct_api_error_1.CommercetoolsAPIError &&
|
|
44
|
+
if (e instanceof ct_api_error_1.CommercetoolsAPIError &&
|
|
45
|
+
(e.httpErrorStatus === 409 ||
|
|
46
|
+
(e.httpErrorStatus === 400 && e.message.includes('already used without setting a payment interface')))) {
|
|
47
|
+
this.logger.warn({ paymentId: payment.id, paymentVersion: payment.version, retries, err }, 'Unable to update the payment, retrying');
|
|
41
48
|
retries++;
|
|
42
49
|
}
|
|
43
50
|
else {
|
|
51
|
+
this.logger.error({ paymentId: payment.id, paymentVersion: payment.version, retries, err }, 'Unable to update the payment, abort');
|
|
44
52
|
throw e;
|
|
45
53
|
}
|
|
46
54
|
}
|
|
@@ -52,7 +60,7 @@ class DefaultPaymentService {
|
|
|
52
60
|
if (!payment.interfaceId && updateInfo.pspReference) {
|
|
53
61
|
actions.push(this.populateSetInterfaceIdAction(updateInfo.pspReference));
|
|
54
62
|
}
|
|
55
|
-
if (!payment.paymentMethodInfo
|
|
63
|
+
if (!payment.paymentMethodInfo?.method && updateInfo.paymentMethod) {
|
|
56
64
|
actions.push(this.populateSetPaymentMethod(updateInfo.paymentMethod));
|
|
57
65
|
}
|
|
58
66
|
if (updateInfo.transaction) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools/connect-payments-sdk",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Payment SDK for commercetools payment connectors",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
],
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@commercetools-backend/loggers": "22.
|
|
18
|
+
"@commercetools-backend/loggers": "22.29.0",
|
|
19
19
|
"@commercetools/platform-sdk": "7.9.0",
|
|
20
20
|
"@commercetools/sdk-client-v2": "2.5.0",
|
|
21
21
|
"jsonwebtoken": "9.0.2",
|