@shipengine/js-api 4.12.0 → 4.14.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.
@@ -20,6 +20,14 @@ export type AccountBillingResponse = {
20
20
  stateProvince: string;
21
21
  };
22
22
  /** @internal */
23
+ type PaymentMethodWithId = {
24
+ paymentMethodId: string;
25
+ };
26
+ /** @internal */
27
+ type PaymentMethodWithSession = {
28
+ sessionId: string;
29
+ };
30
+ /** @internal */
23
31
  export type UpsertAccountBillingRequestBody = {
24
32
  addressLine1: string;
25
33
  addressLine2?: string;
@@ -28,9 +36,13 @@ export type UpsertAccountBillingRequestBody = {
28
36
  countryCode: string;
29
37
  email: string;
30
38
  fullName: string;
31
- paymentMethod: {
32
- sessionId: string;
33
- };
39
+ /**
40
+ * In the request , payment method has to pass either a paymentMethodId or a sessionId
41
+ * Cases:
42
+ * 1. When we want to assign a newly created payment method where you don't yet know the payment method ID -> session ID.
43
+ * 2. If we already know the payment method ID because it was created previously -> payment method ID.
44
+ */
45
+ paymentMethod: PaymentMethodWithId | PaymentMethodWithSession;
34
46
  phone: string;
35
47
  postalCode: string;
36
48
  stateProvince: string;
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from "axios";
2
- import { ConfigResponse, CreateSessionRequest, CreateSessionResponse, PaymentMethodsResponse, PreviewTransactionRequest, PreviewTransactionResponse } from "./types";
2
+ import { ConfigResponse, CreateSessionRequest, CreateSessionResponse, PaymentMethodsResponse, PreviewTransactionRequest, PreviewTransactionResponse, UpdatePaymentMethodRequest, UpdatePaymentMethodResponse } from "./types";
3
3
  /**
4
4
  * # Auctane Pay API module - /v1/payments
5
5
  *
@@ -38,4 +38,9 @@ export declare class AuctanePayAPI {
38
38
  * @docs https://auctane.atlassian.net/wiki/spaces/SEEU/pages/5906662077/AUCTANE+PAY+ENDPOINTS+FOR+SHIPSTATION+API#Delete-payment-method
39
39
  */
40
40
  deletePaymentMethod: (paymentMethodId: string) => Promise<import("axios").AxiosResponse<void, any>>;
41
+ /**
42
+ * The `updatePaymentMethod` method allows to update a saved Payment Method
43
+ * @docs https://auctane.atlassian.net/wiki/spaces/SEEU/pages/5906662077/AUCTANE+PAY+ENDPOINTS+FOR+SHIPSTATION+API#Auctane-Pay-available-endpoints-in-Shipstation-API
44
+ */
45
+ updatePaymentMethod: (paymentMethodId: string, payload: UpdatePaymentMethodRequest) => Promise<import("axios").AxiosResponse<UpdatePaymentMethodResponse, any>>;
41
46
  }
@@ -53,6 +53,25 @@ export interface CreateSessionRequest {
53
53
  */
54
54
  returnUrl?: string;
55
55
  }
56
+ export interface UpdatePaymentMethodRequest {
57
+ /** Billing Address associated with the Payment Method */
58
+ billingAddress: {
59
+ addressLine1: string;
60
+ addressLine2: string;
61
+ cityLocality: string;
62
+ countryCode: string;
63
+ postalCode: string;
64
+ stateProvince: string;
65
+ };
66
+ /** Transaction categories for this Payment Method */
67
+ defaultPaymentMethodCategories: AuctanePayTransactionCategory[];
68
+ /** Expiration Date for the Payment Method (Format: MM/YYYY) */
69
+ expirationDate: string;
70
+ /** Holder name for the payment method */
71
+ holderName: string;
72
+ /** Nickname used for this Payment Method */
73
+ nickname: string;
74
+ }
56
75
  /**
57
76
  * @category Entities
58
77
  */
@@ -92,8 +111,9 @@ export interface PaymentMethod {
92
111
  /**
93
112
  * List of processes or payment gateways
94
113
  * in which this Payment Method is registered
114
+ * Some endpoints, like GET Payment Methods does not return this value
95
115
  */
96
- enrolledProcessors: string[];
116
+ enrolledProcessors?: string[];
97
117
  /**
98
118
  * If applicable/available, the current expiration
99
119
  * we have on file for the payment method.
@@ -119,6 +139,11 @@ export interface PaymentMethod {
119
139
  /** Source account ID */
120
140
  sourceAccountId: string;
121
141
  }
142
+ /**
143
+ * @category Entities
144
+ * The PaymentMethod from the Update response
145
+ */
146
+ export type UpdatePaymentMethodResponse = Omit<PaymentMethod, "sourceAccountId" | "paymentMethodType" | "institutionName">;
122
147
  /**
123
148
  * @category Entities
124
149
  */
package/index.js CHANGED
@@ -286,6 +286,16 @@ class AuctanePayAPI {
286
286
  this.deletePaymentMethod = (paymentMethodId) => {
287
287
  return this.client.delete(`/v1/payments/payment_methods/${paymentMethodId}`);
288
288
  };
289
+ /**
290
+ * The `updatePaymentMethod` method allows to update a saved Payment Method
291
+ * @docs https://auctane.atlassian.net/wiki/spaces/SEEU/pages/5906662077/AUCTANE+PAY+ENDPOINTS+FOR+SHIPSTATION+API#Auctane-Pay-available-endpoints-in-Shipstation-API
292
+ */
293
+ this.updatePaymentMethod = (paymentMethodId, payload) => {
294
+ return this.client.put(
295
+ `/v1/payments/payment_methods/${paymentMethodId}`,
296
+ payload
297
+ );
298
+ };
289
299
  this.client = client;
290
300
  }
291
301
  }
package/index.mjs CHANGED
@@ -282,6 +282,16 @@ class AuctanePayAPI {
282
282
  this.deletePaymentMethod = (paymentMethodId) => {
283
283
  return this.client.delete(`/v1/payments/payment_methods/${paymentMethodId}`);
284
284
  };
285
+ /**
286
+ * The `updatePaymentMethod` method allows to update a saved Payment Method
287
+ * @docs https://auctane.atlassian.net/wiki/spaces/SEEU/pages/5906662077/AUCTANE+PAY+ENDPOINTS+FOR+SHIPSTATION+API#Auctane-Pay-available-endpoints-in-Shipstation-API
288
+ */
289
+ this.updatePaymentMethod = (paymentMethodId, payload) => {
290
+ return this.client.put(
291
+ `/v1/payments/payment_methods/${paymentMethodId}`,
292
+ payload
293
+ );
294
+ };
285
295
  this.client = client;
286
296
  }
287
297
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "4.12.0",
3
+ "version": "4.14.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {