-
Notifications
You must be signed in to change notification settings - Fork 0
/
accounts.ts
139 lines (108 loc) · 3.97 KB
/
accounts.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import * as Core from '../../core';
import { APIResource } from '../../resource';
import * as AccountsAPI from './accounts';
import * as AddressesAPI from './addresses';
import * as ExistsAPI from './exists';
import * as PaymentMethodsAPI from './payment-methods';
export class Accounts extends APIResource {
addresses: AddressesAPI.Addresses = new AddressesAPI.Addresses(this._client);
exists: ExistsAPI.Exists = new ExistsAPI.Exists(this._client);
paymentMethods: PaymentMethodsAPI.PaymentMethods = new PaymentMethodsAPI.PaymentMethods(this._client);
/**
* Retrieve a shopper's account details, such as addresses and payment information
*/
accountGet(
params: AccountAccountGetParams,
options?: Core.RequestOptions,
): Core.APIPromise<AccountAccountGetResponse> {
const { 'X-Publishable-Key': xPublishableKey } = params;
return this._client.get('/account', {
...options,
headers: { 'X-Publishable-Key': xPublishableKey, ...options?.headers },
});
}
}
export interface AccountAccountGetResponse {
addresses: Array<AccountAccountGetResponse.Address>;
payment_methods: Array<AccountAccountGetResponse.PaymentMethod>;
profile?: AccountAccountGetResponse.Profile;
}
export namespace AccountAccountGetResponse {
export interface Address {
id: string;
country_code: string;
first_name: string;
last_name: string;
locality: string;
postal_code: string;
street_address1: string;
company?: string;
email?: string;
is_default?: boolean;
phone?: string;
region?: string;
street_address2?: string;
}
export interface PaymentMethod {
'.tag': 'credit_card';
/**
* The expiration date of the credit card. TODO TO MAKE EXPIRATION REUSABLE
*/
expiration: string;
/**
* The last 4 digits of the credit card number.
*/
last4: string;
/**
* The credit card network.
*/
network: 'visa' | 'mastercard' | 'amex' | 'discover' | 'jcb' | 'unionpay' | 'alliancedata' | 'citiplcc';
id?: string;
/**
* The ID of credit card's billing address
*/
billing_address_id?: string;
}
export interface Profile {
/**
* An email address.
*/
email?: string;
/**
* The given name of the person associated with this record.
*/
first_name?: string;
/**
* The last name of the person associated with this record.
*/
last_name?: string;
/**
* A phone number following E164 standards, in its globalized format, i.e.
* prepended with a plus sign.
*/
phone?: string;
}
}
export interface AccountAccountGetParams {
/**
* The publicly viewable identifier used to identify a merchant division.
*/
'X-Publishable-Key': string;
}
export namespace Accounts {
export import AccountAccountGetResponse = AccountsAPI.AccountAccountGetResponse;
export import AccountAccountGetParams = AccountsAPI.AccountAccountGetParams;
export import Addresses = AddressesAPI.Addresses;
export import AddressUpdateResponse = AddressesAPI.AddressUpdateResponse;
export import AddressAccountAddressCreateResponse = AddressesAPI.AddressAccountAddressCreateResponse;
export import AddressUpdateParams = AddressesAPI.AddressUpdateParams;
export import AddressDeleteParams = AddressesAPI.AddressDeleteParams;
export import AddressAccountAddressCreateParams = AddressesAPI.AddressAccountAddressCreateParams;
export import Exists = ExistsAPI.Exists;
export import ExistListParams = ExistsAPI.ExistListParams;
export import PaymentMethods = PaymentMethodsAPI.PaymentMethods;
export import PaymentMethodAccountAddPaymentMethodResponse = PaymentMethodsAPI.PaymentMethodAccountAddPaymentMethodResponse;
export import PaymentMethodDeleteParams = PaymentMethodsAPI.PaymentMethodDeleteParams;
export import PaymentMethodAccountAddPaymentMethodParams = PaymentMethodsAPI.PaymentMethodAccountAddPaymentMethodParams;
}