@xyo-network/rebilly-payment-card-authorization-plugin 2.94.1

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 (208) hide show
  1. package/LICENSE +165 -0
  2. package/README.md +13 -0
  3. package/dist/browser/Api/PaymentCardToken/Request.d.cts +88 -0
  4. package/dist/browser/Api/PaymentCardToken/Request.d.cts.map +1 -0
  5. package/dist/browser/Api/PaymentCardToken/Request.d.mts +88 -0
  6. package/dist/browser/Api/PaymentCardToken/Request.d.mts.map +1 -0
  7. package/dist/browser/Api/PaymentCardToken/Request.d.ts +88 -0
  8. package/dist/browser/Api/PaymentCardToken/Request.d.ts.map +1 -0
  9. package/dist/browser/Api/PaymentCardToken/Response.d.cts +70 -0
  10. package/dist/browser/Api/PaymentCardToken/Response.d.cts.map +1 -0
  11. package/dist/browser/Api/PaymentCardToken/Response.d.mts +70 -0
  12. package/dist/browser/Api/PaymentCardToken/Response.d.mts.map +1 -0
  13. package/dist/browser/Api/PaymentCardToken/Response.d.ts +70 -0
  14. package/dist/browser/Api/PaymentCardToken/Response.d.ts.map +1 -0
  15. package/dist/browser/Api/PaymentCardToken/index.d.cts +3 -0
  16. package/dist/browser/Api/PaymentCardToken/index.d.cts.map +1 -0
  17. package/dist/browser/Api/PaymentCardToken/index.d.mts +3 -0
  18. package/dist/browser/Api/PaymentCardToken/index.d.mts.map +1 -0
  19. package/dist/browser/Api/PaymentCardToken/index.d.ts +3 -0
  20. package/dist/browser/Api/PaymentCardToken/index.d.ts.map +1 -0
  21. package/dist/browser/Api/index.d.cts +2 -0
  22. package/dist/browser/Api/index.d.cts.map +1 -0
  23. package/dist/browser/Api/index.d.mts +2 -0
  24. package/dist/browser/Api/index.d.mts.map +1 -0
  25. package/dist/browser/Api/index.d.ts +2 -0
  26. package/dist/browser/Api/index.d.ts.map +1 -0
  27. package/dist/browser/Config.d.cts +11 -0
  28. package/dist/browser/Config.d.cts.map +1 -0
  29. package/dist/browser/Config.d.mts +11 -0
  30. package/dist/browser/Config.d.mts.map +1 -0
  31. package/dist/browser/Config.d.ts +11 -0
  32. package/dist/browser/Config.d.ts.map +1 -0
  33. package/dist/browser/Params.d.cts +7 -0
  34. package/dist/browser/Params.d.cts.map +1 -0
  35. package/dist/browser/Params.d.mts +7 -0
  36. package/dist/browser/Params.d.mts.map +1 -0
  37. package/dist/browser/Params.d.ts +7 -0
  38. package/dist/browser/Params.d.ts.map +1 -0
  39. package/dist/browser/RebillyProviderSettings/RebillyApiSettings.d.cts +17 -0
  40. package/dist/browser/RebillyProviderSettings/RebillyApiSettings.d.cts.map +1 -0
  41. package/dist/browser/RebillyProviderSettings/RebillyApiSettings.d.mts +17 -0
  42. package/dist/browser/RebillyProviderSettings/RebillyApiSettings.d.mts.map +1 -0
  43. package/dist/browser/RebillyProviderSettings/RebillyApiSettings.d.ts +17 -0
  44. package/dist/browser/RebillyProviderSettings/RebillyApiSettings.d.ts.map +1 -0
  45. package/dist/browser/RebillyProviderSettings/RebillyAuthSettings.d.cts +15 -0
  46. package/dist/browser/RebillyProviderSettings/RebillyAuthSettings.d.cts.map +1 -0
  47. package/dist/browser/RebillyProviderSettings/RebillyAuthSettings.d.mts +15 -0
  48. package/dist/browser/RebillyProviderSettings/RebillyAuthSettings.d.mts.map +1 -0
  49. package/dist/browser/RebillyProviderSettings/RebillyAuthSettings.d.ts +15 -0
  50. package/dist/browser/RebillyProviderSettings/RebillyAuthSettings.d.ts.map +1 -0
  51. package/dist/browser/RebillyProviderSettings/RebillyOrganizationSettings.d.cts +10 -0
  52. package/dist/browser/RebillyProviderSettings/RebillyOrganizationSettings.d.cts.map +1 -0
  53. package/dist/browser/RebillyProviderSettings/RebillyOrganizationSettings.d.mts +10 -0
  54. package/dist/browser/RebillyProviderSettings/RebillyOrganizationSettings.d.mts.map +1 -0
  55. package/dist/browser/RebillyProviderSettings/RebillyOrganizationSettings.d.ts +10 -0
  56. package/dist/browser/RebillyProviderSettings/RebillyOrganizationSettings.d.ts.map +1 -0
  57. package/dist/browser/RebillyProviderSettings/index.d.cts +4 -0
  58. package/dist/browser/RebillyProviderSettings/index.d.cts.map +1 -0
  59. package/dist/browser/RebillyProviderSettings/index.d.mts +4 -0
  60. package/dist/browser/RebillyProviderSettings/index.d.mts.map +1 -0
  61. package/dist/browser/RebillyProviderSettings/index.d.ts +4 -0
  62. package/dist/browser/RebillyProviderSettings/index.d.ts.map +1 -0
  63. package/dist/browser/Schema.d.cts +3 -0
  64. package/dist/browser/Schema.d.cts.map +1 -0
  65. package/dist/browser/Schema.d.mts +3 -0
  66. package/dist/browser/Schema.d.mts.map +1 -0
  67. package/dist/browser/Schema.d.ts +3 -0
  68. package/dist/browser/Schema.d.ts.map +1 -0
  69. package/dist/browser/Sentinel.d.cts +45 -0
  70. package/dist/browser/Sentinel.d.cts.map +1 -0
  71. package/dist/browser/Sentinel.d.mts +45 -0
  72. package/dist/browser/Sentinel.d.mts.map +1 -0
  73. package/dist/browser/Sentinel.d.ts +45 -0
  74. package/dist/browser/Sentinel.d.ts.map +1 -0
  75. package/dist/browser/index.cjs +151 -0
  76. package/dist/browser/index.cjs.map +1 -0
  77. package/dist/browser/index.d.cts +5 -0
  78. package/dist/browser/index.d.cts.map +1 -0
  79. package/dist/browser/index.d.mts +5 -0
  80. package/dist/browser/index.d.mts.map +1 -0
  81. package/dist/browser/index.d.ts +5 -0
  82. package/dist/browser/index.d.ts.map +1 -0
  83. package/dist/browser/index.js +128 -0
  84. package/dist/browser/index.js.map +1 -0
  85. package/dist/browser/util/index.d.cts +2 -0
  86. package/dist/browser/util/index.d.cts.map +1 -0
  87. package/dist/browser/util/index.d.mts +2 -0
  88. package/dist/browser/util/index.d.mts.map +1 -0
  89. package/dist/browser/util/index.d.ts +2 -0
  90. package/dist/browser/util/index.d.ts.map +1 -0
  91. package/dist/browser/util/toTokenRequest.d.cts +10 -0
  92. package/dist/browser/util/toTokenRequest.d.cts.map +1 -0
  93. package/dist/browser/util/toTokenRequest.d.mts +10 -0
  94. package/dist/browser/util/toTokenRequest.d.mts.map +1 -0
  95. package/dist/browser/util/toTokenRequest.d.ts +10 -0
  96. package/dist/browser/util/toTokenRequest.d.ts.map +1 -0
  97. package/dist/node/Api/PaymentCardToken/Request.d.cts +88 -0
  98. package/dist/node/Api/PaymentCardToken/Request.d.cts.map +1 -0
  99. package/dist/node/Api/PaymentCardToken/Request.d.mts +88 -0
  100. package/dist/node/Api/PaymentCardToken/Request.d.mts.map +1 -0
  101. package/dist/node/Api/PaymentCardToken/Request.d.ts +88 -0
  102. package/dist/node/Api/PaymentCardToken/Request.d.ts.map +1 -0
  103. package/dist/node/Api/PaymentCardToken/Response.d.cts +70 -0
  104. package/dist/node/Api/PaymentCardToken/Response.d.cts.map +1 -0
  105. package/dist/node/Api/PaymentCardToken/Response.d.mts +70 -0
  106. package/dist/node/Api/PaymentCardToken/Response.d.mts.map +1 -0
  107. package/dist/node/Api/PaymentCardToken/Response.d.ts +70 -0
  108. package/dist/node/Api/PaymentCardToken/Response.d.ts.map +1 -0
  109. package/dist/node/Api/PaymentCardToken/index.d.cts +3 -0
  110. package/dist/node/Api/PaymentCardToken/index.d.cts.map +1 -0
  111. package/dist/node/Api/PaymentCardToken/index.d.mts +3 -0
  112. package/dist/node/Api/PaymentCardToken/index.d.mts.map +1 -0
  113. package/dist/node/Api/PaymentCardToken/index.d.ts +3 -0
  114. package/dist/node/Api/PaymentCardToken/index.d.ts.map +1 -0
  115. package/dist/node/Api/index.d.cts +2 -0
  116. package/dist/node/Api/index.d.cts.map +1 -0
  117. package/dist/node/Api/index.d.mts +2 -0
  118. package/dist/node/Api/index.d.mts.map +1 -0
  119. package/dist/node/Api/index.d.ts +2 -0
  120. package/dist/node/Api/index.d.ts.map +1 -0
  121. package/dist/node/Config.d.cts +11 -0
  122. package/dist/node/Config.d.cts.map +1 -0
  123. package/dist/node/Config.d.mts +11 -0
  124. package/dist/node/Config.d.mts.map +1 -0
  125. package/dist/node/Config.d.ts +11 -0
  126. package/dist/node/Config.d.ts.map +1 -0
  127. package/dist/node/Params.d.cts +7 -0
  128. package/dist/node/Params.d.cts.map +1 -0
  129. package/dist/node/Params.d.mts +7 -0
  130. package/dist/node/Params.d.mts.map +1 -0
  131. package/dist/node/Params.d.ts +7 -0
  132. package/dist/node/Params.d.ts.map +1 -0
  133. package/dist/node/RebillyProviderSettings/RebillyApiSettings.d.cts +17 -0
  134. package/dist/node/RebillyProviderSettings/RebillyApiSettings.d.cts.map +1 -0
  135. package/dist/node/RebillyProviderSettings/RebillyApiSettings.d.mts +17 -0
  136. package/dist/node/RebillyProviderSettings/RebillyApiSettings.d.mts.map +1 -0
  137. package/dist/node/RebillyProviderSettings/RebillyApiSettings.d.ts +17 -0
  138. package/dist/node/RebillyProviderSettings/RebillyApiSettings.d.ts.map +1 -0
  139. package/dist/node/RebillyProviderSettings/RebillyAuthSettings.d.cts +15 -0
  140. package/dist/node/RebillyProviderSettings/RebillyAuthSettings.d.cts.map +1 -0
  141. package/dist/node/RebillyProviderSettings/RebillyAuthSettings.d.mts +15 -0
  142. package/dist/node/RebillyProviderSettings/RebillyAuthSettings.d.mts.map +1 -0
  143. package/dist/node/RebillyProviderSettings/RebillyAuthSettings.d.ts +15 -0
  144. package/dist/node/RebillyProviderSettings/RebillyAuthSettings.d.ts.map +1 -0
  145. package/dist/node/RebillyProviderSettings/RebillyOrganizationSettings.d.cts +10 -0
  146. package/dist/node/RebillyProviderSettings/RebillyOrganizationSettings.d.cts.map +1 -0
  147. package/dist/node/RebillyProviderSettings/RebillyOrganizationSettings.d.mts +10 -0
  148. package/dist/node/RebillyProviderSettings/RebillyOrganizationSettings.d.mts.map +1 -0
  149. package/dist/node/RebillyProviderSettings/RebillyOrganizationSettings.d.ts +10 -0
  150. package/dist/node/RebillyProviderSettings/RebillyOrganizationSettings.d.ts.map +1 -0
  151. package/dist/node/RebillyProviderSettings/index.d.cts +4 -0
  152. package/dist/node/RebillyProviderSettings/index.d.cts.map +1 -0
  153. package/dist/node/RebillyProviderSettings/index.d.mts +4 -0
  154. package/dist/node/RebillyProviderSettings/index.d.mts.map +1 -0
  155. package/dist/node/RebillyProviderSettings/index.d.ts +4 -0
  156. package/dist/node/RebillyProviderSettings/index.d.ts.map +1 -0
  157. package/dist/node/Schema.d.cts +3 -0
  158. package/dist/node/Schema.d.cts.map +1 -0
  159. package/dist/node/Schema.d.mts +3 -0
  160. package/dist/node/Schema.d.mts.map +1 -0
  161. package/dist/node/Schema.d.ts +3 -0
  162. package/dist/node/Schema.d.ts.map +1 -0
  163. package/dist/node/Sentinel.d.cts +45 -0
  164. package/dist/node/Sentinel.d.cts.map +1 -0
  165. package/dist/node/Sentinel.d.mts +45 -0
  166. package/dist/node/Sentinel.d.mts.map +1 -0
  167. package/dist/node/Sentinel.d.ts +45 -0
  168. package/dist/node/Sentinel.d.ts.map +1 -0
  169. package/dist/node/index.cjs +158 -0
  170. package/dist/node/index.cjs.map +1 -0
  171. package/dist/node/index.d.cts +5 -0
  172. package/dist/node/index.d.cts.map +1 -0
  173. package/dist/node/index.d.mts +5 -0
  174. package/dist/node/index.d.mts.map +1 -0
  175. package/dist/node/index.d.ts +5 -0
  176. package/dist/node/index.d.ts.map +1 -0
  177. package/dist/node/index.js +129 -0
  178. package/dist/node/index.js.map +1 -0
  179. package/dist/node/util/index.d.cts +2 -0
  180. package/dist/node/util/index.d.cts.map +1 -0
  181. package/dist/node/util/index.d.mts +2 -0
  182. package/dist/node/util/index.d.mts.map +1 -0
  183. package/dist/node/util/index.d.ts +2 -0
  184. package/dist/node/util/index.d.ts.map +1 -0
  185. package/dist/node/util/toTokenRequest.d.cts +10 -0
  186. package/dist/node/util/toTokenRequest.d.cts.map +1 -0
  187. package/dist/node/util/toTokenRequest.d.mts +10 -0
  188. package/dist/node/util/toTokenRequest.d.mts.map +1 -0
  189. package/dist/node/util/toTokenRequest.d.ts +10 -0
  190. package/dist/node/util/toTokenRequest.d.ts.map +1 -0
  191. package/package.json +71 -0
  192. package/src/Api/PaymentCardToken/Request.ts +238 -0
  193. package/src/Api/PaymentCardToken/Response.ts +73 -0
  194. package/src/Api/PaymentCardToken/index.ts +2 -0
  195. package/src/Api/index.ts +1 -0
  196. package/src/Config.ts +18 -0
  197. package/src/Params.ts +12 -0
  198. package/src/RebillyProviderSettings/RebillyApiSettings.ts +23 -0
  199. package/src/RebillyProviderSettings/RebillyAuthSettings.ts +15 -0
  200. package/src/RebillyProviderSettings/RebillyOrganizationSettings.ts +9 -0
  201. package/src/RebillyProviderSettings/index.ts +3 -0
  202. package/src/Schema.ts +2 -0
  203. package/src/Sentinel.ts +117 -0
  204. package/src/index.ts +4 -0
  205. package/src/util/index.ts +1 -0
  206. package/src/util/toTokenRequest.ts +24 -0
  207. package/typedoc.json +5 -0
  208. package/xy.config.ts +14 -0
@@ -0,0 +1,10 @@
1
+ import { BillingAddress, PaymentCard } from '@xyo-network/payment-payload-plugins';
2
+ import { CreatePaymentTokenRequest } from '../Api';
3
+ /**
4
+ * Converts a payment card and billing address to a token request
5
+ * @param paymentCard The payment card
6
+ * @param billingAddress The billing address
7
+ * @returns The token request
8
+ */
9
+ export declare const toTokenRequest: (paymentCard: PaymentCard, billingAddress: BillingAddress) => CreatePaymentTokenRequest;
10
+ //# 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,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAA;AAElF,OAAO,EAAE,yBAAyB,EAAE,MAAM,QAAQ,CAAA;AAElD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,gBAAiB,WAAW,kBAAkB,cAAc,KAAG,yBAazF,CAAA"}
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
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
+ },
8
+ "bugs": {
9
+ "email": "support@xyo.network",
10
+ "url": "https://github.com/XYOracleNetwork/plugins/issues"
11
+ },
12
+ "dependencies": {
13
+ "@xylabs/assert": "^3.1.11",
14
+ "@xylabs/axios": "^3.1.11",
15
+ "@xyo-network/id-payload-plugin": "^2.99.1",
16
+ "@xyo-network/module-model": "^2.99.1",
17
+ "@xyo-network/payload-builder": "^2.99.1",
18
+ "@xyo-network/payload-model": "^2.99.1",
19
+ "@xyo-network/payment-payload-plugins": "~2.94.1",
20
+ "@xyo-network/sentinel-abstract": "^2.99.1",
21
+ "@xyo-network/sentinel-model": "^2.99.1"
22
+ },
23
+ "devDependencies": {
24
+ "@xylabs/jest-helpers": "^3.1.11",
25
+ "@xylabs/ts-scripts-yarn3": "^3.9.1",
26
+ "@xylabs/tsconfig": "^3.9.1",
27
+ "@xyo-network/boundwitness-model": "^2.99.1",
28
+ "typescript": "^5.4.5"
29
+ },
30
+ "description": "Typescript/Javascript Plugins for XYO Platform",
31
+ "types": "dist/node/index.d.ts",
32
+ "exports": {
33
+ ".": {
34
+ "browser": {
35
+ "require": {
36
+ "types": "./dist/browser/index.d.cts",
37
+ "default": "./dist/browser/index.cjs"
38
+ },
39
+ "import": {
40
+ "types": "./dist/browser/index.d.mts",
41
+ "default": "./dist/browser/index.js"
42
+ }
43
+ },
44
+ "node": {
45
+ "require": {
46
+ "types": "./dist/node/index.d.cts",
47
+ "default": "./dist/node/index.cjs"
48
+ },
49
+ "import": {
50
+ "types": "./dist/node/index.d.mts",
51
+ "default": "./dist/node/index.js"
52
+ }
53
+ }
54
+ },
55
+ "./package.json": "./package.json"
56
+ },
57
+ "main": "dist/node/index.cjs",
58
+ "module": "dist/node/index.js",
59
+ "homepage": "https://xyo.network",
60
+ "license": "LGPL-3.0-only",
61
+ "publishConfig": {
62
+ "access": "public"
63
+ },
64
+ "repository": {
65
+ "type": "git",
66
+ "url": "https://github.com/XYOracleNetwork/plugins.git"
67
+ },
68
+ "sideEffects": false,
69
+ "version": "2.94.1",
70
+ "type": "module"
71
+ }
@@ -0,0 +1,238 @@
1
+ export interface ContactPhoneNumber {
2
+ /**
3
+ * Phone number label or name.
4
+ * <= 45 characters
5
+ */
6
+ label: string
7
+ /**
8
+ * Specifies if the phone number is the contact's primary phone number.
9
+ */
10
+ primary?: boolean
11
+ /**
12
+ * Phone number value.
13
+ * <= 50 characters
14
+ */
15
+ value: string
16
+ }
17
+
18
+ export interface ContactEmail {
19
+ /**
20
+ * Email label or name.
21
+ * <= 45 characters
22
+ */
23
+ label: string
24
+ /**
25
+ * Specifies if the email address is the contact's primary email address.
26
+ */
27
+ primary?: boolean
28
+ /**
29
+ * Email address value.
30
+ * <= 255 characters
31
+ */
32
+ value: string
33
+ }
34
+
35
+ /**
36
+ * Billing address details associated with the payment token.
37
+ */
38
+ export interface RequestBillingAddress {
39
+ /** Street address line 1. */
40
+ address: string
41
+ /** Street address line 2. */
42
+ address2?: string | null
43
+ /** City of the billing address. */
44
+ city?: string
45
+ /** Country code of the billing address, ISO 3166-1 alpha-2 code. */
46
+ country?: string
47
+ /** Date of birth of the cardholder. */
48
+ dob?: string
49
+ /** Email addresses associated with the billing address. */
50
+ emails?: ContactEmail[]
51
+ /** First name of the cardholder. */
52
+ firstName: string
53
+ /** Job title of the cardholder. */
54
+ jobTitle?: string | null
55
+ /** Last name of the cardholder. */
56
+ lastName: string
57
+ /** Organization or company name associated with the billing address. */
58
+ organization?: string | null
59
+ /** Phone numbers associated with the billing address. */
60
+ phoneNumbers?: ContactPhoneNumber[]
61
+ /** Postal or ZIP code of the billing address. */
62
+ postalCode?: string
63
+ /** State or region of the billing address. */
64
+ region?: string
65
+ }
66
+
67
+ export interface RequestPaymentCardInstrument {
68
+ /**
69
+ * Card Verification Value (CVV/CVC) of the payment card.
70
+ */
71
+ cvv: string
72
+ /**
73
+ * Expiration month of the payment card.
74
+ */
75
+ expMonth: number
76
+ /**
77
+ * Expiration year of the payment card.
78
+ */
79
+ expYear: number
80
+ /**
81
+ * Primary Account Number (PAN) of the payment card. This value is required to perform a payment.
82
+ */
83
+ pan: string
84
+ }
85
+
86
+ export type PaymentMethod =
87
+ // | 'ach'
88
+ // | 'AdvCash'
89
+ // | 'Alfa-click'
90
+ // | 'Alipay'
91
+ // | 'AstroPay Card'
92
+ // | 'AstroPay-GO'
93
+ // | 'Baloto'
94
+ // | 'Bancontact-mobile'
95
+ // | 'Bancontact'
96
+ // | 'bank-transfer-2'
97
+ // | 'bank-transfer-3'
98
+ // | 'bank-transfer-4'
99
+ // | 'bank-transfer-5'
100
+ // | 'bank-transfer-6'
101
+ // | 'bank-transfer-7'
102
+ // | 'bank-transfer-8'
103
+ // | 'bank-transfer-9'
104
+ // | 'bank-transfer'
105
+ // | 'BankReferenced'
106
+ // | 'Beeline'
107
+ // | 'Belfius-direct-net'
108
+ // | 'bitcoin'
109
+ // | 'Bizum'
110
+ // | 'Boleto'
111
+ // | 'cash-deposit'
112
+ // | 'cash'
113
+ // | 'CASHlib'
114
+ // | 'CashToCode'
115
+ // | 'check'
116
+ // | 'China UnionPay'
117
+ // | 'Cleo'
118
+ // | 'CODVoucher'
119
+ // | 'Conekta-oxxo'
120
+ // | 'cryptocurrency'
121
+ // | 'Cupon-de-pagos'
122
+ // | 'digital-wallet'
123
+ // | 'domestic-cards'
124
+ // | 'echeck'
125
+ // | 'ecoPayz'
126
+ // | 'ecoVoucher'
127
+ // | 'Efecty'
128
+ // | 'ePay.bg'
129
+ // | 'EPS'
130
+ // | 'eZeeWallet'
131
+ // | 'FasterPay'
132
+ // | 'Flexepin'
133
+ // | 'Giropay'
134
+ // | 'Google Pay'
135
+ // | 'Gpaysafe'
136
+ // | 'iDEAL'
137
+ // | 'iDebit'
138
+ // | 'ING-homepay'
139
+ // | 'INOVAPAY-pin'
140
+ // | 'INOVAPAY-wallet'
141
+ // | 'InstaDebit'
142
+ // | 'instant-bank-transfer'
143
+ // | 'InstantPayments'
144
+ // | 'Interac-eTransfer'
145
+ // | 'Interac-online'
146
+ // | 'Interac'
147
+ // | 'invoice'
148
+ // | 'iWallet'
149
+ // | 'Jeton'
150
+ // | 'jpay'
151
+ // | 'Khelocard'
152
+ // | 'Klarna'
153
+ // | 'KNOT'
154
+ // | 'loonie'
155
+ // | 'Matrix'
156
+ // | 'MaxiCash'
157
+ // | 'Megafon'
158
+ // | 'MiFinity-eWallet'
159
+ // | 'miscellaneous'
160
+ // | 'MTS'
161
+ // | 'MuchBetter'
162
+ // | 'Multibanco'
163
+ // | 'Neosurf'
164
+ // | 'Netbanking'
165
+ // | 'Neteller'
166
+ // | 'Nordea-Solo'
167
+ // | 'OchaPay'
168
+ // | 'online-bank-transfer'
169
+ // | 'Onlineueberweisen'
170
+ // | 'oriental-wallet'
171
+ // | 'OXXO'
172
+ // | 'P24'
173
+ // | 'Pagadito'
174
+ // | 'PagoEffectivo'
175
+ // | 'Pagsmile-deposit-express'
176
+ // | 'Pagsmile-lottery'
177
+ // | 'Pay4Fun'
178
+ // | 'PayCash'
179
+ // | 'Payeer'
180
+ 'payment-card'
181
+ // | 'PaymentAsia-crypto'
182
+ // | 'Paymero'
183
+ // | 'Paynote'
184
+ // | 'paypal'
185
+ // | 'Paysafecard'
186
+ // | 'Paysafecash'
187
+ // | 'PayTabs'
188
+ // | 'Perfect-money'
189
+ // | 'phone'
190
+ // | 'PhonePe'
191
+ // | 'Piastrix'
192
+ // | 'PinPay'
193
+ // | 'plaid-account'
194
+ // | 'POLi'
195
+ // | 'PostFinance-card'
196
+ // | 'PostFinance-e-finance'
197
+ // | 'QIWI'
198
+ // | 'QPay'
199
+ // | 'QQPay'
200
+ // | 'rapyd-checkout'
201
+ // | 'Resurs'
202
+ // | 'SafetyPay'
203
+ // | 'SEPA'
204
+ // | 'Skrill Rapid Transfer'
205
+ // | 'Skrill'
206
+ // | 'SMSVoucher'
207
+ // | 'Sofort'
208
+ // | 'SparkPay'
209
+ // | 'swift-dbt'
210
+ // | 'Tele2'
211
+ // | 'Terminaly-RF'
212
+ // | 'ToditoCash-card'
213
+ // | 'Trustly'
214
+ // | 'UPayCard'
215
+ // | 'UPI'
216
+ // | 'USD-coin'
217
+ // | 'VCreditos'
218
+ // | 'VenusPoint'
219
+ // | 'voucher-2'
220
+ // | 'voucher-3'
221
+ // | 'voucher-4'
222
+ // | 'voucher'
223
+ // | 'Webmoney'
224
+ // | 'Webpay Card'
225
+ // | 'Webpay-2'
226
+ // | 'Webpay'
227
+ // | 'WeChat Pay'
228
+ // | 'XPay-P2P'
229
+ // | 'XPay-QR'
230
+ // | 'Yandex-money'
231
+ // | 'Zimpler'
232
+ // | 'Zotapay'
233
+
234
+ export interface CreatePaymentTokenRequest {
235
+ billingAddress: RequestBillingAddress
236
+ method: PaymentMethod
237
+ paymentInstrument: RequestPaymentCardInstrument
238
+ }
@@ -0,0 +1,73 @@
1
+ import { PaymentMethod, RequestBillingAddress } from './Request'
2
+
3
+ export interface ResponseBillingAddress extends RequestBillingAddress {
4
+ hash?: string | null
5
+ }
6
+
7
+ /**
8
+ * Main interface for API response encapsulating all relevant details.
9
+ */
10
+ export interface CreateTokenResponse {
11
+ /** Hyperlinks to related API resources. */
12
+ _links: Link[]
13
+ /** Billing address associated with the payment token. */
14
+ billingAddress: ResponseBillingAddress
15
+ /** Card brand such as Visa or Mastercard. */
16
+ brand: string
17
+ /** An identifier for the browser data. */
18
+ browserData: unknown | null
19
+ /** Date and time when the token was created. */
20
+ createdTime: string
21
+ /** Expiration time of the token. */
22
+ expirationTime: string | null
23
+ /** Date and time when the token expired. */
24
+ expiredTime: string | null
25
+ /** An identifier for the fingerprint of the device used. */
26
+ fingerprint: string | null
27
+ /** An identifier of the token. */
28
+ id: string
29
+ /** Indicates if the token has been used. */
30
+ isUsed: boolean
31
+ /** The last four digits of the payment instrument. */
32
+ last4: string
33
+ /** Payment method such as 'payment-card'. */
34
+ method: PaymentMethod
35
+ /** Payment instrument details. */
36
+ paymentInstrument: ResponsePaymentCardInstrument
37
+ /** Metadata related to risk evaluation. */
38
+ riskMetadata: unknown | null
39
+ /** Date and time when the token was last updated. */
40
+ updatedTime: string
41
+ /** Usage time of the token. */
42
+ usageTime: string | null
43
+ /** Indicates if the token has already been used. */
44
+ used: boolean
45
+ /** Date and time when the token was first used. */
46
+ usedTime: string | null
47
+ }
48
+
49
+ /**
50
+ * Payment instrument details such as credit card information.
51
+ */
52
+ export interface ResponsePaymentCardInstrument {
53
+ /** Bank identification number or issuer identification number of the card. */
54
+ bin: string
55
+ /** Card brand such as Visa or Mastercard. */
56
+ brand: string
57
+ /** Expiration month of the card. */
58
+ expMonth: number
59
+ /** Expiration year of the card. */
60
+ expYear: number
61
+ /** Last four digits of the card number. */
62
+ last4: string
63
+ }
64
+
65
+ /**
66
+ * Links structure for API navigation.
67
+ */
68
+ export interface Link {
69
+ /** URL of the related resource. */
70
+ href: string
71
+ /** Relation type of the link. */
72
+ rel: string
73
+ }
@@ -0,0 +1,2 @@
1
+ export * from './Request'
2
+ export * from './Response'
@@ -0,0 +1 @@
1
+ export * from './PaymentCardToken'
package/src/Config.ts ADDED
@@ -0,0 +1,18 @@
1
+ import { SentinelConfig } from '@xyo-network/sentinel-model'
2
+
3
+ import { RebillyApiDomainSettings } from './RebillyProviderSettings'
4
+ import { RebillyPaymentCardAuthorizationSentinelSchema } from './Schema'
5
+
6
+ export const RebillyPaymentCardAuthorizationSentinelConfigSchema = `${RebillyPaymentCardAuthorizationSentinelSchema}.config`
7
+ export type RebillyPaymentCardAuthorizationSentinelConfigSchema = typeof RebillyPaymentCardAuthorizationSentinelConfigSchema
8
+
9
+ /*
10
+ * The Rebilly Payment Card Authorization Sentinel Config
11
+ */
12
+ export type RebillyPaymentCardAuthorizationSentinelConfig = SentinelConfig<{
13
+ /**
14
+ * The config schema
15
+ */
16
+ schema: RebillyPaymentCardAuthorizationSentinelConfigSchema
17
+ }> &
18
+ Partial<RebillyApiDomainSettings>
package/src/Params.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { AnyConfigSchema } from '@xyo-network/module-model'
2
+ import { SentinelParams } from '@xyo-network/sentinel-model'
3
+
4
+ import { RebillyPaymentCardAuthorizationSentinelConfig } from './Config'
5
+ import { RebillyOrganizationSettings, RebillyPublishableApiSettings } from './RebillyProviderSettings'
6
+
7
+ export type RebillyPaymentCardAuthorizationParams = Partial<RebillyPublishableApiSettings & RebillyOrganizationSettings>
8
+
9
+ export type RebillyPaymentCardAuthorizationSentinelParams<
10
+ TConfig extends AnyConfigSchema<RebillyPaymentCardAuthorizationSentinelConfig> = AnyConfigSchema<RebillyPaymentCardAuthorizationSentinelConfig>,
11
+ TParams extends RebillyPaymentCardAuthorizationParams = RebillyPaymentCardAuthorizationParams,
12
+ > = SentinelParams<TConfig, TParams>
@@ -0,0 +1,23 @@
1
+ export interface RebillyApiDomainSettings {
2
+ /**
3
+ * The Rebilly domain (https://api-sandbox.rebilly.com, https://api.rebilly.com)
4
+ */
5
+ domain: 'https://api-sandbox.rebilly.com' | 'https://api.rebilly.com'
6
+ }
7
+
8
+ export interface RebillyApiKeySettings extends RebillyApiDomainSettings {
9
+ /*
10
+ * The Rebilly API key
11
+ */
12
+ apiKey: string
13
+ }
14
+ export interface RebillyApiSettings extends RebillyApiDomainSettings, RebillyApiKeySettings {}
15
+
16
+ export interface RebillyPublishableApiKeySettings extends RebillyApiDomainSettings {
17
+ /*
18
+ * The Rebilly Publishable API key
19
+ */
20
+ publishableApiKey: string
21
+ }
22
+
23
+ export interface RebillyPublishableApiSettings extends RebillyApiDomainSettings, RebillyPublishableApiKeySettings {}
@@ -0,0 +1,15 @@
1
+ export interface RebillyUserEmailSettings {
2
+ /**
3
+ * Email associated with Rebilly account
4
+ */
5
+ email: string
6
+ }
7
+
8
+ export interface RebillyUserPasswordSettings extends RebillyUserEmailSettings {
9
+ /**
10
+ * Password associated with Rebilly account
11
+ */
12
+ password: string
13
+ }
14
+
15
+ export interface RebillyAuthSettings extends RebillyUserEmailSettings, RebillyUserPasswordSettings {}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Rebilly organization settings
3
+ */
4
+ export interface RebillyOrganizationSettings {
5
+ /**
6
+ * The Rebilly organization ID
7
+ */
8
+ organizationId: string
9
+ }
@@ -0,0 +1,3 @@
1
+ export * from './RebillyApiSettings'
2
+ export * from './RebillyAuthSettings'
3
+ export * from './RebillyOrganizationSettings'
package/src/Schema.ts ADDED
@@ -0,0 +1,2 @@
1
+ export const RebillyPaymentCardAuthorizationSentinelSchema = 'network.xyo.sentinel.payments.payment.instrument.card.authorization.rebilly'
2
+ export type RebillyPaymentCardAuthorizationSentinelSchema = typeof RebillyPaymentCardAuthorizationSentinelSchema
@@ -0,0 +1,117 @@
1
+ import { assertEx } from '@xylabs/assert'
2
+ import { AxiosJson, AxiosRequestConfig, HttpStatusCode } from '@xylabs/axios'
3
+ import { IdPayload, IdSchema } from '@xyo-network/id-payload-plugin'
4
+ import { PayloadBuilder } from '@xyo-network/payload-builder'
5
+ import { Payload, WithSources } from '@xyo-network/payload-model'
6
+ import { isBillingAddress, isPaymentCard } from '@xyo-network/payment-payload-plugins'
7
+ import { AbstractSentinel } from '@xyo-network/sentinel-abstract'
8
+ import { SentinelInstance, SentinelModuleEventData } from '@xyo-network/sentinel-model'
9
+
10
+ import { CreateTokenResponse } from './Api'
11
+ import { RebillyPaymentCardAuthorizationSentinelConfigSchema } from './Config'
12
+ import { RebillyPaymentCardAuthorizationSentinelParams } from './Params'
13
+ import { toTokenRequest } from './util'
14
+
15
+ const removePrefix = (str: string, prefix: string) => {
16
+ const regex = new RegExp(`^${prefix}`)
17
+ return str.replace(regex, '')
18
+ }
19
+
20
+ const moduleName = 'RebillyPaymentCardAuthorizationSentinel'
21
+ export class RebillyPaymentCardAuthorizationSentinel<
22
+ TParams extends RebillyPaymentCardAuthorizationSentinelParams = RebillyPaymentCardAuthorizationSentinelParams,
23
+ TEventData extends SentinelModuleEventData<SentinelInstance<TParams>> = SentinelModuleEventData<SentinelInstance<TParams>>,
24
+ > extends AbstractSentinel<TParams, TEventData> {
25
+ static override configSchemas = [RebillyPaymentCardAuthorizationSentinelConfigSchema]
26
+ static override defaultConfigSchema = RebillyPaymentCardAuthorizationSentinelConfigSchema
27
+
28
+ protected _apiRoot: string | undefined = undefined
29
+ protected _domain: string | undefined = undefined
30
+ protected _headers: AxiosRequestConfig['headers'] | undefined = undefined
31
+ protected _organizationId: string | undefined = undefined
32
+ protected _publishableApiKey: string | undefined = undefined
33
+ protected _tokenEndpoint: string | undefined = undefined
34
+
35
+ /**
36
+ * The Rebilly Organization API root endpoint
37
+ */
38
+ protected get apiRoot() {
39
+ if (!this._apiRoot) this._apiRoot = `${this.domain}/organizations/${this.organizationId}`
40
+ return this._apiRoot
41
+ }
42
+
43
+ /**
44
+ * The Rebilly domain
45
+ */
46
+ protected get domain() {
47
+ if (!this._domain) this._domain = assertEx(this.params.domain ?? this.config.domain, () => `${moduleName}: Missing domain in params/config`)
48
+ return this._domain
49
+ }
50
+
51
+ /**
52
+ * The headers to be included in the request for each request
53
+ */
54
+ protected get headers(): AxiosRequestConfig['headers'] {
55
+ if (!this._headers) this._headers = { Authorization: this.publishableApiKey }
56
+ return this._headers
57
+ }
58
+
59
+ /**
60
+ * True if the environment is sandbox (testing), false otherwise
61
+ */
62
+ protected get isSandboxEnvironment(): boolean {
63
+ return this.domain.includes('sandbox')
64
+ }
65
+
66
+ /**
67
+ * The Rebilly organization ID
68
+ */
69
+ protected get organizationId() {
70
+ if (!this._organizationId)
71
+ this._organizationId = removePrefix(
72
+ assertEx(this.params.organizationId, () => `${moduleName}: Missing organizationId in params`),
73
+ 'org_',
74
+ )
75
+ return this._organizationId
76
+ }
77
+
78
+ /**
79
+ * The Rebilly Publishable API key
80
+ */
81
+ protected get publishableApiKey(): string {
82
+ if (!this._publishableApiKey)
83
+ this._publishableApiKey = assertEx(this.params.publishableApiKey, () => `${moduleName}: Missing publishableApiKey in params`)
84
+ return this._publishableApiKey
85
+ }
86
+
87
+ /**
88
+ * The Rebilly Organization token creation endpoint
89
+ */
90
+ protected get tokenEndpoint() {
91
+ if (!this._tokenEndpoint) this._tokenEndpoint = `${this.apiRoot}/tokens`
92
+ return this._tokenEndpoint
93
+ }
94
+
95
+ override async reportHandler(payloads?: Payload[]): Promise<Payload[]> {
96
+ await this.started('throw')
97
+ const results: WithSources<IdPayload>[] = []
98
+ // Verify necessary inputs and if nothing meets our criteria, bail early
99
+ if (!payloads || payloads.length === 0) return results
100
+ const paymentCard = payloads?.find(isPaymentCard)
101
+ if (!paymentCard) return results
102
+ const billingAddress = payloads?.find(isBillingAddress)
103
+ if (!billingAddress) return results
104
+ const axios = new AxiosJson({ headers: this.headers })
105
+ try {
106
+ const data = toTokenRequest(paymentCard, billingAddress)
107
+ const response = await axios.post<CreateTokenResponse>(this.tokenEndpoint, data)
108
+ assertEx(response.status === HttpStatusCode.Created, () => `Failed to tokenize payment card: ${response.status}`)
109
+ const token = response.data
110
+ const sources = await PayloadBuilder.dataHashes([paymentCard, billingAddress])
111
+ results.push({ salt: token.id, schema: IdSchema, sources })
112
+ } catch (error) {
113
+ this.logger?.error?.(`${moduleName}: Error creating payment token: ${error}`)
114
+ }
115
+ return results
116
+ }
117
+ }
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from './Config'
2
+ export * from './Params'
3
+ export * from './Schema'
4
+ export * from './Sentinel'
@@ -0,0 +1 @@
1
+ export * from './toTokenRequest'
@@ -0,0 +1,24 @@
1
+ import { BillingAddress, PaymentCard } from '@xyo-network/payment-payload-plugins'
2
+
3
+ import { CreatePaymentTokenRequest } from '../Api'
4
+
5
+ /**
6
+ * Converts a payment card and billing address to a token request
7
+ * @param paymentCard The payment card
8
+ * @param billingAddress The billing address
9
+ * @returns The token request
10
+ */
11
+ export const toTokenRequest = (paymentCard: PaymentCard, billingAddress: BillingAddress): CreatePaymentTokenRequest => {
12
+ const { cvv, expMonth, expYear, cardNumber } = paymentCard
13
+ // NOTE: We are destructuring all but the schema and passing it along to the billingAddress. This
14
+ // is to allow for missing fields to be omitted rather than set to undefined and for any new fields
15
+ // that might be added later to be automatically picked up on. It is fine to pass this along since
16
+ // the user is supplying this data about themselves.
17
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
18
+ const { schema: _, ...fields } = billingAddress
19
+ return {
20
+ billingAddress: { ...fields },
21
+ method: 'payment-card',
22
+ paymentInstrument: { cvv, expMonth, expYear, pan: cardNumber },
23
+ }
24
+ }
package/typedoc.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://typedoc.org/schema.json",
3
+ "entryPoints": ["./src/index.ts"],
4
+ "tsconfig": "./tsconfig.typedoc.json"
5
+ }
package/xy.config.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
2
+ const config: XyTsupConfig = {
3
+ compile: {
4
+ browser: {
5
+ src: true,
6
+ },
7
+ node: {
8
+ src: true,
9
+ },
10
+ },
11
+ }
12
+
13
+ // eslint-disable-next-line import/no-default-export
14
+ export default config