@shipengine/js-api 4.11.1 → 4.13.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.
@@ -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
  *
@@ -33,4 +33,14 @@ export declare class AuctanePayAPI {
33
33
  * @docs https://auctane.atlassian.net/wiki/spaces/SEEU/pages/5906662077/AUCTANE+PAY+ENDPOINTS+FOR+SHIPSTATION+API#Get-payment-methods
34
34
  */
35
35
  getPaymentMethods: () => Promise<import("axios").AxiosResponse<PaymentMethodsResponse, any>>;
36
+ /**
37
+ * The `deletePaymentMethod` method deletes a Payment Method for a given user.
38
+ * @docs https://auctane.atlassian.net/wiki/spaces/SEEU/pages/5906662077/AUCTANE+PAY+ENDPOINTS+FOR+SHIPSTATION+API#Delete-payment-method
39
+ */
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>>;
36
46
  }
@@ -21,6 +21,11 @@ export interface AuctanePaySessionMetadata {
21
21
  * Allowed Payment Method for AuctanePay
22
22
  */
23
23
  export type AuctanePayPaymentMethod = "credit_card" | "pay_pal" | "stamps" | "pay_by_bank_us" | "pay_by_bank_eu";
24
+ /**
25
+ * @category Entities
26
+ * List of possible Payment Method types
27
+ */
28
+ export type PaymentMethodType = "unknown" | "visa" | "mastercard" | "amex" | "discover" | "maestro" | "dinersclub" | "ach" | "jcb" | "pulse" | "star" | "unionpay";
24
29
  /**
25
30
  * @category Entities
26
31
  * Payment Method Details for AuctanePay
@@ -48,6 +53,25 @@ export interface CreateSessionRequest {
48
53
  */
49
54
  returnUrl?: string;
50
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
+ }
51
75
  /**
52
76
  * @category Entities
53
77
  */
@@ -87,8 +111,9 @@ export interface PaymentMethod {
87
111
  /**
88
112
  * List of processes or payment gateways
89
113
  * in which this Payment Method is registered
114
+ * Some endpoints, like GET Payment Methods does not return this value
90
115
  */
91
- enrolledProcessors: string[];
116
+ enrolledProcessors?: string[];
92
117
  /**
93
118
  * If applicable/available, the current expiration
94
119
  * we have on file for the payment method.
@@ -103,7 +128,7 @@ export interface PaymentMethod {
103
128
  /** The nickname of the payment method */
104
129
  nickname: string;
105
130
  /** Enumeration of supported payment methods. */
106
- paymentMethod: "unknown" | "visa" | "mastercard" | "amex" | "discover" | "maestro" | "dinersclub" | "ach" | "jcb" | "pulse" | "star" | "unionpay";
131
+ paymentMethod: PaymentMethodType;
107
132
  /**
108
133
  * The Display Name to show in any text
109
134
  * based UI/context for the Logo.
@@ -114,6 +139,11 @@ export interface PaymentMethod {
114
139
  /** Source account ID */
115
140
  sourceAccountId: string;
116
141
  }
142
+ /**
143
+ * @category Entities
144
+ * The PaymentMethod from the Update response
145
+ */
146
+ export type UpdatePaymentMethodResponse = Omit<PaymentMethod, "sourceAccountId" | "paymentMethodType" | "institutionName">;
117
147
  /**
118
148
  * @category Entities
119
149
  */
package/index.js CHANGED
@@ -279,6 +279,23 @@ class AuctanePayAPI {
279
279
  this.getPaymentMethods = () => {
280
280
  return this.client.get("/v1/payments/payment_methods");
281
281
  };
282
+ /**
283
+ * The `deletePaymentMethod` method deletes a Payment Method for a given user.
284
+ * @docs https://auctane.atlassian.net/wiki/spaces/SEEU/pages/5906662077/AUCTANE+PAY+ENDPOINTS+FOR+SHIPSTATION+API#Delete-payment-method
285
+ */
286
+ this.deletePaymentMethod = (paymentMethodId) => {
287
+ return this.client.delete(`/v1/payments/payment_methods/${paymentMethodId}`);
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
+ };
282
299
  this.client = client;
283
300
  }
284
301
  }
package/index.mjs CHANGED
@@ -275,6 +275,23 @@ class AuctanePayAPI {
275
275
  this.getPaymentMethods = () => {
276
276
  return this.client.get("/v1/payments/payment_methods");
277
277
  };
278
+ /**
279
+ * The `deletePaymentMethod` method deletes a Payment Method for a given user.
280
+ * @docs https://auctane.atlassian.net/wiki/spaces/SEEU/pages/5906662077/AUCTANE+PAY+ENDPOINTS+FOR+SHIPSTATION+API#Delete-payment-method
281
+ */
282
+ this.deletePaymentMethod = (paymentMethodId) => {
283
+ return this.client.delete(`/v1/payments/payment_methods/${paymentMethodId}`);
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
+ };
278
295
  this.client = client;
279
296
  }
280
297
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "4.11.1",
3
+ "version": "4.13.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {