@xyo-network/payment-payload-plugins 6.1.0 → 7.0.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/dist/neutral/Amount/Iso4217Currency.d.ts.map +1 -1
- package/dist/neutral/Amount/Payload.d.ts +56 -15
- package/dist/neutral/Amount/Payload.d.ts.map +1 -1
- package/dist/neutral/Billing/Address/Address.d.ts +102 -32
- package/dist/neutral/Billing/Address/Address.d.ts.map +1 -1
- package/dist/neutral/Currency.d.ts +5 -1
- package/dist/neutral/Currency.d.ts.map +1 -1
- package/dist/neutral/Discount/Payload/Coupon/Coupons/FixedAmount.d.ts +81 -15
- package/dist/neutral/Discount/Payload/Coupon/Coupons/FixedAmount.d.ts.map +1 -1
- package/dist/neutral/Discount/Payload/Coupon/Coupons/FixedPercentage.d.ts +74 -15
- package/dist/neutral/Discount/Payload/Coupon/Coupons/FixedPercentage.d.ts.map +1 -1
- package/dist/neutral/Discount/Payload/Coupon/Coupons/FixedPrice.d.ts +81 -15
- package/dist/neutral/Discount/Payload/Coupon/Coupons/FixedPrice.d.ts.map +1 -1
- package/dist/neutral/Discount/Payload/Coupon/Payload.d.ts +186 -9
- package/dist/neutral/Discount/Payload/Coupon/Payload.d.ts.map +1 -1
- package/dist/neutral/Discount/Payload/Coupon/types/Condition.d.ts +91 -7
- package/dist/neutral/Discount/Payload/Coupon/types/Condition.d.ts.map +1 -1
- package/dist/neutral/Discount/Payload/Coupon/types/CouponFields.d.ts +8 -12
- package/dist/neutral/Discount/Payload/Coupon/types/CouponFields.d.ts.map +1 -1
- package/dist/neutral/Discount/Payload/Discount.d.ts +53 -14
- package/dist/neutral/Discount/Payload/Discount.d.ts.map +1 -1
- package/dist/neutral/Escrow/Outcome.d.ts +64 -17
- package/dist/neutral/Escrow/Outcome.d.ts.map +1 -1
- package/dist/neutral/Escrow/Terms/Terms.d.ts +303 -62
- package/dist/neutral/Escrow/Terms/Terms.d.ts.map +1 -1
- package/dist/neutral/Escrow/util/appraisal/getAppraisalsByAsset.d.ts.map +1 -1
- package/dist/neutral/Escrow/util/appraisal/getSignaturesByAppraisal.d.ts.map +1 -1
- package/dist/neutral/Escrow/util/secret/createEscrowIntent.d.ts +9 -1
- package/dist/neutral/Escrow/util/secret/createEscrowIntent.d.ts.map +1 -1
- package/dist/neutral/Escrow/util/secret/updateEscrowTermsWithSecret.d.ts +9 -1
- package/dist/neutral/Escrow/util/secret/updateEscrowTermsWithSecret.d.ts.map +1 -1
- package/dist/neutral/Escrow/validators/common/ModuleInstanceValidators/moduleInstanceValidators.d.ts.map +1 -1
- package/dist/neutral/Escrow/validators/common/SecretValidators/getPartySecretSignedValidator.d.ts.map +1 -1
- package/dist/neutral/Escrow/validators/escrow/appraisal.d.ts.map +1 -1
- package/dist/neutral/Payment/Instrument/Card/Payload.d.ts +74 -34
- package/dist/neutral/Payment/Instrument/Card/Payload.d.ts.map +1 -1
- package/dist/neutral/Payment/Payload.d.ts +57 -23
- package/dist/neutral/Payment/Payload.d.ts.map +1 -1
- package/dist/neutral/Payment/Status/Payload.d.ts +53 -22
- package/dist/neutral/Payment/Status/Payload.d.ts.map +1 -1
- package/dist/neutral/Purchase/Payload.d.ts +53 -24
- package/dist/neutral/Purchase/Payload.d.ts.map +1 -1
- package/dist/neutral/Receipt/Payload.d.ts +57 -23
- package/dist/neutral/Receipt/Payload.d.ts.map +1 -1
- package/dist/neutral/Subtotal/Diviner/Payload.d.ts +53 -14
- package/dist/neutral/Subtotal/Diviner/Payload.d.ts.map +1 -1
- package/dist/neutral/Total/Diviner/Payload.d.ts +53 -14
- package/dist/neutral/Total/Diviner/Payload.d.ts.map +1 -1
- package/dist/neutral/index.mjs +475 -275
- package/dist/neutral/index.mjs.map +4 -4
- package/package.json +17 -20
package/dist/neutral/index.mjs
CHANGED
|
@@ -180,26 +180,34 @@ var Iso4217CurrencyCodes = {
|
|
|
180
180
|
ZWG: 924,
|
|
181
181
|
ZWL: 932
|
|
182
182
|
};
|
|
183
|
-
var isIso4217CurrencyCode = (code) => Iso4217CurrencyCodes
|
|
183
|
+
var isIso4217CurrencyCode = (code) => Object.hasOwn(Iso4217CurrencyCodes, code);
|
|
184
184
|
|
|
185
185
|
// src/Amount/Payload.ts
|
|
186
|
-
import { AsObjectFactory } from "@xylabs/sdk-js";
|
|
187
186
|
import {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
} from "@
|
|
187
|
+
zodAsFactory,
|
|
188
|
+
zodIsFactory,
|
|
189
|
+
zodToFactory
|
|
190
|
+
} from "@xylabs/sdk-js";
|
|
191
|
+
import { asSchema, PayloadZodOfSchema } from "@xyo-network/sdk-js";
|
|
192
|
+
import * as z from "zod/mini";
|
|
192
193
|
var AmountSchema = asSchema("network.xyo.payments.amount", true);
|
|
193
|
-
var
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
var
|
|
198
|
-
var
|
|
194
|
+
var AmountFieldsZod = z.object({
|
|
195
|
+
amount: z.number(),
|
|
196
|
+
currency: z.custom()
|
|
197
|
+
});
|
|
198
|
+
var AmountZod = z.extend(PayloadZodOfSchema(AmountSchema), { ...AmountFieldsZod.shape });
|
|
199
|
+
var isAmount = zodIsFactory(AmountZod);
|
|
200
|
+
var asAmount = zodAsFactory(AmountZod, "asAmount");
|
|
201
|
+
var toAmount = zodToFactory(AmountZod, "toAmount");
|
|
199
202
|
|
|
200
203
|
// src/Billing/Address/Address.ts
|
|
201
|
-
import {
|
|
202
|
-
|
|
204
|
+
import {
|
|
205
|
+
zodAsFactory as zodAsFactory2,
|
|
206
|
+
zodIsFactory as zodIsFactory2,
|
|
207
|
+
zodToFactory as zodToFactory2
|
|
208
|
+
} from "@xylabs/sdk-js";
|
|
209
|
+
import { PayloadZodOfSchema as PayloadZodOfSchema2 } from "@xyo-network/sdk-js";
|
|
210
|
+
import * as z2 from "zod/mini";
|
|
203
211
|
|
|
204
212
|
// src/Billing/Address/Schema.ts
|
|
205
213
|
import { asSchema as asSchema4 } from "@xyo-network/sdk-js";
|
|
@@ -218,12 +226,34 @@ var BillingSchema = asSchema3(`${PaymentsSchema}.billing`, true);
|
|
|
218
226
|
var BillingAddressSchema = asSchema4(`${BillingSchema}.address`, true);
|
|
219
227
|
|
|
220
228
|
// src/Billing/Address/Address.ts
|
|
221
|
-
var
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
229
|
+
var BillingAddressFieldsZod = z2.object({
|
|
230
|
+
/** Street address line 1. */
|
|
231
|
+
address: z2.optional(z2.string()),
|
|
232
|
+
/** Street address line 2. */
|
|
233
|
+
address2: z2.optional(z2.nullable(z2.string())),
|
|
234
|
+
/** City of the billing address. */
|
|
235
|
+
city: z2.optional(z2.string()),
|
|
236
|
+
/** Country code of the billing address, ISO 3166-1 alpha-2 code. */
|
|
237
|
+
country: z2.optional(z2.string()),
|
|
238
|
+
/** First name */
|
|
239
|
+
firstName: z2.string(),
|
|
240
|
+
/** Last name */
|
|
241
|
+
lastName: z2.string(),
|
|
242
|
+
/** Organization or company name associated with the billing address. */
|
|
243
|
+
organization: z2.optional(z2.nullable(z2.string())),
|
|
244
|
+
/** Postal or ZIP code of the billing address. */
|
|
245
|
+
postalCode: z2.optional(z2.string()),
|
|
246
|
+
/** State or region of the billing address. */
|
|
247
|
+
region: z2.optional(z2.string())
|
|
248
|
+
});
|
|
249
|
+
var BillingAddressZod = z2.extend(PayloadZodOfSchema2(BillingAddressSchema), { ...BillingAddressFieldsZod.shape });
|
|
250
|
+
var isBillingAddress = zodIsFactory2(BillingAddressZod);
|
|
251
|
+
var asBillingAddress = zodAsFactory2(BillingAddressZod, "asBillingAddress");
|
|
252
|
+
var toBillingAddress = zodToFactory2(BillingAddressZod, "toBillingAddress");
|
|
253
|
+
|
|
254
|
+
// src/Currency.ts
|
|
255
|
+
import * as z3 from "zod/mini";
|
|
256
|
+
var SupportedCurrencyZod = z3.enum(["USD"]);
|
|
227
257
|
|
|
228
258
|
// src/Discount/Config.ts
|
|
229
259
|
import { asSchema as asSchema5 } from "@xyo-network/sdk-js";
|
|
@@ -308,92 +338,133 @@ var createConditionForRequiredBuyer = (buyer) => {
|
|
|
308
338
|
};
|
|
309
339
|
|
|
310
340
|
// src/Discount/Payload/Coupon/Coupons/FixedAmount.ts
|
|
311
|
-
import { AsObjectFactory as AsObjectFactory3 } from "@xylabs/sdk-js";
|
|
312
341
|
import {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
} from "@
|
|
342
|
+
zodAsFactory as zodAsFactory4,
|
|
343
|
+
zodIsFactory as zodIsFactory4,
|
|
344
|
+
zodToFactory as zodToFactory4
|
|
345
|
+
} from "@xylabs/sdk-js";
|
|
346
|
+
import { asSchema as asSchema7, PayloadZodOfSchema as PayloadZodOfSchema3 } from "@xyo-network/sdk-js";
|
|
347
|
+
import * as z6 from "zod/mini";
|
|
317
348
|
|
|
318
349
|
// src/Discount/Payload/Coupon/Schema.ts
|
|
319
350
|
import { asSchema as asSchema6 } from "@xyo-network/sdk-js";
|
|
320
351
|
var CouponSchema = asSchema6("network.xyo.payments.coupon", true);
|
|
321
352
|
|
|
353
|
+
// src/Discount/Payload/Coupon/types/Condition.ts
|
|
354
|
+
import {
|
|
355
|
+
zodAsFactory as zodAsFactory3,
|
|
356
|
+
zodIsFactory as zodIsFactory3,
|
|
357
|
+
zodToFactory as zodToFactory3
|
|
358
|
+
} from "@xylabs/sdk-js";
|
|
359
|
+
import { SchemaSchema as SchemaSchema4 } from "@xyo-network/sdk-js";
|
|
360
|
+
import * as z4 from "zod/mini";
|
|
361
|
+
var ConditionZod = z4.custom().check(z4.refine((value) => typeof value === "object" && value !== null && value.schema === SchemaSchema4));
|
|
362
|
+
var isCondition = zodIsFactory3(ConditionZod);
|
|
363
|
+
var asCondition = zodAsFactory3(ConditionZod, "asCondition");
|
|
364
|
+
var toCondition = zodToFactory3(ConditionZod, "toCondition");
|
|
365
|
+
|
|
366
|
+
// src/Discount/Payload/Coupon/types/CouponFields.ts
|
|
367
|
+
import { HashZod } from "@xylabs/sdk-js";
|
|
368
|
+
import * as z5 from "zod/mini";
|
|
369
|
+
var CouponFieldsZod = z5.object({
|
|
370
|
+
/**
|
|
371
|
+
* The conditions that must be met in order for this coupon to be applied
|
|
372
|
+
*/
|
|
373
|
+
conditions: z5.optional(z5.array(HashZod)),
|
|
374
|
+
/**
|
|
375
|
+
* A timestamp that indicates the expiration time of the record
|
|
376
|
+
*/
|
|
377
|
+
exp: z5.number(),
|
|
378
|
+
/**
|
|
379
|
+
* A timestamp that indicates the time before which the record is not valid
|
|
380
|
+
*/
|
|
381
|
+
nbf: z5.number(),
|
|
382
|
+
/**
|
|
383
|
+
* Whether or not this discount can be stacked with other discounts
|
|
384
|
+
*/
|
|
385
|
+
stackable: z5.optional(z5.boolean())
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
// src/Discount/Payload/Coupon/types/isStackable.ts
|
|
389
|
+
var isStackable = (x) => (x ?? { stackable: false })?.stackable;
|
|
390
|
+
|
|
322
391
|
// src/Discount/Payload/Coupon/Coupons/FixedAmount.ts
|
|
323
392
|
var FixedAmountCouponSchema = asSchema7(`${CouponSchema}.fixed.amount`, true);
|
|
324
|
-
var
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
var
|
|
329
|
-
var
|
|
393
|
+
var FixedAmountCouponFieldsZod = z6.object({
|
|
394
|
+
...CouponFieldsZod.shape,
|
|
395
|
+
...AmountFieldsZod.shape
|
|
396
|
+
});
|
|
397
|
+
var FixedAmountCouponZod = z6.extend(PayloadZodOfSchema3(FixedAmountCouponSchema), { ...FixedAmountCouponFieldsZod.shape });
|
|
398
|
+
var isFixedAmountCoupon = zodIsFactory4(FixedAmountCouponZod);
|
|
399
|
+
var asFixedAmountCoupon = zodAsFactory4(FixedAmountCouponZod, "asFixedAmountCoupon");
|
|
400
|
+
var toFixedAmountCoupon = zodToFactory4(FixedAmountCouponZod, "toFixedAmountCoupon");
|
|
330
401
|
|
|
331
402
|
// src/Discount/Payload/Coupon/Coupons/FixedPercentage.ts
|
|
332
|
-
import { AsObjectFactory as AsObjectFactory4 } from "@xylabs/sdk-js";
|
|
333
403
|
import {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
} from "@
|
|
404
|
+
zodAsFactory as zodAsFactory5,
|
|
405
|
+
zodIsFactory as zodIsFactory5,
|
|
406
|
+
zodToFactory as zodToFactory5
|
|
407
|
+
} from "@xylabs/sdk-js";
|
|
408
|
+
import { asSchema as asSchema8, PayloadZodOfSchema as PayloadZodOfSchema4 } from "@xyo-network/sdk-js";
|
|
409
|
+
import * as z7 from "zod/mini";
|
|
338
410
|
var FixedPercentageCouponSchema = asSchema8(`${CouponSchema}.fixed.percentage`, true);
|
|
339
|
-
var
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
var
|
|
344
|
-
var
|
|
411
|
+
var FixedPercentageCouponFieldsZod = z7.object({
|
|
412
|
+
...CouponFieldsZod.shape,
|
|
413
|
+
percentage: z7.number()
|
|
414
|
+
});
|
|
415
|
+
var FixedPercentageCouponZod = z7.extend(PayloadZodOfSchema4(FixedPercentageCouponSchema), { ...FixedPercentageCouponFieldsZod.shape });
|
|
416
|
+
var isFixedPercentageCoupon = zodIsFactory5(FixedPercentageCouponZod);
|
|
417
|
+
var asFixedPercentageCoupon = zodAsFactory5(FixedPercentageCouponZod, "asFixedPercentageCoupon");
|
|
418
|
+
var toFixedPercentageCoupon = zodToFactory5(FixedPercentageCouponZod, "toFixedPercentageCoupon");
|
|
345
419
|
|
|
346
420
|
// src/Discount/Payload/Coupon/Coupons/FixedPrice.ts
|
|
347
|
-
import { AsObjectFactory as AsObjectFactory5 } from "@xylabs/sdk-js";
|
|
348
421
|
import {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
} from "@
|
|
422
|
+
zodAsFactory as zodAsFactory6,
|
|
423
|
+
zodIsFactory as zodIsFactory6,
|
|
424
|
+
zodToFactory as zodToFactory6
|
|
425
|
+
} from "@xylabs/sdk-js";
|
|
426
|
+
import { asSchema as asSchema9, PayloadZodOfSchema as PayloadZodOfSchema5 } from "@xyo-network/sdk-js";
|
|
427
|
+
import * as z8 from "zod/mini";
|
|
353
428
|
var FixedPriceCouponSchema = asSchema9(`${CouponSchema}.fixed.price`, true);
|
|
354
|
-
var
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
var
|
|
359
|
-
var
|
|
429
|
+
var FixedPriceCouponFieldsZod = z8.object({
|
|
430
|
+
...CouponFieldsZod.shape,
|
|
431
|
+
...AmountFieldsZod.shape
|
|
432
|
+
});
|
|
433
|
+
var FixedPriceCouponZod = z8.extend(PayloadZodOfSchema5(FixedPriceCouponSchema), { ...FixedPriceCouponFieldsZod.shape });
|
|
434
|
+
var isFixedPriceCoupon = zodIsFactory6(FixedPriceCouponZod);
|
|
435
|
+
var asFixedPriceCoupon = zodAsFactory6(FixedPriceCouponZod, "asFixedPriceCoupon");
|
|
436
|
+
var toFixedPriceCoupon = zodToFactory6(FixedPriceCouponZod, "toFixedPriceCoupon");
|
|
360
437
|
|
|
361
438
|
// src/Discount/Payload/Coupon/Payload.ts
|
|
362
|
-
import { AsObjectFactory as AsObjectFactory6 } from "@xylabs/sdk-js";
|
|
363
|
-
var isCoupon = (x) => isFixedAmountCoupon(x) || isFixedPercentageCoupon(x) || isFixedPriceCoupon(x);
|
|
364
|
-
var asCoupon = AsObjectFactory6.create(isCoupon);
|
|
365
|
-
var isCouponWithSources = (x) => isFixedAmountCouponWithSources(x) || isFixedPercentageCouponWithSources(x) || isFixedPriceCouponWithSources(x);
|
|
366
|
-
var asCouponWithSources = AsObjectFactory6.create(isCouponWithSources);
|
|
367
|
-
|
|
368
|
-
// src/Discount/Payload/Coupon/types/Condition.ts
|
|
369
|
-
import { AsObjectFactory as AsObjectFactory7 } from "@xylabs/sdk-js";
|
|
370
439
|
import {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
} from "@
|
|
375
|
-
|
|
376
|
-
var
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
var
|
|
440
|
+
zodAsFactory as zodAsFactory7,
|
|
441
|
+
zodIsFactory as zodIsFactory7,
|
|
442
|
+
zodToFactory as zodToFactory7
|
|
443
|
+
} from "@xylabs/sdk-js";
|
|
444
|
+
import * as z9 from "zod/mini";
|
|
445
|
+
var CouponZod = z9.union([
|
|
446
|
+
FixedAmountCouponZod,
|
|
447
|
+
FixedPercentageCouponZod,
|
|
448
|
+
FixedPriceCouponZod
|
|
449
|
+
]);
|
|
450
|
+
var isCoupon = zodIsFactory7(CouponZod);
|
|
451
|
+
var asCoupon = zodAsFactory7(CouponZod, "asCoupon");
|
|
452
|
+
var toCoupon = zodToFactory7(CouponZod, "toCoupon");
|
|
382
453
|
|
|
383
454
|
// src/Discount/Payload/Discount.ts
|
|
384
|
-
import { AsObjectFactory as AsObjectFactory8 } from "@xylabs/sdk-js";
|
|
385
455
|
import {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
} from "@
|
|
456
|
+
zodAsFactory as zodAsFactory8,
|
|
457
|
+
zodIsFactory as zodIsFactory8,
|
|
458
|
+
zodToFactory as zodToFactory8
|
|
459
|
+
} from "@xylabs/sdk-js";
|
|
460
|
+
import { asSchema as asSchema10, PayloadZodOfSchema as PayloadZodOfSchema6 } from "@xyo-network/sdk-js";
|
|
461
|
+
import * as z10 from "zod/mini";
|
|
390
462
|
var DiscountSchema = asSchema10("network.xyo.payments.discount", true);
|
|
391
|
-
var
|
|
392
|
-
var
|
|
393
|
-
var
|
|
394
|
-
var
|
|
395
|
-
var
|
|
396
|
-
var asOptionalDiscountWithSources = AsObjectFactory8.createOptional(isDiscountWithSources);
|
|
463
|
+
var DiscountFieldsZod = z10.object({ ...AmountFieldsZod.shape });
|
|
464
|
+
var DiscountZod = z10.extend(PayloadZodOfSchema6(DiscountSchema), { ...DiscountFieldsZod.shape });
|
|
465
|
+
var isDiscount = zodIsFactory8(DiscountZod);
|
|
466
|
+
var asDiscount = zodAsFactory8(DiscountZod, "asDiscount");
|
|
467
|
+
var toDiscount = zodToFactory8(DiscountZod, "toDiscount");
|
|
397
468
|
|
|
398
469
|
// src/Discount/Payload/NoDiscount.ts
|
|
399
470
|
var NO_DISCOUNT = {
|
|
@@ -403,12 +474,14 @@ var NO_DISCOUNT = {
|
|
|
403
474
|
};
|
|
404
475
|
|
|
405
476
|
// src/Escrow/Outcome.ts
|
|
406
|
-
import { AsObjectFactory as AsObjectFactory9 } from "@xylabs/sdk-js";
|
|
407
477
|
import {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
478
|
+
HashZod as HashZod2,
|
|
479
|
+
zodAsFactory as zodAsFactory9,
|
|
480
|
+
zodIsFactory as zodIsFactory9,
|
|
481
|
+
zodToFactory as zodToFactory9
|
|
482
|
+
} from "@xylabs/sdk-js";
|
|
483
|
+
import { asSchema as asSchema12, PayloadZodOfSchema as PayloadZodOfSchema7 } from "@xyo-network/sdk-js";
|
|
484
|
+
import * as z11 from "zod/mini";
|
|
412
485
|
|
|
413
486
|
// src/Escrow/Schema.ts
|
|
414
487
|
import { asSchema as asSchema11 } from "@xyo-network/sdk-js";
|
|
@@ -416,27 +489,93 @@ var EscrowSchema = asSchema11("network.xyo.escrow", true);
|
|
|
416
489
|
|
|
417
490
|
// src/Escrow/Outcome.ts
|
|
418
491
|
var EscrowOutcomeSchema = asSchema12(`${EscrowSchema}.outcome`, true);
|
|
419
|
-
var
|
|
420
|
-
var
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
var
|
|
492
|
+
var EscrowOutcomesZod = z11.enum(["fulfilled", "expired"]);
|
|
493
|
+
var EscrowOutcomeFieldsZod = z11.object({
|
|
494
|
+
outcome: EscrowOutcomesZod,
|
|
495
|
+
terms: HashZod2
|
|
496
|
+
});
|
|
497
|
+
var EscrowOutcomeZod = z11.extend(PayloadZodOfSchema7(EscrowOutcomeSchema), { ...EscrowOutcomeFieldsZod.shape });
|
|
498
|
+
var isEscrowOutcome = zodIsFactory9(EscrowOutcomeZod);
|
|
499
|
+
var asEscrowOutcome = zodAsFactory9(EscrowOutcomeZod, "asEscrowOutcome");
|
|
500
|
+
var toEscrowOutcome = zodToFactory9(EscrowOutcomeZod, "toEscrowOutcome");
|
|
425
501
|
|
|
426
502
|
// src/Escrow/Terms/Terms.ts
|
|
427
|
-
import { AsObjectFactory as AsObjectFactory10 } from "@xylabs/sdk-js";
|
|
428
503
|
import {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
504
|
+
HashZod as HashZod3,
|
|
505
|
+
zodAsFactory as zodAsFactory10,
|
|
506
|
+
zodIsFactory as zodIsFactory10,
|
|
507
|
+
zodToFactory as zodToFactory10
|
|
508
|
+
} from "@xylabs/sdk-js";
|
|
509
|
+
import { asSchema as asSchema13, PayloadZodOfSchema as PayloadZodOfSchema8 } from "@xyo-network/sdk-js";
|
|
510
|
+
import * as z12 from "zod/mini";
|
|
433
511
|
var EscrowTermsSchema = asSchema13(`${EscrowSchema}.terms`, true);
|
|
434
|
-
var
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
512
|
+
var EscrowTermsFieldsZod = z12.object({
|
|
513
|
+
/**
|
|
514
|
+
* The trusted estimators for the worth of the things being sold
|
|
515
|
+
*/
|
|
516
|
+
appraisalAuthorities: z12.array(z12.custom()),
|
|
517
|
+
/**
|
|
518
|
+
* The estimated worths of the things being sold
|
|
519
|
+
*/
|
|
520
|
+
appraisals: z12.array(HashZod3),
|
|
521
|
+
/**
|
|
522
|
+
* The things being sold
|
|
523
|
+
*/
|
|
524
|
+
assets: z12.array(HashZod3),
|
|
525
|
+
/**
|
|
526
|
+
* The buyer
|
|
527
|
+
*/
|
|
528
|
+
buyer: z12.array(z12.custom()),
|
|
529
|
+
/**
|
|
530
|
+
* The buyer
|
|
531
|
+
*/
|
|
532
|
+
buyerSecret: HashZod3,
|
|
533
|
+
/**
|
|
534
|
+
* Any discounts (coupons, vouchers, credits, etc.) to be applied to the escrow
|
|
535
|
+
*/
|
|
536
|
+
discounts: z12.array(HashZod3),
|
|
537
|
+
/**
|
|
538
|
+
* The escrow agent responsible for the escrow
|
|
539
|
+
*/
|
|
540
|
+
escrowAgent: z12.custom(),
|
|
541
|
+
/**
|
|
542
|
+
* The time the escrow expires
|
|
543
|
+
*/
|
|
544
|
+
exp: z12.number(),
|
|
545
|
+
/**
|
|
546
|
+
* The time the escrow starts
|
|
547
|
+
*/
|
|
548
|
+
nbf: z12.number(),
|
|
549
|
+
/**
|
|
550
|
+
* The trusted payment authorities
|
|
551
|
+
*/
|
|
552
|
+
paymentAuthorities: z12.array(z12.custom()),
|
|
553
|
+
/**
|
|
554
|
+
* The seller
|
|
555
|
+
*/
|
|
556
|
+
seller: z12.array(z12.custom()),
|
|
557
|
+
/**
|
|
558
|
+
* The seller
|
|
559
|
+
*/
|
|
560
|
+
sellerSecret: HashZod3
|
|
561
|
+
});
|
|
562
|
+
var EscrowTermsZod = z12.extend(PayloadZodOfSchema8(EscrowTermsSchema), {
|
|
563
|
+
appraisalAuthorities: z12.optional(z12.array(z12.custom())),
|
|
564
|
+
appraisals: z12.optional(z12.array(HashZod3)),
|
|
565
|
+
assets: z12.optional(z12.array(HashZod3)),
|
|
566
|
+
buyer: z12.optional(z12.array(z12.custom())),
|
|
567
|
+
buyerSecret: z12.optional(HashZod3),
|
|
568
|
+
discounts: z12.optional(z12.array(HashZod3)),
|
|
569
|
+
escrowAgent: z12.optional(z12.custom()),
|
|
570
|
+
exp: z12.optional(z12.number()),
|
|
571
|
+
nbf: z12.optional(z12.number()),
|
|
572
|
+
paymentAuthorities: z12.optional(z12.array(z12.custom())),
|
|
573
|
+
seller: z12.optional(z12.array(z12.custom())),
|
|
574
|
+
sellerSecret: z12.optional(HashZod3)
|
|
575
|
+
});
|
|
576
|
+
var isEscrowTerms = zodIsFactory10(EscrowTermsZod);
|
|
577
|
+
var asEscrowTerms = zodAsFactory10(EscrowTermsZod, "asEscrowTerms");
|
|
578
|
+
var toEscrowTerms = zodToFactory10(EscrowTermsZod, "toEscrowTerms");
|
|
440
579
|
|
|
441
580
|
// src/Escrow/util/appraisal/getAppraisalsByAsset.ts
|
|
442
581
|
import { isHashLeaseEstimateWithSources } from "@xyo-network/diviner-hash-lease";
|
|
@@ -444,7 +583,7 @@ var getAppraisalsByAsset = (terms, dictionary) => {
|
|
|
444
583
|
const assets = terms.assets;
|
|
445
584
|
if (!assets || assets.length === 0) return {};
|
|
446
585
|
const appraisals = Object.values(dictionary).filter(isHashLeaseEstimateWithSources);
|
|
447
|
-
const appraisalsByAsset =
|
|
586
|
+
const appraisalsByAsset = /* @__PURE__ */ new Map();
|
|
448
587
|
for (const estimate of appraisals) {
|
|
449
588
|
const { $sources } = estimate;
|
|
450
589
|
if ($sources === void 0 || $sources.length === 0) {
|
|
@@ -452,12 +591,13 @@ var getAppraisalsByAsset = (terms, dictionary) => {
|
|
|
452
591
|
}
|
|
453
592
|
for (const asset of assets) {
|
|
454
593
|
if ($sources.includes(asset)) {
|
|
455
|
-
|
|
456
|
-
|
|
594
|
+
const existing = appraisalsByAsset.get(asset) ?? [];
|
|
595
|
+
existing.push(estimate);
|
|
596
|
+
appraisalsByAsset.set(asset, existing);
|
|
457
597
|
}
|
|
458
598
|
}
|
|
459
599
|
}
|
|
460
|
-
return appraisalsByAsset;
|
|
600
|
+
return Object.fromEntries(appraisalsByAsset);
|
|
461
601
|
};
|
|
462
602
|
|
|
463
603
|
// src/Escrow/util/appraisal/getSignaturesByAppraisal.ts
|
|
@@ -467,23 +607,25 @@ var getSignaturesByAppraisal = (terms, dictionary) => {
|
|
|
467
607
|
if (!appraisals || appraisals.length === 0) return {};
|
|
468
608
|
const appraisalAuthorities = terms.appraisalAuthorities;
|
|
469
609
|
if (!appraisalAuthorities || appraisalAuthorities.length === 0) return {};
|
|
470
|
-
const appraisalBWsValid =
|
|
610
|
+
const appraisalBWsValid = new Map(
|
|
471
611
|
appraisals.map((hash) => [hash, []])
|
|
472
612
|
);
|
|
473
|
-
|
|
613
|
+
const boundWitnesses = Object.values(dictionary).filter(isBoundWitness);
|
|
614
|
+
for (const bw of boundWitnesses) {
|
|
474
615
|
for (const appraisal of appraisals) {
|
|
475
616
|
if (bw.payload_hashes.includes(appraisal) && bw.addresses.some((address) => appraisalAuthorities.includes(address))) {
|
|
476
|
-
appraisalBWsValid
|
|
617
|
+
appraisalBWsValid.get(appraisal)?.push(bw);
|
|
477
618
|
}
|
|
478
619
|
}
|
|
479
620
|
}
|
|
480
|
-
return appraisalBWsValid;
|
|
621
|
+
return Object.fromEntries(appraisalBWsValid);
|
|
481
622
|
};
|
|
482
623
|
|
|
483
624
|
// src/Escrow/util/secret/createEscrowIntent.ts
|
|
484
625
|
import { BoundWitnessBuilder } from "@xyo-network/sdk-js";
|
|
485
626
|
var createEscrowIntentWithSecret = async (terms, secret, account) => {
|
|
486
|
-
const
|
|
627
|
+
const builder = new BoundWitnessBuilder();
|
|
628
|
+
const result = await builder.signers([account]).payloads([terms, secret]).build();
|
|
487
629
|
return result;
|
|
488
630
|
};
|
|
489
631
|
|
|
@@ -496,7 +638,7 @@ var getLogPrefix = (party) => {
|
|
|
496
638
|
var findEscrowPartySecretSignatures = (terms, dictionary, party) => {
|
|
497
639
|
const partyAddresses = terms[party];
|
|
498
640
|
if (partyAddresses === void 0 || partyAddresses.length === 0) {
|
|
499
|
-
console.log(`${getLogPrefix(party)}: No ${party}: ${terms[party]}`);
|
|
641
|
+
console.log(`${getLogPrefix(party)}: No ${party}: ${String(terms[party])}`);
|
|
500
642
|
return [];
|
|
501
643
|
}
|
|
502
644
|
const partySecret = party === "seller" ? "sellerSecret" : "buyerSecret";
|
|
@@ -525,7 +667,8 @@ var updateEscrowTermsWithSecret = async (terms, escrowParty, account, secret) =>
|
|
|
525
667
|
const secretType = escrowParty === "buyer" ? "buyerSecret" : "sellerSecret";
|
|
526
668
|
const secretHash = await PayloadBuilder.dataHash(secret);
|
|
527
669
|
terms[secretType] = secretHash;
|
|
528
|
-
const
|
|
670
|
+
const builder = new BoundWitnessBuilder2();
|
|
671
|
+
const result = await builder.signers(signers).payloads([terms, secret]).build();
|
|
529
672
|
return result;
|
|
530
673
|
};
|
|
531
674
|
|
|
@@ -534,17 +677,15 @@ var moduleIdentifiersContainsOneOf = (escrowTerms, propertyExpression, moduleIde
|
|
|
534
677
|
const termsValue = propertyExpression(escrowTerms);
|
|
535
678
|
if (termsValue === void 0) {
|
|
536
679
|
return required ? false : true;
|
|
537
|
-
} else {
|
|
538
|
-
return Array.isArray(termsValue) ? termsValue.some((address) => moduleIdentifiers.includes(address)) : moduleIdentifiers.includes(termsValue);
|
|
539
680
|
}
|
|
681
|
+
return Array.isArray(termsValue) ? termsValue.some((address) => moduleIdentifiers.includes(address)) : moduleIdentifiers.includes(termsValue);
|
|
540
682
|
};
|
|
541
683
|
var moduleIdentifiersContainsAllOf = (escrowTerms, selector, moduleIdentifiers, required = true) => {
|
|
542
684
|
const termsValue = selector(escrowTerms);
|
|
543
685
|
if (termsValue === void 0) {
|
|
544
686
|
return required ? false : true;
|
|
545
|
-
} else {
|
|
546
|
-
return Array.isArray(termsValue) ? termsValue.every((address) => moduleIdentifiers.includes(address)) : moduleIdentifiers.includes(termsValue);
|
|
547
687
|
}
|
|
688
|
+
return Array.isArray(termsValue) ? termsValue.every((address) => moduleIdentifiers.includes(address)) : moduleIdentifiers.includes(termsValue);
|
|
548
689
|
};
|
|
549
690
|
|
|
550
691
|
// src/Escrow/validators/common/SecretValidators/getPartySecretSignedValidator.ts
|
|
@@ -561,7 +702,10 @@ var getPartySecretSignedValidator = (dictionary, party) => {
|
|
|
561
702
|
console.log(`${getLogPrefix2(party)}: No BoundWitnesses supplied for ${partySecret}: ${terms[partySecret]}`);
|
|
562
703
|
return false;
|
|
563
704
|
}
|
|
564
|
-
const errors = await Promise.all(buyerSecretBWs.map((bw) =>
|
|
705
|
+
const errors = await Promise.all(buyerSecretBWs.map((bw) => {
|
|
706
|
+
const validator = new BoundWitnessValidator(bw);
|
|
707
|
+
return validator.validate();
|
|
708
|
+
}));
|
|
565
709
|
const validBoundWitnesses = errors.every((errors2) => errors2.length === 0);
|
|
566
710
|
if (!validBoundWitnesses) {
|
|
567
711
|
console.log(`${getLogPrefix2(party)}: Invalid BoundWitnesses supplied for ${partySecret}: ${terms[partySecret]}`);
|
|
@@ -596,26 +740,27 @@ var name2 = "EscrowTerms.appraisal";
|
|
|
596
740
|
var appraisalsExistValidator = (terms) => {
|
|
597
741
|
const appraisals = terms.appraisals;
|
|
598
742
|
if (!appraisals || appraisals.length === 0) {
|
|
599
|
-
console.log(`${name2}: No appraisals: ${terms.appraisals}`);
|
|
743
|
+
console.log(`${name2}: No appraisals: ${String(terms.appraisals)}`);
|
|
600
744
|
return false;
|
|
601
745
|
}
|
|
602
746
|
return true;
|
|
603
747
|
};
|
|
604
748
|
var getAppraisalsFromValidAuthoritiesValidator = (dictionary) => {
|
|
605
749
|
return (terms) => {
|
|
606
|
-
const appraisals = assertEx(terms.appraisals, () => `${name2}: No appraisals: ${terms.appraisals}`);
|
|
607
|
-
const appraisalAuthorities = assertEx(terms.appraisalAuthorities, () => `${name2}: No appraisalAuthorities: ${terms.appraisalAuthorities}`);
|
|
608
|
-
const appraisalBWsValid =
|
|
750
|
+
const appraisals = assertEx(terms.appraisals, () => `${name2}: No appraisals: ${String(terms.appraisals)}`);
|
|
751
|
+
const appraisalAuthorities = assertEx(terms.appraisalAuthorities, () => `${name2}: No appraisalAuthorities: ${String(terms.appraisalAuthorities)}`);
|
|
752
|
+
const appraisalBWsValid = new Map(
|
|
609
753
|
appraisals.map((hash) => [hash, []])
|
|
610
754
|
);
|
|
611
|
-
|
|
755
|
+
const boundWitnesses = Object.values(dictionary).filter(isBoundWitness3);
|
|
756
|
+
for (const bw of boundWitnesses) {
|
|
612
757
|
for (const appraisal of appraisals) {
|
|
613
758
|
if (bw.payload_hashes.includes(appraisal) && bw.addresses.some((address) => appraisalAuthorities.includes(address))) {
|
|
614
|
-
appraisalBWsValid
|
|
759
|
+
appraisalBWsValid.get(appraisal)?.push(bw);
|
|
615
760
|
}
|
|
616
761
|
}
|
|
617
762
|
}
|
|
618
|
-
for (const [appraisal, bws] of
|
|
763
|
+
for (const [appraisal, bws] of appraisalBWsValid) {
|
|
619
764
|
if (bws.length === 0) {
|
|
620
765
|
console.log(`${name2}: No valid appraisals for ${appraisal}`);
|
|
621
766
|
return false;
|
|
@@ -642,10 +787,10 @@ var getAppraisalsValidValidator = (dictionary, minimumExp) => {
|
|
|
642
787
|
};
|
|
643
788
|
var getAppraisalsForAllAssetsValidator = (dictionary) => {
|
|
644
789
|
return (terms) => {
|
|
645
|
-
const assets = assertEx(terms.assets, () => `${name2}: No assets: ${terms.assets}`);
|
|
790
|
+
const assets = assertEx(terms.assets, () => `${name2}: No assets: ${String(terms.assets)}`);
|
|
646
791
|
const estimatesByAsset = getAppraisalsByAsset(terms, dictionary);
|
|
647
792
|
if (Object.keys(estimatesByAsset).length !== assets.length) {
|
|
648
|
-
console.log(`${name2}: Missing appraisals for all assets: ${assets}`);
|
|
793
|
+
console.log(`${name2}: Missing appraisals for all assets: ${String(assets)}`);
|
|
649
794
|
return false;
|
|
650
795
|
}
|
|
651
796
|
return true;
|
|
@@ -663,11 +808,11 @@ var name3 = "EscrowTerms.appraisalAuthorities";
|
|
|
663
808
|
var appraisalAuthoritiesExistValidator = (terms) => {
|
|
664
809
|
const appraisalAuthorities = terms.appraisalAuthorities;
|
|
665
810
|
if (!appraisalAuthorities || appraisalAuthorities.length === 0) {
|
|
666
|
-
console.log(`${name3}: No appraisalAuthorities: ${terms.appraisalAuthorities}`);
|
|
811
|
+
console.log(`${name3}: No appraisalAuthorities: ${String(terms.appraisalAuthorities)}`);
|
|
667
812
|
return false;
|
|
668
813
|
}
|
|
669
814
|
if (appraisalAuthorities.map((x) => asAddress(x)).length !== appraisalAuthorities.length) {
|
|
670
|
-
console.log(`${name3}: Invalid address: ${terms.appraisalAuthorities}`);
|
|
815
|
+
console.log(`${name3}: Invalid address: ${String(terms.appraisalAuthorities)}`);
|
|
671
816
|
return false;
|
|
672
817
|
}
|
|
673
818
|
return true;
|
|
@@ -676,7 +821,7 @@ var getAppraisalAuthoritiesAllowedValidator = (allowed) => {
|
|
|
676
821
|
return (terms) => {
|
|
677
822
|
const result = moduleIdentifiersContainsAllOf(terms, (t) => t.appraisalAuthorities, allowed, true);
|
|
678
823
|
if (!result) {
|
|
679
|
-
console.log(`${name3}: Appraisal authority not allowed: ${terms.appraisalAuthorities}`);
|
|
824
|
+
console.log(`${name3}: Appraisal authority not allowed: ${String(terms.appraisalAuthorities)}`);
|
|
680
825
|
}
|
|
681
826
|
return result;
|
|
682
827
|
};
|
|
@@ -687,7 +832,7 @@ var name4 = "EscrowTerms.assets";
|
|
|
687
832
|
var assetsExistValidator = (terms) => {
|
|
688
833
|
const assets = terms.assets;
|
|
689
834
|
if (!assets || assets.length === 0) {
|
|
690
|
-
console.log(`${name4}: No assets: ${terms.assets}`);
|
|
835
|
+
console.log(`${name4}: No assets: ${String(terms.assets)}`);
|
|
691
836
|
return false;
|
|
692
837
|
}
|
|
693
838
|
return true;
|
|
@@ -699,11 +844,11 @@ var name5 = "EscrowTerms.buyer";
|
|
|
699
844
|
var buyerExistsValidator = (terms) => {
|
|
700
845
|
const buyer = terms.buyer;
|
|
701
846
|
if (!buyer || buyer.length === 0) {
|
|
702
|
-
console.log(`${name5}: No buyer: ${terms.buyer}`);
|
|
847
|
+
console.log(`${name5}: No buyer: ${String(terms.buyer)}`);
|
|
703
848
|
return false;
|
|
704
849
|
}
|
|
705
850
|
if (buyer.map((x) => asAddress2(x)).length !== buyer.length) {
|
|
706
|
-
console.log(`${name5}: Invalid address: ${terms.buyer}`);
|
|
851
|
+
console.log(`${name5}: Invalid address: ${String(terms.buyer)}`);
|
|
707
852
|
return false;
|
|
708
853
|
}
|
|
709
854
|
return true;
|
|
@@ -723,7 +868,7 @@ var buyerSecretExistsValidator = (terms) => {
|
|
|
723
868
|
var getBuyerSecretSuppliedValidator = (dictionary) => {
|
|
724
869
|
return (terms) => {
|
|
725
870
|
const buyerSecret = assertEx2(terms.buyerSecret, () => `${name6}: No buyerSecret: ${terms.buyerSecret}`);
|
|
726
|
-
if (!dictionary
|
|
871
|
+
if (!Object.hasOwn(dictionary, buyerSecret)) {
|
|
727
872
|
console.log(`${name6}: Payload not supplied for buyerSecret: ${buyerSecret}`);
|
|
728
873
|
return false;
|
|
729
874
|
}
|
|
@@ -757,7 +902,7 @@ var getPaymentAuthoritiesAllowedValidator = (allowed) => {
|
|
|
757
902
|
return (terms) => {
|
|
758
903
|
const result = moduleIdentifiersContainsAllOf(terms, (t) => t.paymentAuthorities, allowed, true);
|
|
759
904
|
if (!result) {
|
|
760
|
-
console.log(`${name7}: Payment authority not allowed: ${terms.paymentAuthorities}`);
|
|
905
|
+
console.log(`${name7}: Payment authority not allowed: ${String(terms.paymentAuthorities)}`);
|
|
761
906
|
}
|
|
762
907
|
return result;
|
|
763
908
|
};
|
|
@@ -769,11 +914,11 @@ var name8 = "EscrowTerms.seller";
|
|
|
769
914
|
var sellerExistsValidator = (terms) => {
|
|
770
915
|
const seller = terms.seller;
|
|
771
916
|
if (!seller || seller.length === 0) {
|
|
772
|
-
console.log(`${name8}: No seller: ${terms.seller}`);
|
|
917
|
+
console.log(`${name8}: No seller: ${String(terms.seller)}`);
|
|
773
918
|
return false;
|
|
774
919
|
}
|
|
775
920
|
if (seller.map((x) => asAddress3(x)).length !== seller.length) {
|
|
776
|
-
console.log(`${name8}: Invalid address: ${terms.seller}`);
|
|
921
|
+
console.log(`${name8}: Invalid address: ${String(terms.seller)}`);
|
|
777
922
|
return false;
|
|
778
923
|
}
|
|
779
924
|
return true;
|
|
@@ -793,7 +938,7 @@ var sellerSecretExistsValidator = (terms) => {
|
|
|
793
938
|
var getSellerSecretSuppliedValidator = (dictionary) => {
|
|
794
939
|
return (terms) => {
|
|
795
940
|
const sellerSecret = assertEx3(terms.sellerSecret, () => `${name9}: No sellerSecret: ${terms.sellerSecret}`);
|
|
796
|
-
if (!dictionary
|
|
941
|
+
if (!Object.hasOwn(dictionary, sellerSecret)) {
|
|
797
942
|
console.log(`${name9}: Payload not supplied for sellerSecret: ${sellerSecret}`);
|
|
798
943
|
return false;
|
|
799
944
|
}
|
|
@@ -805,8 +950,13 @@ var getSellerSecretSignedValidator = (dictionary) => {
|
|
|
805
950
|
};
|
|
806
951
|
|
|
807
952
|
// src/Payment/Instrument/Card/Payload.ts
|
|
808
|
-
import {
|
|
809
|
-
|
|
953
|
+
import {
|
|
954
|
+
zodAsFactory as zodAsFactory11,
|
|
955
|
+
zodIsFactory as zodIsFactory11,
|
|
956
|
+
zodToFactory as zodToFactory11
|
|
957
|
+
} from "@xylabs/sdk-js";
|
|
958
|
+
import { PayloadZodOfSchema as PayloadZodOfSchema9 } from "@xyo-network/sdk-js";
|
|
959
|
+
import * as z13 from "zod/mini";
|
|
810
960
|
|
|
811
961
|
// src/Payment/Instrument/Card/Schema.ts
|
|
812
962
|
import { asSchema as asSchema16 } from "@xyo-network/sdk-js";
|
|
@@ -825,211 +975,261 @@ var PaymentInstrumentSchema = asSchema15(`${PaymentSchema}.instrument`, true);
|
|
|
825
975
|
var PaymentCardSchema = asSchema16(`${PaymentInstrumentSchema}.card`, true);
|
|
826
976
|
|
|
827
977
|
// src/Payment/Instrument/Card/Payload.ts
|
|
828
|
-
var
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
978
|
+
var PaymentCardFieldsZod = z13.object({
|
|
979
|
+
/**
|
|
980
|
+
* Card Number (PAN) of the payment card. This value is required to perform a payment.
|
|
981
|
+
*/
|
|
982
|
+
cardNumber: z13.string(),
|
|
983
|
+
/**
|
|
984
|
+
* The name as it appears on the payment card.
|
|
985
|
+
*/
|
|
986
|
+
cardholderName: z13.optional(z13.string()),
|
|
987
|
+
/**
|
|
988
|
+
* Card Verification Value (CVV/CVC) of the payment card.
|
|
989
|
+
*/
|
|
990
|
+
cvv: z13.string(),
|
|
991
|
+
/**
|
|
992
|
+
* Expiration month of the payment card.
|
|
993
|
+
*/
|
|
994
|
+
expMonth: z13.number(),
|
|
995
|
+
/**
|
|
996
|
+
* Expiration year of the payment card.
|
|
997
|
+
*/
|
|
998
|
+
expYear: z13.number()
|
|
999
|
+
});
|
|
1000
|
+
var PaymentCardZod = z13.extend(PayloadZodOfSchema9(PaymentCardSchema), { ...PaymentCardFieldsZod.shape });
|
|
1001
|
+
var isPaymentCard = zodIsFactory11(PaymentCardZod);
|
|
1002
|
+
var asPaymentCard = zodAsFactory11(PaymentCardZod, "asPaymentCard");
|
|
1003
|
+
var toPaymentCard = zodToFactory11(PaymentCardZod, "toPaymentCard");
|
|
834
1004
|
|
|
835
1005
|
// src/Payment/Payload.ts
|
|
836
|
-
import { AsObjectFactory as AsObjectFactory12 } from "@xylabs/sdk-js";
|
|
837
1006
|
import {
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
var
|
|
845
|
-
|
|
846
|
-
|
|
1007
|
+
zodAsFactory as zodAsFactory12,
|
|
1008
|
+
zodIsFactory as zodIsFactory12,
|
|
1009
|
+
zodToFactory as zodToFactory12
|
|
1010
|
+
} from "@xylabs/sdk-js";
|
|
1011
|
+
import { PayloadZodOfSchema as PayloadZodOfSchema10 } from "@xyo-network/sdk-js";
|
|
1012
|
+
import * as z14 from "zod/mini";
|
|
1013
|
+
var PaymentFieldsZod = z14.object({
|
|
1014
|
+
/**
|
|
1015
|
+
* The amount paid
|
|
1016
|
+
*/
|
|
1017
|
+
amount: z14.number(),
|
|
1018
|
+
/**
|
|
1019
|
+
* The currency of the amount paid
|
|
1020
|
+
*/
|
|
1021
|
+
currency: SupportedCurrencyZod
|
|
1022
|
+
});
|
|
1023
|
+
var PaymentZod = z14.extend(PayloadZodOfSchema10(PaymentSchema), { ...PaymentFieldsZod.shape });
|
|
1024
|
+
var isPayment = zodIsFactory12(PaymentZod);
|
|
1025
|
+
var asPayment = zodAsFactory12(PaymentZod, "asPayment");
|
|
1026
|
+
var toPayment = zodToFactory12(PaymentZod, "toPayment");
|
|
847
1027
|
|
|
848
1028
|
// src/Payment/Status/Payload.ts
|
|
849
|
-
import { AsObjectFactory as AsObjectFactory13 } from "@xylabs/sdk-js";
|
|
850
1029
|
import {
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
1030
|
+
zodAsFactory as zodAsFactory13,
|
|
1031
|
+
zodIsFactory as zodIsFactory13,
|
|
1032
|
+
zodToFactory as zodToFactory13
|
|
1033
|
+
} from "@xylabs/sdk-js";
|
|
1034
|
+
import { PayloadZodOfSchema as PayloadZodOfSchema11 } from "@xyo-network/sdk-js";
|
|
1035
|
+
import * as z15 from "zod/mini";
|
|
854
1036
|
|
|
855
1037
|
// src/Payment/Status/Schema.ts
|
|
856
1038
|
import { asSchema as asSchema17 } from "@xyo-network/sdk-js";
|
|
857
1039
|
var PaymentStatusSchema = asSchema17(`${PaymentSchema}.status`, true);
|
|
858
1040
|
|
|
859
1041
|
// src/Payment/Status/Payload.ts
|
|
860
|
-
var
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
1042
|
+
var PaymentStatusFieldsZod = z15.object({
|
|
1043
|
+
/**
|
|
1044
|
+
* The result of the payment (i.e. declined)
|
|
1045
|
+
*/
|
|
1046
|
+
result: z15.optional(z15.string()),
|
|
1047
|
+
/**
|
|
1048
|
+
* The status of the payment (i.e. completed)
|
|
1049
|
+
*/
|
|
1050
|
+
status: z15.string()
|
|
1051
|
+
});
|
|
1052
|
+
var PaymentStatusZod = z15.extend(PayloadZodOfSchema11(PaymentStatusSchema), { ...PaymentStatusFieldsZod.shape });
|
|
1053
|
+
var isPaymentStatus = zodIsFactory13(PaymentStatusZod);
|
|
1054
|
+
var asPaymentStatus = zodAsFactory13(PaymentStatusZod, "asPaymentStatus");
|
|
1055
|
+
var toPaymentStatus = zodToFactory13(PaymentStatusZod, "toPaymentStatus");
|
|
866
1056
|
|
|
867
1057
|
// src/Purchase/Payload.ts
|
|
868
|
-
import { AsObjectFactory as AsObjectFactory14 } from "@xylabs/sdk-js";
|
|
869
1058
|
import {
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
1059
|
+
HashZod as HashZod4,
|
|
1060
|
+
zodAsFactory as zodAsFactory14,
|
|
1061
|
+
zodIsFactory as zodIsFactory14,
|
|
1062
|
+
zodToFactory as zodToFactory14
|
|
1063
|
+
} from "@xylabs/sdk-js";
|
|
1064
|
+
import { PayloadZodOfSchema as PayloadZodOfSchema12 } from "@xyo-network/sdk-js";
|
|
1065
|
+
import * as z16 from "zod/mini";
|
|
873
1066
|
|
|
874
1067
|
// src/Purchase/Schema.ts
|
|
875
1068
|
import { asSchema as asSchema18 } from "@xyo-network/sdk-js";
|
|
876
1069
|
var PurchaseSchema = asSchema18(`${PaymentsSchema}.purchase`, true);
|
|
877
1070
|
|
|
878
1071
|
// src/Purchase/Payload.ts
|
|
879
|
-
var
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
1072
|
+
var PurchaseFieldsZod = z16.object({
|
|
1073
|
+
/**
|
|
1074
|
+
* The things that were purchased
|
|
1075
|
+
*/
|
|
1076
|
+
assets: z16.array(HashZod4),
|
|
1077
|
+
/**
|
|
1078
|
+
* The receipts for payments for this purchase. Array to allow for multiple payments
|
|
1079
|
+
* for a single quote.
|
|
1080
|
+
*/
|
|
1081
|
+
receipts: z16.array(HashZod4)
|
|
1082
|
+
});
|
|
1083
|
+
var PurchaseZod = z16.extend(PayloadZodOfSchema12(PurchaseSchema), { ...PurchaseFieldsZod.shape });
|
|
1084
|
+
var isPurchase = zodIsFactory14(PurchaseZod);
|
|
1085
|
+
var asPurchase = zodAsFactory14(PurchaseZod, "asPurchase");
|
|
1086
|
+
var toPurchase = zodToFactory14(PurchaseZod, "toPurchase");
|
|
885
1087
|
|
|
886
1088
|
// src/Receipt/Payload.ts
|
|
887
|
-
import { AsObjectFactory as AsObjectFactory15 } from "@xylabs/sdk-js";
|
|
888
1089
|
import {
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
1090
|
+
zodAsFactory as zodAsFactory15,
|
|
1091
|
+
zodIsFactory as zodIsFactory15,
|
|
1092
|
+
zodToFactory as zodToFactory15
|
|
1093
|
+
} from "@xylabs/sdk-js";
|
|
1094
|
+
import { PayloadZodOfSchema as PayloadZodOfSchema13 } from "@xyo-network/sdk-js";
|
|
1095
|
+
import * as z17 from "zod/mini";
|
|
892
1096
|
|
|
893
1097
|
// src/Receipt/Schema.ts
|
|
894
1098
|
import { asSchema as asSchema19 } from "@xyo-network/sdk-js";
|
|
895
1099
|
var ReceiptSchema = asSchema19(`${PaymentsSchema}.receipt`, true);
|
|
896
1100
|
|
|
897
1101
|
// src/Receipt/Payload.ts
|
|
898
|
-
var
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
1102
|
+
var ReceiptFieldsZod = z17.object({
|
|
1103
|
+
/**
|
|
1104
|
+
* The amount paid
|
|
1105
|
+
*/
|
|
1106
|
+
amount: z17.number(),
|
|
1107
|
+
/**
|
|
1108
|
+
* The currency of the amount paid
|
|
1109
|
+
*/
|
|
1110
|
+
currency: SupportedCurrencyZod
|
|
1111
|
+
});
|
|
1112
|
+
var ReceiptZod = z17.extend(PayloadZodOfSchema13(ReceiptSchema), { ...ReceiptFieldsZod.shape });
|
|
1113
|
+
var isReceipt = zodIsFactory15(ReceiptZod);
|
|
1114
|
+
var asReceipt = zodAsFactory15(ReceiptZod, "asReceipt");
|
|
1115
|
+
var toReceipt = zodToFactory15(ReceiptZod, "toReceipt");
|
|
904
1116
|
|
|
905
1117
|
// src/Subtotal/Diviner/Config.ts
|
|
906
1118
|
import { asSchema as asSchema20 } from "@xyo-network/sdk-js";
|
|
907
1119
|
var PaymentSubtotalDivinerConfigSchema = asSchema20("network.xyo.diviner.payments.subtotal.config", true);
|
|
908
1120
|
|
|
909
1121
|
// src/Subtotal/Diviner/Payload.ts
|
|
910
|
-
import { AsObjectFactory as AsObjectFactory16 } from "@xylabs/sdk-js";
|
|
911
1122
|
import {
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
} from "@
|
|
1123
|
+
zodAsFactory as zodAsFactory16,
|
|
1124
|
+
zodIsFactory as zodIsFactory16,
|
|
1125
|
+
zodToFactory as zodToFactory16
|
|
1126
|
+
} from "@xylabs/sdk-js";
|
|
1127
|
+
import { asSchema as asSchema21, PayloadZodOfSchema as PayloadZodOfSchema14 } from "@xyo-network/sdk-js";
|
|
1128
|
+
import * as z18 from "zod/mini";
|
|
916
1129
|
var SubtotalSchema = asSchema21("network.xyo.payments.subtotal", true);
|
|
917
|
-
var
|
|
918
|
-
var
|
|
919
|
-
var
|
|
920
|
-
var
|
|
921
|
-
var
|
|
922
|
-
var asOptionalSubtotalWithSources = AsObjectFactory16.createOptional(isSubtotalWithSources);
|
|
1130
|
+
var SubtotalFieldsZod = z18.object({ ...AmountFieldsZod.shape });
|
|
1131
|
+
var SubtotalZod = z18.extend(PayloadZodOfSchema14(SubtotalSchema), { ...SubtotalFieldsZod.shape });
|
|
1132
|
+
var isSubtotal = zodIsFactory16(SubtotalZod);
|
|
1133
|
+
var asSubtotal = zodAsFactory16(SubtotalZod, "asSubtotal");
|
|
1134
|
+
var toSubtotal = zodToFactory16(SubtotalZod, "toSubtotal");
|
|
923
1135
|
|
|
924
1136
|
// src/Total/Diviner/Config.ts
|
|
925
1137
|
import { asSchema as asSchema22 } from "@xyo-network/sdk-js";
|
|
926
1138
|
var PaymentTotalDivinerConfigSchema = asSchema22("network.xyo.diviner.payments.total.config", true);
|
|
927
1139
|
|
|
928
1140
|
// src/Total/Diviner/Payload.ts
|
|
929
|
-
import { AsObjectFactory as AsObjectFactory17 } from "@xylabs/sdk-js";
|
|
930
1141
|
import {
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
} from "@
|
|
1142
|
+
zodAsFactory as zodAsFactory17,
|
|
1143
|
+
zodIsFactory as zodIsFactory17,
|
|
1144
|
+
zodToFactory as zodToFactory17
|
|
1145
|
+
} from "@xylabs/sdk-js";
|
|
1146
|
+
import { asSchema as asSchema23, PayloadZodOfSchema as PayloadZodOfSchema15 } from "@xyo-network/sdk-js";
|
|
1147
|
+
import * as z19 from "zod/mini";
|
|
935
1148
|
var TotalSchema = asSchema23("network.xyo.payments.total", true);
|
|
936
|
-
var
|
|
937
|
-
var
|
|
938
|
-
var
|
|
939
|
-
var
|
|
940
|
-
var
|
|
941
|
-
var asOptionalTotalWithSources = AsObjectFactory17.createOptional(isTotalWithSources);
|
|
1149
|
+
var TotalFieldsZod = z19.object({ ...AmountFieldsZod.shape });
|
|
1150
|
+
var TotalZod = z19.extend(PayloadZodOfSchema15(TotalSchema), { ...TotalFieldsZod.shape });
|
|
1151
|
+
var isTotal = zodIsFactory17(TotalZod);
|
|
1152
|
+
var asTotal = zodAsFactory17(TotalZod, "asTotal");
|
|
1153
|
+
var toTotal = zodToFactory17(TotalZod, "toTotal");
|
|
942
1154
|
export {
|
|
1155
|
+
AmountFieldsZod,
|
|
943
1156
|
AmountSchema,
|
|
1157
|
+
AmountZod,
|
|
1158
|
+
BillingAddressFieldsZod,
|
|
944
1159
|
BillingAddressSchema,
|
|
1160
|
+
BillingAddressZod,
|
|
945
1161
|
BillingSchema,
|
|
1162
|
+
ConditionZod,
|
|
1163
|
+
CouponFieldsZod,
|
|
946
1164
|
CouponSchema,
|
|
1165
|
+
CouponZod,
|
|
1166
|
+
DiscountFieldsZod,
|
|
947
1167
|
DiscountSchema,
|
|
1168
|
+
DiscountZod,
|
|
1169
|
+
EscrowOutcomeFieldsZod,
|
|
948
1170
|
EscrowOutcomeSchema,
|
|
1171
|
+
EscrowOutcomeZod,
|
|
1172
|
+
EscrowOutcomesZod,
|
|
949
1173
|
EscrowSchema,
|
|
1174
|
+
EscrowTermsFieldsZod,
|
|
950
1175
|
EscrowTermsSchema,
|
|
1176
|
+
EscrowTermsZod,
|
|
1177
|
+
FixedAmountCouponFieldsZod,
|
|
951
1178
|
FixedAmountCouponSchema,
|
|
1179
|
+
FixedAmountCouponZod,
|
|
1180
|
+
FixedPercentageCouponFieldsZod,
|
|
952
1181
|
FixedPercentageCouponSchema,
|
|
1182
|
+
FixedPercentageCouponZod,
|
|
1183
|
+
FixedPriceCouponFieldsZod,
|
|
953
1184
|
FixedPriceCouponSchema,
|
|
1185
|
+
FixedPriceCouponZod,
|
|
954
1186
|
Iso4217CurrencyCodes,
|
|
955
1187
|
NO_DISCOUNT,
|
|
1188
|
+
PaymentCardFieldsZod,
|
|
956
1189
|
PaymentCardSchema,
|
|
1190
|
+
PaymentCardZod,
|
|
957
1191
|
PaymentDiscountDivinerConfigSchema,
|
|
1192
|
+
PaymentFieldsZod,
|
|
958
1193
|
PaymentInstrumentSchema,
|
|
959
1194
|
PaymentSchema,
|
|
1195
|
+
PaymentStatusFieldsZod,
|
|
960
1196
|
PaymentStatusSchema,
|
|
1197
|
+
PaymentStatusZod,
|
|
961
1198
|
PaymentSubtotalDivinerConfigSchema,
|
|
962
1199
|
PaymentTotalDivinerConfigSchema,
|
|
1200
|
+
PaymentZod,
|
|
1201
|
+
PurchaseFieldsZod,
|
|
963
1202
|
PurchaseSchema,
|
|
1203
|
+
PurchaseZod,
|
|
1204
|
+
ReceiptFieldsZod,
|
|
964
1205
|
ReceiptSchema,
|
|
1206
|
+
ReceiptZod,
|
|
1207
|
+
SubtotalFieldsZod,
|
|
965
1208
|
SubtotalSchema,
|
|
1209
|
+
SubtotalZod,
|
|
1210
|
+
SupportedCurrencyZod,
|
|
1211
|
+
TotalFieldsZod,
|
|
966
1212
|
TotalSchema,
|
|
1213
|
+
TotalZod,
|
|
967
1214
|
appraisalAuthoritiesExistValidator,
|
|
968
1215
|
appraisalsExistValidator,
|
|
969
1216
|
asAmount,
|
|
970
|
-
asAmountWithSources,
|
|
971
1217
|
asBillingAddress,
|
|
972
|
-
asBillingAddressWithSources,
|
|
973
1218
|
asCondition,
|
|
974
|
-
asConditionWithSources,
|
|
975
1219
|
asCoupon,
|
|
976
|
-
asCouponWithSources,
|
|
977
1220
|
asDiscount,
|
|
978
|
-
asDiscountWithSources,
|
|
979
1221
|
asEscrowOutcome,
|
|
980
|
-
asEscrowOutcomeWithSources,
|
|
981
1222
|
asEscrowTerms,
|
|
982
|
-
asEscrowTermsWithSources,
|
|
983
1223
|
asFixedAmountCoupon,
|
|
984
|
-
asFixedAmountCouponWithSources,
|
|
985
1224
|
asFixedPercentageCoupon,
|
|
986
|
-
asFixedPercentageCouponWithSources,
|
|
987
1225
|
asFixedPriceCoupon,
|
|
988
|
-
asFixedPriceCouponWithSources,
|
|
989
|
-
asOptionalAmount,
|
|
990
|
-
asOptionalAmountWithSources,
|
|
991
|
-
asOptionalBillingAddress,
|
|
992
|
-
asOptionalBillingAddressWithSources,
|
|
993
|
-
asOptionalDiscount,
|
|
994
|
-
asOptionalDiscountWithSources,
|
|
995
|
-
asOptionalEscrowOutcome,
|
|
996
|
-
asOptionalEscrowOutcomeWithSources,
|
|
997
|
-
asOptionalEscrowTerms,
|
|
998
|
-
asOptionalEscrowTermsWithSources,
|
|
999
|
-
asOptionalFixedAmountCoupon,
|
|
1000
|
-
asOptionalFixedAmountCouponWithSources,
|
|
1001
|
-
asOptionalFixedPercentageCoupon,
|
|
1002
|
-
asOptionalFixedPercentageCouponWithSources,
|
|
1003
|
-
asOptionalFixedPriceCoupon,
|
|
1004
|
-
asOptionalFixedPriceCouponWithSources,
|
|
1005
|
-
asOptionalPayment,
|
|
1006
|
-
asOptionalPaymentCard,
|
|
1007
|
-
asOptionalPaymentCardWithSources,
|
|
1008
|
-
asOptionalPaymentStatus,
|
|
1009
|
-
asOptionalPaymentStatusWithSources,
|
|
1010
|
-
asOptionalPaymentWithSources,
|
|
1011
|
-
asOptionalPurchase,
|
|
1012
|
-
asOptionalPurchaseWithSources,
|
|
1013
|
-
asOptionalReceipt,
|
|
1014
|
-
asOptionalReceiptWithSources,
|
|
1015
|
-
asOptionalSubtotal,
|
|
1016
|
-
asOptionalSubtotalWithSources,
|
|
1017
|
-
asOptionalTotal,
|
|
1018
|
-
asOptionalTotalWithSources,
|
|
1019
1226
|
asPayment,
|
|
1020
1227
|
asPaymentCard,
|
|
1021
|
-
asPaymentCardWithSources,
|
|
1022
1228
|
asPaymentStatus,
|
|
1023
|
-
asPaymentStatusWithSources,
|
|
1024
|
-
asPaymentWithSources,
|
|
1025
1229
|
asPurchase,
|
|
1026
|
-
asPurchaseWithSources,
|
|
1027
1230
|
asReceipt,
|
|
1028
|
-
asReceiptWithSources,
|
|
1029
1231
|
asSubtotal,
|
|
1030
|
-
asSubtotalWithSources,
|
|
1031
1232
|
asTotal,
|
|
1032
|
-
asTotalWithSources,
|
|
1033
1233
|
assetsExistValidator,
|
|
1034
1234
|
buyerExistsValidator,
|
|
1035
1235
|
buyerSecretExistsValidator,
|
|
@@ -1054,45 +1254,45 @@ export {
|
|
|
1054
1254
|
getSellerSecretSuppliedValidator,
|
|
1055
1255
|
getSignaturesByAppraisal,
|
|
1056
1256
|
isAmount,
|
|
1057
|
-
isAmountWithSources,
|
|
1058
1257
|
isBillingAddress,
|
|
1059
|
-
isBillingAddressWithSources,
|
|
1060
1258
|
isCondition,
|
|
1061
|
-
isConditionWithSources,
|
|
1062
1259
|
isCoupon,
|
|
1063
|
-
isCouponWithSources,
|
|
1064
1260
|
isDiscount,
|
|
1065
|
-
isDiscountWithSources,
|
|
1066
1261
|
isEscrowOutcome,
|
|
1067
|
-
isEscrowOutcomeWithSources,
|
|
1068
1262
|
isEscrowTerms,
|
|
1069
|
-
isEscrowTermsWithSources,
|
|
1070
1263
|
isFixedAmountCoupon,
|
|
1071
|
-
isFixedAmountCouponWithSources,
|
|
1072
1264
|
isFixedPercentageCoupon,
|
|
1073
|
-
isFixedPercentageCouponWithSources,
|
|
1074
1265
|
isFixedPriceCoupon,
|
|
1075
|
-
isFixedPriceCouponWithSources,
|
|
1076
1266
|
isIso4217CurrencyCode,
|
|
1077
1267
|
isPayment,
|
|
1078
1268
|
isPaymentCard,
|
|
1079
|
-
isPaymentCardWithSources,
|
|
1080
1269
|
isPaymentStatus,
|
|
1081
|
-
isPaymentStatusWithSources,
|
|
1082
|
-
isPaymentWithSources,
|
|
1083
1270
|
isPurchase,
|
|
1084
|
-
isPurchaseWithSources,
|
|
1085
1271
|
isReceipt,
|
|
1086
|
-
isReceiptWithSources,
|
|
1087
1272
|
isStackable,
|
|
1088
1273
|
isSubtotal,
|
|
1089
|
-
isSubtotalWithSources,
|
|
1090
1274
|
isTotal,
|
|
1091
|
-
isTotalWithSources,
|
|
1092
1275
|
moduleIdentifiersContainsAllOf,
|
|
1093
1276
|
moduleIdentifiersContainsOneOf,
|
|
1094
1277
|
sellerExistsValidator,
|
|
1095
1278
|
sellerSecretExistsValidator,
|
|
1279
|
+
toAmount,
|
|
1280
|
+
toBillingAddress,
|
|
1281
|
+
toCondition,
|
|
1282
|
+
toCoupon,
|
|
1283
|
+
toDiscount,
|
|
1284
|
+
toEscrowOutcome,
|
|
1285
|
+
toEscrowTerms,
|
|
1286
|
+
toFixedAmountCoupon,
|
|
1287
|
+
toFixedPercentageCoupon,
|
|
1288
|
+
toFixedPriceCoupon,
|
|
1289
|
+
toPayment,
|
|
1290
|
+
toPaymentCard,
|
|
1291
|
+
toPaymentStatus,
|
|
1292
|
+
toPurchase,
|
|
1293
|
+
toReceipt,
|
|
1294
|
+
toSubtotal,
|
|
1295
|
+
toTotal,
|
|
1096
1296
|
updateEscrowTermsWithSecret,
|
|
1097
1297
|
validateWithinWindow
|
|
1098
1298
|
};
|