@wix/payments 1.0.0 → 1.0.2
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/context/package.json +2 -1
- package/meta/package.json +2 -1
- package/package.json +11 -5
- package/type-bundles/context.bundle.d.ts +447 -0
- package/type-bundles/index.bundle.d.ts +746 -0
- package/type-bundles/meta.bundle.d.ts +785 -0
package/context/package.json
CHANGED
package/meta/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/payments",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -9,21 +9,27 @@
|
|
|
9
9
|
"module": "build/es/index.js",
|
|
10
10
|
"main": "build/cjs/index.js",
|
|
11
11
|
"typings": "./build/cjs/index.d.ts",
|
|
12
|
+
"typesBundle": "./type-bundles/index.bundle.d.ts",
|
|
12
13
|
"files": [
|
|
13
14
|
"build",
|
|
14
15
|
"frontend/package.json",
|
|
15
16
|
"meta",
|
|
16
|
-
"context"
|
|
17
|
+
"context",
|
|
18
|
+
"type-bundles"
|
|
17
19
|
],
|
|
18
20
|
"dependencies": {
|
|
19
|
-
"@wix/payments_refunds": "1.0.
|
|
21
|
+
"@wix/payments_refunds": "1.0.2"
|
|
20
22
|
},
|
|
21
23
|
"devDependencies": {
|
|
22
24
|
"@wix/sdk": "https://cdn.dev.wixpress.com/@wix/sdk/02e8069ab2fd783e0e6a080fc7d590e76cb26ab93c8389574286305b.tar.gz",
|
|
25
|
+
"glob": "^10.4.1",
|
|
26
|
+
"rollup": "^4.18.0",
|
|
27
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
23
28
|
"typescript": "^5.3.2"
|
|
24
29
|
},
|
|
25
30
|
"scripts": {
|
|
26
|
-
"build": "tsc -b tsconfig.json tsconfig.esm.json",
|
|
31
|
+
"build": "tsc -b tsconfig.json tsconfig.esm.json && npm run build:dts-bundles",
|
|
32
|
+
"build:dts-bundles": "test -f config/rollup-config.js && rollup --config config/rollup-config.js || echo 'Warning: config/rollup-config.js not found!'",
|
|
27
33
|
"test": ":"
|
|
28
34
|
},
|
|
29
35
|
"wix": {
|
|
@@ -37,5 +43,5 @@
|
|
|
37
43
|
"fqdn": ""
|
|
38
44
|
}
|
|
39
45
|
},
|
|
40
|
-
"falconPackageHash": "
|
|
46
|
+
"falconPackageHash": "0f14b67dab0b7bdac29b3944c929fb968832b9acceeae0060751c5ab"
|
|
41
47
|
}
|
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A refund a record of an attempt of
|
|
3
|
+
* returning funds for a charge from a merchant to a customer to who has made a purchase.
|
|
4
|
+
* Read more about refunds in this [article](<https://dev.wix.com/docs/rest/business-management/payments/refunds/introduction>).
|
|
5
|
+
*/
|
|
6
|
+
interface Refund {
|
|
7
|
+
/**
|
|
8
|
+
* Refund ID.
|
|
9
|
+
* @readonly
|
|
10
|
+
*/
|
|
11
|
+
_id?: string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Revision number, which increments by 1 each time the refund is updated.
|
|
14
|
+
*
|
|
15
|
+
* Ignored when creating a refund.
|
|
16
|
+
* @readonly
|
|
17
|
+
*/
|
|
18
|
+
revision?: string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Date and time the refund was created.
|
|
21
|
+
* @readonly
|
|
22
|
+
*/
|
|
23
|
+
_createdDate?: Date;
|
|
24
|
+
/**
|
|
25
|
+
* Date and time the refund was last updated.
|
|
26
|
+
* @readonly
|
|
27
|
+
*/
|
|
28
|
+
_updatedDate?: Date;
|
|
29
|
+
/** Data Extensions */
|
|
30
|
+
extendedFields?: ExtendedFields;
|
|
31
|
+
/** ID of charge for which the funds are returned by this refund. */
|
|
32
|
+
chargeId?: string | null;
|
|
33
|
+
/** Currency of refund, should be the same as currency of charge. */
|
|
34
|
+
currency?: string | null;
|
|
35
|
+
/**
|
|
36
|
+
* Amount of refund in base units, what's returned to the customer.
|
|
37
|
+
* E.g. "12.95".
|
|
38
|
+
*/
|
|
39
|
+
amount?: string | null;
|
|
40
|
+
/**
|
|
41
|
+
* Application fee returned to merchant from Wix.
|
|
42
|
+
* In base units, e.g. "12.95".
|
|
43
|
+
* Not present when no application fee was returned.
|
|
44
|
+
* @readonly
|
|
45
|
+
*/
|
|
46
|
+
returnedApplicationFee?: string | null;
|
|
47
|
+
/**
|
|
48
|
+
* Processing fee returned to merchant from provider.
|
|
49
|
+
* In base units, e.g. "12.95".
|
|
50
|
+
* Applicable only to Wix Payments provider.
|
|
51
|
+
* Not present when no processing fee was returned.
|
|
52
|
+
* @readonly
|
|
53
|
+
*/
|
|
54
|
+
returnedProcessingFee?: string | null;
|
|
55
|
+
/**
|
|
56
|
+
* True when refund returns all funds for a charge.
|
|
57
|
+
* @readonly
|
|
58
|
+
*/
|
|
59
|
+
full?: boolean | null;
|
|
60
|
+
/**
|
|
61
|
+
* Status of the refund.
|
|
62
|
+
* Read more about statuses in this [article](<https://dev.wix.com/docs/rest/business-management/payments/refunds/introduction#lifecycle-of-a-refund>).
|
|
63
|
+
* @readonly
|
|
64
|
+
*/
|
|
65
|
+
status?: Status;
|
|
66
|
+
/**
|
|
67
|
+
* ID of the refund on the PSP side.
|
|
68
|
+
* @readonly
|
|
69
|
+
*/
|
|
70
|
+
providerRefundId?: string | null;
|
|
71
|
+
/** Reason why this refund was issued. */
|
|
72
|
+
reason?: string | null;
|
|
73
|
+
/**
|
|
74
|
+
* Details about refund status.
|
|
75
|
+
* Mostly used with statuses `FAILED` and `REVERSED`.
|
|
76
|
+
* @readonly
|
|
77
|
+
*/
|
|
78
|
+
statusInfo?: StatusInfo;
|
|
79
|
+
/**
|
|
80
|
+
* Acquirer Reference Number.
|
|
81
|
+
* @readonly
|
|
82
|
+
*/
|
|
83
|
+
acquirerReferenceNumber?: string | null;
|
|
84
|
+
/** Optional free-text note about this refund. */
|
|
85
|
+
note?: string | null;
|
|
86
|
+
}
|
|
87
|
+
interface ExtendedFields {
|
|
88
|
+
/**
|
|
89
|
+
* Extended field data. Each key corresponds to the namespace of the app that created the extended fields.
|
|
90
|
+
* The value of each key is structured according to the schema defined when the extended fields were configured.
|
|
91
|
+
*
|
|
92
|
+
* You can only access fields for which you have the appropriate permissions.
|
|
93
|
+
*
|
|
94
|
+
* Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields).
|
|
95
|
+
*/
|
|
96
|
+
namespaces?: Record<string, Record<string, any>>;
|
|
97
|
+
}
|
|
98
|
+
declare enum Status {
|
|
99
|
+
UNKNOWN_STATUS = "UNKNOWN_STATUS",
|
|
100
|
+
/**
|
|
101
|
+
* Initial status for all refunds.
|
|
102
|
+
* Provisional, refund should be in this status for less than a minute.
|
|
103
|
+
*/
|
|
104
|
+
STARTING = "STARTING",
|
|
105
|
+
/** Status right after STARTED for asynchronous refunds. */
|
|
106
|
+
PENDING = "PENDING",
|
|
107
|
+
/**
|
|
108
|
+
* Refund was successful.
|
|
109
|
+
* Can transition to REVERSED in corner cases.
|
|
110
|
+
*/
|
|
111
|
+
SUCCEEDED = "SUCCEEDED",
|
|
112
|
+
/** Regular error, terminal status. */
|
|
113
|
+
FAILED = "FAILED",
|
|
114
|
+
/**
|
|
115
|
+
* Either refund reversal
|
|
116
|
+
* or any other error that comes after success, terminal status.
|
|
117
|
+
*/
|
|
118
|
+
REVERSED = "REVERSED"
|
|
119
|
+
}
|
|
120
|
+
interface StatusInfo {
|
|
121
|
+
/**
|
|
122
|
+
* Reason code.
|
|
123
|
+
* [Read more about reason codes.](https://dev.wix.com/docs/rest/api-reference/payment-provider-spi/reason-codes)
|
|
124
|
+
*/
|
|
125
|
+
code?: string;
|
|
126
|
+
/** Free-text description. */
|
|
127
|
+
description?: string | null;
|
|
128
|
+
}
|
|
129
|
+
interface Cursors {
|
|
130
|
+
/** Cursor pointing to next page in the list of results. */
|
|
131
|
+
next?: string | null;
|
|
132
|
+
/** Cursor pointing to previous page in the list of results. */
|
|
133
|
+
prev?: string | null;
|
|
134
|
+
}
|
|
135
|
+
interface UpdateExtendedFieldsResponse {
|
|
136
|
+
/** Updated refund. */
|
|
137
|
+
refund?: Refund;
|
|
138
|
+
}
|
|
139
|
+
interface GetRefundabilityResponse {
|
|
140
|
+
/** Refundability for the charge. */
|
|
141
|
+
refundability?: Refundability;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Internal notes:
|
|
145
|
+
*
|
|
146
|
+
* Instead of separate Refundability and PartialRefundability, we provide min and max refund amount.
|
|
147
|
+
* If only full refund is possible, min_refund_amount = max_refund_amount = charge amount.
|
|
148
|
+
*/
|
|
149
|
+
interface Refundability extends RefundabilityDetailsOneOf {
|
|
150
|
+
/** When charge is refundable, specifies what amounts are allowed for refund. */
|
|
151
|
+
refundOptions?: RefundOptions;
|
|
152
|
+
/** When charge is not refundable, specifies why refund is not allowed. */
|
|
153
|
+
rejection?: Rejection;
|
|
154
|
+
/** Whether the caller is allowed to refund the charge. */
|
|
155
|
+
refundable?: boolean;
|
|
156
|
+
/** Currency of the charge. */
|
|
157
|
+
currency?: string | null;
|
|
158
|
+
/**
|
|
159
|
+
* Sum of amounts of `SUCCEEDED` refunds for this charge in base units, e.g. "6.47".
|
|
160
|
+
* Used to prevent unintended refunds, read more in this
|
|
161
|
+
* [article](<https://dev.wix.com/docs/rest/business-management/payments/refunds/introduction#preventing-unintended-refunds>).
|
|
162
|
+
*/
|
|
163
|
+
previouslyRefundedAmount?: string | null;
|
|
164
|
+
}
|
|
165
|
+
/** @oneof */
|
|
166
|
+
interface RefundabilityDetailsOneOf {
|
|
167
|
+
/** When charge is refundable, specifies what amounts are allowed for refund. */
|
|
168
|
+
refundOptions?: RefundOptions;
|
|
169
|
+
/** When charge is not refundable, specifies why refund is not allowed. */
|
|
170
|
+
rejection?: Rejection;
|
|
171
|
+
}
|
|
172
|
+
interface RefundOptions {
|
|
173
|
+
/** Minimum amount allowed to be refunded in base units, e.g. "0.50". */
|
|
174
|
+
minRefundAmount?: string | null;
|
|
175
|
+
/** Maximum amount allowed to be refunded in base units, e.g. "12.95". */
|
|
176
|
+
maxRefundAmount?: string | null;
|
|
177
|
+
}
|
|
178
|
+
interface Rejection {
|
|
179
|
+
/**
|
|
180
|
+
* Following reasons are possible:
|
|
181
|
+
* - `CHARGE_REFUNDED` — charge is already fully refunded.
|
|
182
|
+
* - `CHARGE_REFUND_IN_PROGRESS` — another refund was initiated for this charge
|
|
183
|
+
* and is waiting for confirmation from the provider.
|
|
184
|
+
* - `CHARGE_DISPUTED` — charge was disputed.
|
|
185
|
+
* - `CHARGE_REFUND_PERIOD_ENDED` — charge is too old to be refunded.
|
|
186
|
+
* - `CHARGE_UNPAID` — charge is unpaid.
|
|
187
|
+
* - `PROVIDER_DOWN` — PSP is temporarily down.
|
|
188
|
+
* - `PROVIDER_NOT_SUPPORTED` — provider doesn't support refunds at the moment,
|
|
189
|
+
* charge is in the wrong state,
|
|
190
|
+
* or we don't have required information for this transaction.
|
|
191
|
+
* - `PAYMENT_METHOD_NOT_SUPPORTED` — payment method of a charge doesn't support refunds.
|
|
192
|
+
* - `MERCHANT_ACCOUNT_NOT_SUPPORTED` — merchant account doesn't support refunds at the moment.
|
|
193
|
+
* - `MERCHANT_BALANCE_INSUFFICIENT` — merchant doesn't have enough balance to issue a refund for this charge.
|
|
194
|
+
* - `NOT_AUTHORIZED` — logged in merchant has no permission to refund this charge.
|
|
195
|
+
*/
|
|
196
|
+
reason?: RejectionReason;
|
|
197
|
+
}
|
|
198
|
+
declare enum RejectionReason {
|
|
199
|
+
UNKNOWN_REJECTION_REASON = "UNKNOWN_REJECTION_REASON",
|
|
200
|
+
/** Charge is already fully refunded. */
|
|
201
|
+
CHARGE_REFUNDED = "CHARGE_REFUNDED",
|
|
202
|
+
/** Another refund was initiated for this charge and is waiting for confirmation from the provider. */
|
|
203
|
+
CHARGE_REFUND_IN_PROGRESS = "CHARGE_REFUND_IN_PROGRESS",
|
|
204
|
+
/** Charge was disputed. */
|
|
205
|
+
CHARGE_DISPUTED = "CHARGE_DISPUTED",
|
|
206
|
+
/** Charge is too old to be refunded. */
|
|
207
|
+
CHARGE_REFUND_PERIOD_ENDED = "CHARGE_REFUND_PERIOD_ENDED",
|
|
208
|
+
/** Charge is unpaid. */
|
|
209
|
+
CHARGE_UNPAID = "CHARGE_UNPAID",
|
|
210
|
+
/** PSP is temporarily down. */
|
|
211
|
+
PROVIDER_DOWN = "PROVIDER_DOWN",
|
|
212
|
+
/**
|
|
213
|
+
* Provider doesn't support refunds at the moment, transaction in a wrong state or we don't
|
|
214
|
+
* have required information for this transaction.
|
|
215
|
+
*/
|
|
216
|
+
PROVIDER_NOT_SUPPORTED = "PROVIDER_NOT_SUPPORTED",
|
|
217
|
+
/** Payment method of a charge doesn't support refunds. */
|
|
218
|
+
PAYMENT_METHOD_NOT_SUPPORTED = "PAYMENT_METHOD_NOT_SUPPORTED",
|
|
219
|
+
/** Merchant account doesn't support refunds at the moment. */
|
|
220
|
+
MERCHANT_ACCOUNT_NOT_SUPPORTED = "MERCHANT_ACCOUNT_NOT_SUPPORTED",
|
|
221
|
+
/** Merchant doesn't have enough balance to issue a refund for this charge. */
|
|
222
|
+
MERCHANT_BALANCE_INSUFFICIENT = "MERCHANT_BALANCE_INSUFFICIENT",
|
|
223
|
+
/** Logged in merchant has no permission to refund this charge. */
|
|
224
|
+
NOT_AUTHORIZED = "NOT_AUTHORIZED"
|
|
225
|
+
}
|
|
226
|
+
interface IdentificationData extends IdentificationDataIdOneOf {
|
|
227
|
+
/** ID of a site visitor that has not logged in to the site. */
|
|
228
|
+
anonymousVisitorId?: string;
|
|
229
|
+
/** ID of a site visitor that has logged in to the site. */
|
|
230
|
+
memberId?: string;
|
|
231
|
+
/** ID of a Wix user (site owner, contributor, etc.). */
|
|
232
|
+
wixUserId?: string;
|
|
233
|
+
/** ID of an app. */
|
|
234
|
+
appId?: string;
|
|
235
|
+
/** @readonly */
|
|
236
|
+
identityType?: WebhookIdentityType;
|
|
237
|
+
}
|
|
238
|
+
/** @oneof */
|
|
239
|
+
interface IdentificationDataIdOneOf {
|
|
240
|
+
/** ID of a site visitor that has not logged in to the site. */
|
|
241
|
+
anonymousVisitorId?: string;
|
|
242
|
+
/** ID of a site visitor that has logged in to the site. */
|
|
243
|
+
memberId?: string;
|
|
244
|
+
/** ID of a Wix user (site owner, contributor, etc.). */
|
|
245
|
+
wixUserId?: string;
|
|
246
|
+
/** ID of an app. */
|
|
247
|
+
appId?: string;
|
|
248
|
+
}
|
|
249
|
+
declare enum WebhookIdentityType {
|
|
250
|
+
UNKNOWN = "UNKNOWN",
|
|
251
|
+
ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
|
|
252
|
+
MEMBER = "MEMBER",
|
|
253
|
+
WIX_USER = "WIX_USER",
|
|
254
|
+
APP = "APP"
|
|
255
|
+
}
|
|
256
|
+
interface UpdateExtendedFieldsResponseNonNullableFields {
|
|
257
|
+
refund?: {
|
|
258
|
+
status: Status;
|
|
259
|
+
statusInfo?: {
|
|
260
|
+
code: string;
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
interface GetRefundabilityResponseNonNullableFields {
|
|
265
|
+
refundability?: {
|
|
266
|
+
rejection?: {
|
|
267
|
+
reason: RejectionReason;
|
|
268
|
+
};
|
|
269
|
+
refundable: boolean;
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
interface BaseEventMetadata {
|
|
273
|
+
/** App instance ID. */
|
|
274
|
+
instanceId?: string | null;
|
|
275
|
+
/** Event type. */
|
|
276
|
+
eventType?: string;
|
|
277
|
+
/** The identification type and identity data. */
|
|
278
|
+
identity?: IdentificationData;
|
|
279
|
+
}
|
|
280
|
+
interface EventMetadata extends BaseEventMetadata {
|
|
281
|
+
/**
|
|
282
|
+
* Unique event ID.
|
|
283
|
+
* Allows clients to ignore duplicate webhooks.
|
|
284
|
+
*/
|
|
285
|
+
_id?: string;
|
|
286
|
+
/**
|
|
287
|
+
* Assumes actions are also always typed to an entity_type
|
|
288
|
+
* Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
|
|
289
|
+
*/
|
|
290
|
+
entityFqdn?: string;
|
|
291
|
+
/**
|
|
292
|
+
* This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
|
|
293
|
+
* This is although the created/updated/deleted notion is duplication of the oneof types
|
|
294
|
+
* Example: created/updated/deleted/started/completed/email_opened
|
|
295
|
+
*/
|
|
296
|
+
slug?: string;
|
|
297
|
+
/** ID of the entity associated with the event. */
|
|
298
|
+
entityId?: string;
|
|
299
|
+
/** Event timestamp. */
|
|
300
|
+
eventTime?: Date;
|
|
301
|
+
/**
|
|
302
|
+
* Whether the event was triggered as a result of a privacy regulation application
|
|
303
|
+
* (for example, GDPR).
|
|
304
|
+
*/
|
|
305
|
+
triggeredByAnonymizeRequest?: boolean | null;
|
|
306
|
+
/** If present, indicates the action that triggered the event. */
|
|
307
|
+
originatedFrom?: string | null;
|
|
308
|
+
/**
|
|
309
|
+
* A sequence number defining the order of updates to the underlying entity.
|
|
310
|
+
* For example, given that some entity was updated at 16:00 and than again at 16:01,
|
|
311
|
+
* it is guaranteed that the sequence number of the second update is strictly higher than the first.
|
|
312
|
+
* As the consumer, you can use this value to ensure that you handle messages in the correct order.
|
|
313
|
+
* To do so, you will need to persist this number on your end, and compare the sequence number from the
|
|
314
|
+
* message against the one you have stored. Given that the stored number is higher, you should ignore the message.
|
|
315
|
+
*/
|
|
316
|
+
entityEventSequence?: string | null;
|
|
317
|
+
}
|
|
318
|
+
interface RefundCreatedEnvelope {
|
|
319
|
+
entity: Refund;
|
|
320
|
+
metadata: EventMetadata;
|
|
321
|
+
}
|
|
322
|
+
interface RefundUpdatedEnvelope {
|
|
323
|
+
entity: Refund;
|
|
324
|
+
metadata: EventMetadata;
|
|
325
|
+
}
|
|
326
|
+
interface CreateRefundOptions {
|
|
327
|
+
/**
|
|
328
|
+
* Optional parameter used to prevent unintended refunds.
|
|
329
|
+
* Used to check previously refunded amount according to the client
|
|
330
|
+
* against the amount from server perspective.
|
|
331
|
+
* If they don't match, error with code `PREVIOUSLY_REFUNDED_AMOUNT_MISMATCH` is returned.
|
|
332
|
+
*
|
|
333
|
+
* Read more about preventing unintended refunds in this
|
|
334
|
+
* [article](<https://dev.wix.com/docs/rest/business-management/payments/refunds/introduction#preventing-unintended-refunds>).
|
|
335
|
+
*/
|
|
336
|
+
previouslyRefundedAmount?: string | null;
|
|
337
|
+
}
|
|
338
|
+
interface QueryCursorResult {
|
|
339
|
+
cursors: Cursors;
|
|
340
|
+
hasNext: () => boolean;
|
|
341
|
+
hasPrev: () => boolean;
|
|
342
|
+
length: number;
|
|
343
|
+
pageSize: number;
|
|
344
|
+
}
|
|
345
|
+
interface RefundsQueryResult extends QueryCursorResult {
|
|
346
|
+
items: Refund[];
|
|
347
|
+
query: RefundsQueryBuilder;
|
|
348
|
+
next: () => Promise<RefundsQueryResult>;
|
|
349
|
+
prev: () => Promise<RefundsQueryResult>;
|
|
350
|
+
}
|
|
351
|
+
interface RefundsQueryBuilder {
|
|
352
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
|
353
|
+
* @param value - Value to compare against.
|
|
354
|
+
* @documentationMaturity preview
|
|
355
|
+
*/
|
|
356
|
+
eq: (propertyName: 'chargeId', value: any) => RefundsQueryBuilder;
|
|
357
|
+
/** @documentationMaturity preview */
|
|
358
|
+
in: (propertyName: 'chargeId', value: any) => RefundsQueryBuilder;
|
|
359
|
+
/** @param limit - Number of items to return, which is also the `pageSize` of the results object.
|
|
360
|
+
* @documentationMaturity preview
|
|
361
|
+
*/
|
|
362
|
+
limit: (limit: number) => RefundsQueryBuilder;
|
|
363
|
+
/** @param cursor - A pointer to specific record
|
|
364
|
+
* @documentationMaturity preview
|
|
365
|
+
*/
|
|
366
|
+
skipTo: (cursor: string) => RefundsQueryBuilder;
|
|
367
|
+
/** @documentationMaturity preview */
|
|
368
|
+
find: () => Promise<RefundsQueryResult>;
|
|
369
|
+
}
|
|
370
|
+
interface UpdateExtendedFieldsOptions {
|
|
371
|
+
/** Data to update. Structured according to the [schema](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields#json-schema-for-extended-fields) defined when the extended fields were configured. */
|
|
372
|
+
namespaceData: Record<string, any> | null;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
|
|
376
|
+
interface HttpClient {
|
|
377
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
|
|
378
|
+
}
|
|
379
|
+
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
380
|
+
type HttpResponse<T = any> = {
|
|
381
|
+
data: T;
|
|
382
|
+
status: number;
|
|
383
|
+
statusText: string;
|
|
384
|
+
headers: any;
|
|
385
|
+
request?: any;
|
|
386
|
+
};
|
|
387
|
+
type RequestOptions<_TResponse = any, Data = any> = {
|
|
388
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
389
|
+
url: string;
|
|
390
|
+
data?: Data;
|
|
391
|
+
params?: URLSearchParams;
|
|
392
|
+
} & APIMetadata;
|
|
393
|
+
type APIMetadata = {
|
|
394
|
+
methodFqn?: string;
|
|
395
|
+
entityFqdn?: string;
|
|
396
|
+
packageName?: string;
|
|
397
|
+
};
|
|
398
|
+
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
399
|
+
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
400
|
+
__type: 'event-definition';
|
|
401
|
+
type: Type;
|
|
402
|
+
isDomainEvent?: boolean;
|
|
403
|
+
transformations?: unknown;
|
|
404
|
+
__payload: Payload;
|
|
405
|
+
};
|
|
406
|
+
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
407
|
+
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
408
|
+
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
409
|
+
|
|
410
|
+
declare function createRefund$1(httpClient: HttpClient): (refund: Refund, options?: CreateRefundOptions) => Promise<Refund & {
|
|
411
|
+
status: Status;
|
|
412
|
+
statusInfo?: {
|
|
413
|
+
code: string;
|
|
414
|
+
} | undefined;
|
|
415
|
+
}>;
|
|
416
|
+
declare function getRefund$1(httpClient: HttpClient): (refundId: string) => Promise<Refund & {
|
|
417
|
+
status: Status;
|
|
418
|
+
statusInfo?: {
|
|
419
|
+
code: string;
|
|
420
|
+
} | undefined;
|
|
421
|
+
}>;
|
|
422
|
+
declare function queryRefunds$1(httpClient: HttpClient): () => RefundsQueryBuilder;
|
|
423
|
+
declare function updateExtendedFields$1(httpClient: HttpClient): (_id: string, namespace: string, options: UpdateExtendedFieldsOptions) => Promise<UpdateExtendedFieldsResponse & UpdateExtendedFieldsResponseNonNullableFields>;
|
|
424
|
+
declare function getRefundability$1(httpClient: HttpClient): (chargeId: string) => Promise<GetRefundabilityResponse & GetRefundabilityResponseNonNullableFields>;
|
|
425
|
+
declare const onRefundCreated$1: EventDefinition<RefundCreatedEnvelope, "wix.payments.refunds.v1.refund_created">;
|
|
426
|
+
declare const onRefundUpdated$1: EventDefinition<RefundUpdatedEnvelope, "wix.payments.refunds.v1.refund_updated">;
|
|
427
|
+
|
|
428
|
+
declare const createRefund: BuildRESTFunction<typeof createRefund$1>;
|
|
429
|
+
declare const getRefund: BuildRESTFunction<typeof getRefund$1>;
|
|
430
|
+
declare const queryRefunds: BuildRESTFunction<typeof queryRefunds$1>;
|
|
431
|
+
declare const updateExtendedFields: BuildRESTFunction<typeof updateExtendedFields$1>;
|
|
432
|
+
declare const getRefundability: BuildRESTFunction<typeof getRefundability$1>;
|
|
433
|
+
declare const onRefundCreated: BuildEventDefinition<typeof onRefundCreated$1>;
|
|
434
|
+
declare const onRefundUpdated: BuildEventDefinition<typeof onRefundUpdated$1>;
|
|
435
|
+
|
|
436
|
+
declare const context_createRefund: typeof createRefund;
|
|
437
|
+
declare const context_getRefund: typeof getRefund;
|
|
438
|
+
declare const context_getRefundability: typeof getRefundability;
|
|
439
|
+
declare const context_onRefundCreated: typeof onRefundCreated;
|
|
440
|
+
declare const context_onRefundUpdated: typeof onRefundUpdated;
|
|
441
|
+
declare const context_queryRefunds: typeof queryRefunds;
|
|
442
|
+
declare const context_updateExtendedFields: typeof updateExtendedFields;
|
|
443
|
+
declare namespace context {
|
|
444
|
+
export { context_createRefund as createRefund, context_getRefund as getRefund, context_getRefundability as getRefundability, context_onRefundCreated as onRefundCreated, context_onRefundUpdated as onRefundUpdated, context_queryRefunds as queryRefunds, context_updateExtendedFields as updateExtendedFields };
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export { context as refunds };
|