@bates-solutions/squareup 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +154 -0
  3. package/README.md.backup +292 -0
  4. package/dist/angular/__tests__/setup.d.ts +1 -0
  5. package/dist/angular/__tests__/setup.d.ts.map +1 -0
  6. package/dist/angular/__tests__/setup.js +5 -0
  7. package/dist/angular/__tests__/setup.js.map +1 -0
  8. package/dist/angular/components/index.d.ts +2 -0
  9. package/dist/angular/components/index.d.ts.map +1 -0
  10. package/dist/angular/components/index.js +2 -0
  11. package/dist/angular/components/index.js.map +1 -0
  12. package/dist/angular/components/payment-button.component.d.ts +49 -0
  13. package/dist/angular/components/payment-button.component.d.ts.map +1 -0
  14. package/dist/angular/components/payment-button.component.js +176 -0
  15. package/dist/angular/components/payment-button.component.js.map +1 -0
  16. package/dist/angular/directives/index.d.ts +2 -0
  17. package/dist/angular/directives/index.d.ts.map +1 -0
  18. package/dist/angular/directives/index.js +2 -0
  19. package/dist/angular/directives/index.js.map +1 -0
  20. package/dist/angular/directives/square-card.directive.d.ts +52 -0
  21. package/dist/angular/directives/square-card.directive.d.ts.map +1 -0
  22. package/dist/angular/directives/square-card.directive.js +98 -0
  23. package/dist/angular/directives/square-card.directive.js.map +1 -0
  24. package/dist/angular/index.d.ts +42 -0
  25. package/dist/angular/index.d.ts.map +1 -0
  26. package/dist/angular/index.js +45 -0
  27. package/dist/angular/index.js.map +1 -0
  28. package/dist/angular/services/index.d.ts +6 -0
  29. package/dist/angular/services/index.d.ts.map +1 -0
  30. package/dist/angular/services/index.js +6 -0
  31. package/dist/angular/services/index.js.map +1 -0
  32. package/dist/angular/services/square-catalog.service.d.ts +60 -0
  33. package/dist/angular/services/square-catalog.service.d.ts.map +1 -0
  34. package/dist/angular/services/square-catalog.service.js +152 -0
  35. package/dist/angular/services/square-catalog.service.js.map +1 -0
  36. package/dist/angular/services/square-customers.service.d.ts +77 -0
  37. package/dist/angular/services/square-customers.service.d.ts.map +1 -0
  38. package/dist/angular/services/square-customers.service.js +187 -0
  39. package/dist/angular/services/square-customers.service.js.map +1 -0
  40. package/dist/angular/services/square-orders.service.d.ts +66 -0
  41. package/dist/angular/services/square-orders.service.d.ts.map +1 -0
  42. package/dist/angular/services/square-orders.service.js +170 -0
  43. package/dist/angular/services/square-orders.service.js.map +1 -0
  44. package/dist/angular/services/square-payments.service.d.ts +73 -0
  45. package/dist/angular/services/square-payments.service.d.ts.map +1 -0
  46. package/dist/angular/services/square-payments.service.js +167 -0
  47. package/dist/angular/services/square-payments.service.js.map +1 -0
  48. package/dist/angular/services/square-sdk.service.d.ts +45 -0
  49. package/dist/angular/services/square-sdk.service.d.ts.map +1 -0
  50. package/dist/angular/services/square-sdk.service.js +133 -0
  51. package/dist/angular/services/square-sdk.service.js.map +1 -0
  52. package/dist/angular/square.module.d.ts +36 -0
  53. package/dist/angular/square.module.d.ts.map +1 -0
  54. package/dist/angular/square.module.js +75 -0
  55. package/dist/angular/square.module.js.map +1 -0
  56. package/dist/angular/types.d.ts +189 -0
  57. package/dist/angular/types.d.ts.map +1 -0
  58. package/dist/angular/types.js +8 -0
  59. package/dist/angular/types.js.map +1 -0
  60. package/dist/core/builders/order.builder.d.ts +140 -0
  61. package/dist/core/builders/order.builder.d.ts.map +1 -0
  62. package/dist/core/builders/order.builder.js +185 -0
  63. package/dist/core/builders/order.builder.js.map +1 -0
  64. package/dist/core/client.d.ts +93 -0
  65. package/dist/core/client.d.ts.map +1 -0
  66. package/dist/core/client.js +99 -0
  67. package/dist/core/client.js.map +1 -0
  68. package/dist/core/errors.d.ts +55 -0
  69. package/dist/core/errors.d.ts.map +1 -0
  70. package/dist/core/errors.js +118 -0
  71. package/dist/core/errors.js.map +1 -0
  72. package/dist/core/index.d.ts +17 -0
  73. package/dist/core/index.d.ts.map +1 -0
  74. package/dist/core/index.js +18 -0
  75. package/dist/core/index.js.map +1 -0
  76. package/dist/core/services/catalog.service.d.ts +218 -0
  77. package/dist/core/services/catalog.service.d.ts.map +1 -0
  78. package/dist/core/services/catalog.service.js +274 -0
  79. package/dist/core/services/catalog.service.js.map +1 -0
  80. package/dist/core/services/customers.service.d.ts +197 -0
  81. package/dist/core/services/customers.service.d.ts.map +1 -0
  82. package/dist/core/services/customers.service.js +246 -0
  83. package/dist/core/services/customers.service.js.map +1 -0
  84. package/dist/core/services/inventory.service.d.ts +196 -0
  85. package/dist/core/services/inventory.service.d.ts.map +1 -0
  86. package/dist/core/services/inventory.service.js +266 -0
  87. package/dist/core/services/inventory.service.js.map +1 -0
  88. package/dist/core/services/invoices.service.d.ts +211 -0
  89. package/dist/core/services/invoices.service.d.ts.map +1 -0
  90. package/dist/core/services/invoices.service.js +297 -0
  91. package/dist/core/services/invoices.service.js.map +1 -0
  92. package/dist/core/services/loyalty.service.d.ts +282 -0
  93. package/dist/core/services/loyalty.service.d.ts.map +1 -0
  94. package/dist/core/services/loyalty.service.js +340 -0
  95. package/dist/core/services/loyalty.service.js.map +1 -0
  96. package/dist/core/services/orders.service.d.ts +121 -0
  97. package/dist/core/services/orders.service.d.ts.map +1 -0
  98. package/dist/core/services/orders.service.js +208 -0
  99. package/dist/core/services/orders.service.js.map +1 -0
  100. package/dist/core/services/payments.service.d.ts +121 -0
  101. package/dist/core/services/payments.service.d.ts.map +1 -0
  102. package/dist/core/services/payments.service.js +189 -0
  103. package/dist/core/services/payments.service.js.map +1 -0
  104. package/dist/core/services/subscriptions.service.d.ts +205 -0
  105. package/dist/core/services/subscriptions.service.d.ts.map +1 -0
  106. package/dist/core/services/subscriptions.service.js +265 -0
  107. package/dist/core/services/subscriptions.service.js.map +1 -0
  108. package/dist/core/types/index.d.ts +68 -0
  109. package/dist/core/types/index.d.ts.map +1 -0
  110. package/dist/core/types/index.js +2 -0
  111. package/dist/core/types/index.js.map +1 -0
  112. package/dist/core/utils.d.ts +74 -0
  113. package/dist/core/utils.d.ts.map +1 -0
  114. package/dist/core/utils.js +96 -0
  115. package/dist/core/utils.js.map +1 -0
  116. package/dist/react/SquareProvider.d.ts +50 -0
  117. package/dist/react/SquareProvider.d.ts.map +1 -0
  118. package/dist/react/SquareProvider.js +134 -0
  119. package/dist/react/SquareProvider.js.map +1 -0
  120. package/dist/react/__tests__/CardInput.test.d.ts +2 -0
  121. package/dist/react/__tests__/CardInput.test.d.ts.map +1 -0
  122. package/dist/react/__tests__/CardInput.test.js +218 -0
  123. package/dist/react/__tests__/CardInput.test.js.map +1 -0
  124. package/dist/react/__tests__/PaymentButton.test.d.ts +2 -0
  125. package/dist/react/__tests__/PaymentButton.test.d.ts.map +1 -0
  126. package/dist/react/__tests__/PaymentButton.test.js +400 -0
  127. package/dist/react/__tests__/PaymentButton.test.js.map +1 -0
  128. package/dist/react/__tests__/SquareProvider.test.d.ts +2 -0
  129. package/dist/react/__tests__/SquareProvider.test.d.ts.map +1 -0
  130. package/dist/react/__tests__/SquareProvider.test.js +126 -0
  131. package/dist/react/__tests__/SquareProvider.test.js.map +1 -0
  132. package/dist/react/__tests__/setup.d.ts +2 -0
  133. package/dist/react/__tests__/setup.d.ts.map +1 -0
  134. package/dist/react/__tests__/setup.js +3 -0
  135. package/dist/react/__tests__/setup.js.map +1 -0
  136. package/dist/react/__tests__/useCatalog.test.d.ts +2 -0
  137. package/dist/react/__tests__/useCatalog.test.d.ts.map +1 -0
  138. package/dist/react/__tests__/useCatalog.test.js +277 -0
  139. package/dist/react/__tests__/useCatalog.test.js.map +1 -0
  140. package/dist/react/__tests__/useCustomers.test.d.ts +2 -0
  141. package/dist/react/__tests__/useCustomers.test.d.ts.map +1 -0
  142. package/dist/react/__tests__/useCustomers.test.js +312 -0
  143. package/dist/react/__tests__/useCustomers.test.js.map +1 -0
  144. package/dist/react/__tests__/useOrders.test.d.ts +2 -0
  145. package/dist/react/__tests__/useOrders.test.d.ts.map +1 -0
  146. package/dist/react/__tests__/useOrders.test.js +216 -0
  147. package/dist/react/__tests__/useOrders.test.js.map +1 -0
  148. package/dist/react/__tests__/usePayments.test.d.ts +2 -0
  149. package/dist/react/__tests__/usePayments.test.d.ts.map +1 -0
  150. package/dist/react/__tests__/usePayments.test.js +235 -0
  151. package/dist/react/__tests__/usePayments.test.js.map +1 -0
  152. package/dist/react/__tests__/useSquarePayment.test.d.ts +2 -0
  153. package/dist/react/__tests__/useSquarePayment.test.d.ts.map +1 -0
  154. package/dist/react/__tests__/useSquarePayment.test.js +447 -0
  155. package/dist/react/__tests__/useSquarePayment.test.js.map +1 -0
  156. package/dist/react/components/CardInput.d.ts +69 -0
  157. package/dist/react/components/CardInput.d.ts.map +1 -0
  158. package/dist/react/components/CardInput.js +58 -0
  159. package/dist/react/components/CardInput.js.map +1 -0
  160. package/dist/react/components/PaymentButton.d.ts +71 -0
  161. package/dist/react/components/PaymentButton.d.ts.map +1 -0
  162. package/dist/react/components/PaymentButton.js +140 -0
  163. package/dist/react/components/PaymentButton.js.map +1 -0
  164. package/dist/react/components/index.d.ts +5 -0
  165. package/dist/react/components/index.d.ts.map +1 -0
  166. package/dist/react/components/index.js +3 -0
  167. package/dist/react/components/index.js.map +1 -0
  168. package/dist/react/hooks/index.d.ts +11 -0
  169. package/dist/react/hooks/index.d.ts.map +1 -0
  170. package/dist/react/hooks/index.js +6 -0
  171. package/dist/react/hooks/index.js.map +1 -0
  172. package/dist/react/hooks/useCatalog.d.ts +98 -0
  173. package/dist/react/hooks/useCatalog.d.ts.map +1 -0
  174. package/dist/react/hooks/useCatalog.js +134 -0
  175. package/dist/react/hooks/useCatalog.js.map +1 -0
  176. package/dist/react/hooks/useCustomers.d.ts +105 -0
  177. package/dist/react/hooks/useCustomers.d.ts.map +1 -0
  178. package/dist/react/hooks/useCustomers.js +174 -0
  179. package/dist/react/hooks/useCustomers.js.map +1 -0
  180. package/dist/react/hooks/useOrders.d.ts +112 -0
  181. package/dist/react/hooks/useOrders.d.ts.map +1 -0
  182. package/dist/react/hooks/useOrders.js +115 -0
  183. package/dist/react/hooks/useOrders.js.map +1 -0
  184. package/dist/react/hooks/usePayments.d.ts +98 -0
  185. package/dist/react/hooks/usePayments.d.ts.map +1 -0
  186. package/dist/react/hooks/usePayments.js +89 -0
  187. package/dist/react/hooks/usePayments.js.map +1 -0
  188. package/dist/react/hooks/useSquarePayment.d.ts +52 -0
  189. package/dist/react/hooks/useSquarePayment.d.ts.map +1 -0
  190. package/dist/react/hooks/useSquarePayment.js +146 -0
  191. package/dist/react/hooks/useSquarePayment.js.map +1 -0
  192. package/dist/react/index.d.ts +8 -0
  193. package/dist/react/index.d.ts.map +1 -0
  194. package/dist/react/index.js +7 -0
  195. package/dist/react/index.js.map +1 -0
  196. package/dist/react/types.d.ts +183 -0
  197. package/dist/react/types.d.ts.map +1 -0
  198. package/dist/react/types.js +2 -0
  199. package/dist/react/types.js.map +1 -0
  200. package/dist/server/index.d.ts +43 -0
  201. package/dist/server/index.d.ts.map +1 -0
  202. package/dist/server/index.js +45 -0
  203. package/dist/server/index.js.map +1 -0
  204. package/dist/server/middleware/express.d.ts +77 -0
  205. package/dist/server/middleware/express.d.ts.map +1 -0
  206. package/dist/server/middleware/express.js +123 -0
  207. package/dist/server/middleware/express.js.map +1 -0
  208. package/dist/server/middleware/nextjs.d.ts +118 -0
  209. package/dist/server/middleware/nextjs.d.ts.map +1 -0
  210. package/dist/server/middleware/nextjs.js +172 -0
  211. package/dist/server/middleware/nextjs.js.map +1 -0
  212. package/dist/server/types.d.ts +89 -0
  213. package/dist/server/types.d.ts.map +1 -0
  214. package/dist/server/types.js +7 -0
  215. package/dist/server/types.js.map +1 -0
  216. package/dist/server/webhook.d.ts +114 -0
  217. package/dist/server/webhook.d.ts.map +1 -0
  218. package/dist/server/webhook.js +190 -0
  219. package/dist/server/webhook.js.map +1 -0
  220. package/package.json +118 -0
@@ -0,0 +1,297 @@
1
+ import { parseSquareError, SquareValidationError } from '../errors.js';
2
+ import { createIdempotencyKey } from '../utils.js';
3
+ /**
4
+ * Invoices service for managing Square invoices
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * // Create an invoice
9
+ * const invoice = await square.invoices.create({
10
+ * customerId: 'CUST_123',
11
+ * lineItems: [
12
+ * { name: 'Consulting', quantity: 2, amount: 15000 },
13
+ * ],
14
+ * dueDate: '2024-02-15',
15
+ * });
16
+ *
17
+ * // Publish (send) the invoice
18
+ * await square.invoices.publish(invoice.id, invoice.version);
19
+ * ```
20
+ */
21
+ export class InvoicesService {
22
+ client;
23
+ defaultLocationId;
24
+ constructor(client, defaultLocationId) {
25
+ this.client = client;
26
+ this.defaultLocationId = defaultLocationId;
27
+ }
28
+ /**
29
+ * Create a draft invoice
30
+ *
31
+ * @param options - Invoice creation options
32
+ * @returns Created invoice (in DRAFT status)
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * const invoice = await square.invoices.create({
37
+ * customerId: 'CUST_123',
38
+ * lineItems: [
39
+ * { name: 'Web Development', quantity: 10, amount: 10000 },
40
+ * { name: 'Design Services', quantity: 5, amount: 7500 },
41
+ * ],
42
+ * title: 'January Services',
43
+ * dueDate: '2024-02-01',
44
+ * deliveryMethod: 'EMAIL',
45
+ * });
46
+ * ```
47
+ */
48
+ async create(options) {
49
+ const locationId = options.locationId ?? this.defaultLocationId;
50
+ if (!locationId) {
51
+ throw new SquareValidationError('locationId is required. Set it in client config or provide it explicitly.', 'locationId');
52
+ }
53
+ if (!options.customerId) {
54
+ throw new SquareValidationError('customerId is required', 'customerId');
55
+ }
56
+ if (options.lineItems.length === 0) {
57
+ throw new SquareValidationError('At least one line item is required', 'lineItems');
58
+ }
59
+ try {
60
+ // First create an order for the invoice
61
+ const orderResponse = await this.client.orders.create({
62
+ order: {
63
+ locationId,
64
+ customerId: options.customerId,
65
+ lineItems: options.lineItems.map((item) => ({
66
+ name: item.name,
67
+ quantity: String(item.quantity),
68
+ basePriceMoney: {
69
+ amount: BigInt(item.amount),
70
+ currency: item.currency ?? 'USD',
71
+ },
72
+ note: item.description,
73
+ })),
74
+ },
75
+ idempotencyKey: createIdempotencyKey(),
76
+ });
77
+ if (!orderResponse.order?.id) {
78
+ throw new Error('Failed to create order for invoice');
79
+ }
80
+ // Create the invoice
81
+ const response = await this.client.invoices.create({
82
+ invoice: {
83
+ locationId,
84
+ orderId: orderResponse.order.id,
85
+ primaryRecipient: {
86
+ customerId: options.customerId,
87
+ },
88
+ title: options.title,
89
+ description: options.description,
90
+ invoiceNumber: options.invoiceNumber,
91
+ deliveryMethod: options.deliveryMethod ?? 'EMAIL',
92
+ paymentRequests: [
93
+ {
94
+ requestType: 'BALANCE',
95
+ dueDate: options.dueDate,
96
+ tippingEnabled: options.tippingEnabled ?? false,
97
+ },
98
+ ],
99
+ },
100
+ idempotencyKey: options.idempotencyKey ?? createIdempotencyKey(),
101
+ });
102
+ if (!response.invoice) {
103
+ throw new Error('Invoice was not created');
104
+ }
105
+ return response.invoice;
106
+ }
107
+ catch (error) {
108
+ throw parseSquareError(error);
109
+ }
110
+ }
111
+ /**
112
+ * Get an invoice by ID
113
+ *
114
+ * @param invoiceId - Invoice ID
115
+ * @returns Invoice details
116
+ *
117
+ * @example
118
+ * ```typescript
119
+ * const invoice = await square.invoices.get('INV_123');
120
+ * ```
121
+ */
122
+ async get(invoiceId) {
123
+ try {
124
+ const response = await this.client.invoices.get({ invoiceId });
125
+ if (!response.invoice) {
126
+ throw new Error('Invoice not found');
127
+ }
128
+ return response.invoice;
129
+ }
130
+ catch (error) {
131
+ throw parseSquareError(error);
132
+ }
133
+ }
134
+ /**
135
+ * Publish (send) an invoice
136
+ *
137
+ * @param invoiceId - Invoice ID
138
+ * @param version - Invoice version (for optimistic concurrency)
139
+ * @returns Published invoice
140
+ *
141
+ * @example
142
+ * ```typescript
143
+ * const invoice = await square.invoices.publish('INV_123', 0);
144
+ * console.log(`Invoice sent: ${invoice.publicUrl}`);
145
+ * ```
146
+ */
147
+ async publish(invoiceId, version) {
148
+ try {
149
+ const response = await this.client.invoices.publish({
150
+ invoiceId,
151
+ version,
152
+ idempotencyKey: createIdempotencyKey(),
153
+ });
154
+ if (!response.invoice) {
155
+ throw new Error('Invoice publish failed');
156
+ }
157
+ return response.invoice;
158
+ }
159
+ catch (error) {
160
+ throw parseSquareError(error);
161
+ }
162
+ }
163
+ /**
164
+ * Cancel an invoice
165
+ *
166
+ * @param invoiceId - Invoice ID
167
+ * @param version - Invoice version (for optimistic concurrency)
168
+ * @returns Cancelled invoice
169
+ *
170
+ * @example
171
+ * ```typescript
172
+ * const invoice = await square.invoices.cancel('INV_123', 1);
173
+ * ```
174
+ */
175
+ async cancel(invoiceId, version) {
176
+ try {
177
+ const response = await this.client.invoices.cancel({
178
+ invoiceId,
179
+ version,
180
+ });
181
+ if (!response.invoice) {
182
+ throw new Error('Invoice cancellation failed');
183
+ }
184
+ return response.invoice;
185
+ }
186
+ catch (error) {
187
+ throw parseSquareError(error);
188
+ }
189
+ }
190
+ /**
191
+ * Update an invoice
192
+ *
193
+ * @param invoiceId - Invoice ID
194
+ * @param version - Invoice version (for optimistic concurrency)
195
+ * @param options - Update options
196
+ * @returns Updated invoice
197
+ *
198
+ * @example
199
+ * ```typescript
200
+ * const invoice = await square.invoices.update('INV_123', 0, {
201
+ * title: 'Updated Title',
202
+ * });
203
+ * ```
204
+ */
205
+ async update(invoiceId, version, options) {
206
+ try {
207
+ const fieldsToClear = [];
208
+ if (options.title === '')
209
+ fieldsToClear.push('title');
210
+ if (options.description === '')
211
+ fieldsToClear.push('description');
212
+ const response = await this.client.invoices.update({
213
+ invoiceId,
214
+ invoice: {
215
+ version,
216
+ title: options.title ?? undefined,
217
+ description: options.description ?? undefined,
218
+ paymentRequests: options.dueDate
219
+ ? [
220
+ {
221
+ requestType: 'BALANCE',
222
+ dueDate: options.dueDate,
223
+ },
224
+ ]
225
+ : undefined,
226
+ },
227
+ idempotencyKey: createIdempotencyKey(),
228
+ fieldsToClear: fieldsToClear.length > 0 ? fieldsToClear : undefined,
229
+ });
230
+ if (!response.invoice) {
231
+ throw new Error('Invoice update failed');
232
+ }
233
+ return response.invoice;
234
+ }
235
+ catch (error) {
236
+ throw parseSquareError(error);
237
+ }
238
+ }
239
+ /**
240
+ * Delete a draft invoice
241
+ *
242
+ * @param invoiceId - Invoice ID
243
+ * @param version - Invoice version
244
+ *
245
+ * @example
246
+ * ```typescript
247
+ * await square.invoices.delete('INV_123', 0);
248
+ * ```
249
+ */
250
+ async delete(invoiceId, version) {
251
+ try {
252
+ await this.client.invoices.delete({ invoiceId, version });
253
+ }
254
+ catch (error) {
255
+ throw parseSquareError(error);
256
+ }
257
+ }
258
+ /**
259
+ * Search for invoices
260
+ *
261
+ * @param options - Search options
262
+ * @returns Matching invoices with pagination
263
+ *
264
+ * @example
265
+ * ```typescript
266
+ * const results = await square.invoices.search({
267
+ * customerId: 'CUST_123',
268
+ * });
269
+ * ```
270
+ */
271
+ async search(options) {
272
+ const locationIds = options?.locationIds ?? (this.defaultLocationId ? [this.defaultLocationId] : []);
273
+ if (locationIds.length === 0) {
274
+ throw new SquareValidationError('At least one locationId is required for search');
275
+ }
276
+ try {
277
+ const response = await this.client.invoices.search({
278
+ query: {
279
+ filter: {
280
+ locationIds,
281
+ customerIds: options?.customerId ? [options.customerId] : undefined,
282
+ },
283
+ },
284
+ cursor: options?.cursor,
285
+ limit: options?.limit,
286
+ });
287
+ return {
288
+ data: (response.invoices ?? []),
289
+ cursor: response.cursor,
290
+ };
291
+ }
292
+ catch (error) {
293
+ throw parseSquareError(error);
294
+ }
295
+ }
296
+ }
297
+ //# sourceMappingURL=invoices.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoices.service.js","sourceRoot":"","sources":["../../../src/core/services/invoices.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAyFnD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,eAAe;IAEP;IACA;IAFnB,YACmB,MAAo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C,MAAM,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;QAC5D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,MAAM,CAAC,OAKZ;QACC,MAAM,WAAW,GACf,OAAO,EAAE,WAAW,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAEnF,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,qBAAqB,CAAC,gDAAgD,CAAC,CAAC;QACpF,CAAC;QAED,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;gBACjD,KAAK,EAAE;oBACL,MAAM,EAAE;wBACN,WAAW;wBACX,WAAW,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;qBACpE;iBACF;gBACD,MAAM,EAAE,OAAO,EAAE,MAAM;gBACvB,KAAK,EAAE,OAAO,EAAE,KAAK;aACtB,CAAC,CAAC;YAEH,OAAO;gBACL,IAAI,EAAE,CAAC,QAAQ,CAAC,QAAQ,IAAI,EAAE,CAAc;gBAC5C,MAAM,EAAE,QAAQ,CAAC,MAAM;aACxB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,282 @@
1
+ import type { SquareClient } from 'square';
2
+ /**
3
+ * Loyalty account from Square API
4
+ */
5
+ export interface LoyaltyAccount {
6
+ id?: string;
7
+ programId?: string;
8
+ balance?: number;
9
+ lifetimePoints?: number;
10
+ customerId?: string;
11
+ enrolledAt?: string;
12
+ createdAt?: string;
13
+ updatedAt?: string;
14
+ mapping?: {
15
+ id?: string;
16
+ phoneNumber?: string;
17
+ };
18
+ expiringPointDeadlines?: Array<{
19
+ points?: number;
20
+ expiresAt?: string;
21
+ }>;
22
+ }
23
+ /**
24
+ * Loyalty program from Square API
25
+ */
26
+ export interface LoyaltyProgram {
27
+ id?: string;
28
+ status?: 'INACTIVE' | 'ACTIVE';
29
+ rewardTiers?: Array<{
30
+ id?: string;
31
+ points?: number;
32
+ name?: string;
33
+ definition?: {
34
+ scope?: string;
35
+ discountType?: string;
36
+ percentageDiscount?: string;
37
+ catalogObjectIds?: string[];
38
+ };
39
+ createdAt?: string;
40
+ pricingRuleReference?: {
41
+ objectId?: string;
42
+ catalogVersion?: bigint;
43
+ };
44
+ }>;
45
+ terminology?: {
46
+ one?: string;
47
+ other?: string;
48
+ };
49
+ locationIds?: string[];
50
+ createdAt?: string;
51
+ updatedAt?: string;
52
+ accrualRules?: Array<{
53
+ accrualType?: string;
54
+ points?: number;
55
+ visitData?: {
56
+ minimumAmountMoney?: {
57
+ amount?: bigint;
58
+ currency?: string;
59
+ };
60
+ taxMode?: string;
61
+ };
62
+ spendData?: {
63
+ amountMoney?: {
64
+ amount?: bigint;
65
+ currency?: string;
66
+ };
67
+ excludedCategoryIds?: string[];
68
+ excludedItemVariationIds?: string[];
69
+ taxMode?: string;
70
+ };
71
+ }>;
72
+ expirationPolicy?: {
73
+ expirationDuration?: string;
74
+ };
75
+ }
76
+ /**
77
+ * Loyalty event from Square API
78
+ */
79
+ export interface LoyaltyEvent {
80
+ id?: string;
81
+ type?: string;
82
+ createdAt?: string;
83
+ loyaltyAccountId?: string;
84
+ source?: string;
85
+ accumulatePoints?: {
86
+ loyaltyProgramId?: string;
87
+ points?: number;
88
+ orderId?: string;
89
+ };
90
+ redeemReward?: {
91
+ loyaltyProgramId?: string;
92
+ rewardId?: string;
93
+ orderId?: string;
94
+ };
95
+ adjustPoints?: {
96
+ loyaltyProgramId?: string;
97
+ points?: number;
98
+ reason?: string;
99
+ };
100
+ }
101
+ /**
102
+ * Options for creating a loyalty account
103
+ */
104
+ export interface CreateLoyaltyAccountOptions {
105
+ programId: string;
106
+ phoneNumber?: string;
107
+ customerId?: string;
108
+ idempotencyKey?: string;
109
+ }
110
+ /**
111
+ * Loyalty service for managing Square loyalty programs
112
+ *
113
+ * @example
114
+ * ```typescript
115
+ * // Create a loyalty account
116
+ * const account = await square.loyalty.createAccount({
117
+ * programId: 'PROG_123',
118
+ * phoneNumber: '+15551234567',
119
+ * });
120
+ *
121
+ * // Add points
122
+ * await square.loyalty.accumulatePoints(account.id, {
123
+ * points: 100,
124
+ * });
125
+ *
126
+ * // Redeem a reward
127
+ * await square.loyalty.redeemReward(account.id, 'REWARD_123');
128
+ * ```
129
+ */
130
+ export declare class LoyaltyService {
131
+ private readonly client;
132
+ private readonly defaultLocationId?;
133
+ constructor(client: SquareClient, defaultLocationId?: string | undefined);
134
+ /**
135
+ * Get the loyalty program for the current location
136
+ *
137
+ * @param programId - Optional program ID (uses main program if not provided)
138
+ * @returns Loyalty program details
139
+ *
140
+ * @example
141
+ * ```typescript
142
+ * const program = await square.loyalty.getProgram();
143
+ * console.log(`Points name: ${program.terminology?.other}`);
144
+ * ```
145
+ */
146
+ getProgram(programId?: string): Promise<LoyaltyProgram>;
147
+ /**
148
+ * Create a new loyalty account
149
+ *
150
+ * @param options - Account creation options
151
+ * @returns Created loyalty account
152
+ *
153
+ * @example
154
+ * ```typescript
155
+ * const account = await square.loyalty.createAccount({
156
+ * programId: 'PROG_123',
157
+ * phoneNumber: '+15551234567',
158
+ * });
159
+ * ```
160
+ */
161
+ createAccount(options: CreateLoyaltyAccountOptions): Promise<LoyaltyAccount>;
162
+ /**
163
+ * Get a loyalty account by ID
164
+ *
165
+ * @param accountId - Loyalty account ID
166
+ * @returns Loyalty account details
167
+ *
168
+ * @example
169
+ * ```typescript
170
+ * const account = await square.loyalty.getAccount('ACCT_123');
171
+ * console.log(`Balance: ${account.balance} points`);
172
+ * ```
173
+ */
174
+ getAccount(accountId: string): Promise<LoyaltyAccount>;
175
+ /**
176
+ * Search for loyalty accounts
177
+ *
178
+ * @param options - Search options
179
+ * @returns Matching loyalty accounts
180
+ *
181
+ * @example
182
+ * ```typescript
183
+ * // Find by phone number
184
+ * const accounts = await square.loyalty.searchAccounts({
185
+ * phoneNumber: '+15551234567',
186
+ * });
187
+ *
188
+ * // Find by customer ID
189
+ * const accounts = await square.loyalty.searchAccounts({
190
+ * customerId: 'CUST_123',
191
+ * });
192
+ * ```
193
+ */
194
+ searchAccounts(options?: {
195
+ phoneNumber?: string;
196
+ customerId?: string;
197
+ cursor?: string;
198
+ limit?: number;
199
+ }): Promise<{
200
+ data: LoyaltyAccount[];
201
+ cursor?: string;
202
+ }>;
203
+ /**
204
+ * Accumulate (add) points to a loyalty account
205
+ *
206
+ * @param accountId - Loyalty account ID
207
+ * @param options - Accumulation options
208
+ * @returns Loyalty event
209
+ *
210
+ * @example
211
+ * ```typescript
212
+ * // Add points from an order
213
+ * await square.loyalty.accumulatePoints('ACCT_123', {
214
+ * orderId: 'ORDER_456',
215
+ * });
216
+ *
217
+ * // Add points manually
218
+ * await square.loyalty.accumulatePoints('ACCT_123', {
219
+ * points: 50,
220
+ * });
221
+ * ```
222
+ */
223
+ accumulatePoints(accountId: string, options: {
224
+ orderId?: string;
225
+ points?: number;
226
+ idempotencyKey?: string;
227
+ }): Promise<LoyaltyEvent>;
228
+ /**
229
+ * Adjust points on a loyalty account (add or subtract)
230
+ *
231
+ * @param accountId - Loyalty account ID
232
+ * @param points - Points to add (positive) or subtract (negative)
233
+ * @param reason - Reason for adjustment
234
+ * @returns Loyalty event
235
+ *
236
+ * @example
237
+ * ```typescript
238
+ * // Add bonus points
239
+ * await square.loyalty.adjustPoints('ACCT_123', 100, 'Birthday bonus');
240
+ *
241
+ * // Remove points
242
+ * await square.loyalty.adjustPoints('ACCT_123', -50, 'Points correction');
243
+ * ```
244
+ */
245
+ adjustPoints(accountId: string, points: number, reason?: string, idempotencyKey?: string): Promise<LoyaltyEvent>;
246
+ /**
247
+ * Redeem a reward
248
+ *
249
+ * @param accountId - Loyalty account ID
250
+ * @param rewardTierId - Reward tier ID to redeem
251
+ * @param orderId - Optional order ID to apply reward to
252
+ * @returns Created reward
253
+ *
254
+ * @example
255
+ * ```typescript
256
+ * const reward = await square.loyalty.redeemReward(
257
+ * 'ACCT_123',
258
+ * 'TIER_123',
259
+ * 'ORDER_456'
260
+ * );
261
+ * ```
262
+ */
263
+ redeemReward(accountId: string, rewardTierId: string, orderId?: string, idempotencyKey?: string): Promise<{
264
+ id: string;
265
+ status: string;
266
+ }>;
267
+ /**
268
+ * Calculate points that would be earned for an order
269
+ *
270
+ * @param programId - Loyalty program ID
271
+ * @param orderId - Order ID to calculate points for
272
+ * @returns Points that would be earned
273
+ *
274
+ * @example
275
+ * ```typescript
276
+ * const points = await square.loyalty.calculatePoints('PROG_123', 'ORDER_123');
277
+ * console.log(`This order earns ${points} points`);
278
+ * ```
279
+ */
280
+ calculatePoints(programId: string, orderId: string): Promise<number>;
281
+ }
282
+ //# sourceMappingURL=loyalty.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loyalty.service.d.ts","sourceRoot":"","sources":["../../../src/core/services/loyalty.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAI3C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IAC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