@jsdev_ninja/core 0.8.54 → 0.8.56

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 (66) hide show
  1. package/dist/core.cjs.js +1 -1
  2. package/dist/core.cjs.js.map +1 -1
  3. package/dist/core.es.js +864 -1101
  4. package/dist/core.es.js.map +1 -1
  5. package/dist/core.umd.js +1 -1
  6. package/dist/core.umd.js.map +1 -1
  7. package/dist/entities/Address.d.ts.map +1 -1
  8. package/dist/entities/Address.js +8 -7
  9. package/dist/entities/Atoms.d.ts +0 -1
  10. package/dist/entities/Atoms.d.ts.map +1 -1
  11. package/dist/entities/Atoms.js +1 -3
  12. package/dist/entities/Company.d.ts +0 -32
  13. package/dist/entities/Company.d.ts.map +1 -1
  14. package/dist/entities/Company.js +0 -6
  15. package/dist/entities/Locale.js +1 -1
  16. package/dist/entities/Order.d.ts +30 -48
  17. package/dist/entities/Order.d.ts.map +1 -1
  18. package/dist/entities/Order.js +7 -5
  19. package/dist/entities/Product.d.ts +2 -320
  20. package/dist/entities/Product.d.ts.map +1 -1
  21. package/dist/entities/Product.js +6 -13
  22. package/dist/entities/Profile.d.ts +15 -30
  23. package/dist/entities/Profile.d.ts.map +1 -1
  24. package/dist/entities/Profile.js +9 -11
  25. package/dist/entities/Store.d.ts +0 -36
  26. package/dist/entities/Store.d.ts.map +1 -1
  27. package/dist/entities/Store.js +0 -11
  28. package/dist/entities/index.d.ts +0 -1
  29. package/dist/entities/index.d.ts.map +1 -1
  30. package/dist/entities/index.js +0 -1
  31. package/dist/firebase-api/app.d.ts +2 -0
  32. package/dist/firebase-api/app.d.ts.map +1 -0
  33. package/dist/firebase-api/app.js +16 -0
  34. package/dist/firebase-api/index.d.ts +9 -6
  35. package/dist/firebase-api/index.d.ts.map +1 -1
  36. package/dist/firebase-api/index.js +3 -2
  37. package/dist/index.d.ts +0 -1
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +0 -1
  40. package/dist/tsconfig.app.tsbuildinfo +1 -1
  41. package/lib/entities/Address.ts +8 -7
  42. package/lib/entities/Atoms.ts +1 -4
  43. package/lib/entities/Company.ts +0 -6
  44. package/lib/entities/Locale.ts +1 -1
  45. package/lib/entities/Order.ts +7 -5
  46. package/lib/entities/Product.ts +7 -17
  47. package/lib/entities/Profile.ts +9 -11
  48. package/lib/entities/Store.ts +0 -14
  49. package/lib/entities/index.ts +0 -1
  50. package/lib/firebase-api/app.ts +18 -0
  51. package/lib/firebase-api/index.ts +3 -2
  52. package/lib/index.tsx +0 -1
  53. package/package.json +1 -1
  54. package/src/main.tsx +1 -3
  55. package/dist/entities/Payment.d.ts +0 -368
  56. package/dist/entities/Payment.d.ts.map +0 -1
  57. package/dist/entities/Payment.js +0 -108
  58. package/dist/hypPaymentService/index.d.ts +0 -33
  59. package/dist/hypPaymentService/index.d.ts.map +0 -1
  60. package/dist/hypPaymentService/index.js +0 -100
  61. package/lib/entities/Payment.ts +0 -133
  62. package/lib/hypPaymentService/index.ts +0 -139
  63. package/src/App.css +0 -42
  64. package/src/App.tsx +0 -35
  65. package/src/assets/react.svg +0 -1
  66. package/src/index.css +0 -68
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsdev_ninja/core",
3
- "version": "0.8.54",
3
+ "version": "0.8.56",
4
4
  "main": "dist/core.cjs.js",
5
5
  "module": "dist/core.es.js",
6
6
  "types": "dist/index.d.ts",
package/src/main.tsx CHANGED
@@ -1,3 +1 @@
1
- export const X: number = 20;
2
-
3
- export type F = { id2: string };
1
+ export {};
@@ -1,368 +0,0 @@
1
- import { z } from "zod";
2
- export declare const PayProtocolGeneralSchema: z.ZodObject<{
3
- Masof: z.ZodString;
4
- PassP: z.ZodString;
5
- KEY: z.ZodOptional<z.ZodString>;
6
- Amount: z.ZodString;
7
- Order: z.ZodOptional<z.ZodString>;
8
- Tash: z.ZodString;
9
- FixTash: z.ZodOptional<z.ZodEnum<["True", "False"]>>;
10
- UTF8: z.ZodEnum<["True", "False"]>;
11
- UTF8out: z.ZodEnum<["True", "False"]>;
12
- MoreData: z.ZodOptional<z.ZodEnum<["True", "False"]>>;
13
- J5: z.ZodOptional<z.ZodEnum<["True", "False"]>>;
14
- }, "strip", z.ZodTypeAny, {
15
- Masof: string;
16
- PassP: string;
17
- Amount: string;
18
- Tash: string;
19
- UTF8: "True" | "False";
20
- UTF8out: "True" | "False";
21
- Order?: string | undefined;
22
- KEY?: string | undefined;
23
- FixTash?: "True" | "False" | undefined;
24
- MoreData?: "True" | "False" | undefined;
25
- J5?: "True" | "False" | undefined;
26
- }, {
27
- Masof: string;
28
- PassP: string;
29
- Amount: string;
30
- Tash: string;
31
- UTF8: "True" | "False";
32
- UTF8out: "True" | "False";
33
- Order?: string | undefined;
34
- KEY?: string | undefined;
35
- FixTash?: "True" | "False" | undefined;
36
- MoreData?: "True" | "False" | undefined;
37
- J5?: "True" | "False" | undefined;
38
- }>;
39
- export declare const HypSoftTransactionRequestSchema: z.ZodObject<z.objectUtil.extendShape<{
40
- Masof: z.ZodString;
41
- PassP: z.ZodString;
42
- KEY: z.ZodOptional<z.ZodString>;
43
- Amount: z.ZodString;
44
- Order: z.ZodOptional<z.ZodString>;
45
- Tash: z.ZodString;
46
- FixTash: z.ZodOptional<z.ZodEnum<["True", "False"]>>;
47
- UTF8: z.ZodEnum<["True", "False"]>;
48
- UTF8out: z.ZodEnum<["True", "False"]>;
49
- MoreData: z.ZodOptional<z.ZodEnum<["True", "False"]>>;
50
- J5: z.ZodOptional<z.ZodEnum<["True", "False"]>>;
51
- }, {
52
- action: z.ZodLiteral<"soft">;
53
- Info: z.ZodString;
54
- CC: z.ZodString;
55
- Tmonth: z.ZodString;
56
- Tyear: z.ZodString;
57
- AuthNum: z.ZodString;
58
- cvv: z.ZodOptional<z.ZodString>;
59
- UserId: z.ZodString;
60
- "inputObj.originalUid": z.ZodString;
61
- "inputObj.originalAmount": z.ZodString;
62
- "inputObj.authorizationCodeManpik": z.ZodLiteral<"7">;
63
- ClientName: z.ZodString;
64
- ClientLName: z.ZodString;
65
- Token: z.ZodLiteral<"True">;
66
- }>, "strip", z.ZodTypeAny, {
67
- Masof: string;
68
- PassP: string;
69
- Amount: string;
70
- Tash: string;
71
- UTF8: "True" | "False";
72
- UTF8out: "True" | "False";
73
- action: "soft";
74
- Info: string;
75
- CC: string;
76
- Tmonth: string;
77
- Tyear: string;
78
- AuthNum: string;
79
- UserId: string;
80
- "inputObj.originalUid": string;
81
- "inputObj.originalAmount": string;
82
- "inputObj.authorizationCodeManpik": "7";
83
- ClientName: string;
84
- ClientLName: string;
85
- Token: "True";
86
- Order?: string | undefined;
87
- KEY?: string | undefined;
88
- FixTash?: "True" | "False" | undefined;
89
- MoreData?: "True" | "False" | undefined;
90
- J5?: "True" | "False" | undefined;
91
- cvv?: string | undefined;
92
- }, {
93
- Masof: string;
94
- PassP: string;
95
- Amount: string;
96
- Tash: string;
97
- UTF8: "True" | "False";
98
- UTF8out: "True" | "False";
99
- action: "soft";
100
- Info: string;
101
- CC: string;
102
- Tmonth: string;
103
- Tyear: string;
104
- AuthNum: string;
105
- UserId: string;
106
- "inputObj.originalUid": string;
107
- "inputObj.originalAmount": string;
108
- "inputObj.authorizationCodeManpik": "7";
109
- ClientName: string;
110
- ClientLName: string;
111
- Token: "True";
112
- Order?: string | undefined;
113
- KEY?: string | undefined;
114
- FixTash?: "True" | "False" | undefined;
115
- MoreData?: "True" | "False" | undefined;
116
- J5?: "True" | "False" | undefined;
117
- cvv?: string | undefined;
118
- }>;
119
- export type THypSoftTransactionRequest = z.infer<typeof HypSoftTransactionRequestSchema>;
120
- export declare const HypTokenRequestSchema: z.ZodObject<{
121
- action: z.ZodLiteral<"getToken">;
122
- allowFalse: z.ZodLiteral<"True">;
123
- Masof: z.ZodString;
124
- PassP: z.ZodString;
125
- TransId: z.ZodString;
126
- }, "strip", z.ZodTypeAny, {
127
- Masof: string;
128
- PassP: string;
129
- action: "getToken";
130
- allowFalse: "True";
131
- TransId: string;
132
- }, {
133
- Masof: string;
134
- PassP: string;
135
- action: "getToken";
136
- allowFalse: "True";
137
- TransId: string;
138
- }>;
139
- export type THypTokenRequest = z.infer<typeof HypTokenRequestSchema>;
140
- export declare const HypTokenResponseSchema: z.ZodObject<{
141
- Id: z.ZodString;
142
- Token: z.ZodString;
143
- Tokef: z.ZodString;
144
- CCode: z.ZodString;
145
- }, "strip", z.ZodTypeAny, {
146
- Token: string;
147
- Id: string;
148
- Tokef: string;
149
- CCode: string;
150
- }, {
151
- Token: string;
152
- Id: string;
153
- Tokef: string;
154
- CCode: string;
155
- }>;
156
- export type THypTokenResponse = z.infer<typeof HypTokenResponseSchema>;
157
- export declare const PayProtocolResponseSchema: z.ZodObject<z.objectUtil.extendShape<{
158
- Masof: z.ZodString;
159
- PassP: z.ZodString;
160
- KEY: z.ZodOptional<z.ZodString>;
161
- Amount: z.ZodString;
162
- Order: z.ZodOptional<z.ZodString>;
163
- Tash: z.ZodString;
164
- FixTash: z.ZodOptional<z.ZodEnum<["True", "False"]>>;
165
- UTF8: z.ZodEnum<["True", "False"]>;
166
- UTF8out: z.ZodEnum<["True", "False"]>;
167
- MoreData: z.ZodOptional<z.ZodEnum<["True", "False"]>>;
168
- J5: z.ZodOptional<z.ZodEnum<["True", "False"]>>;
169
- }, {
170
- Id: z.ZodString;
171
- ACode: z.ZodString;
172
- CCode: z.ZodString;
173
- Sign: z.ZodString;
174
- Fild1: z.ZodString;
175
- Fild2: z.ZodString;
176
- Fild3: z.ZodString;
177
- Bank: z.ZodOptional<z.ZodString>;
178
- TransType: z.ZodOptional<z.ZodString>;
179
- Payments: z.ZodOptional<z.ZodString>;
180
- UserId: z.ZodOptional<z.ZodString>;
181
- Brand: z.ZodOptional<z.ZodString>;
182
- Issuer: z.ZodOptional<z.ZodString>;
183
- L4digit: z.ZodOptional<z.ZodString>;
184
- street: z.ZodOptional<z.ZodString>;
185
- city: z.ZodOptional<z.ZodString>;
186
- zip: z.ZodOptional<z.ZodString>;
187
- cell: z.ZodOptional<z.ZodString>;
188
- Coin: z.ZodOptional<z.ZodString>;
189
- Tmonth: z.ZodOptional<z.ZodString>;
190
- Tyear: z.ZodOptional<z.ZodString>;
191
- Hesh: z.ZodOptional<z.ZodString>;
192
- UID: z.ZodOptional<z.ZodString>;
193
- spType: z.ZodOptional<z.ZodString>;
194
- bincard: z.ZodOptional<z.ZodString>;
195
- }>, "strip", z.ZodTypeAny, {
196
- Masof: string;
197
- PassP: string;
198
- Amount: string;
199
- Tash: string;
200
- UTF8: "True" | "False";
201
- UTF8out: "True" | "False";
202
- Id: string;
203
- CCode: string;
204
- ACode: string;
205
- Sign: string;
206
- Fild1: string;
207
- Fild2: string;
208
- Fild3: string;
209
- city?: string | undefined;
210
- street?: string | undefined;
211
- Order?: string | undefined;
212
- KEY?: string | undefined;
213
- FixTash?: "True" | "False" | undefined;
214
- MoreData?: "True" | "False" | undefined;
215
- J5?: "True" | "False" | undefined;
216
- Tmonth?: string | undefined;
217
- Tyear?: string | undefined;
218
- UserId?: string | undefined;
219
- Bank?: string | undefined;
220
- TransType?: string | undefined;
221
- Payments?: string | undefined;
222
- Brand?: string | undefined;
223
- Issuer?: string | undefined;
224
- L4digit?: string | undefined;
225
- zip?: string | undefined;
226
- cell?: string | undefined;
227
- Coin?: string | undefined;
228
- Hesh?: string | undefined;
229
- UID?: string | undefined;
230
- spType?: string | undefined;
231
- bincard?: string | undefined;
232
- }, {
233
- Masof: string;
234
- PassP: string;
235
- Amount: string;
236
- Tash: string;
237
- UTF8: "True" | "False";
238
- UTF8out: "True" | "False";
239
- Id: string;
240
- CCode: string;
241
- ACode: string;
242
- Sign: string;
243
- Fild1: string;
244
- Fild2: string;
245
- Fild3: string;
246
- city?: string | undefined;
247
- street?: string | undefined;
248
- Order?: string | undefined;
249
- KEY?: string | undefined;
250
- FixTash?: "True" | "False" | undefined;
251
- MoreData?: "True" | "False" | undefined;
252
- J5?: "True" | "False" | undefined;
253
- Tmonth?: string | undefined;
254
- Tyear?: string | undefined;
255
- UserId?: string | undefined;
256
- Bank?: string | undefined;
257
- TransType?: string | undefined;
258
- Payments?: string | undefined;
259
- Brand?: string | undefined;
260
- Issuer?: string | undefined;
261
- L4digit?: string | undefined;
262
- zip?: string | undefined;
263
- cell?: string | undefined;
264
- Coin?: string | undefined;
265
- Hesh?: string | undefined;
266
- UID?: string | undefined;
267
- spType?: string | undefined;
268
- bincard?: string | undefined;
269
- }>;
270
- export declare const HypPaymentLinkRequestSchema: z.ZodObject<z.objectUtil.extendShape<{
271
- Masof: z.ZodString;
272
- PassP: z.ZodString;
273
- KEY: z.ZodOptional<z.ZodString>;
274
- Amount: z.ZodString;
275
- Order: z.ZodOptional<z.ZodString>;
276
- Tash: z.ZodString;
277
- FixTash: z.ZodOptional<z.ZodEnum<["True", "False"]>>;
278
- UTF8: z.ZodEnum<["True", "False"]>;
279
- UTF8out: z.ZodEnum<["True", "False"]>;
280
- MoreData: z.ZodOptional<z.ZodEnum<["True", "False"]>>;
281
- J5: z.ZodOptional<z.ZodEnum<["True", "False"]>>;
282
- }, {
283
- Masof: z.ZodString;
284
- PassP: z.ZodString;
285
- KEY: z.ZodString;
286
- action: z.ZodLiteral<"APISign">;
287
- What: z.ZodLiteral<"SIGN">;
288
- Info: z.ZodString;
289
- Sign: z.ZodEnum<["True", "False"]>;
290
- UTF8: z.ZodEnum<["True", "False"]>;
291
- UTF8out: z.ZodEnum<["True", "False"]>;
292
- Tash: z.ZodString;
293
- FixTash: z.ZodOptional<z.ZodEnum<["True", "False"]>>;
294
- sendemail: z.ZodOptional<z.ZodEnum<["True", "False"]>>;
295
- SendHesh: z.ZodOptional<z.ZodEnum<["True", "False"]>>;
296
- heshDesc: z.ZodString;
297
- Pritim: z.ZodOptional<z.ZodEnum<["True", "False"]>>;
298
- UserId: z.ZodString;
299
- ClientName: z.ZodString;
300
- ClientLName: z.ZodOptional<z.ZodString>;
301
- street: z.ZodOptional<z.ZodString>;
302
- city: z.ZodOptional<z.ZodString>;
303
- zip: z.ZodOptional<z.ZodString>;
304
- phone: z.ZodOptional<z.ZodString>;
305
- cell: z.ZodOptional<z.ZodString>;
306
- email: z.ZodOptional<z.ZodString>;
307
- }>, "strip", z.ZodTypeAny, {
308
- Masof: string;
309
- PassP: string;
310
- KEY: string;
311
- Amount: string;
312
- Tash: string;
313
- UTF8: "True" | "False";
314
- UTF8out: "True" | "False";
315
- action: "APISign";
316
- Info: string;
317
- UserId: string;
318
- ClientName: string;
319
- Sign: "True" | "False";
320
- What: "SIGN";
321
- heshDesc: string;
322
- city?: string | undefined;
323
- street?: string | undefined;
324
- email?: string | undefined;
325
- Order?: string | undefined;
326
- FixTash?: "True" | "False" | undefined;
327
- MoreData?: "True" | "False" | undefined;
328
- J5?: "True" | "False" | undefined;
329
- ClientLName?: string | undefined;
330
- zip?: string | undefined;
331
- cell?: string | undefined;
332
- sendemail?: "True" | "False" | undefined;
333
- SendHesh?: "True" | "False" | undefined;
334
- Pritim?: "True" | "False" | undefined;
335
- phone?: string | undefined;
336
- }, {
337
- Masof: string;
338
- PassP: string;
339
- KEY: string;
340
- Amount: string;
341
- Tash: string;
342
- UTF8: "True" | "False";
343
- UTF8out: "True" | "False";
344
- action: "APISign";
345
- Info: string;
346
- UserId: string;
347
- ClientName: string;
348
- Sign: "True" | "False";
349
- What: "SIGN";
350
- heshDesc: string;
351
- city?: string | undefined;
352
- street?: string | undefined;
353
- email?: string | undefined;
354
- Order?: string | undefined;
355
- FixTash?: "True" | "False" | undefined;
356
- MoreData?: "True" | "False" | undefined;
357
- J5?: "True" | "False" | undefined;
358
- ClientLName?: string | undefined;
359
- zip?: string | undefined;
360
- cell?: string | undefined;
361
- sendemail?: "True" | "False" | undefined;
362
- SendHesh?: "True" | "False" | undefined;
363
- Pritim?: "True" | "False" | undefined;
364
- phone?: string | undefined;
365
- }>;
366
- export type TPaymentLinkRequest = z.infer<typeof HypPaymentLinkRequestSchema>;
367
- export type TPayProtocolResponse = z.infer<typeof PayProtocolResponseSchema>;
368
- //# sourceMappingURL=Payment.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Payment.d.ts","sourceRoot":"","sources":["../../lib/entities/Payment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBnC,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB1C,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAEzF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;EAOhC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAErE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;EAKjC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEvE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BpC,CAAC;AAGH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BtC,CAAC;AAGH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAG9E,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -1,108 +0,0 @@
1
- import { z } from "zod";
2
- import { hypBooleanSchema } from "./Atoms";
3
- // 600 - Checking a card number700 - Approved without charge800 - Postpone transaction - success handle ass error
4
- const textSchema = z.string().min(1);
5
- const numericTextSchema = z.string().regex(/^\d+$/, "Must be a numeric string");
6
- export const PayProtocolGeneralSchema = z.object({
7
- Masof: textSchema, // store masof number
8
- PassP: textSchema, // store masof password,
9
- KEY: textSchema.optional(), // hyp api key
10
- Amount: textSchema,
11
- Order: textSchema.optional(), // order id generated by store
12
- Tash: numericTextSchema, // Max number of payments that can be selected by the customer
13
- FixTash: hypBooleanSchema.optional(),
14
- // tashType: - Payment type optional NOT_IN_USE
15
- UTF8: hypBooleanSchema, // request is utf8
16
- UTF8out: hypBooleanSchema, // response is utf8
17
- MoreData: hypBooleanSchema.optional(), // extra data in response
18
- J5: hypBooleanSchema.optional(),
19
- });
20
- export const HypSoftTransactionRequestSchema = PayProtocolGeneralSchema.extend({
21
- action: z.literal("soft"),
22
- Info: textSchema, // text that will be displayed in transaction, report and the management system.
23
- CC: numericTextSchema, // token number
24
- Tmonth: textSchema, // MM
25
- Tyear: textSchema, // YYYY
26
- AuthNum: textSchema, // confirmation number
27
- cvv: z.string().optional(), // only if required
28
- UserId: textSchema,
29
- "inputObj.originalUid": textSchema,
30
- "inputObj.originalAmount": textSchema,
31
- "inputObj.authorizationCodeManpik": z.literal("7"),
32
- ClientName: textSchema,
33
- ClientLName: textSchema,
34
- Token: z.literal("True"),
35
- // CC2
36
- // Coin
37
- });
38
- export const HypTokenRequestSchema = z.object({
39
- action: z.literal("getToken"),
40
- allowFalse: z.literal("True"),
41
- Masof: textSchema, // store masof number
42
- PassP: textSchema, // store masof password,
43
- TransId: numericTextSchema,
44
- //todo api key is not required???
45
- });
46
- export const HypTokenResponseSchema = z.object({
47
- Id: numericTextSchema,
48
- Token: numericTextSchema,
49
- Tokef: numericTextSchema, // credit card validity date in the format YYMM
50
- CCode: numericTextSchema, //0 code is valid
51
- });
52
- export const PayProtocolResponseSchema = PayProtocolGeneralSchema.extend({
53
- Id: textSchema, // transaction Id in Hypay
54
- ACode: numericTextSchema, // confirmation code from credit card company
55
- CCode: z.string(), // todo,
56
- Sign: z.string(), //
57
- Fild1: z.string(), // client full name
58
- Fild2: z.string(), // client email
59
- Fild3: z.string(), // client phone number
60
- // if more data equal to True
61
- Bank: z.string().optional(),
62
- TransType: z.string().optional(),
63
- Payments: z.string().optional(), // Number of payments charged
64
- UserId: z.string().optional(),
65
- Brand: z.string().optional(),
66
- Issuer: z.string().optional(),
67
- L4digit: z.string().optional(),
68
- street: z.string().optional(),
69
- city: z.string().optional(),
70
- zip: z.string().optional(),
71
- cell: z.string().optional(),
72
- Coin: z.string().optional(),
73
- Tmonth: z.string().optional(), // MM format
74
- Tyear: z.string().optional(), // YYYY format
75
- Hesh: z.string().optional(), // invoice number (if invoice module is not active Hesh would get 0)
76
- UID: z.string().optional(), // UID unique value receive from response after successful transaction from request with action pay/soft
77
- spType: z.string().optional(),
78
- bincard: z.string().optional(),
79
- });
80
- // generate payment link
81
- export const HypPaymentLinkRequestSchema = PayProtocolGeneralSchema.extend({
82
- Masof: textSchema, // store masof number
83
- PassP: textSchema, // store masof password,
84
- KEY: textSchema, // hyp api key
85
- action: z.literal("APISign"),
86
- What: z.literal("SIGN"),
87
- Info: textSchema, // text that will be displayed in transaction, report and the management system.
88
- Sign: hypBooleanSchema, // Sign on sent parameters in answer
89
- UTF8: hypBooleanSchema, // request is utf8
90
- UTF8out: hypBooleanSchema, // response is utf8
91
- Tash: numericTextSchema, // Max number of payments that can be selected by the customer
92
- FixTash: hypBooleanSchema.optional(),
93
- sendemail: hypBooleanSchema.optional(),
94
- // EzCount Invoice parameters - Pay Protocol
95
- SendHesh: hypBooleanSchema.optional(), // send invoice in email
96
- heshDesc: textSchema, // [0~Item 1~1~8][0~Item 2~2~1]
97
- Pritim: hypBooleanSchema.optional(), // The invoice description contains items
98
- // client data
99
- UserId: numericTextSchema,
100
- ClientName: textSchema, // first name
101
- ClientLName: textSchema.optional(), // last name
102
- street: textSchema.optional(),
103
- city: textSchema.optional(),
104
- zip: textSchema.optional(),
105
- phone: textSchema.optional(),
106
- cell: textSchema.optional(),
107
- email: textSchema.optional(),
108
- });
@@ -1,33 +0,0 @@
1
- import { TPaymentLinkRequest } from "../entities/Payment";
2
- type chargeJ5TransactionParams = {
3
- transactionId: string;
4
- masof: string;
5
- masofPassword: string;
6
- originalAmount: number;
7
- actualAmount: number;
8
- orderId: string;
9
- creditCardConfirmNumber: string;
10
- transactionUID: string;
11
- clientName: string;
12
- clientLastName: string;
13
- };
14
- export declare const hypPaymentService: {
15
- readonly chargeJ5Transaction: (params: chargeJ5TransactionParams) => Promise<{
16
- success: boolean;
17
- errMessage?: undefined;
18
- } | {
19
- success: boolean;
20
- errMessage: any;
21
- }>;
22
- readonly createPaymentLink: (params: TPaymentLinkRequest) => Promise<{
23
- success: boolean;
24
- paymentLink: string;
25
- errMessage?: undefined;
26
- } | {
27
- success: boolean;
28
- errMessage: any;
29
- paymentLink?: undefined;
30
- }>;
31
- };
32
- export {};
33
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/hypPaymentService/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,mBAAmB,EACnB,MAAM,qBAAqB,CAAC;AA6B7B,KAAK,yBAAyB,GAAG;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,uBAAuB,EAAE,MAAM,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CACvB,CAAC;AAaF,eAAO,MAAM,iBAAiB;2CACK,yBAAyB;;;;;;;yCA2D3B,mBAAmB;;;;;;;;;CAoB1C,CAAC"}
@@ -1,100 +0,0 @@
1
- const baseUrl = "https://pay.hyp.co.il/p/";
2
- function objectToQueryParams(obj) {
3
- return Object.keys(obj)
4
- .map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`)
5
- .join("&");
6
- }
7
- function splitYYMM(yyMM) {
8
- if (!/^\d{4}$/.test(yyMM)) {
9
- throw new Error("Invalid YYMM format. Expected 4-digit string (YYMM).");
10
- }
11
- const yy = yyMM.slice(0, 2); // First 2 digits → Year
12
- const mm = yyMM.slice(2, 4); // Last 2 digits → Month
13
- const currentYear = new Date().getFullYear(); // Get current full year (e.g., 2024)
14
- const century = Math.floor(currentYear / 100) * 100; // Get century (e.g., 2000)
15
- const fullYear = century + parseInt(yy, 10);
16
- // Handle future dates: Assume YY < current YY is from the current century, else from the past century
17
- const currentYY = currentYear % 100;
18
- const correctedYear = parseInt(yy, 10) > currentYY ? fullYear - 100 : fullYear;
19
- return { month: mm, year: correctedYear.toString() };
20
- }
21
- // parse hyp text response
22
- function parseQueryString(query) {
23
- return query.split("&").reduce((acc, param) => {
24
- const [key, value] = param.split("=");
25
- if (key && value) {
26
- acc[key] = decodeURIComponent(value);
27
- }
28
- return acc;
29
- }, {});
30
- }
31
- export const hypPaymentService = {
32
- async chargeJ5Transaction(params) {
33
- try {
34
- const tokenParams = objectToQueryParams({
35
- action: "getToken",
36
- allowFalse: "True",
37
- Masof: params.masof,
38
- PassP: params.masofPassword,
39
- TransId: params.transactionId,
40
- });
41
- const tokenResponse = await fetch(`${baseUrl}?${tokenParams}`);
42
- const body = await tokenResponse.text();
43
- const tokenData = parseQueryString(body);
44
- const cardValidityDate = splitYYMM(tokenData.Tokef);
45
- // todo Tmonth=mm&Tyear=yyyy
46
- let originalAmount = Number(params.originalAmount) * 100;
47
- const transParams = objectToQueryParams({
48
- action: "soft",
49
- MoreData: "True",
50
- UTF8: "True",
51
- UTF8out: "True",
52
- "inputObj.originalUid": params.transactionUID,
53
- "inputObj.originalAmount": originalAmount.toString(),
54
- "inputObj.authorizationCodeManpik": "7",
55
- Amount: params.actualAmount.toString(),
56
- AuthNum: params.creditCardConfirmNumber,
57
- Info: "soft Info",
58
- Masof: params.masof,
59
- PassP: params.masofPassword,
60
- Tash: "1",
61
- Tmonth: cardValidityDate.month,
62
- Tyear: cardValidityDate.year,
63
- Order: params.orderId,
64
- CC: tokenData.Token,
65
- UserId: "203269535",
66
- ClientName: params.clientName,
67
- ClientLName: params.clientLastName,
68
- Token: "True",
69
- FixTash: "True",
70
- });
71
- const transactionCommit = await fetch(`${baseUrl}?${transParams}`);
72
- const transactionData = await transactionCommit.text();
73
- console.log("Amount", params.actualAmount.toString());
74
- console.log("token", tokenData.Token);
75
- console.log("AuthNum", params.creditCardConfirmNumber);
76
- console.log("originalUid", params.transactionUID);
77
- console.log("transactionData", transactionData);
78
- return { success: true };
79
- }
80
- catch (error) {
81
- console.log(error);
82
- return { success: false, errMessage: error.message };
83
- }
84
- },
85
- async createPaymentLink(params) {
86
- try {
87
- const queryString = objectToQueryParams(params);
88
- const url = `${baseUrl}?${queryString}`;
89
- console.log("createPaymentLink url", url);
90
- const signResponse = await fetch(url);
91
- const linkData = await signResponse.text();
92
- const paymentLink = `${baseUrl}?${linkData}`;
93
- return { success: true, paymentLink };
94
- }
95
- catch (error) {
96
- console.log(error);
97
- return { success: false, errMessage: error.message };
98
- }
99
- },
100
- };