@shipengine/js-api 1.12.0 → 1.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.
- package/funding-sources/api.d.ts +8 -4
- package/funding-sources/types.d.ts +42 -11
- package/index.js +16 -3
- package/index.mjs +16 -3
- package/package.json +1 -1
package/funding-sources/api.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
2
|
import { Money } from "../payments";
|
|
3
3
|
import { CreationRangeQuery, PageableQuery } from "../resources";
|
|
4
|
-
import { AddFundsResponse, CarrierRegistration, CarrierRegistrationResponse, CreateFundingSource, CreditCardInfo, FundingSource, FundingSourceAddress, FundingSourceTransactionsResponse, MetadataResponse } from "./types";
|
|
4
|
+
import { AddFundsResponse, CarrierRegistration, CarrierRegistrationResponse, CreateFundingSource, CreditCardInfo, FundingSource, FundingSourceAddress, FundingSourceCreateResponse, FundingSourceTransactionsResponse, InsuranceFundingSourceAcceptedTermsResponse, MetadataResponse } from "./types";
|
|
5
5
|
/**
|
|
6
6
|
* # Funding Sources API module - /v1/funding_sources
|
|
7
7
|
* Docs: https://auctane.atlassian.net/wiki/spaces/SE/pages/3628370266/ShipEngine+Funding+Sources+API
|
|
@@ -23,9 +23,7 @@ export declare class FundingSourcesAPI {
|
|
|
23
23
|
* The `create` method creates a new funding source for a given user. This requires
|
|
24
24
|
* payment information to be collected from the user.
|
|
25
25
|
*/
|
|
26
|
-
create: (createFundingSource: CreateFundingSource) => Promise<import("axios").AxiosResponse<
|
|
27
|
-
fundingSource: FundingSource;
|
|
28
|
-
}, any>>;
|
|
26
|
+
create: (createFundingSource: CreateFundingSource) => Promise<import("axios").AxiosResponse<FundingSourceCreateResponse, any>>;
|
|
29
27
|
/**
|
|
30
28
|
* The `update` method updates a funding source for a given user. This allows the
|
|
31
29
|
* user to update the billing address or payment information associated with the
|
|
@@ -53,4 +51,10 @@ export declare class FundingSourcesAPI {
|
|
|
53
51
|
* See the FundingSourceTransactions type for more information about return data.
|
|
54
52
|
*/
|
|
55
53
|
transactions: (fundingSourceId: string, params?: PageableQuery & CreationRangeQuery) => Promise<import("axios").AxiosResponse<FundingSourceTransactionsResponse, any>>;
|
|
54
|
+
/**
|
|
55
|
+
* Now we can attach insurance providers to the user's Funding Source.
|
|
56
|
+
* This endpoint will retrieve all accepted insurance terms. For example
|
|
57
|
+
* if "ParcelGuard" appears here that means the user its using it.
|
|
58
|
+
*/
|
|
59
|
+
insuranceAcceptedTerms: () => Promise<import("axios").AxiosResponse<InsuranceFundingSourceAcceptedTermsResponse, any>>;
|
|
56
60
|
}
|
|
@@ -25,6 +25,7 @@ export type AbbreviatedCreditCardInfo = {
|
|
|
25
25
|
cardNumberLastFour: string;
|
|
26
26
|
provider: Provider;
|
|
27
27
|
};
|
|
28
|
+
export type FundingSourceInsuranceProvider = "parcelguard" | "x_cover";
|
|
28
29
|
export type Provider = "visa" | "mastercard" | "americanExpress" | "discover";
|
|
29
30
|
export type FundingSourceCarrier = {
|
|
30
31
|
acceptedTerms: Term[];
|
|
@@ -34,8 +35,15 @@ export type FundingSourceCarrier = {
|
|
|
34
35
|
iovationBlackBox: IovationBlackBox;
|
|
35
36
|
pickupAddress?: FundingSourceAddress;
|
|
36
37
|
};
|
|
38
|
+
export type CarrierRegistrationInsuranceProvider = {
|
|
39
|
+
acceptedTerms: Term[];
|
|
40
|
+
agreeToTerms: boolean;
|
|
41
|
+
fundingSourceId: string;
|
|
42
|
+
provider: FundingSourceInsuranceProvider;
|
|
43
|
+
};
|
|
37
44
|
export interface CarrierRegistration {
|
|
38
|
-
carriers
|
|
45
|
+
carriers?: FundingSourceCarrier[];
|
|
46
|
+
insuranceProviders?: CarrierRegistrationInsuranceProvider[];
|
|
39
47
|
}
|
|
40
48
|
export interface FundingSourceAddress {
|
|
41
49
|
addressLine1: string;
|
|
@@ -61,10 +69,17 @@ export interface Term {
|
|
|
61
69
|
termType: string;
|
|
62
70
|
version: string;
|
|
63
71
|
}
|
|
64
|
-
export
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
export interface MetadataTermLink {
|
|
73
|
+
link: string;
|
|
74
|
+
locale: string;
|
|
75
|
+
title: string;
|
|
76
|
+
}
|
|
77
|
+
export interface MetadataOptionalTerm extends Term {
|
|
78
|
+
links: MetadataTermLink[];
|
|
79
|
+
}
|
|
80
|
+
export interface MetadataRequiredTerm extends Term {
|
|
81
|
+
links: MetadataTermLink[];
|
|
82
|
+
}
|
|
68
83
|
export declare enum MetadataCapability {
|
|
69
84
|
AutoFunding = "auto_funding",
|
|
70
85
|
UpdatePaymentMethod = "update_payment_method",
|
|
@@ -97,6 +112,12 @@ export type MetadataRegistrationRequirement = {
|
|
|
97
112
|
requirementType: MetadataRequirement;
|
|
98
113
|
satisfyingFormTypes: MetadataSatisfyingFormTypes[];
|
|
99
114
|
};
|
|
115
|
+
export type MetadataCarrierProfile = {
|
|
116
|
+
capabilities: MetadataCapability[] | null;
|
|
117
|
+
carrierCode: string;
|
|
118
|
+
registrationRequirements: MetadataRegistrationRequirement[];
|
|
119
|
+
requiredTerms: MetadataRequiredTerm[];
|
|
120
|
+
};
|
|
100
121
|
export type TransactionCategory = "adjustment" | "credit" | "debit" | "funds_added" | "insurance" | "label" | "refund" | "service_charge" | "unknown";
|
|
101
122
|
export type FundingSourceTransaction = {
|
|
102
123
|
description?: string | null;
|
|
@@ -117,6 +138,16 @@ export type FundingSourceTransaction = {
|
|
|
117
138
|
transactionCategory: TransactionCategory;
|
|
118
139
|
transactionDate: string;
|
|
119
140
|
};
|
|
141
|
+
export interface FundingSourceInsuranceProviderResponse {
|
|
142
|
+
errorMessage: null | string;
|
|
143
|
+
fundingSourceId: string;
|
|
144
|
+
isSuccessful: boolean;
|
|
145
|
+
provider: FundingSourceInsuranceProvider;
|
|
146
|
+
}
|
|
147
|
+
export interface FundingSourceCreateResponse {
|
|
148
|
+
fundingSource: FundingSource;
|
|
149
|
+
insuranceProviderAttachmentResults: FundingSourceInsuranceProviderResponse[];
|
|
150
|
+
}
|
|
120
151
|
export interface CarrierRegistrationResponse {
|
|
121
152
|
carrierAttachmentResults: [
|
|
122
153
|
{
|
|
@@ -127,22 +158,19 @@ export interface CarrierRegistrationResponse {
|
|
|
127
158
|
nickname: string;
|
|
128
159
|
}
|
|
129
160
|
];
|
|
161
|
+
insuranceProviderAttachmentResults: FundingSourceInsuranceProviderResponse[];
|
|
130
162
|
}
|
|
131
163
|
export interface MetadataResponse {
|
|
132
164
|
defaultFundingSourceProfile: {
|
|
133
165
|
capabilities: MetadataCapability[] | null;
|
|
134
166
|
countryCode: string;
|
|
135
167
|
currencyCode: string;
|
|
168
|
+
optionalTerms: MetadataOptionalTerm[];
|
|
136
169
|
registrationRequirements: MetadataRegistrationRequirement[];
|
|
137
170
|
requiredTerms: MetadataRequiredTerm[];
|
|
138
171
|
};
|
|
139
172
|
defaultRegionProfile: {
|
|
140
|
-
carrierProfiles:
|
|
141
|
-
capabilities: MetadataCapability[] | null;
|
|
142
|
-
carrierCode: string;
|
|
143
|
-
registrationRequirements: MetadataRegistrationRequirement[];
|
|
144
|
-
requiredTerms: MetadataRequiredTerm[];
|
|
145
|
-
}>;
|
|
173
|
+
carrierProfiles: MetadataCarrierProfile[];
|
|
146
174
|
countryCode: string;
|
|
147
175
|
currencyCode: string;
|
|
148
176
|
};
|
|
@@ -156,4 +184,7 @@ export type AddFundsResponse = {
|
|
|
156
184
|
export type FundingSourceTransactionsResponse = {
|
|
157
185
|
transactions: FundingSourceTransaction[];
|
|
158
186
|
} & PageableResult;
|
|
187
|
+
export type InsuranceFundingSourceAcceptedTermsResponse = {
|
|
188
|
+
acceptedTerms: Term[];
|
|
189
|
+
};
|
|
159
190
|
export {};
|
package/index.js
CHANGED
|
@@ -3483,8 +3483,9 @@ class FundingSourcesAPI {
|
|
|
3483
3483
|
*/
|
|
3484
3484
|
this.create = (createFundingSource) => __async$2(this, null, function* () {
|
|
3485
3485
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
3486
|
-
if (!endUserIpAddress)
|
|
3486
|
+
if (!endUserIpAddress) {
|
|
3487
3487
|
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
3488
|
+
}
|
|
3488
3489
|
return yield this.client.post("/v1/funding_sources", __spreadValues$2({
|
|
3489
3490
|
endUserIpAddress
|
|
3490
3491
|
}, createFundingSource));
|
|
@@ -3496,8 +3497,9 @@ class FundingSourcesAPI {
|
|
|
3496
3497
|
*/
|
|
3497
3498
|
this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$2(this, null, function* () {
|
|
3498
3499
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
3499
|
-
if (!endUserIpAddress)
|
|
3500
|
+
if (!endUserIpAddress) {
|
|
3500
3501
|
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
3502
|
+
}
|
|
3501
3503
|
return yield this.client.put(
|
|
3502
3504
|
`/v1/funding_sources/${fundingSourceId}`,
|
|
3503
3505
|
{
|
|
@@ -3513,8 +3515,9 @@ class FundingSourcesAPI {
|
|
|
3513
3515
|
*/
|
|
3514
3516
|
this.registerCarrier = (carrier) => __async$2(this, null, function* () {
|
|
3515
3517
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
3516
|
-
if (!endUserIpAddress)
|
|
3518
|
+
if (!endUserIpAddress) {
|
|
3517
3519
|
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
3520
|
+
}
|
|
3518
3521
|
return yield this.client.post("/v1/registration/funding_source", __spreadValues$2({
|
|
3519
3522
|
endUserIpAddress
|
|
3520
3523
|
}, carrier));
|
|
@@ -3547,6 +3550,16 @@ class FundingSourcesAPI {
|
|
|
3547
3550
|
}
|
|
3548
3551
|
);
|
|
3549
3552
|
};
|
|
3553
|
+
/**
|
|
3554
|
+
* Now we can attach insurance providers to the user's Funding Source.
|
|
3555
|
+
* This endpoint will retrieve all accepted insurance terms. For example
|
|
3556
|
+
* if "ParcelGuard" appears here that means the user its using it.
|
|
3557
|
+
*/
|
|
3558
|
+
this.insuranceAcceptedTerms = () => {
|
|
3559
|
+
return this.client.get(
|
|
3560
|
+
"/v1/insurance/funding_source/accepted_terms"
|
|
3561
|
+
);
|
|
3562
|
+
};
|
|
3550
3563
|
this.client = client;
|
|
3551
3564
|
}
|
|
3552
3565
|
}
|
package/index.mjs
CHANGED
|
@@ -3479,8 +3479,9 @@ class FundingSourcesAPI {
|
|
|
3479
3479
|
*/
|
|
3480
3480
|
this.create = (createFundingSource) => __async$2(this, null, function* () {
|
|
3481
3481
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
3482
|
-
if (!endUserIpAddress)
|
|
3482
|
+
if (!endUserIpAddress) {
|
|
3483
3483
|
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
3484
|
+
}
|
|
3484
3485
|
return yield this.client.post("/v1/funding_sources", __spreadValues$2({
|
|
3485
3486
|
endUserIpAddress
|
|
3486
3487
|
}, createFundingSource));
|
|
@@ -3492,8 +3493,9 @@ class FundingSourcesAPI {
|
|
|
3492
3493
|
*/
|
|
3493
3494
|
this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$2(this, null, function* () {
|
|
3494
3495
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
3495
|
-
if (!endUserIpAddress)
|
|
3496
|
+
if (!endUserIpAddress) {
|
|
3496
3497
|
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
3498
|
+
}
|
|
3497
3499
|
return yield this.client.put(
|
|
3498
3500
|
`/v1/funding_sources/${fundingSourceId}`,
|
|
3499
3501
|
{
|
|
@@ -3509,8 +3511,9 @@ class FundingSourcesAPI {
|
|
|
3509
3511
|
*/
|
|
3510
3512
|
this.registerCarrier = (carrier) => __async$2(this, null, function* () {
|
|
3511
3513
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
3512
|
-
if (!endUserIpAddress)
|
|
3514
|
+
if (!endUserIpAddress) {
|
|
3513
3515
|
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
3516
|
+
}
|
|
3514
3517
|
return yield this.client.post("/v1/registration/funding_source", __spreadValues$2({
|
|
3515
3518
|
endUserIpAddress
|
|
3516
3519
|
}, carrier));
|
|
@@ -3543,6 +3546,16 @@ class FundingSourcesAPI {
|
|
|
3543
3546
|
}
|
|
3544
3547
|
);
|
|
3545
3548
|
};
|
|
3549
|
+
/**
|
|
3550
|
+
* Now we can attach insurance providers to the user's Funding Source.
|
|
3551
|
+
* This endpoint will retrieve all accepted insurance terms. For example
|
|
3552
|
+
* if "ParcelGuard" appears here that means the user its using it.
|
|
3553
|
+
*/
|
|
3554
|
+
this.insuranceAcceptedTerms = () => {
|
|
3555
|
+
return this.client.get(
|
|
3556
|
+
"/v1/insurance/funding_source/accepted_terms"
|
|
3557
|
+
);
|
|
3558
|
+
};
|
|
3546
3559
|
this.client = client;
|
|
3547
3560
|
}
|
|
3548
3561
|
}
|