@deliverart/sdk-js-payment 0.0.4 → 1.1.1
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/dist/index.cjs +4431 -496
- package/dist/index.d.cts +1482 -848
- package/dist/index.d.ts +1482 -848
- package/dist/index.js +4392 -451
- package/package.json +11 -26
- package/.changeset/config.json +0 -11
- package/.github/workflows/workflow.yml +0 -47
- package/.prettierrc +0 -7
- package/CHANGELOG.md +0 -55
- package/README.md +0 -3
- package/eslint.config.js +0 -41
- package/src/index.ts +0 -3
- package/src/models.ts +0 -168
- package/src/requests/index.ts +0 -2
- package/src/requests/payment-configs/DeletePaymentConfig.ts +0 -27
- package/src/requests/payment-configs/GetPaymentConfigDetails.ts +0 -33
- package/src/requests/payment-configs/GetPaymentConfigs.ts +0 -50
- package/src/requests/payment-configs/bank-transfer/CreatePaymentConfigBankTransfer.ts +0 -38
- package/src/requests/payment-configs/bank-transfer/DeletePaymentConfigBankTransfer.ts +0 -27
- package/src/requests/payment-configs/bank-transfer/GetPaymentConfigBankTransferDetails.ts +0 -37
- package/src/requests/payment-configs/bank-transfer/GetPaymentConfigBankTransferList.ts +0 -54
- package/src/requests/payment-configs/bank-transfer/UpdatePaymentConfigBankTransfer.ts +0 -45
- package/src/requests/payment-configs/bank-transfer/index.ts +0 -5
- package/src/requests/payment-configs/cash/CreatePaymentConfigCash.ts +0 -36
- package/src/requests/payment-configs/cash/DeletePaymentConfigCash.ts +0 -27
- package/src/requests/payment-configs/cash/GetPaymentConfigCashDetails.ts +0 -33
- package/src/requests/payment-configs/cash/GetPaymentConfigCashList.ts +0 -52
- package/src/requests/payment-configs/cash/index.ts +0 -4
- package/src/requests/payment-configs/credit-card/CreatePaymentConfigCreditCard.ts +0 -38
- package/src/requests/payment-configs/credit-card/DeletePaymentConfigCreditCard.ts +0 -27
- package/src/requests/payment-configs/credit-card/GetPaymentConfigCreditCardDetails.ts +0 -36
- package/src/requests/payment-configs/credit-card/GetPaymentConfigCreditCardList.ts +0 -54
- package/src/requests/payment-configs/credit-card/index.ts +0 -4
- package/src/requests/payment-configs/index.ts +0 -7
- package/src/requests/payment-configs/stripe/CreatePaymentConfigStripe.ts +0 -36
- package/src/requests/payment-configs/stripe/DeletePaymentConfigStripe.ts +0 -27
- package/src/requests/payment-configs/stripe/GetPaymentConfigStripeDetails.ts +0 -33
- package/src/requests/payment-configs/stripe/GetPaymentConfigStripeList.ts +0 -53
- package/src/requests/payment-configs/stripe/UpdatePaymentConfigStripe.ts +0 -43
- package/src/requests/payment-configs/stripe/index.ts +0 -5
- package/src/requests/payments/DeletePayment.ts +0 -27
- package/src/requests/payments/GetPaymentDetails.ts +0 -30
- package/src/requests/payments/GetPayments.ts +0 -45
- package/src/requests/payments/GetPaymentsForPaymentConfig.ts +0 -53
- package/src/requests/payments/UpdatePayment.ts +0 -32
- package/src/requests/payments/index.ts +0 -5
- package/src/types.ts +0 -194
- package/tsconfig.json +0 -15
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
|
-
import {
|
|
3
|
-
createPaginatedSchema,
|
|
4
|
-
Paginated,
|
|
5
|
-
responseToPagination,
|
|
6
|
-
} from '@deliverart/sdk-js-global-types'
|
|
7
|
-
import { AxiosResponse } from 'axios'
|
|
8
|
-
import { z } from 'zod'
|
|
9
|
-
|
|
10
|
-
import { Payment, PaymentQueryParams, paymentQuerySchema, paymentSchema } from '../../models'
|
|
11
|
-
|
|
12
|
-
export type GetPaymentsQueryParams = PaymentQueryParams
|
|
13
|
-
|
|
14
|
-
export const getPaymentsResponseSchema = createPaginatedSchema(paymentSchema)
|
|
15
|
-
export type GetPaymentsResponse = z.infer<typeof getPaymentsResponseSchema>
|
|
16
|
-
|
|
17
|
-
export const getPaymentsInputSchema = z.undefined()
|
|
18
|
-
|
|
19
|
-
export class GetPayments extends AbstractApiRequest<
|
|
20
|
-
void,
|
|
21
|
-
GetPaymentsResponse,
|
|
22
|
-
GetPaymentsQueryParams
|
|
23
|
-
> {
|
|
24
|
-
readonly method = 'GET'
|
|
25
|
-
readonly contentType = 'application/json'
|
|
26
|
-
readonly accept = 'application/json'
|
|
27
|
-
|
|
28
|
-
readonly inputSchema = getPaymentsInputSchema
|
|
29
|
-
readonly outputSchema = getPaymentsResponseSchema
|
|
30
|
-
readonly querySchema = paymentQuerySchema
|
|
31
|
-
readonly headersSchema = undefined
|
|
32
|
-
|
|
33
|
-
constructor(options?: { query?: GetPaymentsQueryParams }) {
|
|
34
|
-
super(undefined, options)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
getPath(): string {
|
|
38
|
-
return '/payments'
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
parseResponse(data: unknown, rawResponse: AxiosResponse): Paginated<Payment> {
|
|
42
|
-
const payments = z.array(paymentSchema).parse(data)
|
|
43
|
-
return this.validateOutput({ data: payments, pagination: responseToPagination(rawResponse) })
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
|
-
import {
|
|
3
|
-
createPaginatedSchema,
|
|
4
|
-
Paginated,
|
|
5
|
-
responseToPagination,
|
|
6
|
-
} from '@deliverart/sdk-js-global-types'
|
|
7
|
-
import { AxiosResponse } from 'axios'
|
|
8
|
-
import { z } from 'zod'
|
|
9
|
-
|
|
10
|
-
import { Payment, PaymentQueryParams, paymentQuerySchema, paymentSchema } from '../../models'
|
|
11
|
-
|
|
12
|
-
export type GetPaymentsForPaymentConfigQueryParams = PaymentQueryParams
|
|
13
|
-
|
|
14
|
-
export const getPaymentsForPaymentConfigResponseSchema = createPaginatedSchema(paymentSchema)
|
|
15
|
-
export type GetPaymentsForPaymentConfigResponse = z.infer<
|
|
16
|
-
typeof getPaymentsForPaymentConfigResponseSchema
|
|
17
|
-
>
|
|
18
|
-
|
|
19
|
-
export const getPaymentsForPaymentConfigInputSchema = z.undefined()
|
|
20
|
-
|
|
21
|
-
export class GetPaymentsForPaymentConfig extends AbstractApiRequest<
|
|
22
|
-
void,
|
|
23
|
-
GetPaymentsForPaymentConfigResponse,
|
|
24
|
-
GetPaymentsForPaymentConfigQueryParams
|
|
25
|
-
> {
|
|
26
|
-
readonly method = 'GET'
|
|
27
|
-
readonly contentType = 'application/json'
|
|
28
|
-
readonly accept = 'application/json'
|
|
29
|
-
|
|
30
|
-
readonly inputSchema = getPaymentsForPaymentConfigInputSchema
|
|
31
|
-
readonly outputSchema = getPaymentsForPaymentConfigResponseSchema
|
|
32
|
-
readonly querySchema = paymentQuerySchema
|
|
33
|
-
readonly headersSchema = undefined
|
|
34
|
-
|
|
35
|
-
private readonly paymentConfigId: string
|
|
36
|
-
|
|
37
|
-
constructor(
|
|
38
|
-
paymentConfigId: string,
|
|
39
|
-
options?: { query?: GetPaymentsForPaymentConfigQueryParams },
|
|
40
|
-
) {
|
|
41
|
-
super(undefined, options)
|
|
42
|
-
this.paymentConfigId = paymentConfigId
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
getPath(): string {
|
|
46
|
-
return `/payment_configs/${this.paymentConfigId}/payments`
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
parseResponse(data: unknown, rawResponse: AxiosResponse): Paginated<Payment> {
|
|
50
|
-
const payments = z.array(paymentSchema).parse(data)
|
|
51
|
-
return this.validateOutput({ data: payments, pagination: responseToPagination(rawResponse) })
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
|
|
4
|
-
import { PaymentDetails, paymentDetailsSchema, writablePaymentSchema } from '../../models'
|
|
5
|
-
|
|
6
|
-
export const updatePaymentInputSchema = writablePaymentSchema.partial()
|
|
7
|
-
export type UpdatePaymentInput = z.infer<typeof updatePaymentInputSchema>
|
|
8
|
-
|
|
9
|
-
export const updatePaymentResponseSchema = paymentDetailsSchema
|
|
10
|
-
export type UpdatePaymentResponse = PaymentDetails
|
|
11
|
-
|
|
12
|
-
export class UpdatePayment extends AbstractApiRequest<UpdatePaymentInput, UpdatePaymentResponse> {
|
|
13
|
-
readonly method = 'PATCH'
|
|
14
|
-
readonly contentType = 'application/merge-patch+json'
|
|
15
|
-
readonly accept = 'application/json'
|
|
16
|
-
|
|
17
|
-
readonly inputSchema = updatePaymentInputSchema
|
|
18
|
-
readonly outputSchema = updatePaymentResponseSchema
|
|
19
|
-
readonly querySchema = undefined
|
|
20
|
-
readonly headersSchema = undefined
|
|
21
|
-
|
|
22
|
-
private readonly paymentId: string
|
|
23
|
-
|
|
24
|
-
constructor(paymentId: string, input: UpdatePaymentInput) {
|
|
25
|
-
super(input)
|
|
26
|
-
this.paymentId = paymentId
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
getPath(): string {
|
|
30
|
-
return `/payments/${this.paymentId}`
|
|
31
|
-
}
|
|
32
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
export const paymentMethods = ['stripe', 'bank_transfer', 'cash', 'credit_card'] as const
|
|
4
|
-
export const paymentMethodSchema = z.enum(paymentMethods)
|
|
5
|
-
export type PaymentMethod = z.infer<typeof paymentMethodSchema>
|
|
6
|
-
|
|
7
|
-
export const paymentStatuses = [
|
|
8
|
-
'pending',
|
|
9
|
-
'pending_verification',
|
|
10
|
-
'paid',
|
|
11
|
-
'canceled',
|
|
12
|
-
'refunded',
|
|
13
|
-
'failed',
|
|
14
|
-
] as const
|
|
15
|
-
export const paymentStatusSchema = z.enum(paymentStatuses)
|
|
16
|
-
export type PaymentStatus = z.infer<typeof paymentStatusSchema>
|
|
17
|
-
|
|
18
|
-
export const paymentPathSchema = z
|
|
19
|
-
.string()
|
|
20
|
-
.refine(
|
|
21
|
-
val =>
|
|
22
|
-
/^\/payments\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
|
|
23
|
-
val,
|
|
24
|
-
),
|
|
25
|
-
{
|
|
26
|
-
message: 'Invalid payment path format',
|
|
27
|
-
},
|
|
28
|
-
)
|
|
29
|
-
export type PaymentPath = z.infer<typeof paymentPathSchema>
|
|
30
|
-
|
|
31
|
-
export const paymentNullablePathSchema = z
|
|
32
|
-
.string()
|
|
33
|
-
.nullable()
|
|
34
|
-
.refine(
|
|
35
|
-
val => {
|
|
36
|
-
if (!val) return true
|
|
37
|
-
return /^\/payments\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
|
|
38
|
-
val,
|
|
39
|
-
)
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
message: 'Invalid payment path format',
|
|
43
|
-
},
|
|
44
|
-
)
|
|
45
|
-
export type PaymentNullablePath = z.infer<typeof paymentNullablePathSchema>
|
|
46
|
-
|
|
47
|
-
export const paymentConfigPathSchema = z
|
|
48
|
-
.string()
|
|
49
|
-
.refine(
|
|
50
|
-
val =>
|
|
51
|
-
/^\/payment_configs\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
|
|
52
|
-
val,
|
|
53
|
-
),
|
|
54
|
-
{
|
|
55
|
-
message: 'Invalid paymentConfig path format',
|
|
56
|
-
},
|
|
57
|
-
)
|
|
58
|
-
export type PaymentConfigPath = z.infer<typeof paymentConfigPathSchema>
|
|
59
|
-
|
|
60
|
-
export const paymentConfigNullablePathSchema = z
|
|
61
|
-
.string()
|
|
62
|
-
.nullable()
|
|
63
|
-
.refine(
|
|
64
|
-
val => {
|
|
65
|
-
if (!val) return true
|
|
66
|
-
return /^\/payment_configs\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
|
|
67
|
-
val,
|
|
68
|
-
)
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
message: 'Invalid paymentConfig path format',
|
|
72
|
-
},
|
|
73
|
-
)
|
|
74
|
-
export type PaymentConfigNullablePath = z.infer<typeof paymentConfigNullablePathSchema>
|
|
75
|
-
|
|
76
|
-
export const paymentConfigBankTransferPathSchema = z
|
|
77
|
-
.string()
|
|
78
|
-
.refine(
|
|
79
|
-
val =>
|
|
80
|
-
/^\/payment_configs\/bank_transfer\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
|
|
81
|
-
val,
|
|
82
|
-
),
|
|
83
|
-
{
|
|
84
|
-
message: 'Invalid paymentConfigBankTransfer path format',
|
|
85
|
-
},
|
|
86
|
-
)
|
|
87
|
-
export type PaymentConfigBankTransferPath = z.infer<typeof paymentConfigBankTransferPathSchema>
|
|
88
|
-
|
|
89
|
-
export const paymentConfigBankTransferNullablePathSchema = z
|
|
90
|
-
.string()
|
|
91
|
-
.nullable()
|
|
92
|
-
.refine(
|
|
93
|
-
val => {
|
|
94
|
-
if (!val) return true
|
|
95
|
-
return /^\/payment_configs\/bank_transfer\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
|
|
96
|
-
val,
|
|
97
|
-
)
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
message: 'Invalid paymentConfigBankTransfer path format',
|
|
101
|
-
},
|
|
102
|
-
)
|
|
103
|
-
export type PaymentConfigBankTransferNullablePath = z.infer<
|
|
104
|
-
typeof paymentConfigBankTransferNullablePathSchema
|
|
105
|
-
>
|
|
106
|
-
|
|
107
|
-
export const paymentConfigCashPathSchema = z
|
|
108
|
-
.string()
|
|
109
|
-
.refine(
|
|
110
|
-
val =>
|
|
111
|
-
/^\/payment_configs\/cash\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
|
|
112
|
-
val,
|
|
113
|
-
),
|
|
114
|
-
{
|
|
115
|
-
message: 'Invalid paymentConfigCash path format',
|
|
116
|
-
},
|
|
117
|
-
)
|
|
118
|
-
export type PaymentConfigCashPath = z.infer<typeof paymentConfigCashPathSchema>
|
|
119
|
-
|
|
120
|
-
export const paymentConfigCashNullablePathSchema = z
|
|
121
|
-
.string()
|
|
122
|
-
.nullable()
|
|
123
|
-
.refine(
|
|
124
|
-
val => {
|
|
125
|
-
if (!val) return true
|
|
126
|
-
return /^\/payment_configs\/cash\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
|
|
127
|
-
val,
|
|
128
|
-
)
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
message: 'Invalid paymentConfigCash path format',
|
|
132
|
-
},
|
|
133
|
-
)
|
|
134
|
-
export type PaymentConfigCashNullablePath = z.infer<typeof paymentConfigCashNullablePathSchema>
|
|
135
|
-
|
|
136
|
-
export const paymentConfigCreditCardPathSchema = z
|
|
137
|
-
.string()
|
|
138
|
-
.refine(
|
|
139
|
-
val =>
|
|
140
|
-
/^\/payment_configs\/credit_card\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
|
|
141
|
-
val,
|
|
142
|
-
),
|
|
143
|
-
{
|
|
144
|
-
message: 'Invalid paymentConfigCreditCard path format',
|
|
145
|
-
},
|
|
146
|
-
)
|
|
147
|
-
export type PaymentConfigCreditCardPath = z.infer<typeof paymentConfigCreditCardPathSchema>
|
|
148
|
-
|
|
149
|
-
export const paymentConfigCreditCardNullablePathSchema = z
|
|
150
|
-
.string()
|
|
151
|
-
.nullable()
|
|
152
|
-
.refine(
|
|
153
|
-
val => {
|
|
154
|
-
if (!val) return true
|
|
155
|
-
return /^\/payment_configs\/credit_card\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
|
|
156
|
-
val,
|
|
157
|
-
)
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
message: 'Invalid paymentConfigCreditCard path format',
|
|
161
|
-
},
|
|
162
|
-
)
|
|
163
|
-
export type PaymentConfigCreditCardNullablePath = z.infer<
|
|
164
|
-
typeof paymentConfigCreditCardNullablePathSchema
|
|
165
|
-
>
|
|
166
|
-
|
|
167
|
-
export const paymentConfigStripePathSchema = z
|
|
168
|
-
.string()
|
|
169
|
-
.refine(
|
|
170
|
-
val =>
|
|
171
|
-
/^\/payment_configs\/stripe\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
|
|
172
|
-
val,
|
|
173
|
-
),
|
|
174
|
-
{
|
|
175
|
-
message: 'Invalid paymentConfigStripe path format',
|
|
176
|
-
},
|
|
177
|
-
)
|
|
178
|
-
export type PaymentConfigStripePath = z.infer<typeof paymentConfigStripePathSchema>
|
|
179
|
-
|
|
180
|
-
export const paymentConfigStripeNullablePathSchema = z
|
|
181
|
-
.string()
|
|
182
|
-
.nullable()
|
|
183
|
-
.refine(
|
|
184
|
-
val => {
|
|
185
|
-
if (!val) return true
|
|
186
|
-
return /^\/payment_configs\/stripe\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
|
|
187
|
-
val,
|
|
188
|
-
)
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
message: 'Invalid paymentConfigStripe path format',
|
|
192
|
-
},
|
|
193
|
-
)
|
|
194
|
-
export type PaymentConfigStripeNullablePath = z.infer<typeof paymentConfigStripeNullablePathSchema>
|
package/tsconfig.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "Node",
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"forceConsistentCasingInFileNames": true,
|
|
8
|
-
"strict": true,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"outDir": "dist",
|
|
11
|
-
"declaration": true,
|
|
12
|
-
"declarationMap": true
|
|
13
|
-
},
|
|
14
|
-
"include": ["src"]
|
|
15
|
-
}
|