@xyo-network/rebilly-payment-card-authorization-plugin 3.0.3 → 3.0.4

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.
@@ -0,0 +1,38 @@
1
+ export interface ContactPhoneNumber {
2
+ label: string;
3
+ primary?: boolean;
4
+ value: string;
5
+ }
6
+ export interface ContactEmail {
7
+ label: string;
8
+ primary?: boolean;
9
+ value: string;
10
+ }
11
+ export interface RequestBillingAddress {
12
+ address?: string;
13
+ address2?: string | null;
14
+ city?: string;
15
+ country?: string;
16
+ dob?: string;
17
+ emails?: ContactEmail[];
18
+ firstName: string;
19
+ jobTitle?: string | null;
20
+ lastName: string;
21
+ organization?: string | null;
22
+ phoneNumbers?: ContactPhoneNumber[];
23
+ postalCode?: string;
24
+ region?: string;
25
+ }
26
+ export interface RequestPaymentCardInstrument {
27
+ cvv: string;
28
+ expMonth: number;
29
+ expYear: number;
30
+ pan: string;
31
+ }
32
+ export type PaymentMethod = 'payment-card';
33
+ export interface CreatePaymentTokenRequest {
34
+ billingAddress: RequestBillingAddress;
35
+ method: PaymentMethod;
36
+ paymentInstrument: RequestPaymentCardInstrument;
37
+ }
38
+ //# sourceMappingURL=Request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Request.d.ts","sourceRoot":"","sources":["../../../../src/Api/PaymentCardToken/Request.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IAKjC,KAAK,EAAE,MAAM,CAAA;IAIb,OAAO,CAAC,EAAE,OAAO,CAAA;IAKjB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,YAAY;IAK3B,KAAK,EAAE,MAAM,CAAA;IAIb,OAAO,CAAC,EAAE,OAAO,CAAA;IAKjB,KAAK,EAAE,MAAM,CAAA;CACd;AAKD,MAAM,WAAW,qBAAqB;IAEpC,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAExB,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ,MAAM,CAAC,EAAE,YAAY,EAAE,CAAA;IAEvB,SAAS,EAAE,MAAM,CAAA;IAEjB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAExB,QAAQ,EAAE,MAAM,CAAA;IAEhB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAE5B,YAAY,CAAC,EAAE,kBAAkB,EAAE,CAAA;IAEnC,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,4BAA4B;IAI3C,GAAG,EAAE,MAAM,CAAA;IAIX,QAAQ,EAAE,MAAM,CAAA;IAIhB,OAAO,EAAE,MAAM,CAAA;IAIf,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,MAAM,aAAa,GA8FvB,cAAc,CAAA;AAsDhB,MAAM,WAAW,yBAAyB;IACxC,cAAc,EAAE,qBAAqB,CAAA;IACrC,MAAM,EAAE,aAAa,CAAA;IACrB,iBAAiB,EAAE,4BAA4B,CAAA;CAChD"}
@@ -0,0 +1,36 @@
1
+ import type { PaymentMethod, RequestBillingAddress } from './Request.ts';
2
+ export interface ResponseBillingAddress extends RequestBillingAddress {
3
+ hash?: string | null;
4
+ }
5
+ export interface CreateTokenResponse {
6
+ _links: Link[];
7
+ billingAddress: ResponseBillingAddress;
8
+ brand: string;
9
+ browserData: unknown | null;
10
+ createdTime: string;
11
+ expirationTime: string | null;
12
+ expiredTime: string | null;
13
+ fingerprint: string | null;
14
+ id: string;
15
+ isUsed: boolean;
16
+ last4: string;
17
+ method: PaymentMethod;
18
+ paymentInstrument: ResponsePaymentCardInstrument;
19
+ riskMetadata: unknown | null;
20
+ updatedTime: string;
21
+ usageTime: string | null;
22
+ used: boolean;
23
+ usedTime: string | null;
24
+ }
25
+ export interface ResponsePaymentCardInstrument {
26
+ bin: string;
27
+ brand: string;
28
+ expMonth: number;
29
+ expYear: number;
30
+ last4: string;
31
+ }
32
+ export interface Link {
33
+ href: string;
34
+ rel: string;
35
+ }
36
+ //# sourceMappingURL=Response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Response.d.ts","sourceRoot":"","sources":["../../../../src/Api/PaymentCardToken/Response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAExE,MAAM,WAAW,sBAAuB,SAAQ,qBAAqB;IACnE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB;AAKD,MAAM,WAAW,mBAAmB;IAElC,MAAM,EAAE,IAAI,EAAE,CAAA;IAEd,cAAc,EAAE,sBAAsB,CAAA;IAEtC,KAAK,EAAE,MAAM,CAAA;IAEb,WAAW,EAAE,OAAO,GAAG,IAAI,CAAA;IAE3B,WAAW,EAAE,MAAM,CAAA;IAEnB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAE7B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAE1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAE1B,EAAE,EAAE,MAAM,CAAA;IAEV,MAAM,EAAE,OAAO,CAAA;IAEf,KAAK,EAAE,MAAM,CAAA;IAEb,MAAM,EAAE,aAAa,CAAA;IAErB,iBAAiB,EAAE,6BAA6B,CAAA;IAEhD,YAAY,EAAE,OAAO,GAAG,IAAI,CAAA;IAE5B,WAAW,EAAE,MAAM,CAAA;IAEnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IAExB,IAAI,EAAE,OAAO,CAAA;IAEb,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB;AAKD,MAAM,WAAW,6BAA6B;IAE5C,GAAG,EAAE,MAAM,CAAA;IAEX,KAAK,EAAE,MAAM,CAAA;IAEb,QAAQ,EAAE,MAAM,CAAA;IAEhB,OAAO,EAAE,MAAM,CAAA;IAEf,KAAK,EAAE,MAAM,CAAA;CACd;AAKD,MAAM,WAAW,IAAI;IAEnB,IAAI,EAAE,MAAM,CAAA;IAEZ,GAAG,EAAE,MAAM,CAAA;CACZ"}
@@ -0,0 +1,3 @@
1
+ export * from './Request.ts';
2
+ export * from './Response.ts';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Api/PaymentCardToken/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './PaymentCardToken/index.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Api/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA"}
@@ -0,0 +1,8 @@
1
+ import type { RebillyApiDomainSettings } from '@xyo-network/rebilly-payment-payload-plugin';
2
+ import type { SentinelConfig } from '@xyo-network/sentinel-model';
3
+ export declare const RebillyPaymentCardAuthorizationSentinelConfigSchema = "network.xyo.sentinel.payments.payment.instrument.card.authorization.rebilly.config";
4
+ export type RebillyPaymentCardAuthorizationSentinelConfigSchema = typeof RebillyPaymentCardAuthorizationSentinelConfigSchema;
5
+ export type RebillyPaymentCardAuthorizationSentinelConfig = SentinelConfig<{
6
+ schema: RebillyPaymentCardAuthorizationSentinelConfigSchema;
7
+ }> & Partial<RebillyApiDomainSettings>;
8
+ //# sourceMappingURL=Config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAA;AAC3F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAIjE,eAAO,MAAM,mDAAmD,uFAA4D,CAAA;AAC5H,MAAM,MAAM,mDAAmD,GAAG,OAAO,mDAAmD,CAAA;AAK5H,MAAM,MAAM,6CAA6C,GAAG,cAAc,CAAC;IAIzE,MAAM,EAAE,mDAAmD,CAAA;CAC5D,CAAC,GACF,OAAO,CAAC,wBAAwB,CAAC,CAAA"}
@@ -0,0 +1,7 @@
1
+ import type { AnyConfigSchema } from '@xyo-network/module-model';
2
+ import type { RebillyOrganizationSettings, RebillyPublishableApiSettings } from '@xyo-network/rebilly-payment-payload-plugin';
3
+ import type { SentinelParams } from '@xyo-network/sentinel-model';
4
+ import type { RebillyPaymentCardAuthorizationSentinelConfig } from './Config.ts';
5
+ export type RebillyPaymentCardAuthorizationParams = Partial<RebillyPublishableApiSettings & RebillyOrganizationSettings>;
6
+ export type RebillyPaymentCardAuthorizationSentinelParams<TConfig extends AnyConfigSchema<RebillyPaymentCardAuthorizationSentinelConfig> = AnyConfigSchema<RebillyPaymentCardAuthorizationSentinelConfig>, TParams extends RebillyPaymentCardAuthorizationParams = RebillyPaymentCardAuthorizationParams> = SentinelParams<TConfig, TParams>;
7
+ //# sourceMappingURL=Params.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Params.d.ts","sourceRoot":"","sources":["../../src/Params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,KAAK,EAAE,2BAA2B,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAA;AAC7H,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAEjE,OAAO,KAAK,EAAE,6CAA6C,EAAE,MAAM,aAAa,CAAA;AAEhF,MAAM,MAAM,qCAAqC,GAAG,OAAO,CAAC,6BAA6B,GAAG,2BAA2B,CAAC,CAAA;AAExH,MAAM,MAAM,6CAA6C,CACvD,OAAO,SAAS,eAAe,CAAC,6CAA6C,CAAC,GAAG,eAAe,CAAC,6CAA6C,CAAC,EAC/I,OAAO,SAAS,qCAAqC,GAAG,qCAAqC,IAC3F,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ export declare const RebillyPaymentCardAuthorizationSentinelSchema = "network.xyo.sentinel.payments.payment.instrument.card.authorization.rebilly";
2
+ export type RebillyPaymentCardAuthorizationSentinelSchema = typeof RebillyPaymentCardAuthorizationSentinelSchema;
3
+ //# sourceMappingURL=Schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../src/Schema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6CAA6C,gFAAgF,CAAA;AAC1I,MAAM,MAAM,6CAA6C,GAAG,OAAO,6CAA6C,CAAA"}
@@ -0,0 +1,24 @@
1
+ import type { Payload } from '@xyo-network/payload-model';
2
+ import { AbstractSentinel } from '@xyo-network/sentinel-abstract';
3
+ import type { SentinelInstance, SentinelModuleEventData } from '@xyo-network/sentinel-model';
4
+ import type { AxiosRequestConfig } from 'axios';
5
+ import type { RebillyPaymentCardAuthorizationSentinelParams } from './Params.ts';
6
+ export declare class RebillyPaymentCardAuthorizationSentinel<TParams extends RebillyPaymentCardAuthorizationSentinelParams = RebillyPaymentCardAuthorizationSentinelParams, TEventData extends SentinelModuleEventData<SentinelInstance<TParams>> = SentinelModuleEventData<SentinelInstance<TParams>>> extends AbstractSentinel<TParams, TEventData> {
7
+ static configSchemas: string[];
8
+ static defaultConfigSchema: string;
9
+ protected _apiRoot: string | undefined;
10
+ protected _domain: string | undefined;
11
+ protected _headers: AxiosRequestConfig['headers'] | undefined;
12
+ protected _organizationId: string | undefined;
13
+ protected _publishableApiKey: string | undefined;
14
+ protected _tokenEndpoint: string | undefined;
15
+ protected get apiRoot(): string;
16
+ protected get domain(): string;
17
+ protected get headers(): AxiosRequestConfig['headers'];
18
+ protected get isSandboxEnvironment(): boolean;
19
+ protected get organizationId(): string;
20
+ protected get publishableApiKey(): string;
21
+ protected get tokenEndpoint(): string;
22
+ reportHandler(payloads?: Payload[]): Promise<Payload[]>;
23
+ }
24
+ //# sourceMappingURL=Sentinel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sentinel.d.ts","sourceRoot":"","sources":["../../src/Sentinel.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAe,MAAM,4BAA4B,CAAA;AAItE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAC5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAK/C,OAAO,KAAK,EAAE,6CAA6C,EAAE,MAAM,aAAa,CAAA;AAShF,qBAAa,uCAAuC,CAClD,OAAO,SAAS,6CAA6C,GAAG,6CAA6C,EAC7G,UAAU,SAAS,uBAAuB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,GAAG,uBAAuB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAC1H,SAAQ,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7C,OAAgB,aAAa,WAAwD;IACrF,OAAgB,mBAAmB,SAAsD;IAEzF,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAY;IAClD,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAY;IACjD,SAAS,CAAC,QAAQ,EAAE,kBAAkB,CAAC,SAAS,CAAC,GAAG,SAAS,CAAY;IACzE,SAAS,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAY;IACzD,SAAS,CAAC,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAY;IAC5D,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAY;IAKxD,SAAS,KAAK,OAAO,WAGpB;IAKD,SAAS,KAAK,MAAM,WAGnB;IAKD,SAAS,KAAK,OAAO,IAAI,kBAAkB,CAAC,SAAS,CAAC,CAGrD;IAKD,SAAS,KAAK,oBAAoB,IAAI,OAAO,CAE5C;IAKD,SAAS,KAAK,cAAc,WAO3B;IAKD,SAAS,KAAK,iBAAiB,IAAI,MAAM,CAIxC;IAKD,SAAS,KAAK,aAAa,WAG1B;IAEc,aAAa,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAwBvE"}
@@ -1,39 +1,5 @@
1
- import { RebillyApiDomainSettings, RebillyPublishableApiSettings, RebillyOrganizationSettings } from '@xyo-network/rebilly-payment-payload-plugin';
2
- import { SentinelConfig, SentinelParams, SentinelModuleEventData, SentinelInstance } from '@xyo-network/sentinel-model';
3
- import { AnyConfigSchema } from '@xyo-network/module-model';
4
- import { Payload } from '@xyo-network/payload-model';
5
- import { AbstractSentinel } from '@xyo-network/sentinel-abstract';
6
- import { AxiosRequestConfig } from 'axios';
7
-
8
- declare const RebillyPaymentCardAuthorizationSentinelConfigSchema = "network.xyo.sentinel.payments.payment.instrument.card.authorization.rebilly.config";
9
- type RebillyPaymentCardAuthorizationSentinelConfigSchema = typeof RebillyPaymentCardAuthorizationSentinelConfigSchema;
10
- type RebillyPaymentCardAuthorizationSentinelConfig = SentinelConfig<{
11
- schema: RebillyPaymentCardAuthorizationSentinelConfigSchema;
12
- }> & Partial<RebillyApiDomainSettings>;
13
-
14
- type RebillyPaymentCardAuthorizationParams = Partial<RebillyPublishableApiSettings & RebillyOrganizationSettings>;
15
- type RebillyPaymentCardAuthorizationSentinelParams<TConfig extends AnyConfigSchema<RebillyPaymentCardAuthorizationSentinelConfig> = AnyConfigSchema<RebillyPaymentCardAuthorizationSentinelConfig>, TParams extends RebillyPaymentCardAuthorizationParams = RebillyPaymentCardAuthorizationParams> = SentinelParams<TConfig, TParams>;
16
-
17
- declare const RebillyPaymentCardAuthorizationSentinelSchema = "network.xyo.sentinel.payments.payment.instrument.card.authorization.rebilly";
18
- type RebillyPaymentCardAuthorizationSentinelSchema = typeof RebillyPaymentCardAuthorizationSentinelSchema;
19
-
20
- declare class RebillyPaymentCardAuthorizationSentinel<TParams extends RebillyPaymentCardAuthorizationSentinelParams = RebillyPaymentCardAuthorizationSentinelParams, TEventData extends SentinelModuleEventData<SentinelInstance<TParams>> = SentinelModuleEventData<SentinelInstance<TParams>>> extends AbstractSentinel<TParams, TEventData> {
21
- static configSchemas: string[];
22
- static defaultConfigSchema: string;
23
- protected _apiRoot: string | undefined;
24
- protected _domain: string | undefined;
25
- protected _headers: AxiosRequestConfig['headers'] | undefined;
26
- protected _organizationId: string | undefined;
27
- protected _publishableApiKey: string | undefined;
28
- protected _tokenEndpoint: string | undefined;
29
- protected get apiRoot(): string;
30
- protected get domain(): string;
31
- protected get headers(): AxiosRequestConfig['headers'];
32
- protected get isSandboxEnvironment(): boolean;
33
- protected get organizationId(): string;
34
- protected get publishableApiKey(): string;
35
- protected get tokenEndpoint(): string;
36
- reportHandler(payloads?: Payload[]): Promise<Payload[]>;
37
- }
38
-
39
- export { type RebillyPaymentCardAuthorizationParams, RebillyPaymentCardAuthorizationSentinel, type RebillyPaymentCardAuthorizationSentinelConfig, RebillyPaymentCardAuthorizationSentinelConfigSchema, type RebillyPaymentCardAuthorizationSentinelParams, RebillyPaymentCardAuthorizationSentinelSchema };
1
+ export * from './Config.ts';
2
+ export * from './Params.ts';
3
+ export * from './Schema.ts';
4
+ export * from './Sentinel.ts';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA"}
@@ -15,12 +15,22 @@ import { HttpStatusCode } from "axios";
15
15
 
16
16
  // src/util/toTokenRequest.ts
17
17
  var toTokenRequest = (paymentCard, billingAddress) => {
18
- const { cvv, expMonth, expYear, cardNumber } = paymentCard;
18
+ const {
19
+ cvv,
20
+ expMonth,
21
+ expYear,
22
+ cardNumber
23
+ } = paymentCard;
19
24
  const { schema: _, ...fields } = billingAddress;
20
25
  return {
21
26
  billingAddress: { ...fields },
22
27
  method: "payment-card",
23
- paymentInstrument: { cvv, expMonth, expYear, pan: cardNumber }
28
+ paymentInstrument: {
29
+ cvv,
30
+ expMonth,
31
+ expYear,
32
+ pan: cardNumber
33
+ }
24
34
  };
25
35
  };
26
36
 
@@ -107,7 +117,11 @@ var RebillyPaymentCardAuthorizationSentinel = class extends AbstractSentinel {
107
117
  assertEx(response.status === HttpStatusCode.Created, () => `Failed to tokenize payment card: ${response.status}`);
108
118
  const { id } = response.data;
109
119
  const sources = await PayloadBuilder.dataHashes([paymentCard, billingAddress]);
110
- results.push({ id, schema: RebillyPaymentAuthorizationTokenSchema, sources });
120
+ results.push({
121
+ id,
122
+ schema: RebillyPaymentAuthorizationTokenSchema,
123
+ sources
124
+ });
111
125
  } catch (error) {
112
126
  this.logger?.error?.(`${moduleName}: Error creating payment token: ${error}`);
113
127
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Schema.ts","../../src/Config.ts","../../src/Sentinel.ts","../../src/util/toTokenRequest.ts"],"sourcesContent":["export const RebillyPaymentCardAuthorizationSentinelSchema = 'network.xyo.sentinel.payments.payment.instrument.card.authorization.rebilly'\nexport type RebillyPaymentCardAuthorizationSentinelSchema = typeof RebillyPaymentCardAuthorizationSentinelSchema\n","import type { RebillyApiDomainSettings } from '@xyo-network/rebilly-payment-payload-plugin'\nimport type { SentinelConfig } from '@xyo-network/sentinel-model'\n\nimport { RebillyPaymentCardAuthorizationSentinelSchema } from './Schema.ts'\n\nexport const RebillyPaymentCardAuthorizationSentinelConfigSchema = `${RebillyPaymentCardAuthorizationSentinelSchema}.config`\nexport type RebillyPaymentCardAuthorizationSentinelConfigSchema = typeof RebillyPaymentCardAuthorizationSentinelConfigSchema\n\n/*\n * The Rebilly Payment Card Authorization Sentinel Config\n */\nexport type RebillyPaymentCardAuthorizationSentinelConfig = SentinelConfig<{\n /**\n * The config schema\n */\n schema: RebillyPaymentCardAuthorizationSentinelConfigSchema\n}> &\nPartial<RebillyApiDomainSettings>\n","import { assertEx } from '@xylabs/assert'\nimport { AxiosJson } from '@xylabs/axios'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport { isBillingAddress, isPaymentCard } from '@xyo-network/payment-payload-plugins'\nimport type { RebillyPaymentAuthorizationToken } from '@xyo-network/rebilly-payment-payload-plugin'\nimport { RebillyPaymentAuthorizationTokenSchema } from '@xyo-network/rebilly-payment-payload-plugin'\nimport { AbstractSentinel } from '@xyo-network/sentinel-abstract'\nimport type { SentinelInstance, SentinelModuleEventData } from '@xyo-network/sentinel-model'\nimport type { AxiosRequestConfig } from 'axios'\nimport { HttpStatusCode } from 'axios'\n\nimport type { CreateTokenResponse } from './Api/index.ts'\nimport { RebillyPaymentCardAuthorizationSentinelConfigSchema } from './Config.ts'\nimport type { RebillyPaymentCardAuthorizationSentinelParams } from './Params.ts'\nimport { toTokenRequest } from './util/index.ts'\n\nconst removePrefix = (str: string, prefix: string) => {\n const regex = new RegExp(`^${prefix}`)\n return str.replace(regex, '')\n}\n\nconst moduleName = 'RebillyPaymentCardAuthorizationSentinel'\nexport class RebillyPaymentCardAuthorizationSentinel<\n TParams extends RebillyPaymentCardAuthorizationSentinelParams = RebillyPaymentCardAuthorizationSentinelParams,\n TEventData extends SentinelModuleEventData<SentinelInstance<TParams>> = SentinelModuleEventData<SentinelInstance<TParams>>,\n> extends AbstractSentinel<TParams, TEventData> {\n static override configSchemas = [RebillyPaymentCardAuthorizationSentinelConfigSchema]\n static override defaultConfigSchema = RebillyPaymentCardAuthorizationSentinelConfigSchema\n\n protected _apiRoot: string | undefined = undefined\n protected _domain: string | undefined = undefined\n protected _headers: AxiosRequestConfig['headers'] | undefined = undefined\n protected _organizationId: string | undefined = undefined\n protected _publishableApiKey: string | undefined = undefined\n protected _tokenEndpoint: string | undefined = undefined\n\n /**\n * The Rebilly Organization API root endpoint\n */\n protected get apiRoot() {\n if (!this._apiRoot) this._apiRoot = `${this.domain}/organizations/${this.organizationId}`\n return this._apiRoot\n }\n\n /**\n * The Rebilly domain\n */\n protected get domain() {\n if (!this._domain) this._domain = assertEx(this.params.domain ?? this.config.domain, () => `${moduleName}: Missing domain in params/config`)\n return this._domain\n }\n\n /**\n * The headers to be included in the request for each request\n */\n protected get headers(): AxiosRequestConfig['headers'] {\n if (!this._headers) this._headers = { Authorization: this.publishableApiKey }\n return this._headers\n }\n\n /**\n * True if the environment is sandbox (testing), false otherwise\n */\n protected get isSandboxEnvironment(): boolean {\n return this.domain.includes('sandbox')\n }\n\n /**\n * The Rebilly organization ID\n */\n protected get organizationId() {\n if (!this._organizationId)\n this._organizationId = removePrefix(\n assertEx(this.params.organizationId, () => `${moduleName}: Missing organizationId in params`),\n 'org_',\n )\n return this._organizationId\n }\n\n /**\n * The Rebilly Publishable API key\n */\n protected get publishableApiKey(): string {\n if (!this._publishableApiKey)\n this._publishableApiKey = assertEx(this.params.publishableApiKey, () => `${moduleName}: Missing publishableApiKey in params`)\n return this._publishableApiKey\n }\n\n /**\n * The Rebilly Organization token creation endpoint\n */\n protected get tokenEndpoint() {\n if (!this._tokenEndpoint) this._tokenEndpoint = `${this.apiRoot}/tokens`\n return this._tokenEndpoint\n }\n\n override async reportHandler(payloads?: Payload[]): Promise<Payload[]> {\n await this.started('throw')\n const results: WithSources<RebillyPaymentAuthorizationToken>[] = []\n // Verify necessary inputs and if nothing meets our criteria, bail early\n if (!payloads || payloads.length === 0) return results\n const paymentCard = payloads?.find(isPaymentCard)\n if (!paymentCard) return results\n const billingAddress = payloads?.find(isBillingAddress)\n if (!billingAddress) return results\n const axios = new AxiosJson({ headers: this.headers })\n try {\n const data = toTokenRequest(paymentCard, billingAddress)\n const response = await axios.post<CreateTokenResponse>(this.tokenEndpoint, data)\n assertEx(response.status === HttpStatusCode.Created, () => `Failed to tokenize payment card: ${response.status}`)\n const { id } = response.data\n const sources = await PayloadBuilder.dataHashes([paymentCard, billingAddress])\n results.push({ id, schema: RebillyPaymentAuthorizationTokenSchema, sources })\n } catch (error) {\n this.logger?.error?.(`${moduleName}: Error creating payment token: ${error}`)\n }\n return results\n }\n}\n","import type { BillingAddress, PaymentCard } from '@xyo-network/payment-payload-plugins'\n\nimport type { CreatePaymentTokenRequest } from '../Api/index.ts'\n\n/**\n * Converts a payment card and billing address to a token request\n * @param paymentCard The payment card\n * @param billingAddress The billing address\n * @returns The token request\n */\nexport const toTokenRequest = (paymentCard: PaymentCard, billingAddress: BillingAddress): CreatePaymentTokenRequest => {\n const { cvv, expMonth, expYear, cardNumber } = paymentCard\n // NOTE: We are destructuring all but the schema and passing it along to the billingAddress. This\n // is to allow for missing fields to be omitted rather than set to undefined and for any new fields\n // that might be added later to be automatically picked up on. It is fine to pass this along since\n // the user is supplying this data about themselves.\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { schema: _, ...fields } = billingAddress\n return {\n billingAddress: { ...fields },\n method: 'payment-card',\n paymentInstrument: { cvv, expMonth, expYear, pan: cardNumber },\n }\n}\n"],"mappings":";AAAO,IAAM,gDAAgD;;;ACKtD,IAAM,sDAAsD,GAAG,6CAA6C;;;ACLnH,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAE/B,SAAS,kBAAkB,qBAAqB;AAEhD,SAAS,8CAA8C;AACvD,SAAS,wBAAwB;AAGjC,SAAS,sBAAsB;;;ACAxB,IAAM,iBAAiB,CAAC,aAA0B,mBAA8D;AACrH,QAAM,EAAE,KAAK,UAAU,SAAS,WAAW,IAAI;AAM/C,QAAM,EAAE,QAAQ,GAAG,GAAG,OAAO,IAAI;AACjC,SAAO;AAAA,IACL,gBAAgB,EAAE,GAAG,OAAO;AAAA,IAC5B,QAAQ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;AAAA;AAAA;AAAA;AAAA,EAKA,IAAc,oBAA4B;AACxC,QAAI,CAAC,KAAK;AACR,WAAK,qBAAqB,SAAS,KAAK,OAAO,mBAAmB,MAAM,GAAG,UAAU,uCAAuC;AAC9H,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKA,IAAc,gBAAgB;AAC5B,QAAI,CAAC,KAAK,eAAgB,MAAK,iBAAiB,GAAG,KAAK,OAAO;AAC/D,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAe,cAAc,UAA0C;AACrE,UAAM,KAAK,QAAQ,OAAO;AAC1B,UAAM,UAA2D,CAAC;AAElE,QAAI,CAAC,YAAY,SAAS,WAAW,EAAG,QAAO;AAC/C,UAAM,cAAc,UAAU,KAAK,aAAa;AAChD,QAAI,CAAC,YAAa,QAAO;AACzB,UAAM,iBAAiB,UAAU,KAAK,gBAAgB;AACtD,QAAI,CAAC,eAAgB,QAAO;AAC5B,UAAM,QAAQ,IAAI,UAAU,EAAE,SAAS,KAAK,QAAQ,CAAC;AACrD,QAAI;AACF,YAAM,OAAO,eAAe,aAAa,cAAc;AACvD,YAAM,WAAW,MAAM,MAAM,KAA0B,KAAK,eAAe,IAAI;AAC/E,eAAS,SAAS,WAAW,eAAe,SAAS,MAAM,oCAAoC,SAAS,MAAM,EAAE;AAChH,YAAM,EAAE,GAAG,IAAI,SAAS;AACxB,YAAM,UAAU,MAAM,eAAe,WAAW,CAAC,aAAa,cAAc,CAAC;AAC7E,cAAQ,KAAK,EAAE,IAAI,QAAQ,wCAAwC,QAAQ,CAAC;AAAA,IAC9E,SAAS,OAAO;AACd,WAAK,QAAQ,QAAQ,GAAG,UAAU,mCAAmC,KAAK,EAAE;AAAA,IAC9E;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/Schema.ts","../../src/Config.ts","../../src/Sentinel.ts","../../src/util/toTokenRequest.ts"],"sourcesContent":["export const RebillyPaymentCardAuthorizationSentinelSchema = 'network.xyo.sentinel.payments.payment.instrument.card.authorization.rebilly'\nexport type RebillyPaymentCardAuthorizationSentinelSchema = typeof RebillyPaymentCardAuthorizationSentinelSchema\n","import type { RebillyApiDomainSettings } from '@xyo-network/rebilly-payment-payload-plugin'\nimport type { SentinelConfig } from '@xyo-network/sentinel-model'\n\nimport { RebillyPaymentCardAuthorizationSentinelSchema } from './Schema.ts'\n\nexport const RebillyPaymentCardAuthorizationSentinelConfigSchema = `${RebillyPaymentCardAuthorizationSentinelSchema}.config`\nexport type RebillyPaymentCardAuthorizationSentinelConfigSchema = typeof RebillyPaymentCardAuthorizationSentinelConfigSchema\n\n/*\n * The Rebilly Payment Card Authorization Sentinel Config\n */\nexport type RebillyPaymentCardAuthorizationSentinelConfig = SentinelConfig<{\n /**\n * The config schema\n */\n schema: RebillyPaymentCardAuthorizationSentinelConfigSchema\n}> &\nPartial<RebillyApiDomainSettings>\n","import { assertEx } from '@xylabs/assert'\nimport { AxiosJson } from '@xylabs/axios'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport { isBillingAddress, isPaymentCard } from '@xyo-network/payment-payload-plugins'\nimport type { RebillyPaymentAuthorizationToken } from '@xyo-network/rebilly-payment-payload-plugin'\nimport { RebillyPaymentAuthorizationTokenSchema } from '@xyo-network/rebilly-payment-payload-plugin'\nimport { AbstractSentinel } from '@xyo-network/sentinel-abstract'\nimport type { SentinelInstance, SentinelModuleEventData } from '@xyo-network/sentinel-model'\nimport type { AxiosRequestConfig } from 'axios'\nimport { HttpStatusCode } from 'axios'\n\nimport type { CreateTokenResponse } from './Api/index.ts'\nimport { RebillyPaymentCardAuthorizationSentinelConfigSchema } from './Config.ts'\nimport type { RebillyPaymentCardAuthorizationSentinelParams } from './Params.ts'\nimport { toTokenRequest } from './util/index.ts'\n\nconst removePrefix = (str: string, prefix: string) => {\n const regex = new RegExp(`^${prefix}`)\n return str.replace(regex, '')\n}\n\nconst moduleName = 'RebillyPaymentCardAuthorizationSentinel'\nexport class RebillyPaymentCardAuthorizationSentinel<\n TParams extends RebillyPaymentCardAuthorizationSentinelParams = RebillyPaymentCardAuthorizationSentinelParams,\n TEventData extends SentinelModuleEventData<SentinelInstance<TParams>> = SentinelModuleEventData<SentinelInstance<TParams>>,\n> extends AbstractSentinel<TParams, TEventData> {\n static override configSchemas = [RebillyPaymentCardAuthorizationSentinelConfigSchema]\n static override defaultConfigSchema = RebillyPaymentCardAuthorizationSentinelConfigSchema\n\n protected _apiRoot: string | undefined = undefined\n protected _domain: string | undefined = undefined\n protected _headers: AxiosRequestConfig['headers'] | undefined = undefined\n protected _organizationId: string | undefined = undefined\n protected _publishableApiKey: string | undefined = undefined\n protected _tokenEndpoint: string | undefined = undefined\n\n /**\n * The Rebilly Organization API root endpoint\n */\n protected get apiRoot() {\n if (!this._apiRoot) this._apiRoot = `${this.domain}/organizations/${this.organizationId}`\n return this._apiRoot\n }\n\n /**\n * The Rebilly domain\n */\n protected get domain() {\n if (!this._domain) this._domain = assertEx(this.params.domain ?? this.config.domain, () => `${moduleName}: Missing domain in params/config`)\n return this._domain\n }\n\n /**\n * The headers to be included in the request for each request\n */\n protected get headers(): AxiosRequestConfig['headers'] {\n if (!this._headers) this._headers = { Authorization: this.publishableApiKey }\n return this._headers\n }\n\n /**\n * True if the environment is sandbox (testing), false otherwise\n */\n protected get isSandboxEnvironment(): boolean {\n return this.domain.includes('sandbox')\n }\n\n /**\n * The Rebilly organization ID\n */\n protected get organizationId() {\n if (!this._organizationId)\n this._organizationId = removePrefix(\n assertEx(this.params.organizationId, () => `${moduleName}: Missing organizationId in params`),\n 'org_',\n )\n return this._organizationId\n }\n\n /**\n * The Rebilly Publishable API key\n */\n protected get publishableApiKey(): string {\n if (!this._publishableApiKey)\n this._publishableApiKey = assertEx(this.params.publishableApiKey, () => `${moduleName}: Missing publishableApiKey in params`)\n return this._publishableApiKey\n }\n\n /**\n * The Rebilly Organization token creation endpoint\n */\n protected get tokenEndpoint() {\n if (!this._tokenEndpoint) this._tokenEndpoint = `${this.apiRoot}/tokens`\n return this._tokenEndpoint\n }\n\n override async reportHandler(payloads?: Payload[]): Promise<Payload[]> {\n await this.started('throw')\n const results: WithSources<RebillyPaymentAuthorizationToken>[] = []\n // Verify necessary inputs and if nothing meets our criteria, bail early\n if (!payloads || payloads.length === 0) return results\n const paymentCard = payloads?.find(isPaymentCard)\n if (!paymentCard) return results\n const billingAddress = payloads?.find(isBillingAddress)\n if (!billingAddress) return results\n const axios = new AxiosJson({ headers: this.headers })\n try {\n const data = toTokenRequest(paymentCard, billingAddress)\n const response = await axios.post<CreateTokenResponse>(this.tokenEndpoint, data)\n assertEx(response.status === HttpStatusCode.Created, () => `Failed to tokenize payment card: ${response.status}`)\n const { id } = response.data\n const sources = await PayloadBuilder.dataHashes([paymentCard, billingAddress])\n results.push({\n id, schema: RebillyPaymentAuthorizationTokenSchema, sources,\n })\n } catch (error) {\n this.logger?.error?.(`${moduleName}: Error creating payment token: ${error}`)\n }\n return results\n }\n}\n","import type { BillingAddress, PaymentCard } from '@xyo-network/payment-payload-plugins'\n\nimport type { CreatePaymentTokenRequest } from '../Api/index.ts'\n\n/**\n * Converts a payment card and billing address to a token request\n * @param paymentCard The payment card\n * @param billingAddress The billing address\n * @returns The token request\n */\nexport const toTokenRequest = (paymentCard: PaymentCard, billingAddress: BillingAddress): CreatePaymentTokenRequest => {\n const {\n cvv, expMonth, expYear, cardNumber,\n } = paymentCard\n // NOTE: We are destructuring all but the schema and passing it along to the billingAddress. This\n // is to allow for missing fields to be omitted rather than set to undefined and for any new fields\n // that might be added later to be automatically picked up on. It is fine to pass this along since\n // the user is supplying this data about themselves.\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { schema: _, ...fields } = billingAddress\n return {\n billingAddress: { ...fields },\n method: 'payment-card',\n paymentInstrument: {\n cvv, expMonth, expYear, pan: cardNumber,\n },\n }\n}\n"],"mappings":";AAAO,IAAM,gDAAgD;;;ACKt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AAS,WAAW,eAAe,SAAS,MAAM,oCAAoC,SAAS,MAAM,EAAE;AAChH,YAAM,EAAE,GAAG,IAAI,SAAS;AACxB,YAAM,UAAU,MAAM,eAAe,WAAW,CAAC,aAAa,cAAc,CAAC;AAC7E,cAAQ,KAAK;AAAA,QACX;AAAA,QAAI,QAAQ;AAAA,QAAwC;AAAA,MACtD,CAAC;AAAA,IACH,SAAS,OAAO;AACd,WAAK,QAAQ,QAAQ,GAAG,UAAU,mCAAmC,KAAK,EAAE;AAAA,IAC9E;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -0,0 +1,2 @@
1
+ export * from './toTokenRequest.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { BillingAddress, PaymentCard } from '@xyo-network/payment-payload-plugins';
2
+ import type { CreatePaymentTokenRequest } from '../Api/index.ts';
3
+ export declare const toTokenRequest: (paymentCard: PaymentCard, billingAddress: BillingAddress) => CreatePaymentTokenRequest;
4
+ //# sourceMappingURL=toTokenRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toTokenRequest.d.ts","sourceRoot":"","sources":["../../../src/util/toTokenRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAA;AAEvF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAA;AAQhE,eAAO,MAAM,cAAc,gBAAiB,WAAW,kBAAkB,cAAc,KAAG,yBAiBzF,CAAA"}
package/package.json CHANGED
@@ -1,36 +1,24 @@
1
1
  {
2
2
  "name": "@xyo-network/rebilly-payment-card-authorization-plugin",
3
- "author": {
4
- "email": "support@xyo.network",
5
- "name": "XYO Development Team",
6
- "url": "https://xyo.network"
7
- },
3
+ "version": "3.0.4",
4
+ "description": "Typescript/Javascript Plugins for XYO Platform",
5
+ "homepage": "https://xyo.network",
8
6
  "bugs": {
9
- "email": "support@xyo.network",
10
- "url": "git+https://github.com/XYOracleNetwork/plugins/issues"
7
+ "url": "git+https://github.com/XYOracleNetwork/plugins/issues",
8
+ "email": "support@xyo.network"
11
9
  },
12
- "dependencies": {
13
- "@xylabs/assert": "^4.0.2",
14
- "@xylabs/axios": "^4.0.2",
15
- "@xyo-network/module-model": "^3.0.3",
16
- "@xyo-network/payload-builder": "^3.0.3",
17
- "@xyo-network/payload-model": "^3.0.3",
18
- "@xyo-network/payment-payload-plugins": "^3.0.3",
19
- "@xyo-network/rebilly-payment-payload-plugin": "^3.0.3",
20
- "@xyo-network/sentinel-abstract": "^3.0.3",
21
- "@xyo-network/sentinel-model": "^3.0.3",
22
- "axios": "^1.7.4"
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/XYOracleNetwork/plugins.git"
23
13
  },
24
- "devDependencies": {
25
- "@xylabs/jest-helpers": "^4.0.2",
26
- "@xylabs/ts-scripts-yarn3": "^4.0.0-rc.20",
27
- "@xylabs/tsconfig": "^4.0.0-rc.20",
28
- "@xyo-network/boundwitness-model": "^3.0.3",
29
- "jest": "^29.7.0",
30
- "typescript": "^5.5.4"
14
+ "license": "LGPL-3.0-only",
15
+ "author": {
16
+ "name": "XYO Development Team",
17
+ "email": "support@xyo.network",
18
+ "url": "https://xyo.network"
31
19
  },
32
- "description": "Typescript/Javascript Plugins for XYO Platform",
33
- "types": "dist/neutral/index.d.ts",
20
+ "sideEffects": false,
21
+ "type": "module",
34
22
  "exports": {
35
23
  ".": {
36
24
  "types": "./dist/neutral/index.d.ts",
@@ -39,16 +27,28 @@
39
27
  "./package.json": "./package.json"
40
28
  },
41
29
  "module": "dist/neutral/index.mjs",
42
- "homepage": "https://xyo.network",
43
- "license": "LGPL-3.0-only",
44
- "publishConfig": {
45
- "access": "public"
30
+ "types": "dist/neutral/index.d.ts",
31
+ "dependencies": {
32
+ "@xylabs/assert": "^4.0.4",
33
+ "@xylabs/axios": "^4.0.4",
34
+ "@xyo-network/module-model": "^3.0.10",
35
+ "@xyo-network/payload-builder": "^3.0.10",
36
+ "@xyo-network/payload-model": "^3.0.10",
37
+ "@xyo-network/payment-payload-plugins": "^3.0.4",
38
+ "@xyo-network/rebilly-payment-payload-plugin": "^3.0.4",
39
+ "@xyo-network/sentinel-abstract": "^3.0.10",
40
+ "@xyo-network/sentinel-model": "^3.0.10",
41
+ "axios": "^1.7.5"
46
42
  },
47
- "repository": {
48
- "type": "git",
49
- "url": "git+https://github.com/XYOracleNetwork/plugins.git"
43
+ "devDependencies": {
44
+ "@xylabs/jest-helpers": "^4.0.4",
45
+ "@xylabs/ts-scripts-yarn3": "^4.0.7",
46
+ "@xylabs/tsconfig": "^4.0.7",
47
+ "@xyo-network/boundwitness-model": "^3.0.10",
48
+ "jest": "^29.7.0",
49
+ "typescript": "^5.5.4"
50
50
  },
51
- "sideEffects": false,
52
- "version": "3.0.3",
53
- "type": "module"
51
+ "publishConfig": {
52
+ "access": "public"
53
+ }
54
54
  }
package/src/Sentinel.ts CHANGED
@@ -111,7 +111,9 @@ export class RebillyPaymentCardAuthorizationSentinel<
111
111
  assertEx(response.status === HttpStatusCode.Created, () => `Failed to tokenize payment card: ${response.status}`)
112
112
  const { id } = response.data
113
113
  const sources = await PayloadBuilder.dataHashes([paymentCard, billingAddress])
114
- results.push({ id, schema: RebillyPaymentAuthorizationTokenSchema, sources })
114
+ results.push({
115
+ id, schema: RebillyPaymentAuthorizationTokenSchema, sources,
116
+ })
115
117
  } catch (error) {
116
118
  this.logger?.error?.(`${moduleName}: Error creating payment token: ${error}`)
117
119
  }
@@ -9,7 +9,9 @@ import type { CreatePaymentTokenRequest } from '../Api/index.ts'
9
9
  * @returns The token request
10
10
  */
11
11
  export const toTokenRequest = (paymentCard: PaymentCard, billingAddress: BillingAddress): CreatePaymentTokenRequest => {
12
- const { cvv, expMonth, expYear, cardNumber } = paymentCard
12
+ const {
13
+ cvv, expMonth, expYear, cardNumber,
14
+ } = paymentCard
13
15
  // NOTE: We are destructuring all but the schema and passing it along to the billingAddress. This
14
16
  // is to allow for missing fields to be omitted rather than set to undefined and for any new fields
15
17
  // that might be added later to be automatically picked up on. It is fine to pass this along since
@@ -19,6 +21,8 @@ export const toTokenRequest = (paymentCard: PaymentCard, billingAddress: Billing
19
21
  return {
20
22
  billingAddress: { ...fields },
21
23
  method: 'payment-card',
22
- paymentInstrument: { cvv, expMonth, expYear, pan: cardNumber },
24
+ paymentInstrument: {
25
+ cvv, expMonth, expYear, pan: cardNumber,
26
+ },
23
27
  }
24
28
  }
package/xy.config.ts CHANGED
@@ -3,9 +3,7 @@ const config: XyTsupConfig = {
3
3
  compile: {
4
4
  browser: {},
5
5
  node: {},
6
- neutral: {
7
- src: true,
8
- },
6
+ neutral: { src: true },
9
7
  },
10
8
  }
11
9