@commercetools/connect-payments-sdk 0.15.0 → 0.16.0

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,11 @@
1
1
  # @commercetools/connect-payments-sdk
2
2
 
3
+ ## 0.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 84c0cda: added new method to find payments by interfaceId
8
+
3
9
  ## 0.15.0
4
10
 
5
11
  ### Minor Changes
@@ -1,5 +1,5 @@
1
1
  import { Payment, PaymentDraft, Transaction } from '@commercetools/platform-sdk';
2
- import { GetPayment, PaymentService, PaymentServiceOptions, TransactionData, UpdatePayment } from '../types/payment.type';
2
+ import { FindPaymentsByInterfaceId, GetPayment, PaymentService, PaymentServiceOptions, TransactionData, UpdatePayment } from '../types/payment.type';
3
3
  /**
4
4
  * This is the default implementation of the PaymentService interface.
5
5
  */
@@ -8,6 +8,7 @@ export declare class DefaultPaymentService implements PaymentService {
8
8
  private logger;
9
9
  constructor(opts: PaymentServiceOptions);
10
10
  getPayment(opts: GetPayment): Promise<Payment>;
11
+ findPaymentsByInterfaceId(opts: FindPaymentsByInterfaceId): Promise<Payment[]>;
11
12
  createPayment(draft: PaymentDraft): Promise<Payment>;
12
13
  updatePayment(opts: UpdatePayment): Promise<Payment>;
13
14
  private consolidateUpdateActions;
@@ -15,6 +15,10 @@ class DefaultPaymentService {
15
15
  async getPayment(opts) {
16
16
  return await this.ctAPI.payment.getPaymentById(opts.id);
17
17
  }
18
+ async findPaymentsByInterfaceId(opts) {
19
+ const predicate = `interfaceId="${opts.interfaceId}"`;
20
+ return (await this.ctAPI.payment.find(predicate)).results;
21
+ }
18
22
  async createPayment(draft) {
19
23
  return await this.ctAPI.payment.createPayment(draft);
20
24
  }
@@ -14,6 +14,9 @@ export type GetPayment = {
14
14
  id: string;
15
15
  version?: number;
16
16
  };
17
+ export type FindPaymentsByInterfaceId = {
18
+ interfaceId: string;
19
+ };
17
20
  export type PSPInteraction = {
18
21
  request?: string;
19
22
  response?: string;
@@ -41,6 +44,7 @@ export type UpdatePayment = {
41
44
  */
42
45
  export interface PaymentService {
43
46
  getPayment(opts: GetPayment): Promise<Payment>;
47
+ findPaymentsByInterfaceId(opts: FindPaymentsByInterfaceId): Promise<Payment[]>;
44
48
  createPayment(draft: PaymentDraft): Promise<Payment>;
45
49
  updatePayment(opts: UpdatePayment): Promise<Payment>;
46
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools/connect-payments-sdk",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "Payment SDK for commercetools payment connectors",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -16,7 +16,7 @@
16
16
  "license": "ISC",
17
17
  "dependencies": {
18
18
  "@commercetools-backend/loggers": "22.38.1",
19
- "@commercetools/platform-sdk": "8.0.0",
19
+ "@commercetools/platform-sdk": "8.1.0",
20
20
  "@commercetools/sdk-client-v2": "2.5.0",
21
21
  "jsonwebtoken": "9.0.2",
22
22
  "jwks-rsa": "3.1.0",