@commercetools/connect-payments-sdk 0.19.0 → 0.20.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
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @commercetools/connect-payments-sdk
|
|
2
2
|
|
|
3
|
+
## 0.20.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7fc7ae1: Fix UpdatePayment type. Use CustomFieldsDraft instead of CustomFields
|
|
8
|
+
|
|
9
|
+
## 0.20.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 772d5be: Add support for updating payment interface interactions. It introduces a breaking change, the CustomFieldsData type has been removed.
|
|
14
|
+
|
|
3
15
|
## 0.19.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -4,6 +4,6 @@ export { SessionService as CommercetoolsSessionService, Session } from './types/
|
|
|
4
4
|
export { AuthorizationService as CommercetoolsAuthorizationService } from './types/authorization.type';
|
|
5
5
|
export { OrderService as CommercetoolsOrderService } from './types/order.type';
|
|
6
6
|
export { CommercetoolsClient } from './types/api.type';
|
|
7
|
-
export { Cart, Order, OrderPagedQueryResponse, Payment, PaymentDraft, Money, LineItem, CustomLineItem, Address, Transaction, TransactionType, TransactionState, ShippingInfo, } from '@commercetools/platform-sdk';
|
|
7
|
+
export { CustomFieldsDraft, Cart, Order, OrderPagedQueryResponse, Payment, PaymentDraft, Money, LineItem, CustomLineItem, Address, Transaction, TransactionType, TransactionState, ShippingInfo, } from '@commercetools/platform-sdk';
|
|
8
8
|
export * as CurrencyConverters from './helpers/currency.converter';
|
|
9
9
|
export * as TaxRateConverter from './helpers/taxrate.converter';
|
|
@@ -18,6 +18,7 @@ export declare class DefaultPaymentService implements PaymentService {
|
|
|
18
18
|
private populateChangeTransactionState;
|
|
19
19
|
private populateSetPaymentMethod;
|
|
20
20
|
private populateSetCustomType;
|
|
21
|
+
private populateAddInterfaceInteractions;
|
|
21
22
|
findMatchingTransactions(payment: Payment, transaction: TransactionData): Transaction[];
|
|
22
23
|
private consolidateTransactionChanges;
|
|
23
24
|
}
|
|
@@ -76,6 +76,9 @@ class DefaultPaymentService {
|
|
|
76
76
|
if (updateInfo.customFields) {
|
|
77
77
|
actions.push(this.populateSetCustomType(updateInfo.customFields));
|
|
78
78
|
}
|
|
79
|
+
if (updateInfo.pspInteractions && updateInfo.pspInteractions.length > 0) {
|
|
80
|
+
actions.push(...this.populateAddInterfaceInteractions(updateInfo.pspInteractions));
|
|
81
|
+
}
|
|
79
82
|
return actions;
|
|
80
83
|
}
|
|
81
84
|
populateSetInterfaceIdAction(interfaceId) {
|
|
@@ -116,13 +119,17 @@ class DefaultPaymentService {
|
|
|
116
119
|
populateSetCustomType(customFields) {
|
|
117
120
|
return {
|
|
118
121
|
action: 'setCustomType',
|
|
119
|
-
|
|
120
|
-
typeId: 'type',
|
|
121
|
-
key: customFields.typeKey,
|
|
122
|
-
},
|
|
123
|
-
fields: customFields.fields,
|
|
122
|
+
...customFields,
|
|
124
123
|
};
|
|
125
124
|
}
|
|
125
|
+
populateAddInterfaceInteractions(pspInteractions) {
|
|
126
|
+
return pspInteractions.map((interaction) => {
|
|
127
|
+
return {
|
|
128
|
+
action: 'addInterfaceInteraction',
|
|
129
|
+
...interaction,
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
}
|
|
126
133
|
findMatchingTransactions(payment, transaction) {
|
|
127
134
|
return payment.transactions.filter((tx) => {
|
|
128
135
|
return (tx.type === transaction.type &&
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Money, Payment, PaymentDraft, TransactionState, TransactionType } from '@commercetools/platform-sdk';
|
|
1
|
+
import { CustomFieldsDraft, Money, Payment, PaymentDraft, TransactionState, TransactionType } from '@commercetools/platform-sdk';
|
|
2
2
|
import { CommercetoolsAPI } from './api.type';
|
|
3
3
|
import { Logger } from '../../logger';
|
|
4
4
|
export type PaymentAmount = {
|
|
@@ -27,17 +27,13 @@ export type TransactionData = {
|
|
|
27
27
|
interactionId?: string;
|
|
28
28
|
state: TransactionState;
|
|
29
29
|
};
|
|
30
|
-
export type CustomFieldsData = {
|
|
31
|
-
typeKey: string;
|
|
32
|
-
fields: Record<string, unknown>;
|
|
33
|
-
};
|
|
34
30
|
export type UpdatePayment = {
|
|
35
31
|
id: string;
|
|
36
32
|
pspReference?: string;
|
|
37
|
-
|
|
33
|
+
pspInteractions?: CustomFieldsDraft[];
|
|
38
34
|
transaction?: TransactionData;
|
|
39
35
|
paymentMethod?: string;
|
|
40
|
-
customFields?:
|
|
36
|
+
customFields?: CustomFieldsDraft;
|
|
41
37
|
};
|
|
42
38
|
/**
|
|
43
39
|
* Payment service interface exposes methods to interact with the commercetools platform API.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools/connect-payments-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"description": "Payment SDK for commercetools payment connectors",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
],
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@commercetools-backend/loggers": "
|
|
19
|
-
"@commercetools/platform-sdk": "8.
|
|
18
|
+
"@commercetools-backend/loggers": "23.2.0",
|
|
19
|
+
"@commercetools/platform-sdk": "8.5.0",
|
|
20
20
|
"@commercetools/sdk-client-v2": "2.5.0",
|
|
21
21
|
"jsonwebtoken": "9.0.2",
|
|
22
|
-
"jwks-rsa": "3.
|
|
22
|
+
"jwks-rsa": "3.2.0",
|
|
23
23
|
"lodash": "4.17.21",
|
|
24
24
|
"logform": "2.7.0"
|
|
25
25
|
}
|