@xyo-network/rebilly-payment-card-authorization-plugin 2.99.5 → 2.99.6

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.
@@ -3,8 +3,6 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
10
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -18,7 +16,6 @@ var __copyProps = (to, from, except, desc) => {
18
16
  return to;
19
17
  };
20
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
22
19
 
23
20
  // src/index.ts
24
21
  var src_exports = {};
@@ -42,32 +39,28 @@ var import_payload_builder = require("@xyo-network/payload-builder");
42
39
  var import_payment_payload_plugins = require("@xyo-network/payment-payload-plugins");
43
40
  var import_rebilly_payment_payload_plugin = require("@xyo-network/rebilly-payment-payload-plugin");
44
41
  var import_sentinel_abstract = require("@xyo-network/sentinel-abstract");
42
+ var import_axios2 = require("axios");
45
43
 
46
44
  // src/util/toTokenRequest.ts
47
- var toTokenRequest = /* @__PURE__ */ __name((paymentCard, billingAddress) => {
45
+ var toTokenRequest = (paymentCard, billingAddress) => {
48
46
  const { cvv, expMonth, expYear, cardNumber } = paymentCard;
49
47
  const { schema: _, ...fields } = billingAddress;
50
48
  return {
51
- billingAddress: {
52
- ...fields
53
- },
49
+ billingAddress: { ...fields },
54
50
  method: "payment-card",
55
- paymentInstrument: {
56
- cvv,
57
- expMonth,
58
- expYear,
59
- pan: cardNumber
60
- }
51
+ paymentInstrument: { cvv, expMonth, expYear, pan: cardNumber }
61
52
  };
62
- }, "toTokenRequest");
53
+ };
63
54
 
64
55
  // src/Sentinel.ts
65
- var removePrefix = /* @__PURE__ */ __name((str, prefix) => {
56
+ var removePrefix = (str, prefix) => {
66
57
  const regex = new RegExp(`^${prefix}`);
67
58
  return str.replace(regex, "");
68
- }, "removePrefix");
59
+ };
69
60
  var moduleName = "RebillyPaymentCardAuthorizationSentinel";
70
- var _RebillyPaymentCardAuthorizationSentinel = class _RebillyPaymentCardAuthorizationSentinel extends import_sentinel_abstract.AbstractSentinel {
61
+ var RebillyPaymentCardAuthorizationSentinel = class extends import_sentinel_abstract.AbstractSentinel {
62
+ static configSchemas = [RebillyPaymentCardAuthorizationSentinelConfigSchema];
63
+ static defaultConfigSchema = RebillyPaymentCardAuthorizationSentinelConfigSchema;
71
64
  _apiRoot = void 0;
72
65
  _domain = void 0;
73
66
  _headers = void 0;
@@ -75,51 +68,54 @@ var _RebillyPaymentCardAuthorizationSentinel = class _RebillyPaymentCardAuthoriz
75
68
  _publishableApiKey = void 0;
76
69
  _tokenEndpoint = void 0;
77
70
  /**
78
- * The Rebilly Organization API root endpoint
79
- */
71
+ * The Rebilly Organization API root endpoint
72
+ */
80
73
  get apiRoot() {
81
74
  if (!this._apiRoot) this._apiRoot = `${this.domain}/organizations/${this.organizationId}`;
82
75
  return this._apiRoot;
83
76
  }
84
77
  /**
85
- * The Rebilly domain
86
- */
78
+ * The Rebilly domain
79
+ */
87
80
  get domain() {
88
81
  if (!this._domain) this._domain = (0, import_assert.assertEx)(this.params.domain ?? this.config.domain, () => `${moduleName}: Missing domain in params/config`);
89
82
  return this._domain;
90
83
  }
91
84
  /**
92
- * The headers to be included in the request for each request
93
- */
85
+ * The headers to be included in the request for each request
86
+ */
94
87
  get headers() {
95
- if (!this._headers) this._headers = {
96
- Authorization: this.publishableApiKey
97
- };
88
+ if (!this._headers) this._headers = { Authorization: this.publishableApiKey };
98
89
  return this._headers;
99
90
  }
100
91
  /**
101
- * True if the environment is sandbox (testing), false otherwise
102
- */
92
+ * True if the environment is sandbox (testing), false otherwise
93
+ */
103
94
  get isSandboxEnvironment() {
104
95
  return this.domain.includes("sandbox");
105
96
  }
106
97
  /**
107
- * The Rebilly organization ID
108
- */
98
+ * The Rebilly organization ID
99
+ */
109
100
  get organizationId() {
110
- if (!this._organizationId) this._organizationId = removePrefix((0, import_assert.assertEx)(this.params.organizationId, () => `${moduleName}: Missing organizationId in params`), "org_");
101
+ if (!this._organizationId)
102
+ this._organizationId = removePrefix(
103
+ (0, import_assert.assertEx)(this.params.organizationId, () => `${moduleName}: Missing organizationId in params`),
104
+ "org_"
105
+ );
111
106
  return this._organizationId;
112
107
  }
113
108
  /**
114
- * The Rebilly Publishable API key
115
- */
109
+ * The Rebilly Publishable API key
110
+ */
116
111
  get publishableApiKey() {
117
- if (!this._publishableApiKey) this._publishableApiKey = (0, import_assert.assertEx)(this.params.publishableApiKey, () => `${moduleName}: Missing publishableApiKey in params`);
112
+ if (!this._publishableApiKey)
113
+ this._publishableApiKey = (0, import_assert.assertEx)(this.params.publishableApiKey, () => `${moduleName}: Missing publishableApiKey in params`);
118
114
  return this._publishableApiKey;
119
115
  }
120
116
  /**
121
- * The Rebilly Organization token creation endpoint
122
- */
117
+ * The Rebilly Organization token creation endpoint
118
+ */
123
119
  get tokenEndpoint() {
124
120
  if (!this._tokenEndpoint) this._tokenEndpoint = `${this.apiRoot}/tokens`;
125
121
  return this._tokenEndpoint;
@@ -133,35 +129,20 @@ var _RebillyPaymentCardAuthorizationSentinel = class _RebillyPaymentCardAuthoriz
133
129
  if (!paymentCard) return results;
134
130
  const billingAddress = payloads == null ? void 0 : payloads.find(import_payment_payload_plugins.isBillingAddress);
135
131
  if (!billingAddress) return results;
136
- const axios = new import_axios.AxiosJson({
137
- headers: this.headers
138
- });
132
+ const axios = new import_axios.AxiosJson({ headers: this.headers });
139
133
  try {
140
134
  const data = toTokenRequest(paymentCard, billingAddress);
141
135
  const response = await axios.post(this.tokenEndpoint, data);
142
- (0, import_assert.assertEx)(response.status === import_axios.HttpStatusCode.Created, () => `Failed to tokenize payment card: ${response.status}`);
136
+ (0, import_assert.assertEx)(response.status === import_axios2.HttpStatusCode.Created, () => `Failed to tokenize payment card: ${response.status}`);
143
137
  const { id } = response.data;
144
- const sources = await import_payload_builder.PayloadBuilder.dataHashes([
145
- paymentCard,
146
- billingAddress
147
- ]);
148
- results.push({
149
- id,
150
- schema: import_rebilly_payment_payload_plugin.RebillyPaymentAuthorizationTokenSchema,
151
- sources
152
- });
138
+ const sources = await import_payload_builder.PayloadBuilder.dataHashes([paymentCard, billingAddress]);
139
+ results.push({ id, schema: import_rebilly_payment_payload_plugin.RebillyPaymentAuthorizationTokenSchema, sources });
153
140
  } catch (error) {
154
141
  (_b = (_a = this.logger) == null ? void 0 : _a.error) == null ? void 0 : _b.call(_a, `${moduleName}: Error creating payment token: ${error}`);
155
142
  }
156
143
  return results;
157
144
  }
158
145
  };
159
- __name(_RebillyPaymentCardAuthorizationSentinel, "RebillyPaymentCardAuthorizationSentinel");
160
- __publicField(_RebillyPaymentCardAuthorizationSentinel, "configSchemas", [
161
- RebillyPaymentCardAuthorizationSentinelConfigSchema
162
- ]);
163
- __publicField(_RebillyPaymentCardAuthorizationSentinel, "defaultConfigSchema", RebillyPaymentCardAuthorizationSentinelConfigSchema);
164
- var RebillyPaymentCardAuthorizationSentinel = _RebillyPaymentCardAuthorizationSentinel;
165
146
  // Annotate the CommonJS export names for ESM import in node:
166
147
  0 && (module.exports = {
167
148
  RebillyPaymentCardAuthorizationSentinel,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/Schema.ts","../../src/Config.ts","../../src/Sentinel.ts","../../src/util/toTokenRequest.ts"],"sourcesContent":["export * from './Config.ts'\nexport * from './Params.ts'\nexport * from './Schema.ts'\nexport * from './Sentinel.ts'\n","export const RebillyPaymentCardAuthorizationSentinelSchema = 'network.xyo.sentinel.payments.payment.instrument.card.authorization.rebilly'\nexport type RebillyPaymentCardAuthorizationSentinelSchema = typeof RebillyPaymentCardAuthorizationSentinelSchema\n","import { RebillyApiDomainSettings } from '@xyo-network/rebilly-payment-payload-plugin'\nimport { 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, AxiosRequestConfig, HttpStatusCode } from '@xylabs/axios'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload, WithSources } from '@xyo-network/payload-model'\nimport { isBillingAddress, isPaymentCard } from '@xyo-network/payment-payload-plugins'\nimport { RebillyPaymentAuthorizationToken, RebillyPaymentAuthorizationTokenSchema } from '@xyo-network/rebilly-payment-payload-plugin'\nimport { AbstractSentinel } from '@xyo-network/sentinel-abstract'\nimport { SentinelInstance, SentinelModuleEventData } from '@xyo-network/sentinel-model'\n\nimport { CreateTokenResponse } from './Api/index.ts'\nimport { RebillyPaymentCardAuthorizationSentinelConfigSchema } from './Config.ts'\nimport { 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 { BillingAddress, PaymentCard } from '@xyo-network/payment-payload-plugins'\n\nimport { 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":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;ACAO,IAAMA,gDAAgD;;;ACKtD,IAAMC,sDAAsD,GAAGC,6CAAAA;;;ACLtE,oBAAyB;AACz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AA;IACvE;AACA,WAAOvB;EACT;AACF;AA7FUvB;AACR,cAJWD,0CAIKiD,iBAAgB;EAACC;;AACjC,cALWlD,0CAKKmD,uBAAsBD;AALjC,IAAMlD,0CAAN;","names":["RebillyPaymentCardAuthorizationSentinelSchema","RebillyPaymentCardAuthorizationSentinelConfigSchema","RebillyPaymentCardAuthorizationSentinelSchema","toTokenRequest","paymentCard","billingAddress","cvv","expMonth","expYear","cardNumber","schema","_","fields","method","paymentInstrument","pan","removePrefix","str","prefix","regex","RegExp","replace","moduleName","RebillyPaymentCardAuthorizationSentinel","AbstractSentinel","_apiRoot","undefined","_domain","_headers","_organizationId","_publishableApiKey","_tokenEndpoint","apiRoot","domain","organizationId","assertEx","params","config","headers","Authorization","publishableApiKey","isSandboxEnvironment","includes","tokenEndpoint","reportHandler","payloads","started","results","length","paymentCard","find","isPaymentCard","billingAddress","isBillingAddress","axios","AxiosJson","data","toTokenRequest","response","post","status","HttpStatusCode","Created","id","sources","PayloadBuilder","dataHashes","push","schema","RebillyPaymentAuthorizationTokenSchema","error","logger","configSchemas","RebillyPaymentCardAuthorizationSentinelConfigSchema","defaultConfigSchema"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/Schema.ts","../../src/Config.ts","../../src/Sentinel.ts","../../src/util/toTokenRequest.ts"],"sourcesContent":["export * from './Config.ts'\nexport * from './Params.ts'\nexport * from './Schema.ts'\nexport * from './Sentinel.ts'\n","export const RebillyPaymentCardAuthorizationSentinelSchema = 'network.xyo.sentinel.payments.payment.instrument.card.authorization.rebilly'\nexport type RebillyPaymentCardAuthorizationSentinelSchema = typeof RebillyPaymentCardAuthorizationSentinelSchema\n","import { RebillyApiDomainSettings } from '@xyo-network/rebilly-payment-payload-plugin'\nimport { 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 { Payload, WithSources } from '@xyo-network/payload-model'\nimport { isBillingAddress, isPaymentCard } from '@xyo-network/payment-payload-plugins'\nimport { RebillyPaymentAuthorizationToken, RebillyPaymentAuthorizationTokenSchema } from '@xyo-network/rebilly-payment-payload-plugin'\nimport { AbstractSentinel } from '@xyo-network/sentinel-abstract'\nimport { SentinelInstance, SentinelModuleEventData } from '@xyo-network/sentinel-model'\nimport { AxiosRequestConfig, HttpStatusCode } from 'axios'\n\nimport { CreateTokenResponse } from './Api/index.ts'\nimport { RebillyPaymentCardAuthorizationSentinelConfigSchema } from './Config.ts'\nimport { 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 { BillingAddress, PaymentCard } from '@xyo-network/payment-payload-plugins'\n\nimport { 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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,gDAAgD;;;ACKtD,IAAM,sDAAsD,GAAG,6CAA6C;;;ACLnH,oBAAyB;AACzB,mBAA0B;AAC1B,6BAA+B;AAE/B,qCAAgD;AAChD,4CAAyF;AACzF,+BAAiC;AAEjC,IAAAA,gBAAmD;;;ACE5C,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,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in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
-
6
1
  // src/Schema.ts
7
2
  var RebillyPaymentCardAuthorizationSentinelSchema = "network.xyo.sentinel.payments.payment.instrument.card.authorization.rebilly";
8
3
 
@@ -11,37 +6,33 @@ var RebillyPaymentCardAuthorizationSentinelConfigSchema = `${RebillyPaymentCardA
11
6
 
12
7
  // src/Sentinel.ts
13
8
  import { assertEx } from "@xylabs/assert";
14
- import { AxiosJson, HttpStatusCode } from "@xylabs/axios";
9
+ import { AxiosJson } from "@xylabs/axios";
15
10
  import { PayloadBuilder } from "@xyo-network/payload-builder";
16
11
  import { isBillingAddress, isPaymentCard } from "@xyo-network/payment-payload-plugins";
17
12
  import { RebillyPaymentAuthorizationTokenSchema } from "@xyo-network/rebilly-payment-payload-plugin";
18
13
  import { AbstractSentinel } from "@xyo-network/sentinel-abstract";
14
+ import { HttpStatusCode } from "axios";
19
15
 
20
16
  // src/util/toTokenRequest.ts
21
- var toTokenRequest = /* @__PURE__ */ __name((paymentCard, billingAddress) => {
17
+ var toTokenRequest = (paymentCard, billingAddress) => {
22
18
  const { cvv, expMonth, expYear, cardNumber } = paymentCard;
23
19
  const { schema: _, ...fields } = billingAddress;
24
20
  return {
25
- billingAddress: {
26
- ...fields
27
- },
21
+ billingAddress: { ...fields },
28
22
  method: "payment-card",
29
- paymentInstrument: {
30
- cvv,
31
- expMonth,
32
- expYear,
33
- pan: cardNumber
34
- }
23
+ paymentInstrument: { cvv, expMonth, expYear, pan: cardNumber }
35
24
  };
36
- }, "toTokenRequest");
25
+ };
37
26
 
38
27
  // src/Sentinel.ts
39
- var removePrefix = /* @__PURE__ */ __name((str, prefix) => {
28
+ var removePrefix = (str, prefix) => {
40
29
  const regex = new RegExp(`^${prefix}`);
41
30
  return str.replace(regex, "");
42
- }, "removePrefix");
31
+ };
43
32
  var moduleName = "RebillyPaymentCardAuthorizationSentinel";
44
- var _RebillyPaymentCardAuthorizationSentinel = class _RebillyPaymentCardAuthorizationSentinel extends AbstractSentinel {
33
+ var RebillyPaymentCardAuthorizationSentinel = class extends AbstractSentinel {
34
+ static configSchemas = [RebillyPaymentCardAuthorizationSentinelConfigSchema];
35
+ static defaultConfigSchema = RebillyPaymentCardAuthorizationSentinelConfigSchema;
45
36
  _apiRoot = void 0;
46
37
  _domain = void 0;
47
38
  _headers = void 0;
@@ -49,51 +40,54 @@ var _RebillyPaymentCardAuthorizationSentinel = class _RebillyPaymentCardAuthoriz
49
40
  _publishableApiKey = void 0;
50
41
  _tokenEndpoint = void 0;
51
42
  /**
52
- * The Rebilly Organization API root endpoint
53
- */
43
+ * The Rebilly Organization API root endpoint
44
+ */
54
45
  get apiRoot() {
55
46
  if (!this._apiRoot) this._apiRoot = `${this.domain}/organizations/${this.organizationId}`;
56
47
  return this._apiRoot;
57
48
  }
58
49
  /**
59
- * The Rebilly domain
60
- */
50
+ * The Rebilly domain
51
+ */
61
52
  get domain() {
62
53
  if (!this._domain) this._domain = assertEx(this.params.domain ?? this.config.domain, () => `${moduleName}: Missing domain in params/config`);
63
54
  return this._domain;
64
55
  }
65
56
  /**
66
- * The headers to be included in the request for each request
67
- */
57
+ * The headers to be included in the request for each request
58
+ */
68
59
  get headers() {
69
- if (!this._headers) this._headers = {
70
- Authorization: this.publishableApiKey
71
- };
60
+ if (!this._headers) this._headers = { Authorization: this.publishableApiKey };
72
61
  return this._headers;
73
62
  }
74
63
  /**
75
- * True if the environment is sandbox (testing), false otherwise
76
- */
64
+ * True if the environment is sandbox (testing), false otherwise
65
+ */
77
66
  get isSandboxEnvironment() {
78
67
  return this.domain.includes("sandbox");
79
68
  }
80
69
  /**
81
- * The Rebilly organization ID
82
- */
70
+ * The Rebilly organization ID
71
+ */
83
72
  get organizationId() {
84
- if (!this._organizationId) this._organizationId = removePrefix(assertEx(this.params.organizationId, () => `${moduleName}: Missing organizationId in params`), "org_");
73
+ if (!this._organizationId)
74
+ this._organizationId = removePrefix(
75
+ assertEx(this.params.organizationId, () => `${moduleName}: Missing organizationId in params`),
76
+ "org_"
77
+ );
85
78
  return this._organizationId;
86
79
  }
87
80
  /**
88
- * The Rebilly Publishable API key
89
- */
81
+ * The Rebilly Publishable API key
82
+ */
90
83
  get publishableApiKey() {
91
- if (!this._publishableApiKey) this._publishableApiKey = assertEx(this.params.publishableApiKey, () => `${moduleName}: Missing publishableApiKey in params`);
84
+ if (!this._publishableApiKey)
85
+ this._publishableApiKey = assertEx(this.params.publishableApiKey, () => `${moduleName}: Missing publishableApiKey in params`);
92
86
  return this._publishableApiKey;
93
87
  }
94
88
  /**
95
- * The Rebilly Organization token creation endpoint
96
- */
89
+ * The Rebilly Organization token creation endpoint
90
+ */
97
91
  get tokenEndpoint() {
98
92
  if (!this._tokenEndpoint) this._tokenEndpoint = `${this.apiRoot}/tokens`;
99
93
  return this._tokenEndpoint;
@@ -107,35 +101,20 @@ var _RebillyPaymentCardAuthorizationSentinel = class _RebillyPaymentCardAuthoriz
107
101
  if (!paymentCard) return results;
108
102
  const billingAddress = payloads == null ? void 0 : payloads.find(isBillingAddress);
109
103
  if (!billingAddress) return results;
110
- const axios = new AxiosJson({
111
- headers: this.headers
112
- });
104
+ const axios = new AxiosJson({ headers: this.headers });
113
105
  try {
114
106
  const data = toTokenRequest(paymentCard, billingAddress);
115
107
  const response = await axios.post(this.tokenEndpoint, data);
116
108
  assertEx(response.status === HttpStatusCode.Created, () => `Failed to tokenize payment card: ${response.status}`);
117
109
  const { id } = response.data;
118
- const sources = await PayloadBuilder.dataHashes([
119
- paymentCard,
120
- billingAddress
121
- ]);
122
- results.push({
123
- id,
124
- schema: RebillyPaymentAuthorizationTokenSchema,
125
- sources
126
- });
110
+ const sources = await PayloadBuilder.dataHashes([paymentCard, billingAddress]);
111
+ results.push({ id, schema: RebillyPaymentAuthorizationTokenSchema, sources });
127
112
  } catch (error) {
128
113
  (_b = (_a = this.logger) == null ? void 0 : _a.error) == null ? void 0 : _b.call(_a, `${moduleName}: Error creating payment token: ${error}`);
129
114
  }
130
115
  return results;
131
116
  }
132
117
  };
133
- __name(_RebillyPaymentCardAuthorizationSentinel, "RebillyPaymentCardAuthorizationSentinel");
134
- __publicField(_RebillyPaymentCardAuthorizationSentinel, "configSchemas", [
135
- RebillyPaymentCardAuthorizationSentinelConfigSchema
136
- ]);
137
- __publicField(_RebillyPaymentCardAuthorizationSentinel, "defaultConfigSchema", RebillyPaymentCardAuthorizationSentinelConfigSchema);
138
- var RebillyPaymentCardAuthorizationSentinel = _RebillyPaymentCardAuthorizationSentinel;
139
118
  export {
140
119
  RebillyPaymentCardAuthorizationSentinel,
141
120
  RebillyPaymentCardAuthorizationSentinelConfigSchema,
@@ -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 { RebillyApiDomainSettings } from '@xyo-network/rebilly-payment-payload-plugin'\nimport { 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, AxiosRequestConfig, HttpStatusCode } from '@xylabs/axios'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload, WithSources } from '@xyo-network/payload-model'\nimport { isBillingAddress, isPaymentCard } from '@xyo-network/payment-payload-plugins'\nimport { RebillyPaymentAuthorizationToken, RebillyPaymentAuthorizationTokenSchema } from '@xyo-network/rebilly-payment-payload-plugin'\nimport { AbstractSentinel } from '@xyo-network/sentinel-abstract'\nimport { SentinelInstance, SentinelModuleEventData } from '@xyo-network/sentinel-model'\n\nimport { CreateTokenResponse } from './Api/index.ts'\nimport { RebillyPaymentCardAuthorizationSentinelConfigSchema } from './Config.ts'\nimport { 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 { BillingAddress, PaymentCard } from '@xyo-network/payment-payload-plugins'\n\nimport { 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,IAAMA,gDAAgD;;;ACKtD,IAAMC,sDAAsD,GAAGC,6CAAAA;;;ACLtE,SAASC,gBAAgB;AACzB,SAASC,WAA+BC,sBAAsB;AAC9D,SAASC,sBAAsB;AAE/B,SAASC,kBAAkBC,qBAAqB;AAChD,SAA2CC,8CAA8C;AACzF,SAASC,wBAAwB;;;ACI1B,IAAMC,iBAAiB,wBAACC,aAA0BC,mBAAAA;AACvD,QAAM,EAAEC,KAAKC,UAAUC,SAASC,WAAU,IAAKL;AAM/C,QAAM,EAAEM,QAAQC,GAAG,GAAGC,OAAAA,IAAWP;AACjC,SAAO;IACLA,gBAAgB;MAAE,GAAGO;IAAO;IAC5BC,QAAQ;IACRC,mBAAmB;MAAER;MAAKC;MAAUC;MAASO,KAAKN;IAAW;EAC/D;AACF,GAb8B;;;ADI9B,IAAMO,eAAe,wBAACC,KAAaC,WAAAA;AACjC,QAAMC,QAAQ,IAAIC,OAAO,IAAIF,MAAAA,EAAQ;AACrC,SAAOD,IAAII,QAAQF,OAAO,EAAA;AAC5B,GAHqB;AAKrB,IAAMG,aAAa;AACZ,IAAMC,2CAA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OD;AAC/C,UAAME,cAAcJ,qCAAUK,KAAKC;AACnC,QAAI,CAACF,YAAa,QAAOF;AACzB,UAAMK,iBAAiBP,qCAAUK,KAAKG;AACtC,QAAI,CAACD,eAAgB,QAAOL;AAC5B,UAAMO,QAAQ,IAAIC,UAAU;MAAEjB,SAAS,KAAKA;IAAQ,CAAA;AACpD,QAAI;AACF,YAAMkB,OAAOC,eAAeR,aAAaG,cAAAA;AACzC,YAAMM,WAAW,MAAMJ,MAAMK,KAA0B,KAAKhB,eAAea,IAAAA;AAC3ErB,eAASuB,SAASE,WAAWC,eAAeC,SAAS,MAAM,oCAAoCJ,SAASE,MAAM,EAAE;AAChH,YAAM,EAAEG,GAAE,IAAKL,SAASF;AACxB,YAAMQ,UAAU,MAAMC,eAAeC,WAAW;QAACjB;QAAaG;OAAe;AAC7EL,cAAQoB,KAAK;QAAEJ;QAAIK,QAAQC;QAAwCL;MAAQ,CAAA;IAC7E,SAASM,OAAO;AACd,uBAAKC,WAAL,mBAAaD,UAAb,4BAAqB,GAAGhD,UAAAA,mCAA6CgD,KAAAA;IACvE;AACA,WAAOvB;EACT;AACF;AA7FUvB;AACR,cAJWD,0CAIKiD,iBAAgB;EAACC;;AACjC,cALWlD,0CAKKmD,uBAAsBD;AALjC,IAAMlD,0CAAN;","names":["RebillyPaymentCardAuthorizationSentinelSchema","RebillyPaymentCardAuthorizationSentinelConfigSchema","RebillyPaymentCardAuthorizationSentinelSchema","assertEx","AxiosJson","HttpStatusCode","PayloadBuilder","isBillingAddress","isPaymentCard","RebillyPaymentAuthorizationTokenSchema","AbstractSentinel","toTokenRequest","paymentCard","billingAddress","cvv","expMonth","expYear","cardNumber","schema","_","fields","method","paymentInstrument","pan","removePrefix","str","prefix","regex","RegExp","replace","moduleName","RebillyPaymentCardAuthorizationSentinel","AbstractSentinel","_apiRoot","undefined","_domain","_headers","_organizationId","_publishableApiKey","_tokenEndpoint","apiRoot","domain","organizationId","assertEx","params","config","headers","Authorization","publishableApiKey","isSandboxEnvironment","includes","tokenEndpoint","reportHandler","payloads","started","results","length","paymentCard","find","isPaymentCard","billingAddress","isBillingAddress","axios","AxiosJson","data","toTokenRequest","response","post","status","HttpStatusCode","Created","id","sources","PayloadBuilder","dataHashes","push","schema","RebillyPaymentAuthorizationTokenSchema","error","logger","configSchemas","RebillyPaymentCardAuthorizationSentinelConfigSchema","defaultConfigSchema"]}
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 { RebillyApiDomainSettings } from '@xyo-network/rebilly-payment-payload-plugin'\nimport { 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 { Payload, WithSources } from '@xyo-network/payload-model'\nimport { isBillingAddress, isPaymentCard } from '@xyo-network/payment-payload-plugins'\nimport { RebillyPaymentAuthorizationToken, RebillyPaymentAuthorizationTokenSchema } from '@xyo-network/rebilly-payment-payload-plugin'\nimport { AbstractSentinel } from '@xyo-network/sentinel-abstract'\nimport { SentinelInstance, SentinelModuleEventData } from '@xyo-network/sentinel-model'\nimport { AxiosRequestConfig, HttpStatusCode } from 'axios'\n\nimport { CreateTokenResponse } from './Api/index.ts'\nimport { RebillyPaymentCardAuthorizationSentinelConfigSchema } from './Config.ts'\nimport { 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 { BillingAddress, PaymentCard } from '@xyo-network/payment-payload-plugins'\n\nimport { 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;AAChD,SAA2C,8CAA8C;AACzF,SAAS,wBAAwB;AAEjC,SAA6B,sBAAsB;;;ACE5C,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;AAAA,IACR,mBAAmB,EAAE,KAAK,UAAU,SAAS,KAAK,WAAW;AAAA,EAC/D;AACF;;;ADRA,IAAM,eAAe,CAAC,KAAa,WAAmB;AACpD,QAAM,QAAQ,IAAI,OAAO,IAAI,MAAM,EAAE;AACrC,SAAO,IAAI,QAAQ,OAAO,EAAE;AAC9B;AAEA,IAAM,aAAa;AACZ,IAAM,0CAAN,cAGG,iBAAsC;AAAA,EAC9C,OAAgB,gBAAgB,CAAC,mDAAmD;AAAA,EACpF,OAAgB,sBAAsB;AAAA,EAE5B,WAA+B;AAAA,EAC/B,UAA8B;AAAA,EAC9B,WAAsD;AAAA,EACtD,kBAAsC;AAAA,EACtC,qBAAyC;AAAA,EACzC,iBAAqC;AAAA;AAAA;AAAA;AAAA,EAK/C,IAAc,UAAU;AACtB,QAAI,CAAC,KAAK,SAAU,MAAK,WAAW,GA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CAAU,KAAK;AACtC,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,uBAAK,WAAL,mBAAa,UAAb,4BAAqB,GAAG,UAAU,mCAAmC,KAAK;AAAA,IAC5E;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
package/package.json CHANGED
@@ -10,21 +10,22 @@
10
10
  "url": "https://github.com/XYOracleNetwork/plugins/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@xylabs/assert": "^3.6.8",
14
- "@xylabs/axios": "^3.6.8",
15
- "@xyo-network/module-model": "^2.111.2",
16
- "@xyo-network/payload-builder": "^2.111.2",
17
- "@xyo-network/payload-model": "^2.111.2",
18
- "@xyo-network/payment-payload-plugins": "^2.99.5",
19
- "@xyo-network/rebilly-payment-payload-plugin": "^2.99.5",
20
- "@xyo-network/sentinel-abstract": "^2.111.2",
21
- "@xyo-network/sentinel-model": "^2.111.2"
13
+ "@xylabs/assert": "^3.6.12",
14
+ "@xylabs/axios": "^3.6.12",
15
+ "@xyo-network/module-model": "^2.111.3",
16
+ "@xyo-network/payload-builder": "^2.111.3",
17
+ "@xyo-network/payload-model": "^2.111.3",
18
+ "@xyo-network/payment-payload-plugins": "^2.99.6",
19
+ "@xyo-network/rebilly-payment-payload-plugin": "^2.99.6",
20
+ "@xyo-network/sentinel-abstract": "^2.111.3",
21
+ "@xyo-network/sentinel-model": "^2.111.3",
22
+ "axios": "^1.7.3"
22
23
  },
23
24
  "devDependencies": {
24
- "@xylabs/jest-helpers": "^3.6.8",
25
- "@xylabs/ts-scripts-yarn3": "^3.15.13",
26
- "@xylabs/tsconfig": "^3.15.13",
27
- "@xyo-network/boundwitness-model": "^2.111.2",
25
+ "@xylabs/jest-helpers": "^3.6.12",
26
+ "@xylabs/ts-scripts-yarn3": "^3.15.14",
27
+ "@xylabs/tsconfig": "^3.15.14",
28
+ "@xyo-network/boundwitness-model": "^2.111.3",
28
29
  "jest": "^29.7.0",
29
30
  "typescript": "^5.5.4"
30
31
  },
@@ -67,6 +68,6 @@
67
68
  "url": "https://github.com/XYOracleNetwork/plugins.git"
68
69
  },
69
70
  "sideEffects": false,
70
- "version": "2.99.5",
71
+ "version": "2.99.6",
71
72
  "type": "module"
72
73
  }
package/src/Sentinel.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import { assertEx } from '@xylabs/assert'
2
- import { AxiosJson, AxiosRequestConfig, HttpStatusCode } from '@xylabs/axios'
2
+ import { AxiosJson } from '@xylabs/axios'
3
3
  import { PayloadBuilder } from '@xyo-network/payload-builder'
4
4
  import { Payload, WithSources } from '@xyo-network/payload-model'
5
5
  import { isBillingAddress, isPaymentCard } from '@xyo-network/payment-payload-plugins'
6
6
  import { RebillyPaymentAuthorizationToken, RebillyPaymentAuthorizationTokenSchema } from '@xyo-network/rebilly-payment-payload-plugin'
7
7
  import { AbstractSentinel } from '@xyo-network/sentinel-abstract'
8
8
  import { SentinelInstance, SentinelModuleEventData } from '@xyo-network/sentinel-model'
9
+ import { AxiosRequestConfig, HttpStatusCode } from 'axios'
9
10
 
10
11
  import { CreateTokenResponse } from './Api/index.ts'
11
12
  import { RebillyPaymentCardAuthorizationSentinelConfigSchema } from './Config.ts'