@superdurable/connector-braintree 0.1.0 → 0.2.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/README.md +3 -1
- package/dex-connector.json +1356 -2
- package/dist/chunk-KA52AO5W.js +1036 -0
- package/dist/connection-Cn9eRQrg.d.ts +562 -0
- package/dist/index.d.ts +1333 -6
- package/dist/index.js +1750 -15
- package/dist/mock.d.ts +444 -5
- package/dist/mock.js +1073 -4
- package/package.json +3 -3
- package/dist/chunk-4EVX2UKI.js +0 -109
- package/dist/connection-B5NUruTy.d.ts +0 -74
package/dist/index.js
CHANGED
|
@@ -1,7 +1,134 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AcceptDisputeBranch,
|
|
3
|
+
AcceptDisputeBranchAccepted,
|
|
4
|
+
AcceptDisputeBranchDefect,
|
|
5
|
+
AcceptDisputeBranchNotFound,
|
|
6
|
+
AcceptDisputeBranchProviderRejected,
|
|
7
|
+
AcceptDisputeBranchUncertain,
|
|
8
|
+
AcceptDisputeDefinition,
|
|
9
|
+
AcceptDisputeMetadata,
|
|
10
|
+
CaptureTransactionBranch,
|
|
11
|
+
CaptureTransactionBranchCaptured,
|
|
12
|
+
CaptureTransactionBranchDefect,
|
|
13
|
+
CaptureTransactionBranchNotFound,
|
|
14
|
+
CaptureTransactionBranchProviderRejected,
|
|
15
|
+
CaptureTransactionDefinition,
|
|
16
|
+
CaptureTransactionInputSchema,
|
|
17
|
+
CaptureTransactionMetadata,
|
|
18
|
+
ChargePaymentMethodBranch,
|
|
19
|
+
ChargePaymentMethodBranchCharged,
|
|
20
|
+
ChargePaymentMethodBranchDefect,
|
|
21
|
+
ChargePaymentMethodBranchNotFound,
|
|
22
|
+
ChargePaymentMethodBranchProviderRejected,
|
|
23
|
+
ChargePaymentMethodDefinition,
|
|
24
|
+
ChargePaymentMethodInputSchema,
|
|
25
|
+
ChargePaymentMethodMetadata,
|
|
2
26
|
ConfigSchema,
|
|
3
27
|
Connection,
|
|
4
28
|
ConnectorID,
|
|
29
|
+
CreateCustomerBranch,
|
|
30
|
+
CreateCustomerBranchCreated,
|
|
31
|
+
CreateCustomerBranchDefect,
|
|
32
|
+
CreateCustomerBranchProviderRejected,
|
|
33
|
+
CreateCustomerBranchUncertain,
|
|
34
|
+
CreateCustomerDefinition,
|
|
35
|
+
CreateCustomerInputSchema,
|
|
36
|
+
CreateCustomerMetadata,
|
|
37
|
+
CreateDisputeFileEvidenceBranch,
|
|
38
|
+
CreateDisputeFileEvidenceBranchCreated,
|
|
39
|
+
CreateDisputeFileEvidenceBranchDefect,
|
|
40
|
+
CreateDisputeFileEvidenceBranchNotFound,
|
|
41
|
+
CreateDisputeFileEvidenceBranchProviderRejected,
|
|
42
|
+
CreateDisputeFileEvidenceBranchUncertain,
|
|
43
|
+
CreateDisputeFileEvidenceDefinition,
|
|
44
|
+
CreateDisputeFileEvidenceInputSchema,
|
|
45
|
+
CreateDisputeFileEvidenceMetadata,
|
|
46
|
+
CreateDisputeTextEvidenceBranch,
|
|
47
|
+
CreateDisputeTextEvidenceBranchCreated,
|
|
48
|
+
CreateDisputeTextEvidenceBranchDefect,
|
|
49
|
+
CreateDisputeTextEvidenceBranchNotFound,
|
|
50
|
+
CreateDisputeTextEvidenceBranchProviderRejected,
|
|
51
|
+
CreateDisputeTextEvidenceBranchUncertain,
|
|
52
|
+
CreateDisputeTextEvidenceDefinition,
|
|
53
|
+
CreateDisputeTextEvidenceInputSchema,
|
|
54
|
+
CreateDisputeTextEvidenceMetadata,
|
|
55
|
+
CredentialMaterialError,
|
|
56
|
+
CustomerDeleteResultSchema,
|
|
57
|
+
CustomerProfileSchema,
|
|
58
|
+
DeleteCustomerBranch,
|
|
59
|
+
DeleteCustomerBranchDefect,
|
|
60
|
+
DeleteCustomerBranchDeleted,
|
|
61
|
+
DeleteCustomerBranchInvalidResponse,
|
|
62
|
+
DeleteCustomerBranchNotFound,
|
|
63
|
+
DeleteCustomerBranchProviderRejected,
|
|
64
|
+
DeleteCustomerDefinition,
|
|
65
|
+
DeleteCustomerMetadata,
|
|
66
|
+
DeleteDisputeEvidenceBranch,
|
|
67
|
+
DeleteDisputeEvidenceBranchDefect,
|
|
68
|
+
DeleteDisputeEvidenceBranchDeleted,
|
|
69
|
+
DeleteDisputeEvidenceBranchInvalidResponse,
|
|
70
|
+
DeleteDisputeEvidenceBranchNotFound,
|
|
71
|
+
DeleteDisputeEvidenceBranchProviderRejected,
|
|
72
|
+
DeleteDisputeEvidenceDefinition,
|
|
73
|
+
DeleteDisputeEvidenceInputSchema,
|
|
74
|
+
DeleteDisputeEvidenceMetadata,
|
|
75
|
+
DeletePaymentMethodFromVaultBranch,
|
|
76
|
+
DeletePaymentMethodFromVaultBranchDefect,
|
|
77
|
+
DeletePaymentMethodFromVaultBranchDeleted,
|
|
78
|
+
DeletePaymentMethodFromVaultBranchInvalidResponse,
|
|
79
|
+
DeletePaymentMethodFromVaultBranchNotFound,
|
|
80
|
+
DeletePaymentMethodFromVaultBranchProviderRejected,
|
|
81
|
+
DeletePaymentMethodFromVaultDefinition,
|
|
82
|
+
DeletePaymentMethodFromVaultMetadata,
|
|
83
|
+
DisputeEvidenceDeleteResultSchema,
|
|
84
|
+
DisputeEvidenceProfileSchema,
|
|
85
|
+
DisputeProfileSchema,
|
|
86
|
+
DisputeTextEvidenceProfileSchema,
|
|
87
|
+
DisputesPageSchema,
|
|
88
|
+
FinalizeDisputeBranch,
|
|
89
|
+
FinalizeDisputeBranchDefect,
|
|
90
|
+
FinalizeDisputeBranchFinalized,
|
|
91
|
+
FinalizeDisputeBranchNotFound,
|
|
92
|
+
FinalizeDisputeBranchProviderRejected,
|
|
93
|
+
FinalizeDisputeBranchUncertain,
|
|
94
|
+
FinalizeDisputeDefinition,
|
|
95
|
+
FinalizeDisputeMetadata,
|
|
96
|
+
GetCustomerBranch,
|
|
97
|
+
GetCustomerBranchDefect,
|
|
98
|
+
GetCustomerBranchFound,
|
|
99
|
+
GetCustomerBranchInvalidResponse,
|
|
100
|
+
GetCustomerBranchNotFound,
|
|
101
|
+
GetCustomerBranchProviderRejected,
|
|
102
|
+
GetCustomerDefinition,
|
|
103
|
+
GetCustomerInputSchema,
|
|
104
|
+
GetCustomerMetadata,
|
|
105
|
+
GetDisputeBranch,
|
|
106
|
+
GetDisputeBranchDefect,
|
|
107
|
+
GetDisputeBranchFound,
|
|
108
|
+
GetDisputeBranchInvalidResponse,
|
|
109
|
+
GetDisputeBranchNotFound,
|
|
110
|
+
GetDisputeBranchProviderRejected,
|
|
111
|
+
GetDisputeDefinition,
|
|
112
|
+
GetDisputeInputSchema,
|
|
113
|
+
GetDisputeMetadata,
|
|
114
|
+
GetPaymentMethodBranch,
|
|
115
|
+
GetPaymentMethodBranchDefect,
|
|
116
|
+
GetPaymentMethodBranchFound,
|
|
117
|
+
GetPaymentMethodBranchInvalidResponse,
|
|
118
|
+
GetPaymentMethodBranchNotFound,
|
|
119
|
+
GetPaymentMethodBranchProviderRejected,
|
|
120
|
+
GetPaymentMethodDefinition,
|
|
121
|
+
GetPaymentMethodInputSchema,
|
|
122
|
+
GetPaymentMethodMetadata,
|
|
123
|
+
GetRefundBranch,
|
|
124
|
+
GetRefundBranchDefect,
|
|
125
|
+
GetRefundBranchFound,
|
|
126
|
+
GetRefundBranchInvalidResponse,
|
|
127
|
+
GetRefundBranchNotFound,
|
|
128
|
+
GetRefundBranchProviderRejected,
|
|
129
|
+
GetRefundDefinition,
|
|
130
|
+
GetRefundInputSchema,
|
|
131
|
+
GetRefundMetadata,
|
|
5
132
|
GetTransactionBranch,
|
|
6
133
|
GetTransactionBranchDefect,
|
|
7
134
|
GetTransactionBranchFound,
|
|
@@ -11,16 +138,347 @@ import {
|
|
|
11
138
|
GetTransactionDefinition,
|
|
12
139
|
GetTransactionInputSchema,
|
|
13
140
|
GetTransactionMetadata,
|
|
141
|
+
PaymentMethodDeleteResultSchema,
|
|
142
|
+
PaymentMethodProfileSchema,
|
|
14
143
|
ProviderID,
|
|
144
|
+
RefundProfileSchema,
|
|
145
|
+
RefundTransactionBranch,
|
|
146
|
+
RefundTransactionBranchDefect,
|
|
147
|
+
RefundTransactionBranchNotFound,
|
|
148
|
+
RefundTransactionBranchProviderRejected,
|
|
149
|
+
RefundTransactionBranchRefunded,
|
|
150
|
+
RefundTransactionDefinition,
|
|
151
|
+
RefundTransactionInputSchema,
|
|
152
|
+
RefundTransactionMetadata,
|
|
153
|
+
SearchDisputesBranch,
|
|
154
|
+
SearchDisputesBranchDefect,
|
|
155
|
+
SearchDisputesBranchInvalidResponse,
|
|
156
|
+
SearchDisputesBranchNotFound,
|
|
157
|
+
SearchDisputesBranchProviderRejected,
|
|
158
|
+
SearchDisputesBranchSearched,
|
|
159
|
+
SearchDisputesDefinition,
|
|
160
|
+
SearchDisputesInputSchema,
|
|
161
|
+
SearchDisputesMetadata,
|
|
162
|
+
SearchTransactionsBranch,
|
|
163
|
+
SearchTransactionsBranchDefect,
|
|
164
|
+
SearchTransactionsBranchInvalidResponse,
|
|
165
|
+
SearchTransactionsBranchNotFound,
|
|
166
|
+
SearchTransactionsBranchProviderRejected,
|
|
167
|
+
SearchTransactionsBranchSearched,
|
|
168
|
+
SearchTransactionsDefinition,
|
|
169
|
+
SearchTransactionsInputSchema,
|
|
170
|
+
SearchTransactionsMetadata,
|
|
15
171
|
TransactionProfileSchema,
|
|
172
|
+
TransactionsPageSchema,
|
|
173
|
+
UpdateCreditCardBillingAddressBranch,
|
|
174
|
+
UpdateCreditCardBillingAddressBranchDefect,
|
|
175
|
+
UpdateCreditCardBillingAddressBranchNotFound,
|
|
176
|
+
UpdateCreditCardBillingAddressBranchProviderRejected,
|
|
177
|
+
UpdateCreditCardBillingAddressBranchUncertain,
|
|
178
|
+
UpdateCreditCardBillingAddressBranchUpdated,
|
|
179
|
+
UpdateCreditCardBillingAddressDefinition,
|
|
180
|
+
UpdateCreditCardBillingAddressInputSchema,
|
|
181
|
+
UpdateCreditCardBillingAddressMetadata,
|
|
182
|
+
UpdateCreditCardCardholderNameBranch,
|
|
183
|
+
UpdateCreditCardCardholderNameBranchDefect,
|
|
184
|
+
UpdateCreditCardCardholderNameBranchNotFound,
|
|
185
|
+
UpdateCreditCardCardholderNameBranchProviderRejected,
|
|
186
|
+
UpdateCreditCardCardholderNameBranchUncertain,
|
|
187
|
+
UpdateCreditCardCardholderNameBranchUpdated,
|
|
188
|
+
UpdateCreditCardCardholderNameDefinition,
|
|
189
|
+
UpdateCreditCardCardholderNameInputSchema,
|
|
190
|
+
UpdateCreditCardCardholderNameMetadata,
|
|
191
|
+
UpdateCreditCardExpirationDateBranch,
|
|
192
|
+
UpdateCreditCardExpirationDateBranchDefect,
|
|
193
|
+
UpdateCreditCardExpirationDateBranchNotFound,
|
|
194
|
+
UpdateCreditCardExpirationDateBranchProviderRejected,
|
|
195
|
+
UpdateCreditCardExpirationDateBranchUncertain,
|
|
196
|
+
UpdateCreditCardExpirationDateBranchUpdated,
|
|
197
|
+
UpdateCreditCardExpirationDateDefinition,
|
|
198
|
+
UpdateCreditCardExpirationDateInputSchema,
|
|
199
|
+
UpdateCreditCardExpirationDateMetadata,
|
|
200
|
+
UpdateCustomerBranch,
|
|
201
|
+
UpdateCustomerBranchDefect,
|
|
202
|
+
UpdateCustomerBranchInvalidResponse,
|
|
203
|
+
UpdateCustomerBranchNotFound,
|
|
204
|
+
UpdateCustomerBranchProviderRejected,
|
|
205
|
+
UpdateCustomerBranchUpdated,
|
|
206
|
+
UpdateCustomerDefinition,
|
|
207
|
+
UpdateCustomerInputSchema,
|
|
208
|
+
UpdateCustomerMetadata,
|
|
209
|
+
VaultPaymentMethodBranch,
|
|
210
|
+
VaultPaymentMethodBranchDefect,
|
|
211
|
+
VaultPaymentMethodBranchNotFound,
|
|
212
|
+
VaultPaymentMethodBranchProviderRejected,
|
|
213
|
+
VaultPaymentMethodBranchUncertain,
|
|
214
|
+
VaultPaymentMethodBranchVaulted,
|
|
215
|
+
VaultPaymentMethodDefinition,
|
|
216
|
+
VaultPaymentMethodInputSchema,
|
|
217
|
+
VaultPaymentMethodMetadata,
|
|
218
|
+
VoidTransactionBranch,
|
|
219
|
+
VoidTransactionBranchDefect,
|
|
220
|
+
VoidTransactionBranchNotFound,
|
|
221
|
+
VoidTransactionBranchProviderRejected,
|
|
222
|
+
VoidTransactionBranchVoided,
|
|
223
|
+
VoidTransactionDefinition,
|
|
224
|
+
VoidTransactionMetadata,
|
|
16
225
|
decodeCredentials,
|
|
226
|
+
isCredentialMaterialError,
|
|
17
227
|
newConnection,
|
|
18
228
|
newConnectionWithOperations,
|
|
19
229
|
newProjectConnection
|
|
20
|
-
} from "./chunk-
|
|
230
|
+
} from "./chunk-KA52AO5W.js";
|
|
21
231
|
|
|
22
232
|
// src/generated/steps.ts
|
|
23
|
-
import { goToBranch, newQueryStep } from "@superdurable/connectors-sdk";
|
|
233
|
+
import { goToBranch, newMutationStep, newQueryStep } from "@superdurable/connectors-sdk";
|
|
234
|
+
function newGetDisputeStep(configuration) {
|
|
235
|
+
const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
|
|
236
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
237
|
+
return newQueryStep({ ...stepConfiguration, operation: connection.operations.getDispute(), connection: connection.reference, branches: [
|
|
238
|
+
goToBranch("found", found),
|
|
239
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
240
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
241
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
242
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
243
|
+
] });
|
|
244
|
+
}
|
|
245
|
+
function newSearchDisputesStep(configuration) {
|
|
246
|
+
const { connection, connectionName, searched, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
|
|
247
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
248
|
+
return newQueryStep({ ...stepConfiguration, operation: connection.operations.searchDisputes(), connection: connection.reference, branches: [
|
|
249
|
+
goToBranch("searched", searched),
|
|
250
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
251
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
252
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
253
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
254
|
+
] });
|
|
255
|
+
}
|
|
256
|
+
function newAcceptDisputeStep(configuration) {
|
|
257
|
+
const { connection, connectionName, accepted, notFound, providerRejected, defect, uncertain, ...stepConfiguration } = configuration;
|
|
258
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
259
|
+
return newMutationStep({ ...stepConfiguration, operation: connection.operations.acceptDispute(), connection: connection.reference, branches: [
|
|
260
|
+
goToBranch("accepted", accepted),
|
|
261
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
262
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
263
|
+
...defect ? [goToBranch("defect", defect)] : [],
|
|
264
|
+
...uncertain ? [goToBranch("uncertain", uncertain)] : []
|
|
265
|
+
] });
|
|
266
|
+
}
|
|
267
|
+
function newCreateDisputeTextEvidenceStep(configuration) {
|
|
268
|
+
const { connection, connectionName, created, notFound, providerRejected, defect, uncertain, ...stepConfiguration } = configuration;
|
|
269
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
270
|
+
return newMutationStep({ ...stepConfiguration, operation: connection.operations.createDisputeTextEvidence(), connection: connection.reference, branches: [
|
|
271
|
+
goToBranch("created", created),
|
|
272
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
273
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
274
|
+
...defect ? [goToBranch("defect", defect)] : [],
|
|
275
|
+
...uncertain ? [goToBranch("uncertain", uncertain)] : []
|
|
276
|
+
] });
|
|
277
|
+
}
|
|
278
|
+
function newCreateDisputeFileEvidenceStep(configuration) {
|
|
279
|
+
const { connection, connectionName, created, notFound, providerRejected, defect, uncertain, ...stepConfiguration } = configuration;
|
|
280
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
281
|
+
return newMutationStep({ ...stepConfiguration, operation: connection.operations.createDisputeFileEvidence(), connection: connection.reference, branches: [
|
|
282
|
+
goToBranch("created", created),
|
|
283
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
284
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
285
|
+
...defect ? [goToBranch("defect", defect)] : [],
|
|
286
|
+
...uncertain ? [goToBranch("uncertain", uncertain)] : []
|
|
287
|
+
] });
|
|
288
|
+
}
|
|
289
|
+
function newDeleteDisputeEvidenceStep(configuration) {
|
|
290
|
+
const { connection, connectionName, deleted, notFound, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
|
|
291
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
292
|
+
return newMutationStep({ ...stepConfiguration, operation: connection.operations.deleteDisputeEvidence(), connection: connection.reference, branches: [
|
|
293
|
+
goToBranch("deleted", deleted),
|
|
294
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
295
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
296
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
297
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
298
|
+
] });
|
|
299
|
+
}
|
|
300
|
+
function newFinalizeDisputeStep(configuration) {
|
|
301
|
+
const { connection, connectionName, finalized, notFound, providerRejected, defect, uncertain, ...stepConfiguration } = configuration;
|
|
302
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
303
|
+
return newMutationStep({ ...stepConfiguration, operation: connection.operations.finalizeDispute(), connection: connection.reference, branches: [
|
|
304
|
+
goToBranch("finalized", finalized),
|
|
305
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
306
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
307
|
+
...defect ? [goToBranch("defect", defect)] : [],
|
|
308
|
+
...uncertain ? [goToBranch("uncertain", uncertain)] : []
|
|
309
|
+
] });
|
|
310
|
+
}
|
|
311
|
+
function newSearchTransactionsStep(configuration) {
|
|
312
|
+
const { connection, connectionName, searched, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
|
|
313
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
314
|
+
return newQueryStep({ ...stepConfiguration, operation: connection.operations.searchTransactions(), connection: connection.reference, branches: [
|
|
315
|
+
goToBranch("searched", searched),
|
|
316
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
317
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
318
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
319
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
320
|
+
] });
|
|
321
|
+
}
|
|
322
|
+
function newChargePaymentMethodStep(configuration) {
|
|
323
|
+
const { connection, connectionName, charged, notFound, providerRejected, defect, maxSends, ...stepConfiguration } = configuration;
|
|
324
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
325
|
+
return newMutationStep({ ...stepConfiguration, operation: connection.operations.chargePaymentMethod(), connection: connection.reference, branches: [
|
|
326
|
+
goToBranch("charged", charged),
|
|
327
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
328
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
329
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
330
|
+
] });
|
|
331
|
+
}
|
|
332
|
+
function newCaptureTransactionStep(configuration) {
|
|
333
|
+
const { connection, connectionName, captured, notFound, providerRejected, defect, maxSends, ...stepConfiguration } = configuration;
|
|
334
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
335
|
+
return newMutationStep({ ...stepConfiguration, operation: connection.operations.captureTransaction(), connection: connection.reference, branches: [
|
|
336
|
+
goToBranch("captured", captured),
|
|
337
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
338
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
339
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
340
|
+
] });
|
|
341
|
+
}
|
|
342
|
+
function newVoidTransactionStep(configuration) {
|
|
343
|
+
const { connection, connectionName, voided, notFound, providerRejected, defect, maxSends, ...stepConfiguration } = configuration;
|
|
344
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
345
|
+
return newMutationStep({ ...stepConfiguration, operation: connection.operations.voidTransaction(), connection: connection.reference, branches: [
|
|
346
|
+
goToBranch("voided", voided),
|
|
347
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
348
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
349
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
350
|
+
] });
|
|
351
|
+
}
|
|
352
|
+
function newRefundTransactionStep(configuration) {
|
|
353
|
+
const { connection, connectionName, refunded, notFound, providerRejected, defect, maxSends, ...stepConfiguration } = configuration;
|
|
354
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
355
|
+
return newMutationStep({ ...stepConfiguration, operation: connection.operations.refundTransaction(), connection: connection.reference, branches: [
|
|
356
|
+
goToBranch("refunded", refunded),
|
|
357
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
358
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
359
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
360
|
+
] });
|
|
361
|
+
}
|
|
362
|
+
function newVaultPaymentMethodStep(configuration) {
|
|
363
|
+
const { connection, connectionName, vaulted, notFound, providerRejected, defect, uncertain, ...stepConfiguration } = configuration;
|
|
364
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
365
|
+
return newMutationStep({ ...stepConfiguration, operation: connection.operations.vaultPaymentMethod(), connection: connection.reference, branches: [
|
|
366
|
+
goToBranch("vaulted", vaulted),
|
|
367
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
368
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
369
|
+
...defect ? [goToBranch("defect", defect)] : [],
|
|
370
|
+
...uncertain ? [goToBranch("uncertain", uncertain)] : []
|
|
371
|
+
] });
|
|
372
|
+
}
|
|
373
|
+
function newUpdateCreditCardCardholderNameStep(configuration) {
|
|
374
|
+
const { connection, connectionName, updated, notFound, providerRejected, defect, uncertain, ...stepConfiguration } = configuration;
|
|
375
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
376
|
+
return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateCreditCardCardholderName(), connection: connection.reference, branches: [
|
|
377
|
+
goToBranch("updated", updated),
|
|
378
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
379
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
380
|
+
...defect ? [goToBranch("defect", defect)] : [],
|
|
381
|
+
...uncertain ? [goToBranch("uncertain", uncertain)] : []
|
|
382
|
+
] });
|
|
383
|
+
}
|
|
384
|
+
function newUpdateCreditCardExpirationDateStep(configuration) {
|
|
385
|
+
const { connection, connectionName, updated, notFound, providerRejected, defect, uncertain, ...stepConfiguration } = configuration;
|
|
386
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
387
|
+
return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateCreditCardExpirationDate(), connection: connection.reference, branches: [
|
|
388
|
+
goToBranch("updated", updated),
|
|
389
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
390
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
391
|
+
...defect ? [goToBranch("defect", defect)] : [],
|
|
392
|
+
...uncertain ? [goToBranch("uncertain", uncertain)] : []
|
|
393
|
+
] });
|
|
394
|
+
}
|
|
395
|
+
function newUpdateCreditCardBillingAddressStep(configuration) {
|
|
396
|
+
const { connection, connectionName, updated, notFound, providerRejected, defect, uncertain, ...stepConfiguration } = configuration;
|
|
397
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
398
|
+
return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateCreditCardBillingAddress(), connection: connection.reference, branches: [
|
|
399
|
+
goToBranch("updated", updated),
|
|
400
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
401
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
402
|
+
...defect ? [goToBranch("defect", defect)] : [],
|
|
403
|
+
...uncertain ? [goToBranch("uncertain", uncertain)] : []
|
|
404
|
+
] });
|
|
405
|
+
}
|
|
406
|
+
function newDeletePaymentMethodFromVaultStep(configuration) {
|
|
407
|
+
const { connection, connectionName, deleted, notFound, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
|
|
408
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
409
|
+
return newMutationStep({ ...stepConfiguration, operation: connection.operations.deletePaymentMethodFromVault(), connection: connection.reference, branches: [
|
|
410
|
+
goToBranch("deleted", deleted),
|
|
411
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
412
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
413
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
414
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
415
|
+
] });
|
|
416
|
+
}
|
|
417
|
+
function newCreateCustomerStep(configuration) {
|
|
418
|
+
const { connection, connectionName, created, providerRejected, defect, uncertain, ...stepConfiguration } = configuration;
|
|
419
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
420
|
+
return newMutationStep({ ...stepConfiguration, operation: connection.operations.createCustomer(), connection: connection.reference, branches: [
|
|
421
|
+
goToBranch("created", created),
|
|
422
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
423
|
+
...defect ? [goToBranch("defect", defect)] : [],
|
|
424
|
+
...uncertain ? [goToBranch("uncertain", uncertain)] : []
|
|
425
|
+
] });
|
|
426
|
+
}
|
|
427
|
+
function newUpdateCustomerStep(configuration) {
|
|
428
|
+
const { connection, connectionName, updated, notFound, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
|
|
429
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
430
|
+
return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateCustomer(), connection: connection.reference, branches: [
|
|
431
|
+
goToBranch("updated", updated),
|
|
432
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
433
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
434
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
435
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
436
|
+
] });
|
|
437
|
+
}
|
|
438
|
+
function newDeleteCustomerStep(configuration) {
|
|
439
|
+
const { connection, connectionName, deleted, notFound, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
|
|
440
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
441
|
+
return newMutationStep({ ...stepConfiguration, operation: connection.operations.deleteCustomer(), connection: connection.reference, branches: [
|
|
442
|
+
goToBranch("deleted", deleted),
|
|
443
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
444
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
445
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
446
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
447
|
+
] });
|
|
448
|
+
}
|
|
449
|
+
function newGetCustomerStep(configuration) {
|
|
450
|
+
const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
|
|
451
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
452
|
+
return newQueryStep({ ...stepConfiguration, operation: connection.operations.getCustomer(), connection: connection.reference, branches: [
|
|
453
|
+
goToBranch("found", found),
|
|
454
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
455
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
456
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
457
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
458
|
+
] });
|
|
459
|
+
}
|
|
460
|
+
function newGetPaymentMethodStep(configuration) {
|
|
461
|
+
const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
|
|
462
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
463
|
+
return newQueryStep({ ...stepConfiguration, operation: connection.operations.getPaymentMethod(), connection: connection.reference, branches: [
|
|
464
|
+
goToBranch("found", found),
|
|
465
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
466
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
467
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
468
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
469
|
+
] });
|
|
470
|
+
}
|
|
471
|
+
function newGetRefundStep(configuration) {
|
|
472
|
+
const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
|
|
473
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
474
|
+
return newQueryStep({ ...stepConfiguration, operation: connection.operations.getRefund(), connection: connection.reference, branches: [
|
|
475
|
+
goToBranch("found", found),
|
|
476
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
477
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
478
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
479
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
480
|
+
] });
|
|
481
|
+
}
|
|
24
482
|
function newGetTransactionStep(configuration) {
|
|
25
483
|
const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
|
|
26
484
|
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
@@ -38,9 +496,917 @@ import { SecretString as SecretString2 } from "@superdurable/connectors-sdk";
|
|
|
38
496
|
import { z } from "zod";
|
|
39
497
|
|
|
40
498
|
// src/client.ts
|
|
41
|
-
import { Buffer } from "buffer";
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
499
|
+
import { Buffer as Buffer2 } from "buffer";
|
|
500
|
+
import { isAbsolute as isAbsolute2 } from "path";
|
|
501
|
+
import { SecretString, newQueryBranch as newQueryBranch2, newQueryRetry as newQueryRetry2 } from "@superdurable/connectors-sdk";
|
|
502
|
+
import { BodyTooLargeError, ProviderTransportError, isHeaderSafeCredential, parseRetryAfter, sendProviderRequest, validateBaseURL } from "@superdurable/connectors-sdk/providerhttp";
|
|
503
|
+
|
|
504
|
+
// src/queries.ts
|
|
505
|
+
import { newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
|
|
506
|
+
var GraphQLQuery = class {
|
|
507
|
+
constructor(client, spec) {
|
|
508
|
+
this.client = client;
|
|
509
|
+
this.spec = spec;
|
|
510
|
+
}
|
|
511
|
+
client;
|
|
512
|
+
spec;
|
|
513
|
+
/** Return the manifest-generated query contract. */
|
|
514
|
+
definition() {
|
|
515
|
+
return this.spec.definition;
|
|
516
|
+
}
|
|
517
|
+
/** Validate input, execute once, and classify the provider response. */
|
|
518
|
+
async invoke(call, input) {
|
|
519
|
+
const { definition, query, empty, success, invalid, decode } = this.spec;
|
|
520
|
+
const failure2 = (kind, message) => ({ provider: "braintree", operation: definition.operation.operationId, kind, message });
|
|
521
|
+
const branch = (name, kind, message) => newQueryBranch(name, empty(), {}, failure2(kind, message));
|
|
522
|
+
const retry2 = (kind, message, delay = 0) => newQueryRetry(failure2(kind, message), delay);
|
|
523
|
+
const variables = this.spec.variables(input);
|
|
524
|
+
if (!variables) return branch("defect", "VALIDATION", invalid);
|
|
525
|
+
const response = await this.client.graphQL(call, query, variables);
|
|
526
|
+
if (response.error === "credential") return branch("defect", "AUTHENTICATION", "Braintree credentials are unavailable");
|
|
527
|
+
if (response.error === "request" || response.error === "interrupted" && success === "searched") {
|
|
528
|
+
return retry2("TRANSPORT", "Braintree request failed");
|
|
529
|
+
}
|
|
530
|
+
if (response.status === 429) return retry2("RATE_LIMIT", "Braintree rate limited the request", response.retryAfterMs);
|
|
531
|
+
if (response.status === 408 || response.status >= 500) return retry2("AVAILABILITY", "Braintree is temporarily unavailable", response.retryAfterMs);
|
|
532
|
+
if (response.status !== 200) return branch("providerRejected", "PROVIDER_REJECTION", `Braintree rejected HTTP ${response.status}`);
|
|
533
|
+
if (response.error === "tooLarge") return branch("invalidResponse", "RESPONSE_TOO_LARGE", "Braintree response exceeded the configured limit");
|
|
534
|
+
if (response.error) return retry2("TRANSPORT", "Braintree response was interrupted");
|
|
535
|
+
try {
|
|
536
|
+
const document = object(JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(response.body)));
|
|
537
|
+
if (document.data != null) object(document.data);
|
|
538
|
+
const errors = arrayOrEmpty(document.errors);
|
|
539
|
+
if (errors.length) {
|
|
540
|
+
switch (classifyGraphQLErrors(errors)) {
|
|
541
|
+
case "graphQLNotFound":
|
|
542
|
+
return branch("notFound", "NOT_FOUND", "Braintree did not expose the resource");
|
|
543
|
+
case "rateLimited":
|
|
544
|
+
return retry2("RATE_LIMIT", "Braintree reported a resource limit", response.retryAfterMs);
|
|
545
|
+
case "unavailable":
|
|
546
|
+
return retry2("AVAILABILITY", "Braintree reported a temporary failure", response.retryAfterMs);
|
|
547
|
+
case "rejected":
|
|
548
|
+
return branch("providerRejected", "PROVIDER_REJECTION", "Braintree rejected the GraphQL query");
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
const output = decode(object(document.data), variables);
|
|
552
|
+
if (output === null) return branch("notFound", "NOT_FOUND", "Braintree did not expose the resource");
|
|
553
|
+
return newQueryBranch(success, output);
|
|
554
|
+
} catch {
|
|
555
|
+
return branch("invalidResponse", "PROTOCOL", "Braintree returned invalid GraphQL JSON");
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
var NodeQuery = class extends GraphQLQuery {
|
|
560
|
+
constructor(client, spec) {
|
|
561
|
+
super(client, {
|
|
562
|
+
...spec,
|
|
563
|
+
success: "found",
|
|
564
|
+
variables: (input) => {
|
|
565
|
+
const id = spec.id(input);
|
|
566
|
+
return isValidGraphQLID(id) ? { id } : void 0;
|
|
567
|
+
},
|
|
568
|
+
decode: (data, variables) => {
|
|
569
|
+
if (data.node === null) return null;
|
|
570
|
+
const node = object(data.node);
|
|
571
|
+
const typename = string(node.__typename), id = string(node.id);
|
|
572
|
+
if (!typename) throw new TypeError("missing GraphQL type");
|
|
573
|
+
if (typename !== spec.typename) return null;
|
|
574
|
+
if (id !== variables.id) throw new TypeError("wrong node identity");
|
|
575
|
+
return spec.profile(node);
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
var GetDisputeOperation = class extends NodeQuery {
|
|
581
|
+
/** Bind the provider client. */
|
|
582
|
+
constructor(client) {
|
|
583
|
+
super(client, {
|
|
584
|
+
definition: GetDisputeDefinition,
|
|
585
|
+
typename: "Dispute",
|
|
586
|
+
invalid: "disputeId is invalid",
|
|
587
|
+
query: "query GetDispute($id: ID!) { node(id: $id) { __typename ... on Dispute { id status replyByDate evidence { id category ... on DisputeTextEvidence { content } } } } }",
|
|
588
|
+
empty: () => ({ id: "", status: "" }),
|
|
589
|
+
id: (input) => input.disputeId,
|
|
590
|
+
profile: dispute
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
var GetCustomerOperation = class extends NodeQuery {
|
|
595
|
+
/** Bind the provider client. */
|
|
596
|
+
constructor(client) {
|
|
597
|
+
super(client, {
|
|
598
|
+
definition: GetCustomerDefinition,
|
|
599
|
+
typename: "Customer",
|
|
600
|
+
invalid: "customerId is invalid",
|
|
601
|
+
query: "query GetCustomer($id: ID!) { node(id: $id) { __typename ... on Customer { id firstName lastName email } } }",
|
|
602
|
+
empty: () => ({ id: "", firstName: "", lastName: "", email: "" }),
|
|
603
|
+
id: (input) => input.customerId,
|
|
604
|
+
profile: (node) => ({ id: string(node.id), firstName: string(node.firstName), lastName: string(node.lastName), email: string(node.email) })
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
var GetPaymentMethodOperation = class extends NodeQuery {
|
|
609
|
+
/** Bind the provider client. */
|
|
610
|
+
constructor(client) {
|
|
611
|
+
super(client, {
|
|
612
|
+
definition: GetPaymentMethodDefinition,
|
|
613
|
+
typename: "PaymentMethod",
|
|
614
|
+
invalid: "paymentMethodId is invalid",
|
|
615
|
+
query: "query GetPaymentMethod($id: ID!) { node(id: $id) { __typename ... on PaymentMethod { id usage } } }",
|
|
616
|
+
empty: () => ({ id: "", usage: "" }),
|
|
617
|
+
id: (input) => input.paymentMethodId,
|
|
618
|
+
profile: (node) => ({ id: string(node.id), usage: string(node.usage) })
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
var GetRefundOperation = class extends NodeQuery {
|
|
623
|
+
/** Bind the provider client. */
|
|
624
|
+
constructor(client) {
|
|
625
|
+
super(client, {
|
|
626
|
+
definition: GetRefundDefinition,
|
|
627
|
+
typename: "Refund",
|
|
628
|
+
invalid: "refundId is invalid",
|
|
629
|
+
query: "query GetRefund($id: ID!) { node(id: $id) { __typename ... on Refund { id status } } }",
|
|
630
|
+
empty: () => ({ id: "", status: "" }),
|
|
631
|
+
id: (input) => input.refundId,
|
|
632
|
+
profile: (node) => ({ id: string(node.id), status: string(node.status) })
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
};
|
|
636
|
+
var SearchDisputesOperation = class extends GraphQLQuery {
|
|
637
|
+
/** Bind the provider client. */
|
|
638
|
+
constructor(client) {
|
|
639
|
+
super(client, {
|
|
640
|
+
definition: SearchDisputesDefinition,
|
|
641
|
+
success: "searched",
|
|
642
|
+
invalid: "dispute search input is invalid",
|
|
643
|
+
query: "query SearchDisputes($input: DisputeSearchInput!, $first: Int!, $after: String) { disputes(input: $input, first: $first, after: $after) { edges { node { id status replyByDate } } pageInfo { hasNextPage endCursor } } }",
|
|
644
|
+
empty: () => ({ disputes: [], hasNextPage: false }),
|
|
645
|
+
variables: ({ disputeId = "", status = "", first = 0, after = "" }) => {
|
|
646
|
+
if (!disputeId && !status || disputeId && !isValidGraphQLID(disputeId) || status && !disputeStatuses.has(status)) return void 0;
|
|
647
|
+
return searchVariables({ id: disputeId, status }, first, after);
|
|
648
|
+
},
|
|
649
|
+
decode: (data) => {
|
|
650
|
+
const { nodes, page } = searchPage(data, "disputes");
|
|
651
|
+
const disputes = nodes.map(dispute);
|
|
652
|
+
if (disputes.some((entry) => !isValidGraphQLID(entry.id) || !disputeStatuses.has(entry.status))) throw new TypeError("invalid dispute result");
|
|
653
|
+
return { disputes, ...page };
|
|
654
|
+
}
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
var SearchTransactionsOperation = class extends GraphQLQuery {
|
|
659
|
+
/** Bind the provider client. */
|
|
660
|
+
constructor(client) {
|
|
661
|
+
super(client, {
|
|
662
|
+
definition: SearchTransactionsDefinition,
|
|
663
|
+
success: "searched",
|
|
664
|
+
invalid: "transaction search input is invalid",
|
|
665
|
+
query: "query SearchTransactions($input: TransactionSearchInput!, $first: Int!, $after: String) { transactions(input: $input, first: $first, after: $after) { edges { node { id status } } pageInfo { hasNextPage endCursor } } }",
|
|
666
|
+
empty: () => ({ transactions: [], hasNextPage: false }),
|
|
667
|
+
variables: ({ transactionId = "", orderId = "", first = 0, after = "" }) => {
|
|
668
|
+
if (!transactionId && !orderId || transactionId && !isValidGraphQLID(transactionId) || !isValidOrderID(orderId)) return void 0;
|
|
669
|
+
return searchVariables({ id: transactionId, orderId }, first, after);
|
|
670
|
+
},
|
|
671
|
+
decode: (data) => {
|
|
672
|
+
const { nodes, page } = searchPage(data, "transactions");
|
|
673
|
+
const transactions = nodes.map((entry) => ({ id: string(entry.id), status: string(entry.status) }));
|
|
674
|
+
if (transactions.some((entry) => !isValidGraphQLID(entry.id) || !entry.status)) throw new TypeError("invalid transaction result");
|
|
675
|
+
return { transactions, ...page };
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
};
|
|
680
|
+
var disputeStatuses = /* @__PURE__ */ new Set(["ACCEPTED", "AUTO_ACCEPTED", "DISPUTED", "EXPIRED", "LOST", "OPEN", "UNDER_REVIEW", "WON"]);
|
|
681
|
+
function dispute(node) {
|
|
682
|
+
const evidence2 = arrayOrEmpty(node.evidence).map((value) => {
|
|
683
|
+
const entry = value === null ? {} : object(value);
|
|
684
|
+
const id = string(entry.id), category = string(entry.category), content = string(entry.content);
|
|
685
|
+
return { id, ...category ? { category } : {}, ...content ? { content } : {} };
|
|
686
|
+
});
|
|
687
|
+
const replyByDate = string(node.replyByDate);
|
|
688
|
+
return { id: string(node.id), status: string(node.status), ...replyByDate ? { replyByDate } : {}, ...evidence2.length ? { evidence: evidence2 } : {} };
|
|
689
|
+
}
|
|
690
|
+
function searchVariables(filters, first, after) {
|
|
691
|
+
if (!Number.isInteger(first) || first < 0 || first > 100 || !isValidByteLength(after, 500)) return void 0;
|
|
692
|
+
const input = Object.fromEntries(Object.entries(filters).filter(([, value]) => value).map(([key, value]) => [key, { is: value }]));
|
|
693
|
+
return { input, first: first || 50, ...after ? { after } : {} };
|
|
694
|
+
}
|
|
695
|
+
function searchPage(data, key) {
|
|
696
|
+
const collection = object(data[key]);
|
|
697
|
+
const pageInfo = object(collection.pageInfo);
|
|
698
|
+
const hasNextPage = pageInfo.hasNextPage ?? false;
|
|
699
|
+
const endCursor = string(pageInfo.endCursor);
|
|
700
|
+
if (typeof hasNextPage !== "boolean" || hasNextPage && !endCursor) throw new TypeError("invalid GraphQL pagination");
|
|
701
|
+
const nodes = arrayOrEmpty(collection.edges).map((edge) => object(object(edge).node));
|
|
702
|
+
return { nodes, page: { hasNextPage, ...endCursor ? { endCursor } : {} } };
|
|
703
|
+
}
|
|
704
|
+
function object(value) {
|
|
705
|
+
if (!isObject(value)) throw new TypeError("expected a GraphQL object");
|
|
706
|
+
return value;
|
|
707
|
+
}
|
|
708
|
+
function string(value) {
|
|
709
|
+
if (value == null) return "";
|
|
710
|
+
if (typeof value !== "string") throw new TypeError("expected a GraphQL string");
|
|
711
|
+
return value;
|
|
712
|
+
}
|
|
713
|
+
function arrayOrEmpty(value) {
|
|
714
|
+
if (value == null) return [];
|
|
715
|
+
if (!Array.isArray(value)) throw new TypeError("expected a GraphQL list");
|
|
716
|
+
return value;
|
|
717
|
+
}
|
|
718
|
+
function isValidByteLength(value, maximum) {
|
|
719
|
+
return typeof value === "string" && !/\p{Cs}/u.test(value) && Buffer.byteLength(value) <= maximum;
|
|
720
|
+
}
|
|
721
|
+
function isValidOrderID(value) {
|
|
722
|
+
return isValidByteLength(value, 255) && !/^\p{White_Space}|\p{White_Space}$|[\r\n]/u.test(value);
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
// src/mutations.ts
|
|
726
|
+
import { isIP } from "net";
|
|
727
|
+
import { newMutationBranch, newMutationRetry } from "@superdurable/connectors-sdk";
|
|
728
|
+
var BraintreeMutation = class {
|
|
729
|
+
constructor(client, contract, query, empty, success, isFinancial = false, hasNotFoundBranch = true) {
|
|
730
|
+
this.client = client;
|
|
731
|
+
this.contract = contract;
|
|
732
|
+
this.query = query;
|
|
733
|
+
this.empty = empty;
|
|
734
|
+
this.success = success;
|
|
735
|
+
this.isFinancial = isFinancial;
|
|
736
|
+
this.hasNotFoundBranch = hasNotFoundBranch;
|
|
737
|
+
}
|
|
738
|
+
client;
|
|
739
|
+
contract;
|
|
740
|
+
query;
|
|
741
|
+
empty;
|
|
742
|
+
success;
|
|
743
|
+
isFinancial;
|
|
744
|
+
hasNotFoundBranch;
|
|
745
|
+
/** Return the manifest-generated mutation contract. */
|
|
746
|
+
definition() {
|
|
747
|
+
return this.contract;
|
|
748
|
+
}
|
|
749
|
+
/** Return the stable call ID for provider correlation. */
|
|
750
|
+
idempotencyKey(callID, input) {
|
|
751
|
+
void input;
|
|
752
|
+
return callID;
|
|
753
|
+
}
|
|
754
|
+
async write(call, values, decode) {
|
|
755
|
+
const request = { clientMutationId: call.id, ...values, ...this.isFinancial ? { apiRequestKey: call.idempotencyKey ?? "" } : {} };
|
|
756
|
+
const response = await this.client.graphQL(call, this.query, { input: request });
|
|
757
|
+
const hasPrior = call.context.attempt > 1;
|
|
758
|
+
return this.complete(response, hasPrior, decode);
|
|
759
|
+
}
|
|
760
|
+
complete(response, hasPrior, decode) {
|
|
761
|
+
const failure2 = this.wireFailure(response, hasPrior);
|
|
762
|
+
if (failure2) return failure2;
|
|
763
|
+
try {
|
|
764
|
+
const document = object(json(response.body));
|
|
765
|
+
const { data } = document;
|
|
766
|
+
if (this.isFinancial && data != null) {
|
|
767
|
+
for (const entry of Object.values(object(data))) if (entry != null) object(entry);
|
|
768
|
+
}
|
|
769
|
+
const errors = arrayOrEmpty(document.errors);
|
|
770
|
+
if (errors.length) {
|
|
771
|
+
if (this.isFinancial) {
|
|
772
|
+
if (hasPrior || data != null && Object.keys(object(data)).length) return this.protocol();
|
|
773
|
+
} else if (data != null) return this.protocol();
|
|
774
|
+
return this.graphQLFailure(errors, hasPrior, response.retryAfterMs);
|
|
775
|
+
}
|
|
776
|
+
const payload = object(data)[this.contract.operation.operationId];
|
|
777
|
+
if (payload == null) return this.protocol();
|
|
778
|
+
return newMutationBranch(this.success, decode(payload));
|
|
779
|
+
} catch {
|
|
780
|
+
return this.protocol();
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
wireFailure(response, hasPrior) {
|
|
784
|
+
if (response.error === "credential") {
|
|
785
|
+
return hasPrior ? this.retry("TRANSPORT", "an earlier Braintree write remains unconfirmed") : this.branch("defect", "AUTHENTICATION", "Braintree credentials are unavailable");
|
|
786
|
+
}
|
|
787
|
+
if (response.error && response.error !== "tooLarge") return this.retry("TRANSPORT", "Braintree write outcome is unknown");
|
|
788
|
+
if (response.status === 429) return this.retry("RATE_LIMIT", "Braintree rate limited the mutation", response.retryAfterMs);
|
|
789
|
+
if (response.status === 408 || response.status >= 500) return this.retry("AVAILABILITY", "Braintree write outcome is unknown", response.retryAfterMs);
|
|
790
|
+
if (response.status !== 200) {
|
|
791
|
+
if (hasPrior || !isDefiniteRefusal(response)) {
|
|
792
|
+
return this.retry("TRANSPORT", "Braintree write outcome is unknown", this.isFinancial ? response.retryAfterMs : 0);
|
|
793
|
+
}
|
|
794
|
+
return this.branch("providerRejected", "PROVIDER_REJECTION", `Braintree rejected HTTP ${response.status}`);
|
|
795
|
+
}
|
|
796
|
+
if (response.error === "tooLarge") return this.retry("RESPONSE_TOO_LARGE", "Braintree write response exceeded the configured limit");
|
|
797
|
+
return void 0;
|
|
798
|
+
}
|
|
799
|
+
graphQLFailure(errors, hasPrior, delay) {
|
|
800
|
+
const outcome = writeErrorOutcome(errors);
|
|
801
|
+
if (outcome === "RATE_LIMIT") return this.retry(outcome, "Braintree reported a resource limit", delay);
|
|
802
|
+
if (outcome === "AVAILABILITY") return this.retry(outcome, "Braintree reported a temporary failure", delay);
|
|
803
|
+
if (!hasPrior && this.hasNotFoundBranch && outcome === "NOT_FOUND") return this.branch("notFound", outcome, "Braintree did not find the resource");
|
|
804
|
+
if (!hasPrior && outcome === "PROVIDER_REJECTION") return this.branch("providerRejected", outcome, "Braintree rejected the mutation");
|
|
805
|
+
return this.isFinancial ? this.protocol() : this.retry("TRANSPORT", "Braintree write outcome is unknown");
|
|
806
|
+
}
|
|
807
|
+
failure(kind, message) {
|
|
808
|
+
return { provider: "braintree", operation: this.contract.operation.operationId, kind, message };
|
|
809
|
+
}
|
|
810
|
+
branch(branch, kind, message) {
|
|
811
|
+
return newMutationBranch(branch, this.empty(), {}, this.failure(kind, message));
|
|
812
|
+
}
|
|
813
|
+
invalid(message) {
|
|
814
|
+
return this.branch("defect", "VALIDATION", message);
|
|
815
|
+
}
|
|
816
|
+
retry(kind, message, delay = 0) {
|
|
817
|
+
return newMutationRetry(this.failure(kind, message), delay);
|
|
818
|
+
}
|
|
819
|
+
protocol() {
|
|
820
|
+
return this.retry("PROTOCOL", "Braintree returned invalid mutation confirmation");
|
|
821
|
+
}
|
|
822
|
+
};
|
|
823
|
+
var TransactionMutation = class extends BraintreeMutation {
|
|
824
|
+
constructor(client, contract, query, success) {
|
|
825
|
+
super(client, contract, query, emptyStatus, success, true);
|
|
826
|
+
}
|
|
827
|
+
transaction(call, values, expectedID = "") {
|
|
828
|
+
return this.write(call, values, (payload) => financialProfile(payload, "transaction", expectedID));
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
var ChargePaymentMethodOperation = class extends TransactionMutation {
|
|
832
|
+
/** Bind the provider client. */
|
|
833
|
+
constructor(client) {
|
|
834
|
+
super(
|
|
835
|
+
client,
|
|
836
|
+
ChargePaymentMethodDefinition,
|
|
837
|
+
"mutation ChargePaymentMethod($input: ChargePaymentMethodInput!) { chargePaymentMethod(input: $input) { transaction { id status } } }",
|
|
838
|
+
"charged"
|
|
839
|
+
);
|
|
840
|
+
}
|
|
841
|
+
/** Send an amount and optional merchant routing fields. */
|
|
842
|
+
async invoke(call, input) {
|
|
843
|
+
const { paymentMethodId, amount, merchantAccountId = "", orderId = "" } = input;
|
|
844
|
+
if (!isValidGraphQLID(paymentMethodId) || !isValidAmount(amount) || merchantAccountId && !isValidGraphQLID(merchantAccountId) || !isValidOrderID(orderId)) {
|
|
845
|
+
return this.invalid("financial mutation input is invalid");
|
|
846
|
+
}
|
|
847
|
+
const transaction = { amount, ...merchantAccountId ? { merchantAccountId } : {}, ...orderId ? { orderId } : {} };
|
|
848
|
+
return this.transaction(call, { paymentMethodId, transaction });
|
|
849
|
+
}
|
|
850
|
+
};
|
|
851
|
+
var CaptureTransactionOperation = class extends TransactionMutation {
|
|
852
|
+
/** Bind the provider client. */
|
|
853
|
+
constructor(client) {
|
|
854
|
+
super(
|
|
855
|
+
client,
|
|
856
|
+
CaptureTransactionDefinition,
|
|
857
|
+
"mutation CaptureTransaction($input: CaptureTransactionInput!) { captureTransaction(input: $input) { transaction { id status } } }",
|
|
858
|
+
"captured"
|
|
859
|
+
);
|
|
860
|
+
}
|
|
861
|
+
/** Capture the specified amount or the full authorization. */
|
|
862
|
+
async invoke(call, input) {
|
|
863
|
+
const { transactionId, amount = "" } = input;
|
|
864
|
+
if (!isValidGraphQLID(transactionId) || amount && !isValidAmount(amount)) return this.invalid("financial mutation input is invalid");
|
|
865
|
+
return this.transaction(call, { transactionId, ...amount ? { transaction: { amount } } : {} }, transactionId);
|
|
866
|
+
}
|
|
867
|
+
};
|
|
868
|
+
var VoidTransactionOperation = class extends TransactionMutation {
|
|
869
|
+
/** Bind the provider client. */
|
|
870
|
+
constructor(client) {
|
|
871
|
+
super(
|
|
872
|
+
client,
|
|
873
|
+
VoidTransactionDefinition,
|
|
874
|
+
"mutation VoidTransaction($input: VoidTransactionInput!) { voidTransaction(input: $input) { transaction { id status } } }",
|
|
875
|
+
"voided"
|
|
876
|
+
);
|
|
877
|
+
}
|
|
878
|
+
/** Void the selected transaction and confirm its identity. */
|
|
879
|
+
async invoke(call, input) {
|
|
880
|
+
if (!isValidGraphQLID(input.transactionId)) return this.invalid("financial mutation input is invalid");
|
|
881
|
+
return this.transaction(call, { transactionId: input.transactionId }, input.transactionId);
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
var RefundTransactionOperation = class extends BraintreeMutation {
|
|
885
|
+
/** Bind the provider client. */
|
|
886
|
+
constructor(client) {
|
|
887
|
+
super(
|
|
888
|
+
client,
|
|
889
|
+
RefundTransactionDefinition,
|
|
890
|
+
"mutation RefundTransaction($input: RefundTransactionInput!) { refundTransaction(input: $input) { refund { id status } } }",
|
|
891
|
+
emptyStatus,
|
|
892
|
+
"refunded",
|
|
893
|
+
true
|
|
894
|
+
);
|
|
895
|
+
}
|
|
896
|
+
/** Refund the supplied amount or the full eligible transaction. */
|
|
897
|
+
async invoke(call, input) {
|
|
898
|
+
const { transactionId, amount = "", orderId = "" } = input;
|
|
899
|
+
if (!isValidGraphQLID(transactionId) || amount && !isValidAmount(amount) || !isValidOrderID(orderId)) {
|
|
900
|
+
return this.invalid("financial mutation input is invalid");
|
|
901
|
+
}
|
|
902
|
+
const refund = { ...amount ? { amount } : {}, ...orderId ? { orderId } : {} };
|
|
903
|
+
return this.write(call, { transactionId, ...amount || orderId ? { refund } : {} }, (payload) => financialProfile(payload, "refund"));
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
var UpdateCustomerOperation = class extends BraintreeMutation {
|
|
907
|
+
/** Bind the provider client. */
|
|
908
|
+
constructor(client) {
|
|
909
|
+
super(
|
|
910
|
+
client,
|
|
911
|
+
UpdateCustomerDefinition,
|
|
912
|
+
"mutation UpdateCustomer($input: UpdateCustomerInput!) { updateCustomer(input: $input) { customer { id firstName lastName email } } }",
|
|
913
|
+
() => ({ id: "", firstName: "", lastName: "", email: "" }),
|
|
914
|
+
"updated"
|
|
915
|
+
);
|
|
916
|
+
}
|
|
917
|
+
/** Write absolute contact fields, including explicit blanks. */
|
|
918
|
+
async invoke(call, input) {
|
|
919
|
+
const { customerId, firstName = "", lastName = "", email = "" } = input;
|
|
920
|
+
if (!isValidGraphQLID(customerId) || !isValidOrderID(firstName) || !isValidOrderID(lastName) || !isValidCustomerEmail(email)) {
|
|
921
|
+
return this.invalid("customer contact fields are invalid");
|
|
922
|
+
}
|
|
923
|
+
return this.write(call, { customerId, customer: { firstName, lastName, email } }, (payload) => customerProfile(payload, customerId));
|
|
924
|
+
}
|
|
925
|
+
};
|
|
926
|
+
var DeleteCustomerOperation = class extends BraintreeMutation {
|
|
927
|
+
/** Bind the provider client. */
|
|
928
|
+
constructor(client) {
|
|
929
|
+
super(
|
|
930
|
+
client,
|
|
931
|
+
DeleteCustomerDefinition,
|
|
932
|
+
"mutation DeleteCustomer($input: DeleteCustomerInput!) { deleteCustomer(input: $input) { clientMutationId } }",
|
|
933
|
+
() => ({ customerId: "", deleted: false }),
|
|
934
|
+
"deleted"
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
/** Delete the selected customer and confirm the payload. */
|
|
938
|
+
async invoke(call, input) {
|
|
939
|
+
if (!isValidGraphQLID(input.customerId)) return this.invalid("customerId is invalid");
|
|
940
|
+
return this.write(call, { customerId: input.customerId }, () => ({ customerId: input.customerId, deleted: true }));
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
var DeletePaymentMethodFromVaultOperation = class extends BraintreeMutation {
|
|
944
|
+
/** Bind the provider client. */
|
|
945
|
+
constructor(client) {
|
|
946
|
+
super(
|
|
947
|
+
client,
|
|
948
|
+
DeletePaymentMethodFromVaultDefinition,
|
|
949
|
+
"mutation DeletePaymentMethodFromVault($input: DeletePaymentMethodFromVaultInput!) { deletePaymentMethodFromVault(input: $input) { clientMutationId } }",
|
|
950
|
+
() => ({ paymentMethodId: "", deleted: false }),
|
|
951
|
+
"deleted"
|
|
952
|
+
);
|
|
953
|
+
}
|
|
954
|
+
/** Delete the selected payment method and confirm the payload. */
|
|
955
|
+
async invoke(call, input) {
|
|
956
|
+
if (!isValidGraphQLID(input.paymentMethodId)) return this.invalid("paymentMethodId is invalid");
|
|
957
|
+
return this.write(call, { paymentMethodId: input.paymentMethodId }, () => ({ paymentMethodId: input.paymentMethodId, deleted: true }));
|
|
958
|
+
}
|
|
959
|
+
};
|
|
960
|
+
var DeleteDisputeEvidenceOperation = class extends BraintreeMutation {
|
|
961
|
+
/** Bind the provider client. */
|
|
962
|
+
constructor(client) {
|
|
963
|
+
super(
|
|
964
|
+
client,
|
|
965
|
+
DeleteDisputeEvidenceDefinition,
|
|
966
|
+
"mutation DeleteDisputeEvidence($input: DeleteDisputeEvidenceInput!) { deleteDisputeEvidence(input: $input) { clientMutationId } }",
|
|
967
|
+
() => ({ disputeId: "", evidenceId: "", deleted: false }),
|
|
968
|
+
"deleted"
|
|
969
|
+
);
|
|
970
|
+
}
|
|
971
|
+
/** Remove the evidence and return its identity. */
|
|
972
|
+
async invoke(call, input) {
|
|
973
|
+
const { disputeId, evidenceId } = input;
|
|
974
|
+
if (!isValidGraphQLID(disputeId) || !isValidGraphQLID(evidenceId)) return this.invalid("dispute evidence IDs are invalid");
|
|
975
|
+
return this.write(call, { disputeId, evidenceId }, () => ({ disputeId, evidenceId, deleted: true }));
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
function emptyStatus() {
|
|
979
|
+
return { id: "", status: "" };
|
|
980
|
+
}
|
|
981
|
+
function financialProfile(payload, resource, expectedID = "") {
|
|
982
|
+
const entry = object(object(payload)[resource]);
|
|
983
|
+
const id = string(entry.id), status = string(entry.status);
|
|
984
|
+
if (!isValidGraphQLID(id) || !status || expectedID && id !== expectedID) throw new TypeError("invalid financial result identity");
|
|
985
|
+
return { id, status };
|
|
986
|
+
}
|
|
987
|
+
function customerProfile(payload, expectedID = "") {
|
|
988
|
+
const customer = object(object(payload).customer);
|
|
989
|
+
const id = string(customer.id);
|
|
990
|
+
if (!isValidGraphQLID(id) || expectedID && id !== expectedID) throw new TypeError("invalid customer identity");
|
|
991
|
+
return { id, firstName: string(customer.firstName), lastName: string(customer.lastName), email: string(customer.email) };
|
|
992
|
+
}
|
|
993
|
+
function isValidAmount(value) {
|
|
994
|
+
return /^[0-9]{1,10}(?:\.[0-9]{2,3})?$/.test(value) && /[1-9]/.test(value);
|
|
995
|
+
}
|
|
996
|
+
var emailWord = String.raw`[^\x00-\x20\x7f()<>\[\]:;@\\,."]+`;
|
|
997
|
+
var emailAtom = new RegExp(`^${emailWord}(?:\\.${emailWord})*$`, "u");
|
|
998
|
+
function isValidCustomerEmail(value) {
|
|
999
|
+
if (value === "") return true;
|
|
1000
|
+
if (!isValidByteLength(value, 254) || /^\p{White_Space}|\p{White_Space}$/u.test(value)) return false;
|
|
1001
|
+
const separator = value.indexOf("@");
|
|
1002
|
+
if (separator < 0 || !emailAtom.test(value.slice(0, separator))) return false;
|
|
1003
|
+
const domain = value.slice(separator + 1);
|
|
1004
|
+
return emailAtom.test(domain) || domain.startsWith("[") && domain.endsWith("]") && !domain.includes("%") && isIP(domain.slice(1, -1)) !== 0;
|
|
1005
|
+
}
|
|
1006
|
+
var errorClasses = /* @__PURE__ */ new Map([
|
|
1007
|
+
["NOT_FOUND", "NOT_FOUND"],
|
|
1008
|
+
["VALIDATION", "PROVIDER_REJECTION"],
|
|
1009
|
+
["AUTHORIZATION", "PROVIDER_REJECTION"],
|
|
1010
|
+
["RESOURCE_LIMIT", "RATE_LIMIT"],
|
|
1011
|
+
["INTERNAL", "AVAILABILITY"],
|
|
1012
|
+
["SERVICE_AVAILABILITY", "AVAILABILITY"]
|
|
1013
|
+
]);
|
|
1014
|
+
function writeErrorOutcome(errors) {
|
|
1015
|
+
let outcome;
|
|
1016
|
+
for (const error of errors) {
|
|
1017
|
+
try {
|
|
1018
|
+
const fields = object(error);
|
|
1019
|
+
if (!string(fields.message).replace(/\p{White_Space}/gu, "")) return void 0;
|
|
1020
|
+
const current = errorClasses.get(string(object(fields.extensions).errorClass));
|
|
1021
|
+
if (!current || outcome && outcome !== current) return void 0;
|
|
1022
|
+
outcome = current;
|
|
1023
|
+
} catch {
|
|
1024
|
+
return void 0;
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
return outcome;
|
|
1028
|
+
}
|
|
1029
|
+
function json(body) {
|
|
1030
|
+
return JSON.parse(Buffer.from(body).toString("utf8"));
|
|
1031
|
+
}
|
|
1032
|
+
var refusalStatuses = /* @__PURE__ */ new Set([400, 401, 403, 404, 411, 413, 414, 415, 422]);
|
|
1033
|
+
function isDefiniteRefusal(response) {
|
|
1034
|
+
if (!refusalStatuses.has(response.status)) return false;
|
|
1035
|
+
let fields;
|
|
1036
|
+
try {
|
|
1037
|
+
fields = rawFields(Buffer.from(response.body).toString("utf8"));
|
|
1038
|
+
} catch {
|
|
1039
|
+
return false;
|
|
1040
|
+
}
|
|
1041
|
+
if (fields.get("success") === "true") return false;
|
|
1042
|
+
if (["data", "result", "results"].some((key) => !["", "null", "{}", "[]"].includes(fields.get(key) ?? ""))) return false;
|
|
1043
|
+
return ["code", "message", "error", "errors", "errorInfo"].some((key) => !["", "null", '""', "[]", "{}"].includes(fields.get(key) ?? ""));
|
|
1044
|
+
}
|
|
1045
|
+
function rawFields(text) {
|
|
1046
|
+
object(JSON.parse(text));
|
|
1047
|
+
const tokens = text.matchAll(/"(?:\\.|[^"\\])*"|[{}[\],:]|[^"{}[\],:\s]+/gu);
|
|
1048
|
+
const fields = /* @__PURE__ */ new Map();
|
|
1049
|
+
tokens.next();
|
|
1050
|
+
for (; ; ) {
|
|
1051
|
+
const key = tokens.next().value;
|
|
1052
|
+
if (!key || key[0] === "}") return fields;
|
|
1053
|
+
tokens.next();
|
|
1054
|
+
const first = tokens.next().value;
|
|
1055
|
+
let last = first;
|
|
1056
|
+
let depth = first[0] === "{" || first[0] === "[" ? 1 : 0;
|
|
1057
|
+
while (depth > 0) {
|
|
1058
|
+
last = tokens.next().value;
|
|
1059
|
+
if (last[0] === "}" || last[0] === "]") depth--;
|
|
1060
|
+
if (last[0] === "{" || last[0] === "[") depth++;
|
|
1061
|
+
}
|
|
1062
|
+
fields.set(JSON.parse(key[0]), text.slice(first.index, last.index + last[0].length));
|
|
1063
|
+
if (tokens.next().value?.[0] === "}") return fields;
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
// src/limited.ts
|
|
1068
|
+
import { createHash, randomBytes } from "crypto";
|
|
1069
|
+
import { constants } from "fs";
|
|
1070
|
+
import { open, realpath } from "fs/promises";
|
|
1071
|
+
import { isAbsolute, join, relative, sep } from "path";
|
|
1072
|
+
import { definitionMaxSends, newMutationBranch as newMutationBranch2, newMutationUncertain } from "@superdurable/connectors-sdk";
|
|
1073
|
+
import { newFence } from "@superdurable/connectors-sdk/singledispatch";
|
|
1074
|
+
var LimitedMutation = class extends BraintreeMutation {
|
|
1075
|
+
constructor(client, contract, query, empty, success, allowsBlindResend = true, hasNotFoundBranch = true) {
|
|
1076
|
+
super(client, contract, query, empty, success, false, hasNotFoundBranch);
|
|
1077
|
+
this.allowsBlindResend = allowsBlindResend;
|
|
1078
|
+
}
|
|
1079
|
+
allowsBlindResend;
|
|
1080
|
+
async limited(call, values, decode, recovery, fileInput) {
|
|
1081
|
+
const maxSends = call.maxSendsOverride ?? definitionMaxSends(this.contract);
|
|
1082
|
+
let fence;
|
|
1083
|
+
try {
|
|
1084
|
+
fence = newFence(call, this.contract.stepDefaults.executeMethodTimeoutMs ?? 3e4, { maxSends });
|
|
1085
|
+
} catch {
|
|
1086
|
+
return this.branch("defect", "LOCAL_DEFECT", "Braintree dispatch checkpoint is unavailable");
|
|
1087
|
+
}
|
|
1088
|
+
const decision = await fence.decide();
|
|
1089
|
+
if (decision.kind === "failClosed") return this.retry("TRANSPORT", "Braintree dispatch checkpoint could not be trusted");
|
|
1090
|
+
const prior = decision.priorSendUpperBound ?? 0;
|
|
1091
|
+
if (recovery && prior > 0 && decision.marker?.state !== "canResend") {
|
|
1092
|
+
const lookup = await this.client.getDispute().invoke(call, { disputeId: recovery.disputeID });
|
|
1093
|
+
if (lookup.kind !== "branch" || lookup.branch !== "found" || !disputeStatuses.has(lookup.value.status)) {
|
|
1094
|
+
return this.retry("AVAILABILITY", "Braintree dispute read-back is unavailable");
|
|
1095
|
+
}
|
|
1096
|
+
const recovered = recovery.confirm(lookup.value);
|
|
1097
|
+
if (recovered !== void 0) return newMutationBranch2(this.success, recovered);
|
|
1098
|
+
if (lookup.value.status !== "OPEN") return this.uncertain("Braintree dispute changed status after an unknown send");
|
|
1099
|
+
}
|
|
1100
|
+
if (decision.kind === "readBackRequired" || !this.allowsBlindResend && decision.kind !== "sendAllowed") {
|
|
1101
|
+
return this.uncertain("Braintree write remains unconfirmed");
|
|
1102
|
+
}
|
|
1103
|
+
const variables = { input: { clientMutationId: call.id, ...values } };
|
|
1104
|
+
let file;
|
|
1105
|
+
if (fileInput) {
|
|
1106
|
+
try {
|
|
1107
|
+
file = await evidenceMultipart(this.client.evidenceDirectory, this.query, variables, fileInput);
|
|
1108
|
+
} catch {
|
|
1109
|
+
return prior ? this.retry("TRANSPORT", "an earlier possible Braintree write remains unconfirmed") : this.invalid("file evidence is unavailable or invalid");
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
let response;
|
|
1113
|
+
try {
|
|
1114
|
+
response = await fence.dispatch((signal) => file ? this.client.postGraphQL(call, file.body, file.contentType, signal) : this.client.graphQL(call, this.query, variables, signal));
|
|
1115
|
+
} catch {
|
|
1116
|
+
return this.retry("AVAILABILITY", "Braintree dispatch was deferred");
|
|
1117
|
+
}
|
|
1118
|
+
if (response.status === 429 || response.status === 503 || prior === 0 && isDefiniteRefusal(response)) {
|
|
1119
|
+
try {
|
|
1120
|
+
await fence.recordCanResend();
|
|
1121
|
+
} catch {
|
|
1122
|
+
return this.retry("AVAILABILITY", "Braintree resend checkpoint is unavailable");
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
return this.complete(response, prior > 0, decode);
|
|
1126
|
+
}
|
|
1127
|
+
uncertain(message) {
|
|
1128
|
+
return newMutationUncertain(this.empty(), this.failure("TRANSPORT", message));
|
|
1129
|
+
}
|
|
1130
|
+
};
|
|
1131
|
+
var CreateCustomerOperation = class extends LimitedMutation {
|
|
1132
|
+
/** Bind the provider client. */
|
|
1133
|
+
constructor(client) {
|
|
1134
|
+
super(
|
|
1135
|
+
client,
|
|
1136
|
+
CreateCustomerDefinition,
|
|
1137
|
+
"mutation CreateCustomer($input: CreateCustomerInput!) { createCustomer(input: $input) { customer { id firstName lastName email } } }",
|
|
1138
|
+
() => ({ id: "", firstName: "", lastName: "", email: "" }),
|
|
1139
|
+
"created",
|
|
1140
|
+
true,
|
|
1141
|
+
false
|
|
1142
|
+
);
|
|
1143
|
+
}
|
|
1144
|
+
/** Create one customer from the supplied contact fields. */
|
|
1145
|
+
async invoke(call, input) {
|
|
1146
|
+
const { firstName = "", lastName = "", email = "" } = input;
|
|
1147
|
+
if (!isValidOrderID(firstName) || !isValidOrderID(lastName) || !isValidCustomerEmail(email)) return this.invalid("customer contact fields are invalid");
|
|
1148
|
+
return this.limited(call, { customer: { firstName, lastName, email } }, customerProfile);
|
|
1149
|
+
}
|
|
1150
|
+
};
|
|
1151
|
+
var PaymentMethodMutation = class extends LimitedMutation {
|
|
1152
|
+
constructor(client, contract, query, success) {
|
|
1153
|
+
super(client, contract, query, () => ({ id: "", usage: "" }), success);
|
|
1154
|
+
}
|
|
1155
|
+
paymentMethod(call, values, expectedID = "") {
|
|
1156
|
+
return this.limited(call, values, (payload) => paymentProfile(payload, expectedID));
|
|
1157
|
+
}
|
|
1158
|
+
};
|
|
1159
|
+
var VaultPaymentMethodOperation = class extends PaymentMethodMutation {
|
|
1160
|
+
/** Bind the provider client. */
|
|
1161
|
+
constructor(client) {
|
|
1162
|
+
super(
|
|
1163
|
+
client,
|
|
1164
|
+
VaultPaymentMethodDefinition,
|
|
1165
|
+
"mutation VaultPaymentMethod($input: VaultPaymentMethodInput!) { vaultPaymentMethod(input: $input) { paymentMethod { id usage } } }",
|
|
1166
|
+
"vaulted"
|
|
1167
|
+
);
|
|
1168
|
+
}
|
|
1169
|
+
/** Vault the supplied payment method for an optional customer. */
|
|
1170
|
+
async invoke(call, input) {
|
|
1171
|
+
const { paymentMethodId, customerId = "" } = input;
|
|
1172
|
+
if (!isValidGraphQLID(paymentMethodId) || customerId && !isValidGraphQLID(customerId)) return this.invalid("payment method input is invalid");
|
|
1173
|
+
return this.paymentMethod(call, { paymentMethodId, ...customerId ? { customerId } : {} });
|
|
1174
|
+
}
|
|
1175
|
+
};
|
|
1176
|
+
var UpdateCreditCardCardholderNameOperation = class extends PaymentMethodMutation {
|
|
1177
|
+
/** Bind the provider client. */
|
|
1178
|
+
constructor(client) {
|
|
1179
|
+
super(
|
|
1180
|
+
client,
|
|
1181
|
+
UpdateCreditCardCardholderNameDefinition,
|
|
1182
|
+
"mutation UpdateCreditCardCardholderName($input: UpdateCreditCardCardholderNameInput!) { updateCreditCardCardholderName(input: $input) { paymentMethod { id usage } } }",
|
|
1183
|
+
"updated"
|
|
1184
|
+
);
|
|
1185
|
+
}
|
|
1186
|
+
/** Set the name and confirm the payment method identity. */
|
|
1187
|
+
async invoke(call, input) {
|
|
1188
|
+
const { paymentMethodId, cardholderName } = input;
|
|
1189
|
+
if (!isValidGraphQLID(paymentMethodId) || !cardholderName || !isValidOrderID(cardholderName)) return this.invalid("payment method input is invalid");
|
|
1190
|
+
return this.paymentMethod(call, { paymentMethodId, cardholderName }, paymentMethodId);
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
var UpdateCreditCardExpirationDateOperation = class extends PaymentMethodMutation {
|
|
1194
|
+
/** Bind the provider client. */
|
|
1195
|
+
constructor(client) {
|
|
1196
|
+
super(
|
|
1197
|
+
client,
|
|
1198
|
+
UpdateCreditCardExpirationDateDefinition,
|
|
1199
|
+
"mutation UpdateCreditCardExpirationDate($input: UpdateCreditCardExpirationDateInput!) { updateCreditCardExpirationDate(input: $input) { paymentMethod { id usage } } }",
|
|
1200
|
+
"updated"
|
|
1201
|
+
);
|
|
1202
|
+
}
|
|
1203
|
+
/** Set the expiration month and year. */
|
|
1204
|
+
async invoke(call, input) {
|
|
1205
|
+
const { paymentMethodId, expirationMonth, expirationYear } = input;
|
|
1206
|
+
if (!isValidGraphQLID(paymentMethodId) || !/^(?:0[1-9]|1[0-2]|\+[1-9])$/.test(expirationMonth) || !/^[2-9][0-9]{3}$/.test(expirationYear)) {
|
|
1207
|
+
return this.invalid("payment method input is invalid");
|
|
1208
|
+
}
|
|
1209
|
+
return this.paymentMethod(call, { paymentMethodId, expirationMonth, expirationYear }, paymentMethodId);
|
|
1210
|
+
}
|
|
1211
|
+
};
|
|
1212
|
+
var UpdateCreditCardBillingAddressOperation = class extends PaymentMethodMutation {
|
|
1213
|
+
/** Bind the provider client. */
|
|
1214
|
+
constructor(client) {
|
|
1215
|
+
super(
|
|
1216
|
+
client,
|
|
1217
|
+
UpdateCreditCardBillingAddressDefinition,
|
|
1218
|
+
"mutation UpdateCreditCardBillingAddress($input: UpdateCreditCardBillingAddressInput!) { updateCreditCardBillingAddress(input: $input) { paymentMethod { id usage } } }",
|
|
1219
|
+
"updated"
|
|
1220
|
+
);
|
|
1221
|
+
}
|
|
1222
|
+
/** Set the billing address fields and confirm the payment method identity. */
|
|
1223
|
+
async invoke(call, input) {
|
|
1224
|
+
const { paymentMethodId, addressLine1, city, state, postalCode, countryCode } = input;
|
|
1225
|
+
if (!isValidGraphQLID(paymentMethodId) || !isNonblankBounded(addressLine1, 255) || !isNonblankBounded(city, 255) || !isValidByteLength(state, 255) || !isNonblankBounded(postalCode, 9) || !isValidByteLength(countryCode, 2) || Buffer.byteLength(countryCode) !== 2) {
|
|
1226
|
+
return this.invalid("payment method input is invalid");
|
|
1227
|
+
}
|
|
1228
|
+
return this.paymentMethod(call, { paymentMethodId, billingAddress: {
|
|
1229
|
+
addressLine1,
|
|
1230
|
+
adminArea2: city,
|
|
1231
|
+
adminArea1: state,
|
|
1232
|
+
postalCode,
|
|
1233
|
+
countryCode
|
|
1234
|
+
} }, paymentMethodId);
|
|
1235
|
+
}
|
|
1236
|
+
};
|
|
1237
|
+
var DisputeStatus = class extends LimitedMutation {
|
|
1238
|
+
constructor(client, contract, query, success, desiredStatus) {
|
|
1239
|
+
super(client, contract, query, () => ({ id: "", status: "" }), success, false);
|
|
1240
|
+
this.desiredStatus = desiredStatus;
|
|
1241
|
+
}
|
|
1242
|
+
desiredStatus;
|
|
1243
|
+
/** Apply the requested status and recover a previously confirmed result. */
|
|
1244
|
+
async invoke(call, input) {
|
|
1245
|
+
const { disputeId } = input;
|
|
1246
|
+
if (!isValidGraphQLID(disputeId)) return this.invalid("disputeId is invalid");
|
|
1247
|
+
return this.limited(call, { disputeId }, (payload) => {
|
|
1248
|
+
const profile = dispute(object(object(payload).dispute));
|
|
1249
|
+
if (profile.id !== disputeId || profile.status !== this.desiredStatus) throw new TypeError("Braintree dispute identity or status differs");
|
|
1250
|
+
return profile;
|
|
1251
|
+
}, { disputeID: disputeId, confirm: (profile) => profile.status === this.desiredStatus ? profile : void 0 });
|
|
1252
|
+
}
|
|
1253
|
+
};
|
|
1254
|
+
var AcceptDisputeOperation = class extends DisputeStatus {
|
|
1255
|
+
/** Bind the provider client. */
|
|
1256
|
+
constructor(client) {
|
|
1257
|
+
super(
|
|
1258
|
+
client,
|
|
1259
|
+
AcceptDisputeDefinition,
|
|
1260
|
+
"mutation AcceptDispute($input: AcceptDisputeInput!) { acceptDispute(input: $input) { dispute { id status replyByDate } } }",
|
|
1261
|
+
"accepted",
|
|
1262
|
+
"ACCEPTED"
|
|
1263
|
+
);
|
|
1264
|
+
}
|
|
1265
|
+
};
|
|
1266
|
+
var FinalizeDisputeOperation = class extends DisputeStatus {
|
|
1267
|
+
/** Bind the provider client. */
|
|
1268
|
+
constructor(client) {
|
|
1269
|
+
super(
|
|
1270
|
+
client,
|
|
1271
|
+
FinalizeDisputeDefinition,
|
|
1272
|
+
"mutation FinalizeDispute($input: FinalizeDisputeInput!) { finalizeDispute(input: $input) { dispute { id status replyByDate } } }",
|
|
1273
|
+
"finalized",
|
|
1274
|
+
"DISPUTED"
|
|
1275
|
+
);
|
|
1276
|
+
}
|
|
1277
|
+
};
|
|
1278
|
+
var CreateDisputeTextEvidenceOperation = class extends LimitedMutation {
|
|
1279
|
+
/** Bind the provider client. */
|
|
1280
|
+
constructor(client) {
|
|
1281
|
+
super(
|
|
1282
|
+
client,
|
|
1283
|
+
CreateDisputeTextEvidenceDefinition,
|
|
1284
|
+
"mutation CreateDisputeTextEvidence($input: CreateDisputeTextEvidenceInput!) { createDisputeTextEvidence(input: $input) { evidence { id category content } } }",
|
|
1285
|
+
() => ({ id: "" }),
|
|
1286
|
+
"created",
|
|
1287
|
+
false
|
|
1288
|
+
);
|
|
1289
|
+
}
|
|
1290
|
+
/** Attach the statement or confirm a matching statement from an earlier call. */
|
|
1291
|
+
async invoke(call, input) {
|
|
1292
|
+
const { disputeId, category, content } = input;
|
|
1293
|
+
if (!isValidGraphQLID(disputeId) || !isValidCategory(category) || !isNonblankBounded(content, 4e3)) return this.invalid("dispute text evidence input is invalid");
|
|
1294
|
+
return this.limited(call, { disputeId, category, content }, (payload) => {
|
|
1295
|
+
const item = evidence(payload, category);
|
|
1296
|
+
if (item.content !== content) throw new TypeError("Braintree text evidence differs");
|
|
1297
|
+
return item;
|
|
1298
|
+
}, { disputeID: disputeId, confirm: (profile) => profile.evidence?.find((item) => isValidGraphQLID(item.id) && item.category === category && item.content === content) });
|
|
1299
|
+
}
|
|
1300
|
+
};
|
|
1301
|
+
var CreateDisputeFileEvidenceOperation = class extends LimitedMutation {
|
|
1302
|
+
/** Bind the provider client. */
|
|
1303
|
+
constructor(client) {
|
|
1304
|
+
super(
|
|
1305
|
+
client,
|
|
1306
|
+
CreateDisputeFileEvidenceDefinition,
|
|
1307
|
+
"mutation CreateDisputeFileEvidence($input: CreateDisputeFileEvidenceInput!) { createDisputeFileEvidence(input: $input) { dispute { id } evidence { id category } } }",
|
|
1308
|
+
() => ({ id: "" }),
|
|
1309
|
+
"created",
|
|
1310
|
+
false
|
|
1311
|
+
);
|
|
1312
|
+
}
|
|
1313
|
+
/** Verify the file and submit one multipart upload under the dispatch fence. */
|
|
1314
|
+
async invoke(call, input) {
|
|
1315
|
+
const { disputeId, category, fileName, expectedSha256 } = input;
|
|
1316
|
+
if (!isValidGraphQLID(disputeId) || !isValidCategory(category) || !/^[A-Za-z0-9._-]{1,255}$/.test(fileName) || fileName === "." || fileName === ".." || !/^[0-9a-f]{64}$/.test(expectedSha256)) {
|
|
1317
|
+
return this.invalid("dispute file evidence input is invalid");
|
|
1318
|
+
}
|
|
1319
|
+
return this.limited(call, { disputeId, category }, (payload) => {
|
|
1320
|
+
if (string(object(object(payload).dispute).id) !== disputeId) throw new TypeError("Braintree evidence dispute identity differs");
|
|
1321
|
+
return evidence(payload, category);
|
|
1322
|
+
}, void 0, input);
|
|
1323
|
+
}
|
|
1324
|
+
};
|
|
1325
|
+
function paymentProfile(payload, expectedID) {
|
|
1326
|
+
const value = object(object(payload).paymentMethod);
|
|
1327
|
+
const id = string(value.id), usage = string(value.usage);
|
|
1328
|
+
if (!isValidGraphQLID(id) || usage !== "MULTI_USE" || expectedID && expectedID !== id) throw new TypeError("Braintree payment method identity or usage differs");
|
|
1329
|
+
return { id, usage };
|
|
1330
|
+
}
|
|
1331
|
+
function evidence(payload, category) {
|
|
1332
|
+
const value = object(object(payload).evidence);
|
|
1333
|
+
const id = string(value.id), content = string(value.content);
|
|
1334
|
+
if (!isValidGraphQLID(id) || string(value.category) !== category) throw new TypeError("Braintree evidence identity or category differs");
|
|
1335
|
+
return { id, category, ...content ? { content } : {} };
|
|
1336
|
+
}
|
|
1337
|
+
function isValidCategory(value) {
|
|
1338
|
+
return /^[A-Z_]{1,64}$/.test(value);
|
|
1339
|
+
}
|
|
1340
|
+
function isNonblankBounded(value, maximum) {
|
|
1341
|
+
return isValidByteLength(value, maximum) && /[^\p{White_Space}]/u.test(value);
|
|
1342
|
+
}
|
|
1343
|
+
var maximumEvidenceBytes = 4 * 1024 * 1024;
|
|
1344
|
+
var signatures = [
|
|
1345
|
+
{ prefix: Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]), mediaType: "image/png" },
|
|
1346
|
+
{ prefix: Buffer.from([255, 216, 255]), mediaType: "image/jpeg" },
|
|
1347
|
+
{ prefix: Buffer.from("%PDF-"), mediaType: "application/pdf" }
|
|
1348
|
+
];
|
|
1349
|
+
async function evidenceMultipart(directory, query, variables, input) {
|
|
1350
|
+
if (!directory) throw new TypeError("evidence upload is disabled");
|
|
1351
|
+
const root = await realpath(directory);
|
|
1352
|
+
const path = await realpath(join(root, input.fileName));
|
|
1353
|
+
const relativePath = relative(root, path);
|
|
1354
|
+
if (isAbsolute(relativePath) || relativePath === ".." || relativePath.startsWith(`..${sep}`)) {
|
|
1355
|
+
throw new TypeError("evidence file is outside the configured directory");
|
|
1356
|
+
}
|
|
1357
|
+
const file = await open(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
|
|
1358
|
+
let content;
|
|
1359
|
+
try {
|
|
1360
|
+
const info = await file.stat();
|
|
1361
|
+
if (!info.isFile() || info.size <= 0 || info.size > maximumEvidenceBytes) throw new TypeError("invalid evidence file size or type");
|
|
1362
|
+
const bytes = Buffer.allocUnsafe(maximumEvidenceBytes + 1);
|
|
1363
|
+
let position = 0;
|
|
1364
|
+
while (position < bytes.length) {
|
|
1365
|
+
const { bytesRead } = await file.read(bytes, position, bytes.length - position, position);
|
|
1366
|
+
if (bytesRead === 0) break;
|
|
1367
|
+
position += bytesRead;
|
|
1368
|
+
}
|
|
1369
|
+
content = bytes.subarray(0, position);
|
|
1370
|
+
} finally {
|
|
1371
|
+
await file.close();
|
|
1372
|
+
}
|
|
1373
|
+
if (!content.length || content.length > maximumEvidenceBytes || createHash("sha256").update(content).digest("hex") !== input.expectedSha256) {
|
|
1374
|
+
throw new TypeError("evidence digest or size differs");
|
|
1375
|
+
}
|
|
1376
|
+
const signature = signatures.find(({ prefix }) => content.subarray(0, prefix.length).equals(prefix));
|
|
1377
|
+
if (!signature) throw new TypeError("unsupported evidence file format");
|
|
1378
|
+
const boundary = randomBytes(30).toString("hex");
|
|
1379
|
+
const inputFields = variables.input;
|
|
1380
|
+
const orderedInput = Object.fromEntries(Object.keys(inputFields).sort().map((key) => [key, inputFields[key]]));
|
|
1381
|
+
const operations = JSON.stringify({ query, variables: { file: null, input: orderedInput } });
|
|
1382
|
+
return {
|
|
1383
|
+
contentType: `multipart/form-data; boundary=${boundary}`,
|
|
1384
|
+
body: Buffer.concat([
|
|
1385
|
+
Buffer.from(`--${boundary}\r
|
|
1386
|
+
Content-Disposition: form-data; name="operations"\r
|
|
1387
|
+
Content-Type: application/json\r
|
|
1388
|
+
\r
|
|
1389
|
+
${operations}\r
|
|
1390
|
+
`),
|
|
1391
|
+
Buffer.from(`--${boundary}\r
|
|
1392
|
+
Content-Disposition: form-data; name="map"\r
|
|
1393
|
+
\r
|
|
1394
|
+
{"file_to_upload":"variables.file"}\r
|
|
1395
|
+
`),
|
|
1396
|
+
Buffer.from(`--${boundary}\r
|
|
1397
|
+
Content-Disposition: form-data; name="file_to_upload"; filename="${input.fileName}"\r
|
|
1398
|
+
Content-Type: ${signature.mediaType}\r
|
|
1399
|
+
\r
|
|
1400
|
+
`),
|
|
1401
|
+
content,
|
|
1402
|
+
Buffer.from(`\r
|
|
1403
|
+
--${boundary}--\r
|
|
1404
|
+
`)
|
|
1405
|
+
])
|
|
1406
|
+
};
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
// src/client.ts
|
|
44
1410
|
var emptyTransaction = () => ({ id: "", status: "" });
|
|
45
1411
|
var getTransactionGraphQL = "query GetTransaction($id: ID!) { node(id: $id) { __typename ... on Transaction { id status } } }";
|
|
46
1412
|
var BraintreeClient = class {
|
|
@@ -55,6 +1421,8 @@ var BraintreeClient = class {
|
|
|
55
1421
|
this.maxResponseBytes = config.maxResponseBytes ?? 1048576;
|
|
56
1422
|
if (!Number.isSafeInteger(this.timeoutMs) || this.timeoutMs <= 0 || !Number.isSafeInteger(this.maxResponseBytes) || this.maxResponseBytes <= 0)
|
|
57
1423
|
throw new TypeError("Braintree request limits must be positive integers");
|
|
1424
|
+
this.evidenceDirectory = config.evidenceDirectory ?? "";
|
|
1425
|
+
if (this.evidenceDirectory && !isAbsolute2(this.evidenceDirectory)) throw new TypeError("Braintree evidence directory must be absolute");
|
|
58
1426
|
this.send = options.send ?? sendProviderRequest;
|
|
59
1427
|
}
|
|
60
1428
|
credentials;
|
|
@@ -62,34 +1430,136 @@ var BraintreeClient = class {
|
|
|
62
1430
|
timeoutMs;
|
|
63
1431
|
apiVersion;
|
|
64
1432
|
maxResponseBytes;
|
|
1433
|
+
/** Absolute worker directory for dispute evidence. @internal */
|
|
1434
|
+
evidenceDirectory;
|
|
65
1435
|
send;
|
|
66
1436
|
/** Bind the getTransaction Query. */
|
|
67
1437
|
getTransaction() {
|
|
68
1438
|
return new GetTransactionOperation(this);
|
|
69
1439
|
}
|
|
1440
|
+
/** Bind the getDispute Query. */
|
|
1441
|
+
getDispute() {
|
|
1442
|
+
return new GetDisputeOperation(this);
|
|
1443
|
+
}
|
|
1444
|
+
/** Bind the searchDisputes Query. */
|
|
1445
|
+
searchDisputes() {
|
|
1446
|
+
return new SearchDisputesOperation(this);
|
|
1447
|
+
}
|
|
1448
|
+
/** Bind the searchTransactions Query. */
|
|
1449
|
+
searchTransactions() {
|
|
1450
|
+
return new SearchTransactionsOperation(this);
|
|
1451
|
+
}
|
|
1452
|
+
/** Bind the getCustomer Query. */
|
|
1453
|
+
getCustomer() {
|
|
1454
|
+
return new GetCustomerOperation(this);
|
|
1455
|
+
}
|
|
1456
|
+
/** Bind the getPaymentMethod Query. */
|
|
1457
|
+
getPaymentMethod() {
|
|
1458
|
+
return new GetPaymentMethodOperation(this);
|
|
1459
|
+
}
|
|
1460
|
+
/** Bind the getRefund Query. */
|
|
1461
|
+
getRefund() {
|
|
1462
|
+
return new GetRefundOperation(this);
|
|
1463
|
+
}
|
|
1464
|
+
/** Bind the deleteDisputeEvidence Mutation. */
|
|
1465
|
+
deleteDisputeEvidence() {
|
|
1466
|
+
return new DeleteDisputeEvidenceOperation(this);
|
|
1467
|
+
}
|
|
1468
|
+
/** Bind the chargePaymentMethod Mutation. */
|
|
1469
|
+
chargePaymentMethod() {
|
|
1470
|
+
return new ChargePaymentMethodOperation(this);
|
|
1471
|
+
}
|
|
1472
|
+
/** Bind the captureTransaction Mutation. */
|
|
1473
|
+
captureTransaction() {
|
|
1474
|
+
return new CaptureTransactionOperation(this);
|
|
1475
|
+
}
|
|
1476
|
+
/** Bind the voidTransaction Mutation. */
|
|
1477
|
+
voidTransaction() {
|
|
1478
|
+
return new VoidTransactionOperation(this);
|
|
1479
|
+
}
|
|
1480
|
+
/** Bind the refundTransaction Mutation. */
|
|
1481
|
+
refundTransaction() {
|
|
1482
|
+
return new RefundTransactionOperation(this);
|
|
1483
|
+
}
|
|
1484
|
+
/** Bind the deletePaymentMethodFromVault Mutation. */
|
|
1485
|
+
deletePaymentMethodFromVault() {
|
|
1486
|
+
return new DeletePaymentMethodFromVaultOperation(this);
|
|
1487
|
+
}
|
|
1488
|
+
/** Bind the updateCustomer Mutation. */
|
|
1489
|
+
updateCustomer() {
|
|
1490
|
+
return new UpdateCustomerOperation(this);
|
|
1491
|
+
}
|
|
1492
|
+
/** Bind the deleteCustomer Mutation. */
|
|
1493
|
+
deleteCustomer() {
|
|
1494
|
+
return new DeleteCustomerOperation(this);
|
|
1495
|
+
}
|
|
1496
|
+
/** Bind the acceptDispute Mutation. */
|
|
1497
|
+
acceptDispute() {
|
|
1498
|
+
return new AcceptDisputeOperation(this);
|
|
1499
|
+
}
|
|
1500
|
+
/** Bind the createDisputeTextEvidence Mutation. */
|
|
1501
|
+
createDisputeTextEvidence() {
|
|
1502
|
+
return new CreateDisputeTextEvidenceOperation(this);
|
|
1503
|
+
}
|
|
1504
|
+
/** Bind the createDisputeFileEvidence Mutation. */
|
|
1505
|
+
createDisputeFileEvidence() {
|
|
1506
|
+
return new CreateDisputeFileEvidenceOperation(this);
|
|
1507
|
+
}
|
|
1508
|
+
/** Bind the finalizeDispute Mutation. */
|
|
1509
|
+
finalizeDispute() {
|
|
1510
|
+
return new FinalizeDisputeOperation(this);
|
|
1511
|
+
}
|
|
1512
|
+
/** Bind the vaultPaymentMethod Mutation. */
|
|
1513
|
+
vaultPaymentMethod() {
|
|
1514
|
+
return new VaultPaymentMethodOperation(this);
|
|
1515
|
+
}
|
|
1516
|
+
/** Bind the updateCreditCardCardholderName Mutation. */
|
|
1517
|
+
updateCreditCardCardholderName() {
|
|
1518
|
+
return new UpdateCreditCardCardholderNameOperation(this);
|
|
1519
|
+
}
|
|
1520
|
+
/** Bind the updateCreditCardExpirationDate Mutation. */
|
|
1521
|
+
updateCreditCardExpirationDate() {
|
|
1522
|
+
return new UpdateCreditCardExpirationDateOperation(this);
|
|
1523
|
+
}
|
|
1524
|
+
/** Bind the updateCreditCardBillingAddress Mutation. */
|
|
1525
|
+
updateCreditCardBillingAddress() {
|
|
1526
|
+
return new UpdateCreditCardBillingAddressOperation(this);
|
|
1527
|
+
}
|
|
1528
|
+
/** Bind the createCustomer Mutation. */
|
|
1529
|
+
createCustomer() {
|
|
1530
|
+
return new CreateCustomerOperation(this);
|
|
1531
|
+
}
|
|
70
1532
|
/** Resolve credentials and send one bounded transaction lookup. */
|
|
71
1533
|
async get(call, input) {
|
|
1534
|
+
return this.graphQL(call, getTransactionGraphQL, { id: input.transactionId });
|
|
1535
|
+
}
|
|
1536
|
+
/** Resolve credentials and send one bounded GraphQL request. @internal */
|
|
1537
|
+
async graphQL(call, query, variables, signal = call.context.cancellationSignal) {
|
|
1538
|
+
return this.postGraphQL(call, Buffer2.from(JSON.stringify({ query, variables })), "application/json", signal);
|
|
1539
|
+
}
|
|
1540
|
+
/** Send one authenticated GraphQL body without processing redirects. @internal */
|
|
1541
|
+
async postGraphQL(call, body, contentType, signal = call.context.cancellationSignal) {
|
|
72
1542
|
let publicKey;
|
|
73
1543
|
let privateKey;
|
|
74
1544
|
try {
|
|
75
|
-
const credentials = await this.credentials.resolve(call,
|
|
1545
|
+
const credentials = await this.credentials.resolve(call, signal);
|
|
76
1546
|
publicKey = credentials.publicKey;
|
|
77
1547
|
privateKey = credentials.privateKey instanceof SecretString ? credentials.privateKey.reveal() : "";
|
|
78
1548
|
} catch {
|
|
79
1549
|
return emptyExchange("credential");
|
|
80
1550
|
}
|
|
81
1551
|
if (!isHeaderSafeCredential(publicKey) || publicKey.includes(":") || !isHeaderSafeCredential(privateKey)) return emptyExchange("credential");
|
|
82
|
-
const authorization = `Basic ${
|
|
1552
|
+
const authorization = `Basic ${Buffer2.from(`${publicKey}:${privateKey}`, "utf8").toString("base64")}`;
|
|
83
1553
|
const url = new URL(`${this.baseURL}/graphql`);
|
|
84
1554
|
const request = {
|
|
85
1555
|
url: url.toString(),
|
|
86
1556
|
method: "POST",
|
|
87
|
-
headers: { Accept: "application/json", "Content-Type": "
|
|
88
|
-
body
|
|
1557
|
+
headers: { Accept: "application/json", "Content-Type": contentType, "Content-Length": String(body.byteLength), "Braintree-Version": this.apiVersion, Authorization: authorization },
|
|
1558
|
+
body,
|
|
89
1559
|
maxResponseBytes: this.maxResponseBytes,
|
|
90
1560
|
timeoutMs: this.timeoutMs,
|
|
91
1561
|
addressPolicy: this.baseURL.startsWith("https://") ? "publicHTTPS" : "privateNetworkHTTP",
|
|
92
|
-
signal
|
|
1562
|
+
signal
|
|
93
1563
|
};
|
|
94
1564
|
let response;
|
|
95
1565
|
let isTooLarge = false;
|
|
@@ -99,6 +1569,13 @@ var BraintreeClient = class {
|
|
|
99
1569
|
if (error instanceof BodyTooLargeError && error.status !== void 0) {
|
|
100
1570
|
response = { status: error.status, headers: error.headers ?? {}, body: new Uint8Array() };
|
|
101
1571
|
isTooLarge = true;
|
|
1572
|
+
} else if (error instanceof ProviderTransportError && error.status !== void 0) {
|
|
1573
|
+
return {
|
|
1574
|
+
status: error.status,
|
|
1575
|
+
body: new Uint8Array(),
|
|
1576
|
+
retryAfterMs: parseRetryAfter(header(error.headers ?? {}, "retry-after")),
|
|
1577
|
+
error: "interrupted"
|
|
1578
|
+
};
|
|
102
1579
|
} else return emptyExchange("request");
|
|
103
1580
|
}
|
|
104
1581
|
const retryAfterMs = parseRetryAfter(header(response.headers, "retry-after"));
|
|
@@ -128,6 +1605,7 @@ var GetTransactionOperation = class {
|
|
|
128
1605
|
if (exchange.status === 408 || exchange.status >= 500) return retry("AVAILABILITY", "Braintree is temporarily unavailable", exchange.retryAfterMs);
|
|
129
1606
|
if (exchange.status !== 200) return terminal("providerRejected", "PROVIDER_REJECTION", `Braintree rejected HTTP ${exchange.status}`);
|
|
130
1607
|
if (exchange.error === "tooLarge") return terminal("invalidResponse", "RESPONSE_TOO_LARGE", "Braintree response exceeded the configured limit");
|
|
1608
|
+
if (exchange.error === "interrupted") return retry("TRANSPORT", "Braintree response was interrupted");
|
|
131
1609
|
const transaction = decodeTransaction(exchange.body, input.transactionId);
|
|
132
1610
|
if (transaction === "rejected") return terminal("providerRejected", "PROVIDER_REJECTION", "Braintree rejected the GraphQL query");
|
|
133
1611
|
if (transaction === "unavailable") return retry("AVAILABILITY", "Braintree reported a temporary GraphQL failure", exchange.retryAfterMs);
|
|
@@ -135,7 +1613,7 @@ var GetTransactionOperation = class {
|
|
|
135
1613
|
if (transaction === "graphQLNotFound") return terminal("notFound", "NOT_FOUND", "Braintree did not find the transaction");
|
|
136
1614
|
if (transaction === void 0) return terminal("invalidResponse", "PROTOCOL", "Braintree returned invalid transaction JSON");
|
|
137
1615
|
if (transaction === null) return terminal("notFound", "NOT_FOUND", "Braintree did not expose the transaction");
|
|
138
|
-
return
|
|
1616
|
+
return newQueryBranch2("found", transaction);
|
|
139
1617
|
}
|
|
140
1618
|
};
|
|
141
1619
|
function isValidGraphQLID(value) {
|
|
@@ -148,10 +1626,10 @@ function failure(kind, message) {
|
|
|
148
1626
|
return { provider: "braintree", operation: "getTransaction", kind, message };
|
|
149
1627
|
}
|
|
150
1628
|
function terminal(branch, kind, message) {
|
|
151
|
-
return
|
|
1629
|
+
return newQueryBranch2(branch, emptyTransaction(), {}, failure(kind, message));
|
|
152
1630
|
}
|
|
153
1631
|
function retry(kind, message, delay = 0) {
|
|
154
|
-
return
|
|
1632
|
+
return newQueryRetry2(failure(kind, message), delay);
|
|
155
1633
|
}
|
|
156
1634
|
function header(headers, name) {
|
|
157
1635
|
const entry = Object.entries(headers).find(([key]) => key.toLowerCase() === name.toLowerCase())?.[1];
|
|
@@ -199,12 +1677,13 @@ function newProjectConnection2(project, connectionName) {
|
|
|
199
1677
|
return newProjectConnection(project, connectionName, (loadedProject, name) => {
|
|
200
1678
|
const selected = loadedProject.configuration.connections.find((entry) => entry.connectorId === "braintree" && entry.connectionName === name);
|
|
201
1679
|
if (!selected) throw new TypeError("Braintree project connection is not configured");
|
|
202
|
-
const fields = z.strictObject({ baseUrl: z.string().optional(), apiVersion: z.string().optional(), timeout: z.union([z.string(), z.number().int()]).optional(), maxResponseBytes: z.number().int().optional() }).parse(selected.configuration);
|
|
1680
|
+
const fields = z.strictObject({ baseUrl: z.string().optional(), apiVersion: z.string().optional(), timeout: z.union([z.string(), z.number().int()]).optional(), maxResponseBytes: z.number().int().optional(), evidenceDirectory: z.string().optional() }).parse(selected.configuration);
|
|
203
1681
|
const timeoutMs = typeof fields.timeout === "number" ? Math.ceil(fields.timeout / 1e6) : fields.timeout ? parseDurationMilliseconds(fields.timeout) : void 0;
|
|
204
1682
|
const config = {
|
|
205
1683
|
...fields.baseUrl ? { baseUrl: fields.baseUrl } : {},
|
|
206
1684
|
...fields.apiVersion ? { apiVersion: fields.apiVersion } : {},
|
|
207
1685
|
...timeoutMs !== void 0 ? { timeoutMs } : {},
|
|
1686
|
+
...fields.evidenceDirectory !== void 0 ? { evidenceDirectory: fields.evidenceDirectory } : {},
|
|
208
1687
|
...fields.maxResponseBytes !== void 0 ? { maxResponseBytes: fields.maxResponseBytes } : {}
|
|
209
1688
|
};
|
|
210
1689
|
const credentials = {
|
|
@@ -231,10 +1710,151 @@ function parseDurationMilliseconds(value) {
|
|
|
231
1710
|
return milliseconds;
|
|
232
1711
|
}
|
|
233
1712
|
export {
|
|
1713
|
+
AcceptDisputeBranch,
|
|
1714
|
+
AcceptDisputeBranchAccepted,
|
|
1715
|
+
AcceptDisputeBranchDefect,
|
|
1716
|
+
AcceptDisputeBranchNotFound,
|
|
1717
|
+
AcceptDisputeBranchProviderRejected,
|
|
1718
|
+
AcceptDisputeBranchUncertain,
|
|
1719
|
+
AcceptDisputeDefinition,
|
|
1720
|
+
AcceptDisputeMetadata,
|
|
1721
|
+
AcceptDisputeOperation,
|
|
234
1722
|
BraintreeClient,
|
|
1723
|
+
CaptureTransactionBranch,
|
|
1724
|
+
CaptureTransactionBranchCaptured,
|
|
1725
|
+
CaptureTransactionBranchDefect,
|
|
1726
|
+
CaptureTransactionBranchNotFound,
|
|
1727
|
+
CaptureTransactionBranchProviderRejected,
|
|
1728
|
+
CaptureTransactionDefinition,
|
|
1729
|
+
CaptureTransactionInputSchema,
|
|
1730
|
+
CaptureTransactionMetadata,
|
|
1731
|
+
CaptureTransactionOperation,
|
|
1732
|
+
ChargePaymentMethodBranch,
|
|
1733
|
+
ChargePaymentMethodBranchCharged,
|
|
1734
|
+
ChargePaymentMethodBranchDefect,
|
|
1735
|
+
ChargePaymentMethodBranchNotFound,
|
|
1736
|
+
ChargePaymentMethodBranchProviderRejected,
|
|
1737
|
+
ChargePaymentMethodDefinition,
|
|
1738
|
+
ChargePaymentMethodInputSchema,
|
|
1739
|
+
ChargePaymentMethodMetadata,
|
|
1740
|
+
ChargePaymentMethodOperation,
|
|
235
1741
|
ConfigSchema,
|
|
236
1742
|
Connection,
|
|
237
1743
|
ConnectorID,
|
|
1744
|
+
CreateCustomerBranch,
|
|
1745
|
+
CreateCustomerBranchCreated,
|
|
1746
|
+
CreateCustomerBranchDefect,
|
|
1747
|
+
CreateCustomerBranchProviderRejected,
|
|
1748
|
+
CreateCustomerBranchUncertain,
|
|
1749
|
+
CreateCustomerDefinition,
|
|
1750
|
+
CreateCustomerInputSchema,
|
|
1751
|
+
CreateCustomerMetadata,
|
|
1752
|
+
CreateCustomerOperation,
|
|
1753
|
+
CreateDisputeFileEvidenceBranch,
|
|
1754
|
+
CreateDisputeFileEvidenceBranchCreated,
|
|
1755
|
+
CreateDisputeFileEvidenceBranchDefect,
|
|
1756
|
+
CreateDisputeFileEvidenceBranchNotFound,
|
|
1757
|
+
CreateDisputeFileEvidenceBranchProviderRejected,
|
|
1758
|
+
CreateDisputeFileEvidenceBranchUncertain,
|
|
1759
|
+
CreateDisputeFileEvidenceDefinition,
|
|
1760
|
+
CreateDisputeFileEvidenceInputSchema,
|
|
1761
|
+
CreateDisputeFileEvidenceMetadata,
|
|
1762
|
+
CreateDisputeFileEvidenceOperation,
|
|
1763
|
+
CreateDisputeTextEvidenceBranch,
|
|
1764
|
+
CreateDisputeTextEvidenceBranchCreated,
|
|
1765
|
+
CreateDisputeTextEvidenceBranchDefect,
|
|
1766
|
+
CreateDisputeTextEvidenceBranchNotFound,
|
|
1767
|
+
CreateDisputeTextEvidenceBranchProviderRejected,
|
|
1768
|
+
CreateDisputeTextEvidenceBranchUncertain,
|
|
1769
|
+
CreateDisputeTextEvidenceDefinition,
|
|
1770
|
+
CreateDisputeTextEvidenceInputSchema,
|
|
1771
|
+
CreateDisputeTextEvidenceMetadata,
|
|
1772
|
+
CreateDisputeTextEvidenceOperation,
|
|
1773
|
+
CredentialMaterialError,
|
|
1774
|
+
CustomerDeleteResultSchema,
|
|
1775
|
+
CustomerProfileSchema,
|
|
1776
|
+
DeleteCustomerBranch,
|
|
1777
|
+
DeleteCustomerBranchDefect,
|
|
1778
|
+
DeleteCustomerBranchDeleted,
|
|
1779
|
+
DeleteCustomerBranchInvalidResponse,
|
|
1780
|
+
DeleteCustomerBranchNotFound,
|
|
1781
|
+
DeleteCustomerBranchProviderRejected,
|
|
1782
|
+
DeleteCustomerDefinition,
|
|
1783
|
+
DeleteCustomerMetadata,
|
|
1784
|
+
DeleteCustomerOperation,
|
|
1785
|
+
DeleteDisputeEvidenceBranch,
|
|
1786
|
+
DeleteDisputeEvidenceBranchDefect,
|
|
1787
|
+
DeleteDisputeEvidenceBranchDeleted,
|
|
1788
|
+
DeleteDisputeEvidenceBranchInvalidResponse,
|
|
1789
|
+
DeleteDisputeEvidenceBranchNotFound,
|
|
1790
|
+
DeleteDisputeEvidenceBranchProviderRejected,
|
|
1791
|
+
DeleteDisputeEvidenceDefinition,
|
|
1792
|
+
DeleteDisputeEvidenceInputSchema,
|
|
1793
|
+
DeleteDisputeEvidenceMetadata,
|
|
1794
|
+
DeleteDisputeEvidenceOperation,
|
|
1795
|
+
DeletePaymentMethodFromVaultBranch,
|
|
1796
|
+
DeletePaymentMethodFromVaultBranchDefect,
|
|
1797
|
+
DeletePaymentMethodFromVaultBranchDeleted,
|
|
1798
|
+
DeletePaymentMethodFromVaultBranchInvalidResponse,
|
|
1799
|
+
DeletePaymentMethodFromVaultBranchNotFound,
|
|
1800
|
+
DeletePaymentMethodFromVaultBranchProviderRejected,
|
|
1801
|
+
DeletePaymentMethodFromVaultDefinition,
|
|
1802
|
+
DeletePaymentMethodFromVaultMetadata,
|
|
1803
|
+
DeletePaymentMethodFromVaultOperation,
|
|
1804
|
+
DisputeEvidenceDeleteResultSchema,
|
|
1805
|
+
DisputeEvidenceProfileSchema,
|
|
1806
|
+
DisputeProfileSchema,
|
|
1807
|
+
DisputeTextEvidenceProfileSchema,
|
|
1808
|
+
DisputesPageSchema,
|
|
1809
|
+
FinalizeDisputeBranch,
|
|
1810
|
+
FinalizeDisputeBranchDefect,
|
|
1811
|
+
FinalizeDisputeBranchFinalized,
|
|
1812
|
+
FinalizeDisputeBranchNotFound,
|
|
1813
|
+
FinalizeDisputeBranchProviderRejected,
|
|
1814
|
+
FinalizeDisputeBranchUncertain,
|
|
1815
|
+
FinalizeDisputeDefinition,
|
|
1816
|
+
FinalizeDisputeMetadata,
|
|
1817
|
+
FinalizeDisputeOperation,
|
|
1818
|
+
GetCustomerBranch,
|
|
1819
|
+
GetCustomerBranchDefect,
|
|
1820
|
+
GetCustomerBranchFound,
|
|
1821
|
+
GetCustomerBranchInvalidResponse,
|
|
1822
|
+
GetCustomerBranchNotFound,
|
|
1823
|
+
GetCustomerBranchProviderRejected,
|
|
1824
|
+
GetCustomerDefinition,
|
|
1825
|
+
GetCustomerInputSchema,
|
|
1826
|
+
GetCustomerMetadata,
|
|
1827
|
+
GetCustomerOperation,
|
|
1828
|
+
GetDisputeBranch,
|
|
1829
|
+
GetDisputeBranchDefect,
|
|
1830
|
+
GetDisputeBranchFound,
|
|
1831
|
+
GetDisputeBranchInvalidResponse,
|
|
1832
|
+
GetDisputeBranchNotFound,
|
|
1833
|
+
GetDisputeBranchProviderRejected,
|
|
1834
|
+
GetDisputeDefinition,
|
|
1835
|
+
GetDisputeInputSchema,
|
|
1836
|
+
GetDisputeMetadata,
|
|
1837
|
+
GetDisputeOperation,
|
|
1838
|
+
GetPaymentMethodBranch,
|
|
1839
|
+
GetPaymentMethodBranchDefect,
|
|
1840
|
+
GetPaymentMethodBranchFound,
|
|
1841
|
+
GetPaymentMethodBranchInvalidResponse,
|
|
1842
|
+
GetPaymentMethodBranchNotFound,
|
|
1843
|
+
GetPaymentMethodBranchProviderRejected,
|
|
1844
|
+
GetPaymentMethodDefinition,
|
|
1845
|
+
GetPaymentMethodInputSchema,
|
|
1846
|
+
GetPaymentMethodMetadata,
|
|
1847
|
+
GetPaymentMethodOperation,
|
|
1848
|
+
GetRefundBranch,
|
|
1849
|
+
GetRefundBranchDefect,
|
|
1850
|
+
GetRefundBranchFound,
|
|
1851
|
+
GetRefundBranchInvalidResponse,
|
|
1852
|
+
GetRefundBranchNotFound,
|
|
1853
|
+
GetRefundBranchProviderRejected,
|
|
1854
|
+
GetRefundDefinition,
|
|
1855
|
+
GetRefundInputSchema,
|
|
1856
|
+
GetRefundMetadata,
|
|
1857
|
+
GetRefundOperation,
|
|
238
1858
|
GetTransactionBranch,
|
|
239
1859
|
GetTransactionBranchDefect,
|
|
240
1860
|
GetTransactionBranchFound,
|
|
@@ -245,11 +1865,126 @@ export {
|
|
|
245
1865
|
GetTransactionInputSchema,
|
|
246
1866
|
GetTransactionMetadata,
|
|
247
1867
|
GetTransactionOperation,
|
|
1868
|
+
PaymentMethodDeleteResultSchema,
|
|
1869
|
+
PaymentMethodProfileSchema,
|
|
248
1870
|
ProviderID,
|
|
1871
|
+
RefundProfileSchema,
|
|
1872
|
+
RefundTransactionBranch,
|
|
1873
|
+
RefundTransactionBranchDefect,
|
|
1874
|
+
RefundTransactionBranchNotFound,
|
|
1875
|
+
RefundTransactionBranchProviderRejected,
|
|
1876
|
+
RefundTransactionBranchRefunded,
|
|
1877
|
+
RefundTransactionDefinition,
|
|
1878
|
+
RefundTransactionInputSchema,
|
|
1879
|
+
RefundTransactionMetadata,
|
|
1880
|
+
RefundTransactionOperation,
|
|
1881
|
+
SearchDisputesBranch,
|
|
1882
|
+
SearchDisputesBranchDefect,
|
|
1883
|
+
SearchDisputesBranchInvalidResponse,
|
|
1884
|
+
SearchDisputesBranchNotFound,
|
|
1885
|
+
SearchDisputesBranchProviderRejected,
|
|
1886
|
+
SearchDisputesBranchSearched,
|
|
1887
|
+
SearchDisputesDefinition,
|
|
1888
|
+
SearchDisputesInputSchema,
|
|
1889
|
+
SearchDisputesMetadata,
|
|
1890
|
+
SearchDisputesOperation,
|
|
1891
|
+
SearchTransactionsBranch,
|
|
1892
|
+
SearchTransactionsBranchDefect,
|
|
1893
|
+
SearchTransactionsBranchInvalidResponse,
|
|
1894
|
+
SearchTransactionsBranchNotFound,
|
|
1895
|
+
SearchTransactionsBranchProviderRejected,
|
|
1896
|
+
SearchTransactionsBranchSearched,
|
|
1897
|
+
SearchTransactionsDefinition,
|
|
1898
|
+
SearchTransactionsInputSchema,
|
|
1899
|
+
SearchTransactionsMetadata,
|
|
1900
|
+
SearchTransactionsOperation,
|
|
249
1901
|
TransactionProfileSchema,
|
|
1902
|
+
TransactionsPageSchema,
|
|
1903
|
+
UpdateCreditCardBillingAddressBranch,
|
|
1904
|
+
UpdateCreditCardBillingAddressBranchDefect,
|
|
1905
|
+
UpdateCreditCardBillingAddressBranchNotFound,
|
|
1906
|
+
UpdateCreditCardBillingAddressBranchProviderRejected,
|
|
1907
|
+
UpdateCreditCardBillingAddressBranchUncertain,
|
|
1908
|
+
UpdateCreditCardBillingAddressBranchUpdated,
|
|
1909
|
+
UpdateCreditCardBillingAddressDefinition,
|
|
1910
|
+
UpdateCreditCardBillingAddressInputSchema,
|
|
1911
|
+
UpdateCreditCardBillingAddressMetadata,
|
|
1912
|
+
UpdateCreditCardBillingAddressOperation,
|
|
1913
|
+
UpdateCreditCardCardholderNameBranch,
|
|
1914
|
+
UpdateCreditCardCardholderNameBranchDefect,
|
|
1915
|
+
UpdateCreditCardCardholderNameBranchNotFound,
|
|
1916
|
+
UpdateCreditCardCardholderNameBranchProviderRejected,
|
|
1917
|
+
UpdateCreditCardCardholderNameBranchUncertain,
|
|
1918
|
+
UpdateCreditCardCardholderNameBranchUpdated,
|
|
1919
|
+
UpdateCreditCardCardholderNameDefinition,
|
|
1920
|
+
UpdateCreditCardCardholderNameInputSchema,
|
|
1921
|
+
UpdateCreditCardCardholderNameMetadata,
|
|
1922
|
+
UpdateCreditCardCardholderNameOperation,
|
|
1923
|
+
UpdateCreditCardExpirationDateBranch,
|
|
1924
|
+
UpdateCreditCardExpirationDateBranchDefect,
|
|
1925
|
+
UpdateCreditCardExpirationDateBranchNotFound,
|
|
1926
|
+
UpdateCreditCardExpirationDateBranchProviderRejected,
|
|
1927
|
+
UpdateCreditCardExpirationDateBranchUncertain,
|
|
1928
|
+
UpdateCreditCardExpirationDateBranchUpdated,
|
|
1929
|
+
UpdateCreditCardExpirationDateDefinition,
|
|
1930
|
+
UpdateCreditCardExpirationDateInputSchema,
|
|
1931
|
+
UpdateCreditCardExpirationDateMetadata,
|
|
1932
|
+
UpdateCreditCardExpirationDateOperation,
|
|
1933
|
+
UpdateCustomerBranch,
|
|
1934
|
+
UpdateCustomerBranchDefect,
|
|
1935
|
+
UpdateCustomerBranchInvalidResponse,
|
|
1936
|
+
UpdateCustomerBranchNotFound,
|
|
1937
|
+
UpdateCustomerBranchProviderRejected,
|
|
1938
|
+
UpdateCustomerBranchUpdated,
|
|
1939
|
+
UpdateCustomerDefinition,
|
|
1940
|
+
UpdateCustomerInputSchema,
|
|
1941
|
+
UpdateCustomerMetadata,
|
|
1942
|
+
UpdateCustomerOperation,
|
|
1943
|
+
VaultPaymentMethodBranch,
|
|
1944
|
+
VaultPaymentMethodBranchDefect,
|
|
1945
|
+
VaultPaymentMethodBranchNotFound,
|
|
1946
|
+
VaultPaymentMethodBranchProviderRejected,
|
|
1947
|
+
VaultPaymentMethodBranchUncertain,
|
|
1948
|
+
VaultPaymentMethodBranchVaulted,
|
|
1949
|
+
VaultPaymentMethodDefinition,
|
|
1950
|
+
VaultPaymentMethodInputSchema,
|
|
1951
|
+
VaultPaymentMethodMetadata,
|
|
1952
|
+
VaultPaymentMethodOperation,
|
|
1953
|
+
VoidTransactionBranch,
|
|
1954
|
+
VoidTransactionBranchDefect,
|
|
1955
|
+
VoidTransactionBranchNotFound,
|
|
1956
|
+
VoidTransactionBranchProviderRejected,
|
|
1957
|
+
VoidTransactionBranchVoided,
|
|
1958
|
+
VoidTransactionDefinition,
|
|
1959
|
+
VoidTransactionMetadata,
|
|
1960
|
+
VoidTransactionOperation,
|
|
250
1961
|
decodeCredentials,
|
|
1962
|
+
isCredentialMaterialError,
|
|
1963
|
+
newAcceptDisputeStep,
|
|
1964
|
+
newCaptureTransactionStep,
|
|
1965
|
+
newChargePaymentMethodStep,
|
|
251
1966
|
newConnection,
|
|
252
1967
|
newConnectionWithOperations,
|
|
1968
|
+
newCreateCustomerStep,
|
|
1969
|
+
newCreateDisputeFileEvidenceStep,
|
|
1970
|
+
newCreateDisputeTextEvidenceStep,
|
|
1971
|
+
newDeleteCustomerStep,
|
|
1972
|
+
newDeleteDisputeEvidenceStep,
|
|
1973
|
+
newDeletePaymentMethodFromVaultStep,
|
|
1974
|
+
newFinalizeDisputeStep,
|
|
1975
|
+
newGetCustomerStep,
|
|
1976
|
+
newGetDisputeStep,
|
|
1977
|
+
newGetPaymentMethodStep,
|
|
1978
|
+
newGetRefundStep,
|
|
253
1979
|
newGetTransactionStep,
|
|
254
|
-
newProjectConnection2 as newProjectConnection
|
|
1980
|
+
newProjectConnection2 as newProjectConnection,
|
|
1981
|
+
newRefundTransactionStep,
|
|
1982
|
+
newSearchDisputesStep,
|
|
1983
|
+
newSearchTransactionsStep,
|
|
1984
|
+
newUpdateCreditCardBillingAddressStep,
|
|
1985
|
+
newUpdateCreditCardCardholderNameStep,
|
|
1986
|
+
newUpdateCreditCardExpirationDateStep,
|
|
1987
|
+
newUpdateCustomerStep,
|
|
1988
|
+
newVaultPaymentMethodStep,
|
|
1989
|
+
newVoidTransactionStep
|
|
255
1990
|
};
|