@spreeloop/orange_money 1.0.11 → 1.0.13

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 (157) hide show
  1. package/dist/index.d.ts +2 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +18 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/src/disbursements/implementations/disbursement_service.d.ts +63 -0
  6. package/dist/src/disbursements/implementations/disbursement_service.d.ts.map +1 -0
  7. package/dist/src/disbursements/implementations/disbursement_service.js +84 -0
  8. package/dist/src/disbursements/implementations/disbursement_service.js.map +1 -0
  9. package/dist/src/disbursements/implementations/src/live.d.ts +40 -0
  10. package/dist/src/disbursements/implementations/src/live.d.ts.map +1 -0
  11. package/dist/src/disbursements/implementations/src/live.js +61 -0
  12. package/dist/src/disbursements/implementations/src/live.js.map +1 -0
  13. package/dist/src/disbursements/implementations/src/sandbox.d.ts +40 -0
  14. package/dist/src/disbursements/implementations/src/sandbox.d.ts.map +1 -0
  15. package/dist/src/disbursements/implementations/src/sandbox.js +110 -0
  16. package/dist/src/disbursements/implementations/src/sandbox.js.map +1 -0
  17. package/dist/src/disbursements/operations/create_access_token.d.ts +28 -0
  18. package/dist/src/disbursements/operations/create_access_token.d.ts.map +1 -0
  19. package/dist/src/disbursements/operations/create_access_token.js +45 -0
  20. package/dist/src/disbursements/operations/create_access_token.js.map +1 -0
  21. package/dist/src/disbursements/operations/create_access_token.spec.d.ts +2 -0
  22. package/dist/src/disbursements/operations/create_access_token.spec.d.ts.map +1 -0
  23. package/dist/src/disbursements/operations/create_access_token.spec.js +105 -0
  24. package/dist/src/disbursements/operations/create_access_token.spec.js.map +1 -0
  25. package/dist/src/disbursements/operations/get_transfer_status.d.ts +114 -0
  26. package/dist/src/disbursements/operations/get_transfer_status.d.ts.map +1 -0
  27. package/dist/src/disbursements/operations/get_transfer_status.js +128 -0
  28. package/dist/src/disbursements/operations/get_transfer_status.js.map +1 -0
  29. package/dist/src/disbursements/operations/get_transfer_status.spec.d.ts +2 -0
  30. package/dist/src/disbursements/operations/get_transfer_status.spec.d.ts.map +1 -0
  31. package/dist/src/disbursements/operations/get_transfer_status.spec.js +147 -0
  32. package/dist/src/disbursements/operations/get_transfer_status.spec.js.map +1 -0
  33. package/dist/src/disbursements/operations/transfer.d.ts +45 -0
  34. package/dist/src/disbursements/operations/transfer.d.ts.map +1 -0
  35. package/dist/src/disbursements/operations/transfer.js +74 -0
  36. package/dist/src/disbursements/operations/transfer.js.map +1 -0
  37. package/dist/src/disbursements/operations/transfer.spec.d.ts +2 -0
  38. package/dist/src/disbursements/operations/transfer.spec.d.ts.map +1 -0
  39. package/dist/src/disbursements/operations/transfer.spec.js +177 -0
  40. package/dist/src/disbursements/operations/transfer.spec.js.map +1 -0
  41. package/dist/src/disbursements/routes/routes.d.ts +38 -0
  42. package/dist/src/disbursements/routes/routes.d.ts.map +1 -0
  43. package/dist/src/disbursements/routes/routes.js +53 -0
  44. package/dist/src/disbursements/routes/routes.js.map +1 -0
  45. package/dist/src/disbursements/utils/constants.d.ts +5 -0
  46. package/dist/src/disbursements/utils/constants.d.ts.map +1 -0
  47. package/dist/src/disbursements/utils/constants.js +9 -0
  48. package/dist/src/disbursements/utils/constants.js.map +1 -0
  49. package/dist/src/disbursements/utils/regex.d.ts +9 -0
  50. package/dist/src/disbursements/utils/regex.d.ts.map +1 -0
  51. package/dist/src/disbursements/utils/regex.js +12 -0
  52. package/dist/src/disbursements/utils/regex.js.map +1 -0
  53. package/dist/src/disbursements/utils/regex.spec.d.ts +2 -0
  54. package/dist/src/disbursements/utils/regex.spec.d.ts.map +1 -0
  55. package/dist/src/disbursements/utils/regex.spec.js +32 -0
  56. package/dist/src/disbursements/utils/regex.spec.js.map +1 -0
  57. package/dist/src/disbursements/utils/status.d.ts +53 -0
  58. package/dist/src/disbursements/utils/status.d.ts.map +1 -0
  59. package/dist/src/disbursements/utils/status.js +58 -0
  60. package/dist/src/disbursements/utils/status.js.map +1 -0
  61. package/dist/src/disbursements/utils/utils.d.ts +9 -0
  62. package/dist/src/disbursements/utils/utils.d.ts.map +1 -0
  63. package/dist/src/disbursements/utils/utils.js +26 -0
  64. package/dist/src/disbursements/utils/utils.js.map +1 -0
  65. package/dist/src/disbursements/utils/utils.spec.d.ts +2 -0
  66. package/dist/src/disbursements/utils/utils.spec.d.ts.map +1 -0
  67. package/dist/src/disbursements/utils/utils.spec.js +43 -0
  68. package/dist/src/disbursements/utils/utils.spec.js.map +1 -0
  69. package/dist/src/index.d.ts +7 -0
  70. package/dist/src/index.d.ts.map +1 -0
  71. package/dist/src/index.js +15 -0
  72. package/dist/src/index.js.map +1 -0
  73. package/dist/src/payments/implementations/fake.d.ts +33 -0
  74. package/dist/src/payments/implementations/fake.d.ts.map +1 -0
  75. package/dist/src/payments/implementations/fake.js +110 -0
  76. package/dist/src/payments/implementations/fake.js.map +1 -0
  77. package/dist/src/payments/implementations/live.d.ts +45 -0
  78. package/dist/src/payments/implementations/live.d.ts.map +1 -0
  79. package/dist/src/payments/implementations/live.js +69 -0
  80. package/dist/src/payments/implementations/live.js.map +1 -0
  81. package/dist/src/payments/operations/get_access_token.d.ts +11 -0
  82. package/dist/src/payments/operations/get_access_token.d.ts.map +1 -0
  83. package/dist/src/payments/operations/get_access_token.js +47 -0
  84. package/dist/src/payments/operations/get_access_token.js.map +1 -0
  85. package/dist/src/payments/operations/get_access_token.spec.d.ts +2 -0
  86. package/dist/src/payments/operations/get_access_token.spec.d.ts.map +1 -0
  87. package/dist/src/payments/operations/get_access_token.spec.js +74 -0
  88. package/dist/src/payments/operations/get_access_token.spec.js.map +1 -0
  89. package/dist/src/payments/operations/get_pay_token.d.ts +12 -0
  90. package/dist/src/payments/operations/get_pay_token.d.ts.map +1 -0
  91. package/dist/src/payments/operations/get_pay_token.js +43 -0
  92. package/dist/src/payments/operations/get_pay_token.js.map +1 -0
  93. package/dist/src/payments/operations/get_pay_token.spec.d.ts +2 -0
  94. package/dist/src/payments/operations/get_pay_token.spec.d.ts.map +1 -0
  95. package/dist/src/payments/operations/get_pay_token.spec.js +74 -0
  96. package/dist/src/payments/operations/get_pay_token.spec.js.map +1 -0
  97. package/dist/src/payments/operations/get_payment_status.d.ts +23 -0
  98. package/dist/src/payments/operations/get_payment_status.d.ts.map +1 -0
  99. package/dist/src/payments/operations/get_payment_status.js +51 -0
  100. package/dist/src/payments/operations/get_payment_status.js.map +1 -0
  101. package/dist/src/payments/operations/get_payment_status.spec.d.ts +2 -0
  102. package/dist/src/payments/operations/get_payment_status.spec.d.ts.map +1 -0
  103. package/dist/src/payments/operations/get_payment_status.spec.js +101 -0
  104. package/dist/src/payments/operations/get_payment_status.spec.js.map +1 -0
  105. package/dist/src/payments/operations/initialize_om_payment.d.ts +22 -0
  106. package/dist/src/payments/operations/initialize_om_payment.d.ts.map +1 -0
  107. package/dist/src/payments/operations/initialize_om_payment.js +124 -0
  108. package/dist/src/payments/operations/initialize_om_payment.js.map +1 -0
  109. package/dist/src/payments/operations/initialize_om_payment.spec.d.ts +2 -0
  110. package/dist/src/payments/operations/initialize_om_payment.spec.d.ts.map +1 -0
  111. package/dist/src/payments/operations/initialize_om_payment.spec.js +245 -0
  112. package/dist/src/payments/operations/initialize_om_payment.spec.js.map +1 -0
  113. package/dist/src/payments/payments.d.ts +57 -0
  114. package/dist/src/payments/payments.d.ts.map +1 -0
  115. package/dist/src/payments/payments.js +36 -0
  116. package/dist/src/payments/payments.js.map +1 -0
  117. package/dist/src/payments/routes/routes.d.ts +48 -0
  118. package/dist/src/payments/routes/routes.d.ts.map +1 -0
  119. package/dist/src/payments/routes/routes.js +61 -0
  120. package/dist/src/payments/routes/routes.js.map +1 -0
  121. package/dist/src/payments/utils/constants.d.ts +96 -0
  122. package/dist/src/payments/utils/constants.d.ts.map +1 -0
  123. package/dist/src/payments/utils/constants.js +112 -0
  124. package/dist/src/payments/utils/constants.js.map +1 -0
  125. package/dist/src/payments/utils/joi_schema.d.ts +71 -0
  126. package/dist/src/payments/utils/joi_schema.d.ts.map +1 -0
  127. package/dist/src/payments/utils/joi_schema.js +44 -0
  128. package/dist/src/payments/utils/joi_schema.js.map +1 -0
  129. package/dist/src/payments/utils/request_model.d.ts +75 -0
  130. package/dist/src/payments/utils/request_model.d.ts.map +1 -0
  131. package/dist/src/payments/utils/request_model.js +3 -0
  132. package/dist/src/payments/utils/request_model.js.map +1 -0
  133. package/dist/src/payments/utils/utils.d.ts +15 -0
  134. package/dist/src/payments/utils/utils.d.ts.map +1 -0
  135. package/dist/src/payments/utils/utils.js +27 -0
  136. package/dist/src/payments/utils/utils.js.map +1 -0
  137. package/dist/src/utils/https.d.ts +77 -0
  138. package/dist/src/utils/https.d.ts.map +1 -0
  139. package/dist/src/utils/https.js +240 -0
  140. package/dist/src/utils/https.js.map +1 -0
  141. package/dist/src/utils/https.spec.d.ts +2 -0
  142. package/dist/src/utils/https.spec.d.ts.map +1 -0
  143. package/dist/src/utils/https.spec.js +77 -0
  144. package/dist/src/utils/https.spec.js.map +1 -0
  145. package/dist/src/utils/logging_interface.d.ts +23 -0
  146. package/dist/src/utils/logging_interface.d.ts.map +1 -0
  147. package/dist/src/utils/logging_interface.js +3 -0
  148. package/dist/src/utils/logging_interface.js.map +1 -0
  149. package/dist/src/utils/operation_response.d.ts +16 -0
  150. package/dist/src/utils/operation_response.d.ts.map +1 -0
  151. package/dist/src/utils/operation_response.js +3 -0
  152. package/dist/src/utils/operation_response.js.map +1 -0
  153. package/dist/src/utils/utils.d.ts +6 -0
  154. package/dist/src/utils/utils.d.ts.map +1 -0
  155. package/dist/src/utils/utils.js +10 -0
  156. package/dist/src/utils/utils.js.map +1 -0
  157. package/package.json +3 -3
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=transfer.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transfer.spec.d.ts","sourceRoot":"","sources":["../../../../src/disbursements/operations/transfer.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const requests = __importStar(require("../../utils/https"));
27
+ const constants_1 = require("../utils/constants");
28
+ const transfer_1 = require("./transfer");
29
+ describe('transfer', () => {
30
+ it('should fail on invalid parameter provided', async () => {
31
+ const { error, data, raw } = await (0, transfer_1.transfer)({
32
+ configs: {
33
+ channelUserMsisdn: '',
34
+ clientId: '',
35
+ clientSecret: '',
36
+ customerKey: '',
37
+ customerSecret: '',
38
+ pin: '',
39
+ environment: constants_1.DisbursementXTargetEnvironmentType.sandbox,
40
+ logger: console,
41
+ },
42
+ params: {
43
+ webhook: '',
44
+ amount: 0,
45
+ customerPhone: '',
46
+ customerName: '',
47
+ token: '',
48
+ },
49
+ endPoint: '',
50
+ });
51
+ expect(data).not.toBeDefined();
52
+ expect(raw).not.toBeDefined();
53
+ expect(error).toBeDefined();
54
+ });
55
+ it('should fail on invalid phone number provided provided', async () => {
56
+ const { error, data, raw } = await (0, transfer_1.transfer)({
57
+ configs: {
58
+ channelUserMsisdn: '237699947943',
59
+ clientId: 'clientId',
60
+ clientSecret: 'clientSecret',
61
+ customerKey: 'customerKey',
62
+ customerSecret: 'customerSecret',
63
+ pin: 'pin',
64
+ environment: constants_1.DisbursementXTargetEnvironmentType.sandbox,
65
+ logger: console,
66
+ },
67
+ params: {
68
+ webhook: 'https://example.com',
69
+ amount: 100,
70
+ customerPhone: '69532652',
71
+ customerName: 'itachi uchiwa',
72
+ token: 'token',
73
+ },
74
+ endPoint: 'https://example.com',
75
+ });
76
+ expect(data).not.toBeDefined();
77
+ expect(raw).not.toBeDefined();
78
+ expect(error).toBeDefined();
79
+ });
80
+ it('should fail on request failure', async () => {
81
+ const postSpy = jest
82
+ .spyOn(requests, 'postRequest')
83
+ .mockImplementation()
84
+ .mockResolvedValue({
85
+ error: {},
86
+ });
87
+ const { error, data, raw } = await (0, transfer_1.transfer)({
88
+ configs: {
89
+ channelUserMsisdn: '237699947943',
90
+ clientId: 'clientId',
91
+ clientSecret: 'clientSecret',
92
+ customerKey: 'customerKey',
93
+ customerSecret: 'customerSecret',
94
+ pin: 'pin',
95
+ environment: constants_1.DisbursementXTargetEnvironmentType.sandbox,
96
+ logger: console,
97
+ },
98
+ params: {
99
+ webhook: 'https://example.com',
100
+ amount: 100,
101
+ customerPhone: '695326522',
102
+ customerName: 'itachi uchiwa',
103
+ token: 'token',
104
+ },
105
+ endPoint: 'https://example.com',
106
+ });
107
+ expect(data).not.toBeDefined();
108
+ expect(raw).not.toBeDefined();
109
+ expect(postSpy).toHaveBeenCalledTimes(1);
110
+ expect(error).toBeDefined();
111
+ });
112
+ it('should succeed on request succeed', async () => {
113
+ const postSpy = jest
114
+ .spyOn(requests, 'postRequest')
115
+ .mockImplementation()
116
+ .mockResolvedValue({
117
+ response: {
118
+ data: {
119
+ MD5OfMessageBody: 'MD5OfMessageBody',
120
+ MD5OfMessageAttributes: 'MD5OfMessageAttributes',
121
+ MessageId: 'MessageId',
122
+ ResponseMetadata: {
123
+ RequestId: 'RequestId',
124
+ HTTPStatusCode: 200,
125
+ HTTPHeaders: {
126
+ 'x-amzn-requestid': 'x-amzn-requestid',
127
+ 'x-amzn-trace-id': 'x-amzn-trace-id',
128
+ 'content-type': 'content-type',
129
+ 'content-length': 'content-length',
130
+ },
131
+ RetryAttempts: 2,
132
+ },
133
+ },
134
+ },
135
+ });
136
+ const { error, data, raw } = await (0, transfer_1.transfer)({
137
+ configs: {
138
+ channelUserMsisdn: '237699947943',
139
+ clientId: 'clientId',
140
+ clientSecret: 'clientSecret',
141
+ customerKey: 'customerKey',
142
+ customerSecret: 'customerSecret',
143
+ pin: 'pin',
144
+ environment: constants_1.DisbursementXTargetEnvironmentType.sandbox,
145
+ logger: console,
146
+ },
147
+ params: {
148
+ webhook: 'https://example.com',
149
+ amount: 100,
150
+ customerPhone: '695326522',
151
+ customerName: 'itachi uchiwa',
152
+ token: 'token',
153
+ },
154
+ endPoint: 'https://example.com',
155
+ });
156
+ expect(error).not.toBeDefined();
157
+ expect(postSpy).toHaveBeenCalledTimes(1);
158
+ expect(raw).toEqual({
159
+ MD5OfMessageBody: 'MD5OfMessageBody',
160
+ MD5OfMessageAttributes: 'MD5OfMessageAttributes',
161
+ MessageId: 'MessageId',
162
+ ResponseMetadata: {
163
+ RequestId: 'RequestId',
164
+ HTTPStatusCode: 200,
165
+ HTTPHeaders: {
166
+ 'x-amzn-requestid': 'x-amzn-requestid',
167
+ 'x-amzn-trace-id': 'x-amzn-trace-id',
168
+ 'content-type': 'content-type',
169
+ 'content-length': 'content-length',
170
+ },
171
+ RetryAttempts: 2,
172
+ },
173
+ });
174
+ expect(data).toBe('MessageId');
175
+ });
176
+ });
177
+ //# sourceMappingURL=transfer.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transfer.spec.js","sourceRoot":"","sources":["../../../../src/disbursements/operations/transfer.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA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7B,KAAK,EAAE,OAAO;aACf;YACD,QAAQ,EAAE,qBAAqB;SAChC,CAAC,CAAC;QAEH,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;QAChC,MAAM,CAAC,OAAO,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QACzC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;YAClB,gBAAgB,EAAE,kBAAkB;YACpC,sBAAsB,EAAE,wBAAwB;YAChD,SAAS,EAAE,WAAW;YACtB,gBAAgB,EAAE;gBAChB,SAAS,EAAE,WAAW;gBACtB,cAAc,EAAE,GAAG;gBACnB,WAAW,EAAE;oBACX,kBAAkB,EAAE,kBAAkB;oBACtC,iBAAiB,EAAE,iBAAiB;oBACpC,cAAc,EAAE,cAAc;oBAC9B,gBAAgB,EAAE,gBAAgB;iBACnC;gBACD,aAAa,EAAE,CAAC;aACjB;SACF,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Orange Money API routes builder.
3
+ * @class
4
+ */
5
+ export declare class Routes {
6
+ /**
7
+ * Constructs a new {CommonRoutes}.
8
+ * @constructor
9
+ * @param {RoutesParams} config - The required global route configuration.
10
+ */
11
+ /**
12
+ * Returns the base route for the API.
13
+ * e.g: https://docs.google.com/document/d/1h-gMj7PSGAALxRSofOvLa2g5vF3IpDkUufNrU1hX6Yk/edit?pli=1
14
+ * @return {string} The base route.
15
+ */
16
+ private baseRoute;
17
+ /**
18
+ * This route is used to create an access token which can then be used to authorize and authenticate towards the other end-points of the API.
19
+ * e.g : https://docs.google.com/document/d/1h-gMj7PSGAALxRSofOvLa2g5vF3IpDkUufNrU1hX6Yk/edit?pli=1 page 2
20
+ * @return {string}
21
+ */
22
+ createAccessToken(): string;
23
+ /**
24
+ * This route is used to transfer an amount from the owner’s account to a payee account (customer).
25
+ * e.g : https://docs.google.com/document/d/1h-gMj7PSGAALxRSofOvLa2g5vF3IpDkUufNrU1hX6Yk/edit?pli=1 page 4
26
+ * @return {string} - The transfer route.
27
+ */
28
+ transfer(): string;
29
+ /**
30
+ * This route is used to get the status of a transfer.
31
+ *
32
+ * @param {string} Id - The reference of the transfer.
33
+ * e.g : https://docs.google.com/document/d/1h-gMj7PSGAALxRSofOvLa2g5vF3IpDkUufNrU1hX6Yk/edit?pli=1 page 9
34
+ * @return {string} - The transfer status route.
35
+ */
36
+ transferStatus(Id: string): string;
37
+ }
38
+ //# sourceMappingURL=routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../../src/disbursements/routes/routes.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,qBAAa,MAAM;IACjB;;;;OAIG;IAEH;;;;OAIG;IACH,OAAO,CAAC,SAAS;IAIjB;;;;OAIG;IACH,iBAAiB,IAAI,MAAM;IAI3B;;;;OAIG;IACH,QAAQ,IAAI,MAAM;IAIlB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;CAGnC"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Routes = void 0;
4
+ const constants_1 = require("../utils/constants");
5
+ const apiHost = 'https://omapi.ynote.africa';
6
+ const apiTokenHost = 'https://omapi-token.ynote.africa/oauth2/token';
7
+ /**
8
+ * Orange Money API routes builder.
9
+ * @class
10
+ */
11
+ class Routes {
12
+ /**
13
+ * Constructs a new {CommonRoutes}.
14
+ * @constructor
15
+ * @param {RoutesParams} config - The required global route configuration.
16
+ */
17
+ /**
18
+ * Returns the base route for the API.
19
+ * e.g: https://docs.google.com/document/d/1h-gMj7PSGAALxRSofOvLa2g5vF3IpDkUufNrU1hX6Yk/edit?pli=1
20
+ * @return {string} The base route.
21
+ */
22
+ baseRoute() {
23
+ return `${apiHost}/${constants_1.DisbursementXTargetEnvironmentType.prod}`;
24
+ }
25
+ /**
26
+ * This route is used to create an access token which can then be used to authorize and authenticate towards the other end-points of the API.
27
+ * e.g : https://docs.google.com/document/d/1h-gMj7PSGAALxRSofOvLa2g5vF3IpDkUufNrU1hX6Yk/edit?pli=1 page 2
28
+ * @return {string}
29
+ */
30
+ createAccessToken() {
31
+ return apiTokenHost;
32
+ }
33
+ /**
34
+ * This route is used to transfer an amount from the owner’s account to a payee account (customer).
35
+ * e.g : https://docs.google.com/document/d/1h-gMj7PSGAALxRSofOvLa2g5vF3IpDkUufNrU1hX6Yk/edit?pli=1 page 4
36
+ * @return {string} - The transfer route.
37
+ */
38
+ transfer() {
39
+ return `${this.baseRoute()}/refund`;
40
+ }
41
+ /**
42
+ * This route is used to get the status of a transfer.
43
+ *
44
+ * @param {string} Id - The reference of the transfer.
45
+ * e.g : https://docs.google.com/document/d/1h-gMj7PSGAALxRSofOvLa2g5vF3IpDkUufNrU1hX6Yk/edit?pli=1 page 9
46
+ * @return {string} - The transfer status route.
47
+ */
48
+ transferStatus(Id) {
49
+ return `${this.baseRoute()}/refund/status/${Id}`;
50
+ }
51
+ }
52
+ exports.Routes = Routes;
53
+ //# sourceMappingURL=routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../../src/disbursements/routes/routes.ts"],"names":[],"mappings":";;;AAAA,kDAAwE;AAExE,MAAM,OAAO,GAAG,4BAA4B,CAAC;AAC7C,MAAM,YAAY,GAAG,+CAA+C,CAAC;AAErE;;;GAGG;AACH,MAAa,MAAM;IACjB;;;;OAIG;IAEH;;;;OAIG;IACK,SAAS;QACf,OAAO,GAAG,OAAO,IAAI,8CAAkC,CAAC,IAAI,EAAE,CAAC;IACjE,CAAC;IAED;;;;OAIG;IACH,iBAAiB;QACf,OAAO,YAAY,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC;IACtC,CAAC;IAED;;;;;;OAMG;IACH,cAAc,CAAC,EAAU;QACvB,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,kBAAkB,EAAE,EAAE,CAAC;IACnD,CAAC;CACF;AA5CD,wBA4CC"}
@@ -0,0 +1,5 @@
1
+ export declare enum DisbursementXTargetEnvironmentType {
2
+ sandbox = "dev",
3
+ prod = "prod"
4
+ }
5
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/disbursements/utils/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,kCAAkC;IAC5C,OAAO,QAAQ;IACf,IAAI,SAAS;CACd"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DisbursementXTargetEnvironmentType = void 0;
4
+ var DisbursementXTargetEnvironmentType;
5
+ (function (DisbursementXTargetEnvironmentType) {
6
+ DisbursementXTargetEnvironmentType["sandbox"] = "dev";
7
+ DisbursementXTargetEnvironmentType["prod"] = "prod";
8
+ })(DisbursementXTargetEnvironmentType = exports.DisbursementXTargetEnvironmentType || (exports.DisbursementXTargetEnvironmentType = {}));
9
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/disbursements/utils/constants.ts"],"names":[],"mappings":";;;AAAA,IAAY,kCAGX;AAHD,WAAY,kCAAkC;IAC5C,qDAAe,CAAA;IACf,mDAAa,CAAA;AACf,CAAC,EAHW,kCAAkC,GAAlC,0CAAkC,KAAlC,0CAAkC,QAG7C"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The merchant number regExp authorized for numbers by y-note.
3
+ */
4
+ export declare const merchantPhoneNumberRegex: RegExp;
5
+ /**
6
+ * The orange money phone number regex for orange money numbers without the country code.
7
+ */
8
+ export declare const orangeMoneyPhoneNumberWithoutCountryCodeRegex: RegExp;
9
+ //# sourceMappingURL=regex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regex.d.ts","sourceRoot":"","sources":["../../../../src/disbursements/utils/regex.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,wBAAwB,QACY,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,6CAA6C,QACf,CAAC"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.orangeMoneyPhoneNumberWithoutCountryCodeRegex = exports.merchantPhoneNumberRegex = void 0;
4
+ /**
5
+ * The merchant number regExp authorized for numbers by y-note.
6
+ */
7
+ exports.merchantPhoneNumberRegex = /^(237)?(69\d{7}$|65[5-9]\d{6}$|68[6-9]\d{6}$)/;
8
+ /**
9
+ * The orange money phone number regex for orange money numbers without the country code.
10
+ */
11
+ exports.orangeMoneyPhoneNumberWithoutCountryCodeRegex = /^(69\d{7}$|65[5-9]\d{6}$|68[6-9]\d{6}$)/;
12
+ //# sourceMappingURL=regex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regex.js","sourceRoot":"","sources":["../../../../src/disbursements/utils/regex.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,wBAAwB,GACnC,+CAA+C,CAAC;AAElD;;GAEG;AACU,QAAA,6CAA6C,GACxD,yCAAyC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=regex.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regex.spec.d.ts","sourceRoot":"","sources":["../../../../src/disbursements/utils/regex.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const regex_1 = require("./regex");
4
+ describe('Test regex merchant phone number', () => {
5
+ test('Merchant phone number regex matches valid numbers', () => {
6
+ const validNumbers = ['699947943', '237699947943', '237689947943'];
7
+ validNumbers.forEach((number) => {
8
+ expect(regex_1.merchantPhoneNumberRegex.test(number)).toBe(true);
9
+ });
10
+ });
11
+ test('Merchant phone number regex does not match invalid numbers', () => {
12
+ const invalidNumbers = ['12345', '23712345', 'abc'];
13
+ invalidNumbers.forEach((number) => {
14
+ expect(regex_1.merchantPhoneNumberRegex.test(number)).toBe(false);
15
+ });
16
+ });
17
+ });
18
+ describe('Test regex orange money phone number without country code', () => {
19
+ test('Oman phone number without country code regex matches valid numbers', () => {
20
+ const validNumbers = ['696512345', '696898765', '686898765'];
21
+ validNumbers.forEach((number) => {
22
+ expect(regex_1.orangeMoneyPhoneNumberWithoutCountryCodeRegex.test(number)).toBe(true);
23
+ });
24
+ });
25
+ test('Orange money phone number without country code regex does not match invalid numbers', () => {
26
+ const invalidNumbers = ['12345', '96812345', 'abc'];
27
+ invalidNumbers.forEach((number) => {
28
+ expect(regex_1.orangeMoneyPhoneNumberWithoutCountryCodeRegex.test(number)).toBe(false);
29
+ });
30
+ });
31
+ });
32
+ //# sourceMappingURL=regex.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regex.spec.js","sourceRoot":"","sources":["../../../../src/disbursements/utils/regex.spec.ts"],"names":[],"mappings":";;AAAA,mCAGiB;AAEjB,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAChD,IAAI,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC7D,MAAM,YAAY,GAAG,CAAC,WAAW,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;QACnE,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAC9B,MAAM,CAAC,gCAAwB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACtE,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QACpD,cAAc,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAChC,MAAM,CAAC,gCAAwB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AACH,QAAQ,CAAC,2DAA2D,EAAE,GAAG,EAAE;IACzE,IAAI,CAAC,oEAAoE,EAAE,GAAG,EAAE;QAC9E,MAAM,YAAY,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;QAC7D,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAC9B,MAAM,CAAC,qDAA6C,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CACrE,IAAI,CACL,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,qFAAqF,EAAE,GAAG,EAAE;QAC/F,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QACpD,cAAc,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAChC,MAAM,CAAC,qDAA6C,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CACrE,KAAK,CACN,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * The simplified version of transaction status.
3
+ */
4
+ export declare enum DisbursementStatus {
5
+ /**
6
+ * The transaction failed.
7
+ */
8
+ failed = "FAILED",
9
+ /**
10
+ * The transaction is pending.
11
+ */
12
+ pending = "PENDING",
13
+ /**
14
+ * The transaction succeeded.
15
+ */
16
+ succeeded = "SUCCEEDED",
17
+ /**
18
+ * The status received from the endpoint was not recognized.
19
+ */
20
+ unknown = "UNKNOWN"
21
+ }
22
+ export declare enum DisbursementApiRawStatus {
23
+ /**
24
+ * Transaction is in progress on Orange system.
25
+ */
26
+ pending = "PENDING",
27
+ /**
28
+ * The user canceled the disbursement.
29
+ */
30
+ canceled = "CANCELLED",
31
+ /**
32
+ * Waiting for user entry.
33
+ */
34
+ initialized = "INITIATED",
35
+ /**
36
+ * Disbursement is done for mobile.
37
+ */
38
+ succeeded = "SUCCESSFULL",
39
+ /**
40
+ * Disbursement is done for web.
41
+ */
42
+ succeeded2 = "SUCCESS",
43
+ /**
44
+ * Disbursement failed.
45
+ */
46
+ failed = "FAILED",
47
+ /**
48
+ * The token timed out.
49
+ * Note that the minimum token expiration time is 7 min.
50
+ */
51
+ expired = "EXPIRED"
52
+ }
53
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../src/disbursements/utils/status.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,kBAAkB;IAC5B;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,OAAO,YAAY;IAEnB;;OAEG;IACH,SAAS,cAAc;IAEvB;;OAEG;IACH,OAAO,YAAY;CACpB;AAED,oBAAY,wBAAwB;IAClC;;OAEG;IACH,OAAO,YAAY;IAEnB;;OAEG;IACH,QAAQ,cAAc;IAEtB;;OAEG;IACH,WAAW,cAAc;IAEzB;;OAEG;IACH,SAAS,gBAAgB;IAEzB;;OAEG;IACH,UAAU,YAAY;IAEtB;;OAEG;IACH,MAAM,WAAW;IAEjB;;;OAGG;IACH,OAAO,YAAY;CACpB"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DisbursementApiRawStatus = exports.DisbursementStatus = void 0;
4
+ /**
5
+ * The simplified version of transaction status.
6
+ */
7
+ var DisbursementStatus;
8
+ (function (DisbursementStatus) {
9
+ /**
10
+ * The transaction failed.
11
+ */
12
+ DisbursementStatus["failed"] = "FAILED";
13
+ /**
14
+ * The transaction is pending.
15
+ */
16
+ DisbursementStatus["pending"] = "PENDING";
17
+ /**
18
+ * The transaction succeeded.
19
+ */
20
+ DisbursementStatus["succeeded"] = "SUCCEEDED";
21
+ /**
22
+ * The status received from the endpoint was not recognized.
23
+ */
24
+ DisbursementStatus["unknown"] = "UNKNOWN";
25
+ })(DisbursementStatus = exports.DisbursementStatus || (exports.DisbursementStatus = {}));
26
+ var DisbursementApiRawStatus;
27
+ (function (DisbursementApiRawStatus) {
28
+ /**
29
+ * Transaction is in progress on Orange system.
30
+ */
31
+ DisbursementApiRawStatus["pending"] = "PENDING";
32
+ /**
33
+ * The user canceled the disbursement.
34
+ */
35
+ DisbursementApiRawStatus["canceled"] = "CANCELLED";
36
+ /**
37
+ * Waiting for user entry.
38
+ */
39
+ DisbursementApiRawStatus["initialized"] = "INITIATED";
40
+ /**
41
+ * Disbursement is done for mobile.
42
+ */
43
+ DisbursementApiRawStatus["succeeded"] = "SUCCESSFULL";
44
+ /**
45
+ * Disbursement is done for web.
46
+ */
47
+ DisbursementApiRawStatus["succeeded2"] = "SUCCESS";
48
+ /**
49
+ * Disbursement failed.
50
+ */
51
+ DisbursementApiRawStatus["failed"] = "FAILED";
52
+ /**
53
+ * The token timed out.
54
+ * Note that the minimum token expiration time is 7 min.
55
+ */
56
+ DisbursementApiRawStatus["expired"] = "EXPIRED";
57
+ })(DisbursementApiRawStatus = exports.DisbursementApiRawStatus || (exports.DisbursementApiRawStatus = {}));
58
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../src/disbursements/utils/status.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,kBAoBX;AApBD,WAAY,kBAAkB;IAC5B;;OAEG;IACH,uCAAiB,CAAA;IAEjB;;OAEG;IACH,yCAAmB,CAAA;IAEnB;;OAEG;IACH,6CAAuB,CAAA;IAEvB;;OAEG;IACH,yCAAmB,CAAA;AACrB,CAAC,EApBW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAoB7B;AAED,IAAY,wBAoCX;AApCD,WAAY,wBAAwB;IAClC;;OAEG;IACH,+CAAmB,CAAA;IAEnB;;OAEG;IACH,kDAAsB,CAAA;IAEtB;;OAEG;IACH,qDAAyB,CAAA;IAEzB;;OAEG;IACH,qDAAyB,CAAA;IAEzB;;OAEG;IACH,kDAAsB,CAAA;IAEtB;;OAEG;IACH,6CAAiB,CAAA;IAEjB;;;OAGG;IACH,+CAAmB,CAAA;AACrB,CAAC,EApCW,wBAAwB,GAAxB,gCAAwB,KAAxB,gCAAwB,QAoCnC"}
@@ -0,0 +1,9 @@
1
+ import { DisbursementApiRawStatus, DisbursementStatus } from './status';
2
+ /**
3
+ * Maps a raw status from the Disbursement API to a DisbursementStatus.
4
+ *
5
+ * @param {DisbursementApiRawStatus} rawStatus - The raw status from the Disbursement API.
6
+ * @return {DisbursementStatus} The corresponding DisbursementStatus.
7
+ */
8
+ export declare function getStatusFromProviderRawStatus(rawStatus: DisbursementApiRawStatus): DisbursementStatus;
9
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/disbursements/utils/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAExE;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,wBAAwB,GAClC,kBAAkB,CAapB"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getStatusFromProviderRawStatus = void 0;
4
+ const status_1 = require("./status");
5
+ /**
6
+ * Maps a raw status from the Disbursement API to a DisbursementStatus.
7
+ *
8
+ * @param {DisbursementApiRawStatus} rawStatus - The raw status from the Disbursement API.
9
+ * @return {DisbursementStatus} The corresponding DisbursementStatus.
10
+ */
11
+ function getStatusFromProviderRawStatus(rawStatus) {
12
+ switch (rawStatus) {
13
+ case status_1.DisbursementApiRawStatus.pending:
14
+ case status_1.DisbursementApiRawStatus.initialized:
15
+ return status_1.DisbursementStatus.pending;
16
+ case status_1.DisbursementApiRawStatus.succeeded:
17
+ case status_1.DisbursementApiRawStatus.succeeded2:
18
+ return status_1.DisbursementStatus.succeeded;
19
+ case status_1.DisbursementApiRawStatus.canceled:
20
+ case status_1.DisbursementApiRawStatus.expired:
21
+ case status_1.DisbursementApiRawStatus.failed:
22
+ return status_1.DisbursementStatus.failed;
23
+ }
24
+ }
25
+ exports.getStatusFromProviderRawStatus = getStatusFromProviderRawStatus;
26
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/disbursements/utils/utils.ts"],"names":[],"mappings":";;;AAAA,qCAAwE;AAExE;;;;;GAKG;AACH,SAAgB,8BAA8B,CAC5C,SAAmC;IAEnC,QAAQ,SAAS,EAAE;QACjB,KAAK,iCAAwB,CAAC,OAAO,CAAC;QACtC,KAAK,iCAAwB,CAAC,WAAW;YACvC,OAAO,2BAAkB,CAAC,OAAO,CAAC;QACpC,KAAK,iCAAwB,CAAC,SAAS,CAAC;QACxC,KAAK,iCAAwB,CAAC,UAAU;YACtC,OAAO,2BAAkB,CAAC,SAAS,CAAC;QACtC,KAAK,iCAAwB,CAAC,QAAQ,CAAC;QACvC,KAAK,iCAAwB,CAAC,OAAO,CAAC;QACtC,KAAK,iCAAwB,CAAC,MAAM;YAClC,OAAO,2BAAkB,CAAC,MAAM,CAAC;KACpC;AACH,CAAC;AAfD,wEAeC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=utils.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.spec.d.ts","sourceRoot":"","sources":["../../../../src/disbursements/utils/utils.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const status_1 = require("./status");
4
+ const utils_1 = require("./utils");
5
+ describe('getStatusFromProviderRawStatus', () => {
6
+ test('should map raw status to disbursement status', () => {
7
+ const testCases = [
8
+ {
9
+ rawStatus: status_1.DisbursementApiRawStatus.pending,
10
+ expectedStatus: status_1.DisbursementStatus.pending,
11
+ },
12
+ {
13
+ rawStatus: status_1.DisbursementApiRawStatus.initialized,
14
+ expectedStatus: status_1.DisbursementStatus.pending,
15
+ },
16
+ {
17
+ rawStatus: status_1.DisbursementApiRawStatus.succeeded,
18
+ expectedStatus: status_1.DisbursementStatus.succeeded,
19
+ },
20
+ {
21
+ rawStatus: status_1.DisbursementApiRawStatus.succeeded2,
22
+ expectedStatus: status_1.DisbursementStatus.succeeded,
23
+ },
24
+ {
25
+ rawStatus: status_1.DisbursementApiRawStatus.canceled,
26
+ expectedStatus: status_1.DisbursementStatus.failed,
27
+ },
28
+ {
29
+ rawStatus: status_1.DisbursementApiRawStatus.expired,
30
+ expectedStatus: status_1.DisbursementStatus.failed,
31
+ },
32
+ {
33
+ rawStatus: status_1.DisbursementApiRawStatus.failed,
34
+ expectedStatus: status_1.DisbursementStatus.failed,
35
+ },
36
+ ];
37
+ testCases.forEach(({ rawStatus, expectedStatus }) => {
38
+ const result = (0, utils_1.getStatusFromProviderRawStatus)(rawStatus);
39
+ expect(result).toBe(expectedStatus);
40
+ });
41
+ });
42
+ });
43
+ //# sourceMappingURL=utils.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.spec.js","sourceRoot":"","sources":["../../../../src/disbursements/utils/utils.spec.ts"],"names":[],"mappings":";;AAAA,qCAAwE;AACxE,mCAAyD;AAEzD,QAAQ,CAAC,gCAAgC,EAAE,GAAG,EAAE;IAC9C,IAAI,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACxD,MAAM,SAAS,GAAG;YAChB;gBACE,SAAS,EAAE,iCAAwB,CAAC,OAAO;gBAC3C,cAAc,EAAE,2BAAkB,CAAC,OAAO;aAC3C;YACD;gBACE,SAAS,EAAE,iCAAwB,CAAC,WAAW;gBAC/C,cAAc,EAAE,2BAAkB,CAAC,OAAO;aAC3C;YACD;gBACE,SAAS,EAAE,iCAAwB,CAAC,SAAS;gBAC7C,cAAc,EAAE,2BAAkB,CAAC,SAAS;aAC7C;YACD;gBACE,SAAS,EAAE,iCAAwB,CAAC,UAAU;gBAC9C,cAAc,EAAE,2BAAkB,CAAC,SAAS;aAC7C;YACD;gBACE,SAAS,EAAE,iCAAwB,CAAC,QAAQ;gBAC5C,cAAc,EAAE,2BAAkB,CAAC,MAAM;aAC1C;YACD;gBACE,SAAS,EAAE,iCAAwB,CAAC,OAAO;gBAC3C,cAAc,EAAE,2BAAkB,CAAC,MAAM;aAC1C;YACD;gBACE,SAAS,EAAE,iCAAwB,CAAC,MAAM;gBAC1C,cAAc,EAAE,2BAAkB,CAAC,MAAM;aAC1C;SACF,CAAC;QAEF,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,EAAE,EAAE;YAClD,MAAM,MAAM,GAAG,IAAA,sCAA8B,EAAC,SAAS,CAAC,CAAC;YACzD,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { Disbursement } from './disbursements/implementations/disbursement_service';
2
+ export { DisbursementXTargetEnvironmentType } from './disbursements/utils/constants';
3
+ export { DisbursementInterface } from './disbursements/implementations/disbursement_service';
4
+ export { DisbursementStatus } from './disbursements/utils/status';
5
+ export { OrangeMoneyPayment, OrangeMoneyPaymentInterface, } from './payments/payments';
6
+ export { ApiErrorType, OrangeMoneyPaymentStatus, } from './payments/utils/constants';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sDAAsD,CAAC;AACpF,OAAO,EAAE,kCAAkC,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sDAAsD,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EACL,kBAAkB,EAClB,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,YAAY,EACZ,wBAAwB,GACzB,MAAM,4BAA4B,CAAC"}