@gr4vy/sdk 2.3.27 → 2.3.29

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.
Files changed (76) hide show
  1. package/README.md +10 -0
  2. package/funcs/giftCardsActivationsCreate.d.ts +18 -0
  3. package/funcs/giftCardsActivationsCreate.d.ts.map +1 -0
  4. package/funcs/giftCardsActivationsCreate.js +129 -0
  5. package/funcs/giftCardsActivationsCreate.js.map +1 -0
  6. package/funcs/giftCardsIssuancesCreate.d.ts +18 -0
  7. package/funcs/giftCardsIssuancesCreate.d.ts.map +1 -0
  8. package/funcs/giftCardsIssuancesCreate.js +129 -0
  9. package/funcs/giftCardsIssuancesCreate.js.map +1 -0
  10. package/jsr.json +1 -1
  11. package/lib/config.d.ts +3 -3
  12. package/lib/config.js +3 -3
  13. package/models/components/buyer.d.ts +4 -0
  14. package/models/components/buyer.d.ts.map +1 -1
  15. package/models/components/buyer.js +2 -0
  16. package/models/components/buyer.js.map +1 -1
  17. package/models/components/giftcardactivationcreate.d.ts +38 -0
  18. package/models/components/giftcardactivationcreate.d.ts.map +1 -0
  19. package/models/components/giftcardactivationcreate.js +58 -0
  20. package/models/components/giftcardactivationcreate.js.map +1 -0
  21. package/models/components/giftcardissuance.d.ts +51 -0
  22. package/models/components/giftcardissuance.d.ts.map +1 -0
  23. package/models/components/giftcardissuance.js +71 -0
  24. package/models/components/giftcardissuance.js.map +1 -0
  25. package/models/components/giftcardissuancecreate.d.ts +33 -0
  26. package/models/components/giftcardissuancecreate.d.ts.map +1 -0
  27. package/models/components/giftcardissuancecreate.js +57 -0
  28. package/models/components/giftcardissuancecreate.js.map +1 -0
  29. package/models/components/index.d.ts +3 -0
  30. package/models/components/index.d.ts.map +1 -1
  31. package/models/components/index.js +3 -0
  32. package/models/components/index.js.map +1 -1
  33. package/models/components/transactionbuyer.d.ts +4 -0
  34. package/models/components/transactionbuyer.d.ts.map +1 -1
  35. package/models/components/transactionbuyer.js +2 -0
  36. package/models/components/transactionbuyer.js.map +1 -1
  37. package/models/operations/activategiftcard.d.ts +26 -0
  38. package/models/operations/activategiftcard.d.ts.map +1 -0
  39. package/models/operations/activategiftcard.js +58 -0
  40. package/models/operations/activategiftcard.js.map +1 -0
  41. package/models/operations/index.d.ts +2 -0
  42. package/models/operations/index.d.ts.map +1 -1
  43. package/models/operations/index.js +2 -0
  44. package/models/operations/index.js.map +1 -1
  45. package/models/operations/issuegiftcard.d.ts +26 -0
  46. package/models/operations/issuegiftcard.d.ts.map +1 -0
  47. package/models/operations/issuegiftcard.js +58 -0
  48. package/models/operations/issuegiftcard.js.map +1 -0
  49. package/package.json +1 -1
  50. package/sdk/activations.d.ts +12 -0
  51. package/sdk/activations.d.ts.map +1 -0
  52. package/sdk/activations.js +22 -0
  53. package/sdk/activations.js.map +1 -0
  54. package/sdk/giftcards.d.ts +6 -0
  55. package/sdk/giftcards.d.ts.map +1 -1
  56. package/sdk/giftcards.js +8 -0
  57. package/sdk/giftcards.js.map +1 -1
  58. package/sdk/issuances.d.ts +12 -0
  59. package/sdk/issuances.d.ts.map +1 -0
  60. package/sdk/issuances.js +22 -0
  61. package/sdk/issuances.js.map +1 -0
  62. package/src/funcs/giftCardsActivationsCreate.ts +240 -0
  63. package/src/funcs/giftCardsIssuancesCreate.ts +240 -0
  64. package/src/lib/config.ts +3 -3
  65. package/src/models/components/buyer.ts +6 -0
  66. package/src/models/components/giftcardactivationcreate.ts +66 -0
  67. package/src/models/components/giftcardissuance.ts +95 -0
  68. package/src/models/components/giftcardissuancecreate.ts +60 -0
  69. package/src/models/components/index.ts +3 -0
  70. package/src/models/components/transactionbuyer.ts +6 -0
  71. package/src/models/operations/activategiftcard.ts +54 -0
  72. package/src/models/operations/index.ts +2 -0
  73. package/src/models/operations/issuegiftcard.ts +54 -0
  74. package/src/sdk/activations.ts +31 -0
  75. package/src/sdk/giftcards.ts +12 -0
  76. package/src/sdk/issuances.ts +31 -0
@@ -0,0 +1,95 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import {
11
+ GiftCardService,
12
+ GiftCardService$inboundSchema,
13
+ } from "./giftcardservice.js";
14
+
15
+ export type GiftCardIssuance = {
16
+ /**
17
+ * Always `gift-card-issuance`.
18
+ */
19
+ type: "gift-card-issuance";
20
+ /**
21
+ * The ID for the gift card issuance.
22
+ */
23
+ id: string;
24
+ /**
25
+ * The ID of the merchant account this gift card issuance belongs to.
26
+ */
27
+ merchantAccountId: string;
28
+ giftCardService: GiftCardService;
29
+ /**
30
+ * The identifier for this issuance as provided by the gift card service.
31
+ */
32
+ giftCardServicePaymentIssuanceId: string;
33
+ /**
34
+ * The URL for the issued gift card.
35
+ */
36
+ url: string;
37
+ /**
38
+ * The amount loaded onto the gift card, in the smallest denomination for the currency.
39
+ */
40
+ amount: number;
41
+ /**
42
+ * The ISO-4217 currency code for the `amount`.
43
+ */
44
+ currency: string;
45
+ /**
46
+ * The external identifier provided when issuing the gift card.
47
+ */
48
+ externalIdentifier?: string | null | undefined;
49
+ /**
50
+ * The date and time when this gift card was issued.
51
+ */
52
+ createdAt: Date;
53
+ /**
54
+ * The date and time when this gift card issuance was last updated.
55
+ */
56
+ updatedAt: Date;
57
+ };
58
+
59
+ /** @internal */
60
+ export const GiftCardIssuance$inboundSchema: z.ZodType<
61
+ GiftCardIssuance,
62
+ z.ZodTypeDef,
63
+ unknown
64
+ > = z.object({
65
+ type: z.literal("gift-card-issuance").default("gift-card-issuance"),
66
+ id: z.string(),
67
+ merchant_account_id: z.string(),
68
+ gift_card_service: GiftCardService$inboundSchema,
69
+ gift_card_service_payment_issuance_id: z.string(),
70
+ url: z.string(),
71
+ amount: z.number().int(),
72
+ currency: z.string(),
73
+ external_identifier: z.nullable(z.string()).optional(),
74
+ created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
75
+ updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
76
+ }).transform((v) => {
77
+ return remap$(v, {
78
+ "merchant_account_id": "merchantAccountId",
79
+ "gift_card_service": "giftCardService",
80
+ "gift_card_service_payment_issuance_id": "giftCardServicePaymentIssuanceId",
81
+ "external_identifier": "externalIdentifier",
82
+ "created_at": "createdAt",
83
+ "updated_at": "updatedAt",
84
+ });
85
+ });
86
+
87
+ export function giftCardIssuanceFromJSON(
88
+ jsonString: string,
89
+ ): SafeParseResult<GiftCardIssuance, SDKValidationError> {
90
+ return safeParse(
91
+ jsonString,
92
+ (x) => GiftCardIssuance$inboundSchema.parse(JSON.parse(x)),
93
+ `Failed to parse 'GiftCardIssuance' from JSON`,
94
+ );
95
+ }
@@ -0,0 +1,60 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+
8
+ /**
9
+ * The details used to issue a new virtual gift card.
10
+ */
11
+ export type GiftCardIssuanceCreate = {
12
+ /**
13
+ * The provider theme code to issue the gift card against.
14
+ */
15
+ theme: string;
16
+ /**
17
+ * The amount to load onto the gift card, in the smallest denomination for the currency.
18
+ */
19
+ amount: number;
20
+ /**
21
+ * The ISO-4217 currency code for the `amount`.
22
+ */
23
+ currency: string;
24
+ /**
25
+ * An optional external identifier for this issuance.
26
+ */
27
+ externalIdentifier?: string | null | undefined;
28
+ };
29
+
30
+ /** @internal */
31
+ export type GiftCardIssuanceCreate$Outbound = {
32
+ theme: string;
33
+ amount: number;
34
+ currency: string;
35
+ external_identifier?: string | null | undefined;
36
+ };
37
+
38
+ /** @internal */
39
+ export const GiftCardIssuanceCreate$outboundSchema: z.ZodType<
40
+ GiftCardIssuanceCreate$Outbound,
41
+ z.ZodTypeDef,
42
+ GiftCardIssuanceCreate
43
+ > = z.object({
44
+ theme: z.string(),
45
+ amount: z.number().int(),
46
+ currency: z.string(),
47
+ externalIdentifier: z.nullable(z.string()).optional(),
48
+ }).transform((v) => {
49
+ return remap$(v, {
50
+ externalIdentifier: "external_identifier",
51
+ });
52
+ });
53
+
54
+ export function giftCardIssuanceCreateToJSON(
55
+ giftCardIssuanceCreate: GiftCardIssuanceCreate,
56
+ ): string {
57
+ return JSON.stringify(
58
+ GiftCardIssuanceCreate$outboundSchema.parse(giftCardIssuanceCreate),
59
+ );
60
+ }
@@ -120,9 +120,12 @@ export * from "./forterantifraudoptionscartitemdeliverydetails.js";
120
120
  export * from "./forterantifraudoptionsdiscount.js";
121
121
  export * from "./forterantifraudoptionsdiscountcoupondiscountamount.js";
122
122
  export * from "./giftcard.js";
123
+ export * from "./giftcardactivationcreate.js";
123
124
  export * from "./giftcardbalancerequest.js";
124
125
  export * from "./giftcardcreate.js";
125
126
  export * from "./giftcarderrorcode.js";
127
+ export * from "./giftcardissuance.js";
128
+ export * from "./giftcardissuancecreate.js";
126
129
  export * from "./giftcardredemption.js";
127
130
  export * from "./giftcardredemptionstatus.js";
128
131
  export * from "./giftcardrequest.js";
@@ -21,6 +21,10 @@ export type TransactionBuyer = {
21
21
  * The ID for the buyer.
22
22
  */
23
23
  id?: string | null | undefined;
24
+ /**
25
+ * The base62 encoded buyer ID. This represents a shorter version of this buyer's `id` which is sent to payment services, anti-fraud services, and other connectors. You can use this ID to reconcile a payment service's buyer against our system.
26
+ */
27
+ reconciliationId?: string | null | undefined;
24
28
  /**
25
29
  * The display name for the buyer.
26
30
  */
@@ -47,12 +51,14 @@ export const TransactionBuyer$inboundSchema: z.ZodType<
47
51
  > = z.object({
48
52
  type: z.literal("buyer").default("buyer"),
49
53
  id: z.nullable(z.string()).optional(),
54
+ reconciliation_id: z.nullable(z.string()).optional(),
50
55
  display_name: z.nullable(z.string()).optional(),
51
56
  external_identifier: z.nullable(z.string()).optional(),
52
57
  billing_details: z.nullable(BillingDetails$inboundSchema).optional(),
53
58
  account_number: z.nullable(z.string()).optional(),
54
59
  }).transform((v) => {
55
60
  return remap$(v, {
61
+ "reconciliation_id": "reconciliationId",
56
62
  "display_name": "displayName",
57
63
  "external_identifier": "externalIdentifier",
58
64
  "billing_details": "billingDetails",
@@ -0,0 +1,54 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import * as components from "../components/index.js";
8
+
9
+ export type ActivateGiftCardGlobals = {
10
+ merchantAccountId?: string | undefined;
11
+ };
12
+
13
+ export type ActivateGiftCardRequest = {
14
+ /**
15
+ * A unique key that identifies this request. If supported by the gift card service, the value will be forwarded to make the activation idempotent. We recommend using V4 UUIDs, or another random string with enough entropy to avoid collisions.
16
+ */
17
+ idempotencyKey?: string | null | undefined;
18
+ /**
19
+ * The ID of the merchant account to use for this request.
20
+ */
21
+ merchantAccountId?: string | null | undefined;
22
+ giftCardActivationCreate: components.GiftCardActivationCreate;
23
+ };
24
+
25
+ /** @internal */
26
+ export type ActivateGiftCardRequest$Outbound = {
27
+ "idempotency-key"?: string | null | undefined;
28
+ merchantAccountId?: string | null | undefined;
29
+ GiftCardActivationCreate: components.GiftCardActivationCreate$Outbound;
30
+ };
31
+
32
+ /** @internal */
33
+ export const ActivateGiftCardRequest$outboundSchema: z.ZodType<
34
+ ActivateGiftCardRequest$Outbound,
35
+ z.ZodTypeDef,
36
+ ActivateGiftCardRequest
37
+ > = z.object({
38
+ idempotencyKey: z.nullable(z.string()).optional(),
39
+ merchantAccountId: z.nullable(z.string()).optional(),
40
+ giftCardActivationCreate: components.GiftCardActivationCreate$outboundSchema,
41
+ }).transform((v) => {
42
+ return remap$(v, {
43
+ idempotencyKey: "idempotency-key",
44
+ giftCardActivationCreate: "GiftCardActivationCreate",
45
+ });
46
+ });
47
+
48
+ export function activateGiftCardRequestToJSON(
49
+ activateGiftCardRequest: ActivateGiftCardRequest,
50
+ ): string {
51
+ return JSON.stringify(
52
+ ActivateGiftCardRequest$outboundSchema.parse(activateGiftCardRequest),
53
+ );
54
+ }
@@ -2,6 +2,7 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ export * from "./activategiftcard.js";
5
6
  export * from "./addbuyer.js";
6
7
  export * from "./addbuyershippingdetails.js";
7
8
  export * from "./addpaymentlink.js";
@@ -66,6 +67,7 @@ export * from "./gettransactioncapture.js";
66
67
  export * from "./gettransactionrefund.js";
67
68
  export * from "./gettransactionrefundsettlement.js";
68
69
  export * from "./gettransactionsettlement.js";
70
+ export * from "./issuegiftcard.js";
69
71
  export * from "./listallreportexecutions.js";
70
72
  export * from "./listapikeypairs.js";
71
73
  export * from "./listauditlogs.js";
@@ -0,0 +1,54 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import * as components from "../components/index.js";
8
+
9
+ export type IssueGiftCardGlobals = {
10
+ merchantAccountId?: string | undefined;
11
+ };
12
+
13
+ export type IssueGiftCardRequest = {
14
+ /**
15
+ * A unique key forwarded to the gift card service to make the issuance idempotent.
16
+ */
17
+ idempotencyKey?: string | null | undefined;
18
+ /**
19
+ * The ID of the merchant account to use for this request.
20
+ */
21
+ merchantAccountId?: string | null | undefined;
22
+ giftCardIssuanceCreate: components.GiftCardIssuanceCreate;
23
+ };
24
+
25
+ /** @internal */
26
+ export type IssueGiftCardRequest$Outbound = {
27
+ "idempotency-key"?: string | null | undefined;
28
+ merchantAccountId?: string | null | undefined;
29
+ GiftCardIssuanceCreate: components.GiftCardIssuanceCreate$Outbound;
30
+ };
31
+
32
+ /** @internal */
33
+ export const IssueGiftCardRequest$outboundSchema: z.ZodType<
34
+ IssueGiftCardRequest$Outbound,
35
+ z.ZodTypeDef,
36
+ IssueGiftCardRequest
37
+ > = z.object({
38
+ idempotencyKey: z.nullable(z.string()).optional(),
39
+ merchantAccountId: z.nullable(z.string()).optional(),
40
+ giftCardIssuanceCreate: components.GiftCardIssuanceCreate$outboundSchema,
41
+ }).transform((v) => {
42
+ return remap$(v, {
43
+ idempotencyKey: "idempotency-key",
44
+ giftCardIssuanceCreate: "GiftCardIssuanceCreate",
45
+ });
46
+ });
47
+
48
+ export function issueGiftCardRequestToJSON(
49
+ issueGiftCardRequest: IssueGiftCardRequest,
50
+ ): string {
51
+ return JSON.stringify(
52
+ IssueGiftCardRequest$outboundSchema.parse(issueGiftCardRequest),
53
+ );
54
+ }
@@ -0,0 +1,31 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { giftCardsActivationsCreate } from "../funcs/giftCardsActivationsCreate.js";
6
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
7
+ import * as components from "../models/components/index.js";
8
+ import { unwrapAsync } from "../types/fp.js";
9
+
10
+ export class Activations extends ClientSDK {
11
+ /**
12
+ * Activate a gift card
13
+ *
14
+ * @remarks
15
+ * Activate a physical gift card through the primary gift card service.
16
+ */
17
+ async create(
18
+ giftCardActivationCreate: components.GiftCardActivationCreate,
19
+ idempotencyKey?: string | null | undefined,
20
+ merchantAccountId?: string | null | undefined,
21
+ options?: RequestOptions,
22
+ ): Promise<components.GiftCard> {
23
+ return unwrapAsync(giftCardsActivationsCreate(
24
+ this,
25
+ giftCardActivationCreate,
26
+ idempotencyKey,
27
+ merchantAccountId,
28
+ options,
29
+ ));
30
+ }
31
+ }
@@ -11,7 +11,9 @@ import * as components from "../models/components/index.js";
11
11
  import * as operations from "../models/operations/index.js";
12
12
  import { unwrapAsync } from "../types/fp.js";
13
13
  import { PageIterator, unwrapResultIterator } from "../types/operations.js";
14
+ import { Activations } from "./activations.js";
14
15
  import { Balances } from "./balances.js";
16
+ import { Issuances } from "./issuances.js";
15
17
 
16
18
  export class GiftCards extends ClientSDK {
17
19
  private _balances?: Balances;
@@ -19,6 +21,16 @@ export class GiftCards extends ClientSDK {
19
21
  return (this._balances ??= new Balances(this._options));
20
22
  }
21
23
 
24
+ private _activations?: Activations;
25
+ get activations(): Activations {
26
+ return (this._activations ??= new Activations(this._options));
27
+ }
28
+
29
+ private _issuances?: Issuances;
30
+ get issuances(): Issuances {
31
+ return (this._issuances ??= new Issuances(this._options));
32
+ }
33
+
22
34
  /**
23
35
  * Get gift card
24
36
  *
@@ -0,0 +1,31 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { giftCardsIssuancesCreate } from "../funcs/giftCardsIssuancesCreate.js";
6
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
7
+ import * as components from "../models/components/index.js";
8
+ import { unwrapAsync } from "../types/fp.js";
9
+
10
+ export class Issuances extends ClientSDK {
11
+ /**
12
+ * Issue a gift card
13
+ *
14
+ * @remarks
15
+ * Issue a new virtual gift card through the primary gift card service.
16
+ */
17
+ async create(
18
+ giftCardIssuanceCreate: components.GiftCardIssuanceCreate,
19
+ idempotencyKey?: string | null | undefined,
20
+ merchantAccountId?: string | null | undefined,
21
+ options?: RequestOptions,
22
+ ): Promise<components.GiftCardIssuance> {
23
+ return unwrapAsync(giftCardsIssuancesCreate(
24
+ this,
25
+ giftCardIssuanceCreate,
26
+ idempotencyKey,
27
+ merchantAccountId,
28
+ options,
29
+ ));
30
+ }
31
+ }