@technova-tech/connect-cba 0.0.60
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.
- package/bank-one/BankOne.d.ts +31 -0
- package/bank-one/BankOne.js +848 -0
- package/bank-one/index.d.ts +2 -0
- package/bank-one/index.js +18 -0
- package/bank-one/interface/index.d.ts +439 -0
- package/bank-one/interface/index.js +2 -0
- package/common/constants/cba.constant.d.ts +3 -0
- package/common/constants/cba.constant.js +7 -0
- package/common/constants/index.d.ts +1 -0
- package/common/constants/index.js +17 -0
- package/common/errors/BadRequest.d.ts +4 -0
- package/common/errors/BadRequest.js +31 -0
- package/common/errors/HttpRequest.d.ts +3 -0
- package/common/errors/HttpRequest.js +26 -0
- package/common/errors/InternalServer.d.ts +4 -0
- package/common/errors/InternalServer.js +31 -0
- package/common/errors/index.d.ts +4 -0
- package/common/errors/index.js +11 -0
- package/common/errors/messages.d.ts +3 -0
- package/common/errors/messages.js +6 -0
- package/common/http/index.d.ts +14 -0
- package/common/http/index.js +82 -0
- package/common/index.d.ts +5 -0
- package/common/index.js +21 -0
- package/common/interface/ICBA.d.ts +33 -0
- package/common/interface/ICBA.js +33 -0
- package/common/interface/account.d.ts +80 -0
- package/common/interface/account.js +2 -0
- package/common/interface/customer.d.ts +63 -0
- package/common/interface/customer.js +8 -0
- package/common/interface/index.d.ts +4 -0
- package/common/interface/index.js +20 -0
- package/common/interface/transaction.d.ts +40 -0
- package/common/interface/transaction.js +14 -0
- package/common/interface/transfer.d.ts +50 -0
- package/common/interface/transfer.js +2 -0
- package/common/util/index.d.ts +3 -0
- package/common/util/index.js +40 -0
- package/common/util/phone.d.ts +1 -0
- package/common/util/phone.js +15 -0
- package/index.d.ts +4 -0
- package/index.js +30 -0
- package/package.json +42 -0
|
@@ -0,0 +1,848 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
28
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
29
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
30
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
31
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
32
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
33
|
+
var _, done = false;
|
|
34
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
35
|
+
var context = {};
|
|
36
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
37
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
38
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
39
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
40
|
+
if (kind === "accessor") {
|
|
41
|
+
if (result === void 0) continue;
|
|
42
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
43
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
44
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
45
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
46
|
+
}
|
|
47
|
+
else if (_ = accept(result)) {
|
|
48
|
+
if (kind === "field") initializers.unshift(_);
|
|
49
|
+
else descriptor[key] = _;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
53
|
+
done = true;
|
|
54
|
+
};
|
|
55
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
56
|
+
var useValue = arguments.length > 2;
|
|
57
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
58
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
59
|
+
}
|
|
60
|
+
return useValue ? value : void 0;
|
|
61
|
+
};
|
|
62
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
63
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
64
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
65
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
66
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
67
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
68
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
72
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
73
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
74
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
75
|
+
function step(op) {
|
|
76
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
77
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
78
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
79
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
80
|
+
switch (op[0]) {
|
|
81
|
+
case 0: case 1: t = op; break;
|
|
82
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
83
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
84
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
85
|
+
default:
|
|
86
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
87
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
88
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
89
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
90
|
+
if (t[2]) _.ops.pop();
|
|
91
|
+
_.trys.pop(); continue;
|
|
92
|
+
}
|
|
93
|
+
op = body.call(thisArg, _);
|
|
94
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
95
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
99
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
100
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
101
|
+
};
|
|
102
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
103
|
+
exports.BankOne = void 0;
|
|
104
|
+
var randomstring_1 = require("randomstring");
|
|
105
|
+
var typedi_1 = require("typedi");
|
|
106
|
+
var common_1 = require("../common");
|
|
107
|
+
var BankOne = function () {
|
|
108
|
+
var _classDecorators = [(0, typedi_1.Service)()];
|
|
109
|
+
var _classDescriptor;
|
|
110
|
+
var _classExtraInitializers = [];
|
|
111
|
+
var _classThis;
|
|
112
|
+
var _classSuper = common_1.ICoreBankingApplication;
|
|
113
|
+
var BankOne = _classThis = (function (_super) {
|
|
114
|
+
__extends(BankOne_1, _super);
|
|
115
|
+
function BankOne_1() {
|
|
116
|
+
var _this = _super.call(this, {
|
|
117
|
+
baseURL: (0, common_1.getEnv)('BANK_ONE_BASE_URL'),
|
|
118
|
+
}) || this;
|
|
119
|
+
_this.authToken = (0, common_1.getEnv)('BANK_ONE_AUTH_TOKEN');
|
|
120
|
+
_this.accountOfficerCode = (0, common_1.getEnv)('BANK_ONE_ACCOUNT_OFFICER_CODE');
|
|
121
|
+
_this.creditGLCode = (0, common_1.getEnv)('BANK_ONE_CREDIT_GL_CODE');
|
|
122
|
+
_this.debitGLCode = (0, common_1.getEnv)('BANK_ONE_DEBIT_GL_CODE');
|
|
123
|
+
_this.productCode = (0, common_1.getEnv)('BANK_ONE_PRODUCT_CODE');
|
|
124
|
+
_this.businessProductCode = (0, common_1.getEnv)('BANK_ONE_BUSINESS_PRODUCT_CODE');
|
|
125
|
+
return _this;
|
|
126
|
+
}
|
|
127
|
+
BankOne_1.prototype.createCustomer = function (request) {
|
|
128
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
129
|
+
var requestData, response, responseData, CustomerID;
|
|
130
|
+
var _a, _b, _c, _d;
|
|
131
|
+
return __generator(this, function (_e) {
|
|
132
|
+
switch (_e.label) {
|
|
133
|
+
case 0:
|
|
134
|
+
requestData = {
|
|
135
|
+
LastName: request.first_name,
|
|
136
|
+
OtherNames: "".concat((request === null || request === void 0 ? void 0 : request.middle_name) || '', " ").concat(request.first_name),
|
|
137
|
+
City: 'Lagos',
|
|
138
|
+
Address: 'Lagos',
|
|
139
|
+
AccountOfficerCode: this.accountOfficerCode,
|
|
140
|
+
BankVerificationNumber: ((_a = request === null || request === void 0 ? void 0 : request.kyc) === null || _a === void 0 ? void 0 : _a.bvn) || ((_b = request === null || request === void 0 ? void 0 : request.kyc) === null || _b === void 0 ? void 0 : _b.id_number),
|
|
141
|
+
DateOfBirth: '',
|
|
142
|
+
Gender: request.gender === common_1.Gender.MALE ? 0 : 1,
|
|
143
|
+
HasCompleteDocumentation: true,
|
|
144
|
+
PhoneNo: (_c = request.kyc.metadata) === null || _c === void 0 ? void 0 : _c.phone,
|
|
145
|
+
PlaceOfBirth: 'Lagos',
|
|
146
|
+
NationalIdentityNo: ((_d = request === null || request === void 0 ? void 0 : request.kyc) === null || _d === void 0 ? void 0 : _d.nin) || request.kyc.id_number,
|
|
147
|
+
Email: request.kyc.email,
|
|
148
|
+
customerPassportInBytes: request.kyc.imageBase64,
|
|
149
|
+
NotificationPreference: 2,
|
|
150
|
+
};
|
|
151
|
+
console.log('requestData: ', requestData);
|
|
152
|
+
return [4, this.httpClient.post("/BankOneWebAPI/api/Customer/CreateCustomer/2?authToken=".concat(this.authToken), requestData)];
|
|
153
|
+
case 1:
|
|
154
|
+
response = _e.sent();
|
|
155
|
+
console.log('responseData: ', response.data);
|
|
156
|
+
if (response.status !== 200) {
|
|
157
|
+
this.handleResponseError(response.data, 'An error occurred creating customer');
|
|
158
|
+
}
|
|
159
|
+
responseData = response.data;
|
|
160
|
+
if (!responseData.CustomerID) {
|
|
161
|
+
this.handleResponseError(response.data, 'An error occurred creating customer');
|
|
162
|
+
}
|
|
163
|
+
CustomerID = responseData.CustomerID;
|
|
164
|
+
return [2, this.responseHandler.successResponse({
|
|
165
|
+
data: {
|
|
166
|
+
customer: __assign(__assign({}, request), { id: CustomerID }),
|
|
167
|
+
},
|
|
168
|
+
})];
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
BankOne_1.prototype.createBusinessCustomer = function (request) {
|
|
174
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
175
|
+
var requestData, response, responseData, CustomerIDInString;
|
|
176
|
+
return __generator(this, function (_a) {
|
|
177
|
+
switch (_a.label) {
|
|
178
|
+
case 0:
|
|
179
|
+
requestData = {
|
|
180
|
+
Name: request.business_name,
|
|
181
|
+
PhoneNo: request.phone_number,
|
|
182
|
+
PostalAddress: request.address,
|
|
183
|
+
BusinessPhoneNo: request.phone_number,
|
|
184
|
+
TaxIDNo: request.tax_id_no,
|
|
185
|
+
BusinessName: request.business_name,
|
|
186
|
+
TradeName: request.business_name,
|
|
187
|
+
Email: request.email,
|
|
188
|
+
Address: request.address,
|
|
189
|
+
CompanyRegDate: request.company_reg_date,
|
|
190
|
+
ContactPersonName: request.name,
|
|
191
|
+
RegistrationNumber: request.company_reg_no,
|
|
192
|
+
CustomerMembers: request.customers,
|
|
193
|
+
TheDirectors: request.customers,
|
|
194
|
+
};
|
|
195
|
+
console.log('requestData: ', requestData);
|
|
196
|
+
return [4, this.httpClient.post("/BankOneWebAPI/api/Customer/CreateOrganisationCustomer/2?authToken=".concat(this.authToken), requestData)];
|
|
197
|
+
case 1:
|
|
198
|
+
response = _a.sent();
|
|
199
|
+
console.log('response: ', { data: response.data, status: response.status });
|
|
200
|
+
responseData = response.data;
|
|
201
|
+
if (!responseData.CustomerIDInString) {
|
|
202
|
+
this.handleResponseError(response.data, 'An error occurred creating business customer');
|
|
203
|
+
}
|
|
204
|
+
CustomerIDInString = responseData.CustomerIDInString;
|
|
205
|
+
return [2, this.responseHandler.successResponse({
|
|
206
|
+
data: {
|
|
207
|
+
customer: {
|
|
208
|
+
id: CustomerIDInString,
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
})];
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
BankOne_1.prototype.getCustomerById = function (request) {
|
|
217
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
218
|
+
var id, response, responseData;
|
|
219
|
+
return __generator(this, function (_a) {
|
|
220
|
+
switch (_a.label) {
|
|
221
|
+
case 0:
|
|
222
|
+
id = request.id;
|
|
223
|
+
console.log('requestData: ', request);
|
|
224
|
+
return [4, this.httpClient.get("/BankOneWebAPI/api/Customer/GetByCustomerID/2?authToken=".concat(this.authToken, "&CustomerID=").concat(id))];
|
|
225
|
+
case 1:
|
|
226
|
+
response = _a.sent();
|
|
227
|
+
console.log('responseData: ', response.data);
|
|
228
|
+
if (response.status !== 200) {
|
|
229
|
+
this.handleResponseError(response.data, 'An error occurred getting customer details');
|
|
230
|
+
}
|
|
231
|
+
responseData = response.data;
|
|
232
|
+
if (!responseData.customerID) {
|
|
233
|
+
return [2, this.responseHandler.errorResponse('Customer not found')];
|
|
234
|
+
}
|
|
235
|
+
return [2, this.responseHandler.successResponse({
|
|
236
|
+
data: {
|
|
237
|
+
customer: {
|
|
238
|
+
id: responseData.customerID,
|
|
239
|
+
last_name: responseData.LastName,
|
|
240
|
+
middle_name: responseData.OtherNames,
|
|
241
|
+
first_name: responseData.OtherNames,
|
|
242
|
+
gender: responseData.Gender === 1 ? common_1.Gender.MALE : common_1.Gender.FEMALE,
|
|
243
|
+
phone_number: responseData.PhoneNumber,
|
|
244
|
+
kyc: {
|
|
245
|
+
type: 'BVN',
|
|
246
|
+
id_number: responseData.BankVerificationNumber,
|
|
247
|
+
imageBase64: responseData.CustomerPhoto,
|
|
248
|
+
date_of_birth: responseData.DateOfBirth,
|
|
249
|
+
address: responseData.Address,
|
|
250
|
+
email: responseData.Email,
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
})];
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
};
|
|
259
|
+
BankOne_1.prototype.getCustomerByPhoneNumber = function (request) {
|
|
260
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
261
|
+
var phone_number, response, responseData;
|
|
262
|
+
return __generator(this, function (_a) {
|
|
263
|
+
switch (_a.label) {
|
|
264
|
+
case 0:
|
|
265
|
+
phone_number = request.phone_number;
|
|
266
|
+
console.log('requestData: ', request);
|
|
267
|
+
return [4, this.httpClient.get("/BankOneWebAPI/api/Customer/GetByCustomerPhoneNumber/2?authToken=".concat(this.authToken, "&phoneNumber=").concat(phone_number))];
|
|
268
|
+
case 1:
|
|
269
|
+
response = _a.sent();
|
|
270
|
+
console.log('responseData: ', response.data);
|
|
271
|
+
if (response.status !== 200) {
|
|
272
|
+
return [2, this.responseHandler.errorResponse('An error occurred getting customer details')];
|
|
273
|
+
}
|
|
274
|
+
if (Array.isArray(response.data)) {
|
|
275
|
+
responseData = response.data[0];
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
responseData = response.data;
|
|
279
|
+
return [2, this.responseHandler.errorResponse(responseData.Message)];
|
|
280
|
+
}
|
|
281
|
+
return [2, this.responseHandler.successResponse({
|
|
282
|
+
data: {
|
|
283
|
+
customer: {
|
|
284
|
+
id: responseData.customerID,
|
|
285
|
+
last_name: responseData.LastName,
|
|
286
|
+
middle_name: responseData.OtherNames,
|
|
287
|
+
first_name: responseData.OtherNames,
|
|
288
|
+
gender: responseData.Gender === 1 ? common_1.Gender.MALE : common_1.Gender.FEMALE,
|
|
289
|
+
phone_number: responseData.PhoneNumber,
|
|
290
|
+
kyc: {
|
|
291
|
+
type: 'BVN',
|
|
292
|
+
id_number: responseData.BankVerificationNumber,
|
|
293
|
+
imageBase64: responseData.CustomerPhoto,
|
|
294
|
+
date_of_birth: responseData.DateOfBirth,
|
|
295
|
+
address: responseData.Address,
|
|
296
|
+
email: responseData.Email,
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
})];
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
};
|
|
305
|
+
BankOne_1.prototype.updateCustomer = function (request) {
|
|
306
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
307
|
+
var id, update, requestData, response, responseData;
|
|
308
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
309
|
+
return __generator(this, function (_q) {
|
|
310
|
+
switch (_q.label) {
|
|
311
|
+
case 0:
|
|
312
|
+
id = request.id, update = request.update;
|
|
313
|
+
requestData = {
|
|
314
|
+
LastName: update === null || update === void 0 ? void 0 : update.last_name,
|
|
315
|
+
OtherNames: (update === null || update === void 0 ? void 0 : update.middle_name) && (update === null || update === void 0 ? void 0 : update.last_name)
|
|
316
|
+
? "".concat((update === null || update === void 0 ? void 0 : update.middle_name) || '', " ").concat(update.last_name)
|
|
317
|
+
: undefined,
|
|
318
|
+
City: (_b = (_a = update === null || update === void 0 ? void 0 : update.kyc) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.city,
|
|
319
|
+
Address: (_d = (_c = update === null || update === void 0 ? void 0 : update.kyc) === null || _c === void 0 ? void 0 : _c.metadata) === null || _d === void 0 ? void 0 : _d.address,
|
|
320
|
+
AccountOfficerCode: this.accountOfficerCode,
|
|
321
|
+
BankVerificationNumber: ((_e = update === null || update === void 0 ? void 0 : update.kyc) === null || _e === void 0 ? void 0 : _e.bvn) || ((_f = update === null || update === void 0 ? void 0 : update.kyc) === null || _f === void 0 ? void 0 : _f.id_number),
|
|
322
|
+
DateOfBirth: (_g = update === null || update === void 0 ? void 0 : update.kyc) === null || _g === void 0 ? void 0 : _g.date_of_birth,
|
|
323
|
+
PhoneNo: (_j = (_h = update === null || update === void 0 ? void 0 : update.kyc) === null || _h === void 0 ? void 0 : _h.metadata) === null || _j === void 0 ? void 0 : _j.phone,
|
|
324
|
+
PlaceOfBirth: (_l = (_k = update === null || update === void 0 ? void 0 : update.kyc) === null || _k === void 0 ? void 0 : _k.metadata) === null || _l === void 0 ? void 0 : _l.place_of_birth,
|
|
325
|
+
NationalIdentityNo: ((_m = update === null || update === void 0 ? void 0 : update.kyc) === null || _m === void 0 ? void 0 : _m.nin) || ((_o = update === null || update === void 0 ? void 0 : update.kyc) === null || _o === void 0 ? void 0 : _o.id_number),
|
|
326
|
+
Email: update === null || update === void 0 ? void 0 : update.email,
|
|
327
|
+
customerPassportInBytes: (_p = update === null || update === void 0 ? void 0 : update.kyc) === null || _p === void 0 ? void 0 : _p.imageBase64,
|
|
328
|
+
CustomerID: id,
|
|
329
|
+
};
|
|
330
|
+
console.log('requestData: ', requestData);
|
|
331
|
+
return [4, this.httpClient.post("/BankOneWebAPI/api/Customer/UpdateCustomer/2?authToken=".concat(this.authToken), requestData)];
|
|
332
|
+
case 1:
|
|
333
|
+
response = _q.sent();
|
|
334
|
+
console.log('responseData: ', response.data);
|
|
335
|
+
if (response.status !== 200) {
|
|
336
|
+
console.error('Error occurred while updating customer: ', response.data);
|
|
337
|
+
return [2, this.responseHandler.errorResponse('an error occurred completing request')];
|
|
338
|
+
}
|
|
339
|
+
responseData = response.data;
|
|
340
|
+
if (!responseData.IsSuccessful) {
|
|
341
|
+
console.error('An error occurred while updating customer data: ', response.data);
|
|
342
|
+
return [2, this.responseHandler.errorResponse('An error occurred completing request')];
|
|
343
|
+
}
|
|
344
|
+
return [2, this.responseHandler.successResponse({})];
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
});
|
|
348
|
+
};
|
|
349
|
+
BankOne_1.prototype._createAccount = function (request_1) {
|
|
350
|
+
return __awaiter(this, arguments, void 0, function (request, productCode) {
|
|
351
|
+
var customer, trackingRef, requestData, response, responseData;
|
|
352
|
+
var _a, _b, _c, _d, _e, _f;
|
|
353
|
+
if (productCode === void 0) { productCode = this.productCode; }
|
|
354
|
+
return __generator(this, function (_g) {
|
|
355
|
+
switch (_g.label) {
|
|
356
|
+
case 0:
|
|
357
|
+
customer = request.customer;
|
|
358
|
+
trackingRef = (0, randomstring_1.generate)({
|
|
359
|
+
charset: 'alphanumeric',
|
|
360
|
+
length: 10,
|
|
361
|
+
});
|
|
362
|
+
requestData = {
|
|
363
|
+
AccountOfficerCode: this.accountOfficerCode,
|
|
364
|
+
ProductCode: productCode,
|
|
365
|
+
AccountOpeningTrackingRef: trackingRef,
|
|
366
|
+
AccountTier: '1',
|
|
367
|
+
Address: (_a = customer === null || customer === void 0 ? void 0 : customer.kyc) === null || _a === void 0 ? void 0 : _a.address,
|
|
368
|
+
BVN: (_b = customer === null || customer === void 0 ? void 0 : customer.kyc) === null || _b === void 0 ? void 0 : _b.id_number,
|
|
369
|
+
CustomerID: customer.id,
|
|
370
|
+
DateOfBirth: (_c = customer === null || customer === void 0 ? void 0 : customer.kyc) === null || _c === void 0 ? void 0 : _c.date_of_birth,
|
|
371
|
+
Email: (_d = customer === null || customer === void 0 ? void 0 : customer.kyc) === null || _d === void 0 ? void 0 : _d.email,
|
|
372
|
+
Gender: customer.gender === common_1.Gender.MALE ? 0 : 1,
|
|
373
|
+
LastName: customer.last_name,
|
|
374
|
+
NationalIdentityNo: (_e = customer === null || customer === void 0 ? void 0 : customer.kyc) === null || _e === void 0 ? void 0 : _e.id_number,
|
|
375
|
+
NotificationPreference: 0,
|
|
376
|
+
OtherNames: "".concat((customer === null || customer === void 0 ? void 0 : customer.middle_name) || '', " ").concat(customer.first_name),
|
|
377
|
+
PhoneNo: customer === null || customer === void 0 ? void 0 : customer.phone_number,
|
|
378
|
+
PlaceOfBirth: (_f = customer === null || customer === void 0 ? void 0 : customer.kyc) === null || _f === void 0 ? void 0 : _f.place_of_birth,
|
|
379
|
+
TransactionPermission: '1',
|
|
380
|
+
TransactionTrackingRef: trackingRef,
|
|
381
|
+
};
|
|
382
|
+
console.log('requestData: ', requestData);
|
|
383
|
+
return [4, this.httpClient.post("/BankOneWebAPI/api/Account/CreateAccountQuick/2?authToken=".concat(this.authToken), requestData)];
|
|
384
|
+
case 1:
|
|
385
|
+
response = _g.sent();
|
|
386
|
+
console.log('responseData: ', response.data);
|
|
387
|
+
if (response.status !== 200) {
|
|
388
|
+
this.handleResponseError(response.data, 'An error occurred creating account');
|
|
389
|
+
}
|
|
390
|
+
responseData = response.data;
|
|
391
|
+
if (!responseData.IsSuccessful || !responseData.Message.AccountNumber) {
|
|
392
|
+
this.handleResponseError(response.data, 'An error occurred creating account');
|
|
393
|
+
}
|
|
394
|
+
return [2, this.responseHandler.successResponse({
|
|
395
|
+
data: {
|
|
396
|
+
account: {
|
|
397
|
+
id: responseData.Message.Id,
|
|
398
|
+
customer: customer.id,
|
|
399
|
+
name: responseData.Message.FullName,
|
|
400
|
+
number: responseData.Message.AccountNumber,
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
})];
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
});
|
|
407
|
+
};
|
|
408
|
+
BankOne_1.prototype.createAccount = function (request) {
|
|
409
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
410
|
+
return __generator(this, function (_a) {
|
|
411
|
+
return [2, this._createAccount(request, this.productCode)];
|
|
412
|
+
});
|
|
413
|
+
});
|
|
414
|
+
};
|
|
415
|
+
BankOne_1.prototype.createBusinessAccount = function (request) {
|
|
416
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
417
|
+
return __generator(this, function (_a) {
|
|
418
|
+
return [2, this._createAccount(request, this.businessProductCode)];
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
};
|
|
422
|
+
BankOne_1.prototype.getAccount = function (request) {
|
|
423
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
424
|
+
var accountNumber, requestData, response, responseData;
|
|
425
|
+
return __generator(this, function (_a) {
|
|
426
|
+
switch (_a.label) {
|
|
427
|
+
case 0:
|
|
428
|
+
accountNumber = request.accountNumber;
|
|
429
|
+
requestData = {
|
|
430
|
+
AccountNo: accountNumber,
|
|
431
|
+
AuthenticationCode: this.authToken,
|
|
432
|
+
};
|
|
433
|
+
console.log('requestData: ', requestData);
|
|
434
|
+
return [4, this.httpClient.post("/thirdpartyapiservice/apiservice/Account/AccountEnquiry", requestData)];
|
|
435
|
+
case 1:
|
|
436
|
+
response = _a.sent();
|
|
437
|
+
console.log('responseData: ', response.data);
|
|
438
|
+
if (response.status !== 200) {
|
|
439
|
+
this.handleResponseError(response.data, 'An error occurred getting account details');
|
|
440
|
+
}
|
|
441
|
+
responseData = response.data;
|
|
442
|
+
if (!responseData.IsSuccessful) {
|
|
443
|
+
this.handleResponseError(response.data, 'An error occurred getting account details');
|
|
444
|
+
}
|
|
445
|
+
return [2, this.responseHandler.successResponse({
|
|
446
|
+
data: {
|
|
447
|
+
account: {
|
|
448
|
+
number: responseData.Nuban,
|
|
449
|
+
balance: responseData.AvailableBalance,
|
|
450
|
+
ledgerBalance: responseData.LedgerBalance,
|
|
451
|
+
status: responseData.Status,
|
|
452
|
+
tier: responseData.Tier,
|
|
453
|
+
type: responseData.ProductCode,
|
|
454
|
+
},
|
|
455
|
+
},
|
|
456
|
+
})];
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
});
|
|
460
|
+
};
|
|
461
|
+
BankOne_1.prototype.getCustomerAccounts = function (request) {
|
|
462
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
463
|
+
var id, response, responseData;
|
|
464
|
+
return __generator(this, function (_a) {
|
|
465
|
+
switch (_a.label) {
|
|
466
|
+
case 0:
|
|
467
|
+
id = request.id;
|
|
468
|
+
console.log('requestData: ', request);
|
|
469
|
+
return [4, this.httpClient.get("/BankOneWebAPI/api/Account/GetAccountsByCustomerId/2?authToken=".concat(this.authToken, "&customerId=").concat(id))];
|
|
470
|
+
case 1:
|
|
471
|
+
response = _a.sent();
|
|
472
|
+
console.log('responseData: ', response.data);
|
|
473
|
+
if (response.status !== 200) {
|
|
474
|
+
return [2, this.responseHandler.errorResponse('An error occurred getting customer accounts')];
|
|
475
|
+
}
|
|
476
|
+
responseData = response.data;
|
|
477
|
+
if (!responseData.Accounts) {
|
|
478
|
+
return [2, this.responseHandler.errorResponse('An error occurred getting customer accounts')];
|
|
479
|
+
}
|
|
480
|
+
return [2, this.responseHandler.successResponse({
|
|
481
|
+
data: {
|
|
482
|
+
accounts: responseData.Accounts.map(function (account) { return ({
|
|
483
|
+
number: account.NUBAN,
|
|
484
|
+
balance: parseInt(account.availableBalance),
|
|
485
|
+
ledgerBalance: parseInt(account.ledgerBalance),
|
|
486
|
+
tier: account.kycLevel,
|
|
487
|
+
name: account.accountName,
|
|
488
|
+
}); }),
|
|
489
|
+
},
|
|
490
|
+
})];
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
});
|
|
494
|
+
};
|
|
495
|
+
BankOne_1.prototype.updateAccountTier = function (request) {
|
|
496
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
497
|
+
var accountNumber, accountTier, requestData, response, responseData;
|
|
498
|
+
return __generator(this, function (_a) {
|
|
499
|
+
switch (_a.label) {
|
|
500
|
+
case 0:
|
|
501
|
+
accountNumber = request.accountNumber, accountTier = request.accountTier;
|
|
502
|
+
requestData = {
|
|
503
|
+
AccountNumber: accountNumber,
|
|
504
|
+
AccountTier: accountTier,
|
|
505
|
+
};
|
|
506
|
+
console.log('requestData: ', requestData);
|
|
507
|
+
return [4, this.httpClient.post("/BankOneWebAPI/api/Account/UpdateAccountTier2/2?authToken=".concat(this.authToken), requestData)];
|
|
508
|
+
case 1:
|
|
509
|
+
response = _a.sent();
|
|
510
|
+
console.log('responseData: ', response.data);
|
|
511
|
+
if (response.status !== 200) {
|
|
512
|
+
this.handleResponseError(response.data, 'An error occurred updating account tier');
|
|
513
|
+
}
|
|
514
|
+
responseData = response.data;
|
|
515
|
+
if (!responseData.IsSuccessful) {
|
|
516
|
+
this.handleResponseError(response.data, 'An error occurred updating account tier');
|
|
517
|
+
}
|
|
518
|
+
return [2, this.responseHandler.successResponse({
|
|
519
|
+
message: 'Account tier updated successfully',
|
|
520
|
+
})];
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
});
|
|
524
|
+
};
|
|
525
|
+
BankOne_1.prototype.creditAccount = function (request) {
|
|
526
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
527
|
+
var accountNumber, amount, reference, narration, requestData, response, responseData;
|
|
528
|
+
return __generator(this, function (_a) {
|
|
529
|
+
switch (_a.label) {
|
|
530
|
+
case 0:
|
|
531
|
+
accountNumber = request.accountNumber, amount = request.amount, reference = request.reference, narration = request.narration;
|
|
532
|
+
requestData = {
|
|
533
|
+
AccountNumber: accountNumber,
|
|
534
|
+
Amount: String(amount * 100),
|
|
535
|
+
GLCode: this.creditGLCode,
|
|
536
|
+
RetrievalReference: reference,
|
|
537
|
+
Narration: narration,
|
|
538
|
+
Token: this.authToken,
|
|
539
|
+
};
|
|
540
|
+
console.log('requestData: ', requestData);
|
|
541
|
+
return [4, this.httpClient.post("/thirdpartyapiservice/apiservice/CoreTransactions/Credit", requestData)];
|
|
542
|
+
case 1:
|
|
543
|
+
response = _a.sent();
|
|
544
|
+
console.log('responseData: ', response.data);
|
|
545
|
+
if (response.status !== 200) {
|
|
546
|
+
this.handleResponseError(response.data, 'An error occurred crediting account');
|
|
547
|
+
}
|
|
548
|
+
responseData = response.data;
|
|
549
|
+
if (!responseData.IsSuccessful) {
|
|
550
|
+
this.handleResponseError(response.data, 'An error occurred crediting account. Not Successful');
|
|
551
|
+
}
|
|
552
|
+
if (responseData.ResponseCode !== '00') {
|
|
553
|
+
this.handleResponseError(response.data, 'An error occurred crediting account. Response Code not 00');
|
|
554
|
+
}
|
|
555
|
+
return [2, this.responseHandler.successResponse({})];
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
});
|
|
559
|
+
};
|
|
560
|
+
BankOne_1.prototype.debitAccount = function (request) {
|
|
561
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
562
|
+
var accountNumber, amount, reference, narration, requestData, response, responseData;
|
|
563
|
+
return __generator(this, function (_a) {
|
|
564
|
+
switch (_a.label) {
|
|
565
|
+
case 0:
|
|
566
|
+
accountNumber = request.accountNumber, amount = request.amount, reference = request.reference, narration = request.narration;
|
|
567
|
+
requestData = {
|
|
568
|
+
AccountNumber: accountNumber,
|
|
569
|
+
Amount: String(amount * 100),
|
|
570
|
+
GLCode: this.debitGLCode,
|
|
571
|
+
RetrievalReference: reference,
|
|
572
|
+
Narration: narration,
|
|
573
|
+
Token: this.authToken,
|
|
574
|
+
};
|
|
575
|
+
console.log('requestData: ', requestData);
|
|
576
|
+
return [4, this.httpClient.post("/thirdpartyapiservice/apiservice/CoreTransactions/Debit", requestData)];
|
|
577
|
+
case 1:
|
|
578
|
+
response = _a.sent();
|
|
579
|
+
console.log('responseData: ', response.data);
|
|
580
|
+
if (response.status !== 200) {
|
|
581
|
+
this.handleResponseError(response.data, 'An error occurred debiting account');
|
|
582
|
+
}
|
|
583
|
+
responseData = response.data;
|
|
584
|
+
if (!responseData.IsSuccessful) {
|
|
585
|
+
this.handleResponseError(response.data, 'An error occurred debiting account');
|
|
586
|
+
}
|
|
587
|
+
if (responseData.ResponseCode !== '00') {
|
|
588
|
+
this.handleResponseError(response.data, 'An error occurred debiting account');
|
|
589
|
+
}
|
|
590
|
+
return [2, this.responseHandler.successResponse({})];
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
});
|
|
594
|
+
};
|
|
595
|
+
BankOne_1.prototype.getBankList = function (request) {
|
|
596
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
597
|
+
var response;
|
|
598
|
+
return __generator(this, function (_a) {
|
|
599
|
+
switch (_a.label) {
|
|
600
|
+
case 0: return [4, this.httpClient.get("/ThirdPartyAPIService/APIService/BillsPayment/GetCommercialBanks/".concat(this.authToken))];
|
|
601
|
+
case 1:
|
|
602
|
+
response = _a.sent();
|
|
603
|
+
if (response.status !== 200) {
|
|
604
|
+
this.handleResponseError(response.data, 'An error occurred getting account details');
|
|
605
|
+
}
|
|
606
|
+
return [2, this.responseHandler.successResponse({
|
|
607
|
+
data: {
|
|
608
|
+
banks: response.data.map(function (bank) { return ({
|
|
609
|
+
code: bank.Code,
|
|
610
|
+
name: bank.Name,
|
|
611
|
+
}); }),
|
|
612
|
+
},
|
|
613
|
+
})];
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
});
|
|
617
|
+
};
|
|
618
|
+
BankOne_1.prototype.nameEnquiry = function (request) {
|
|
619
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
620
|
+
var accountNumber, bankCode, requestData, response, responseData;
|
|
621
|
+
return __generator(this, function (_a) {
|
|
622
|
+
switch (_a.label) {
|
|
623
|
+
case 0:
|
|
624
|
+
accountNumber = request.accountNumber, bankCode = request.bankCode;
|
|
625
|
+
requestData = {
|
|
626
|
+
AccountNumber: accountNumber,
|
|
627
|
+
Token: this.authToken,
|
|
628
|
+
BankCode: bankCode,
|
|
629
|
+
};
|
|
630
|
+
return [4, this.httpClient.post("/thirdpartyapiservice/apiservice/Transfer/NameEnquiry", requestData)];
|
|
631
|
+
case 1:
|
|
632
|
+
response = _a.sent();
|
|
633
|
+
if (response.status !== 200) {
|
|
634
|
+
this.handleResponseError(response.data, 'An error occurred getting account details');
|
|
635
|
+
}
|
|
636
|
+
responseData = response.data;
|
|
637
|
+
if (!responseData.IsSuccessful) {
|
|
638
|
+
this.handleResponseError(response.data, 'An error occurred getting account details');
|
|
639
|
+
}
|
|
640
|
+
return [2, this.responseHandler.successResponse({
|
|
641
|
+
data: {
|
|
642
|
+
accountName: responseData.Name,
|
|
643
|
+
bvn: responseData.BVN,
|
|
644
|
+
kyc: responseData.KYC,
|
|
645
|
+
sessionID: responseData.SessionID,
|
|
646
|
+
institutionCode: responseData.InstitutionCode,
|
|
647
|
+
},
|
|
648
|
+
})];
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
});
|
|
652
|
+
};
|
|
653
|
+
BankOne_1.prototype.bankTransfer = function (request) {
|
|
654
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
655
|
+
var amount, beneficiaryAccountNumber, beneficiaryBankCode, beneficiaryAccountName, beneficiaryPhoneNumber, originatorAccountNumber, originatorAccountName, reference, narration, sessionID, requestData, response, responseData;
|
|
656
|
+
return __generator(this, function (_a) {
|
|
657
|
+
switch (_a.label) {
|
|
658
|
+
case 0:
|
|
659
|
+
amount = request.amount, beneficiaryAccountNumber = request.beneficiaryAccountNumber, beneficiaryBankCode = request.beneficiaryBankCode, beneficiaryAccountName = request.beneficiaryAccountName, beneficiaryPhoneNumber = request.beneficiaryPhoneNumber, originatorAccountNumber = request.originatorAccountNumber, originatorAccountName = request.originatorAccountName, reference = request.reference, narration = request.narration, sessionID = request.sessionID;
|
|
660
|
+
requestData = {
|
|
661
|
+
Amount: String(amount),
|
|
662
|
+
Payer: originatorAccountName,
|
|
663
|
+
PayerAccountNumber: originatorAccountNumber,
|
|
664
|
+
ReceiverAccountNumber: beneficiaryAccountNumber,
|
|
665
|
+
ReceiverAccountType: '',
|
|
666
|
+
ReceiverBankCode: beneficiaryBankCode,
|
|
667
|
+
ReceiverName: beneficiaryAccountName,
|
|
668
|
+
ReceiverPhoneNumber: beneficiaryPhoneNumber,
|
|
669
|
+
Token: this.authToken,
|
|
670
|
+
TransactionReference: reference,
|
|
671
|
+
Narration: narration,
|
|
672
|
+
NIPSessionID: sessionID,
|
|
673
|
+
};
|
|
674
|
+
console.log('requestData: ', requestData);
|
|
675
|
+
return [4, this.httpClient.post("/thirdpartyapiservice/apiservice/Transfer/InterBankTransfer", requestData)];
|
|
676
|
+
case 1:
|
|
677
|
+
response = _a.sent();
|
|
678
|
+
console.log('responseData: ', response.data);
|
|
679
|
+
if (response.status !== 200) {
|
|
680
|
+
this.handleResponseError(response.data, 'An error occurred transferring funds');
|
|
681
|
+
}
|
|
682
|
+
responseData = response.data;
|
|
683
|
+
if (!responseData.IsSuccessFul) {
|
|
684
|
+
this.handleResponseError(response.data, 'An error occurred transferring funds');
|
|
685
|
+
}
|
|
686
|
+
if (responseData.ResponseCode !== '00') {
|
|
687
|
+
this.handleResponseError(response.data, 'An error occurred transferring funds. Response Code not 00');
|
|
688
|
+
}
|
|
689
|
+
return [2, this.responseHandler.successResponse({
|
|
690
|
+
data: {
|
|
691
|
+
transactionReference: responseData.Reference,
|
|
692
|
+
sessionID: responseData.SessionID,
|
|
693
|
+
status: responseData.Status,
|
|
694
|
+
responseCode: responseData.ResponseCode,
|
|
695
|
+
},
|
|
696
|
+
})];
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
});
|
|
700
|
+
};
|
|
701
|
+
BankOne_1.prototype.intraBankTransfer = function (request) {
|
|
702
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
703
|
+
var sourceAccountNumber, destinationAccountNumber, amount, reference, narration, requestData, response, responseData, transactionReference;
|
|
704
|
+
return __generator(this, function (_a) {
|
|
705
|
+
switch (_a.label) {
|
|
706
|
+
case 0:
|
|
707
|
+
sourceAccountNumber = request.sourceAccountNumber, destinationAccountNumber = request.destinationAccountNumber, amount = request.amount, reference = request.reference, narration = request.narration;
|
|
708
|
+
requestData = {
|
|
709
|
+
Amount: String(amount),
|
|
710
|
+
FromAccountNumber: sourceAccountNumber,
|
|
711
|
+
ToAccountNumber: destinationAccountNumber,
|
|
712
|
+
RetrievalReference: reference,
|
|
713
|
+
Narration: narration || '',
|
|
714
|
+
AuthenticationKey: this.authToken,
|
|
715
|
+
};
|
|
716
|
+
console.log('requestData: ', requestData);
|
|
717
|
+
return [4, this.httpClient.post("/thirdpartyapiservice/apiservice/CoreTransactions/LocalFundsTransfer", requestData)];
|
|
718
|
+
case 1:
|
|
719
|
+
response = _a.sent();
|
|
720
|
+
console.log('responseData: ', response.data);
|
|
721
|
+
if (response.status !== 200) {
|
|
722
|
+
this.handleResponseError(response.data, 'An error occurred transferring funds');
|
|
723
|
+
}
|
|
724
|
+
responseData = response.data;
|
|
725
|
+
if (!responseData.IsSuccessful) {
|
|
726
|
+
this.handleResponseError(response.data, 'An error occurred transferring funds');
|
|
727
|
+
}
|
|
728
|
+
if (responseData.ResponseCode !== '00') {
|
|
729
|
+
this.handleResponseError(response.data, 'An error occurred transferring funds. Response Code not 00');
|
|
730
|
+
}
|
|
731
|
+
transactionReference = responseData === null || responseData === void 0 ? void 0 : responseData.Reference;
|
|
732
|
+
return [2, this.responseHandler.successResponse({
|
|
733
|
+
data: { transactionReference: transactionReference },
|
|
734
|
+
})];
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
});
|
|
738
|
+
};
|
|
739
|
+
BankOne_1.prototype.transactionStatusQuery = function (request) {
|
|
740
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
741
|
+
var transactionReference, date, amount, transactionType, requestData, response, responseData;
|
|
742
|
+
return __generator(this, function (_a) {
|
|
743
|
+
switch (_a.label) {
|
|
744
|
+
case 0:
|
|
745
|
+
transactionReference = request.transactionReference, date = request.date, amount = request.amount, transactionType = request.transactionType;
|
|
746
|
+
requestData = {
|
|
747
|
+
RetrievalReference: transactionReference,
|
|
748
|
+
Token: this.authToken,
|
|
749
|
+
TransactionDate: date,
|
|
750
|
+
Amount: amount,
|
|
751
|
+
TransactionType: transactionType,
|
|
752
|
+
};
|
|
753
|
+
return [4, this.httpClient.post("/thirdpartyapiservice/apiservice/Transactions/TransactionStatusQuery", requestData)];
|
|
754
|
+
case 1:
|
|
755
|
+
response = _a.sent();
|
|
756
|
+
console.log('responseData: ', response.data);
|
|
757
|
+
if (response.status !== 200) {
|
|
758
|
+
this.handleResponseError(response.data, 'An error occurred getting transaction status');
|
|
759
|
+
}
|
|
760
|
+
responseData = response.data;
|
|
761
|
+
if (!responseData.IsSuccessFul) {
|
|
762
|
+
this.handleResponseError(response.data, 'An error occurred getting transaction status');
|
|
763
|
+
}
|
|
764
|
+
return [2, this.responseHandler.successResponse({
|
|
765
|
+
data: {
|
|
766
|
+
status: responseData.Status,
|
|
767
|
+
responseCode: (responseData === null || responseData === void 0 ? void 0 : responseData.ResponseCode) || '',
|
|
768
|
+
responseMessage: (responseData === null || responseData === void 0 ? void 0 : responseData.ResponseMessage) || '',
|
|
769
|
+
},
|
|
770
|
+
message: (responseData === null || responseData === void 0 ? void 0 : responseData.ResponseMessage) || '',
|
|
771
|
+
})];
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
});
|
|
775
|
+
};
|
|
776
|
+
BankOne_1.prototype.freezeAccount = function (request) {
|
|
777
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
778
|
+
var accountNumber, reference, reason, requestData, response, responseData;
|
|
779
|
+
return __generator(this, function (_a) {
|
|
780
|
+
switch (_a.label) {
|
|
781
|
+
case 0:
|
|
782
|
+
accountNumber = request.accountNumber, reference = request.reference, reason = request.reason;
|
|
783
|
+
requestData = {
|
|
784
|
+
AccountNo: accountNumber,
|
|
785
|
+
AuthenticationCode: this.authToken,
|
|
786
|
+
ReferenceID: reference,
|
|
787
|
+
Reason: reason,
|
|
788
|
+
};
|
|
789
|
+
console.log('requestData: ', requestData);
|
|
790
|
+
return [4, this.httpClient.post("/thirdpartyapiservice/apiservice/Account/FreezeAccount", requestData)];
|
|
791
|
+
case 1:
|
|
792
|
+
response = _a.sent();
|
|
793
|
+
console.log('responseData: ', response.data);
|
|
794
|
+
responseData = response.data;
|
|
795
|
+
if (!responseData.RequestStatus) {
|
|
796
|
+
return [2, this.responseHandler.errorResponse(responseData.ResponseDescription)];
|
|
797
|
+
}
|
|
798
|
+
return [2, this.responseHandler.successResponse({
|
|
799
|
+
data: {},
|
|
800
|
+
})];
|
|
801
|
+
}
|
|
802
|
+
});
|
|
803
|
+
});
|
|
804
|
+
};
|
|
805
|
+
BankOne_1.prototype.deactivatePND = function (request) {
|
|
806
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
807
|
+
var accountNumber, requestData, response, responseData;
|
|
808
|
+
return __generator(this, function (_a) {
|
|
809
|
+
switch (_a.label) {
|
|
810
|
+
case 0:
|
|
811
|
+
accountNumber = request.accountNumber;
|
|
812
|
+
requestData = {
|
|
813
|
+
AccountNo: accountNumber,
|
|
814
|
+
AuthenticationCode: this.authToken,
|
|
815
|
+
};
|
|
816
|
+
console.log('requestData: ', requestData);
|
|
817
|
+
return [4, this.httpClient.post("/thirdpartyapiservice/apiservice/Account/DeactivatePND", requestData)];
|
|
818
|
+
case 1:
|
|
819
|
+
response = _a.sent();
|
|
820
|
+
console.log('responseData: ', response.data);
|
|
821
|
+
if (response.status !== 200) {
|
|
822
|
+
this.handleResponseError(response.data, "An error occurred deactivating PND on account: ".concat(requestData.AccountNo));
|
|
823
|
+
}
|
|
824
|
+
responseData = response.data;
|
|
825
|
+
if (!responseData.RequestStatus) {
|
|
826
|
+
this.handleResponseError(response.data, "An error occurred deactivating PND on account: ".concat(requestData.AccountNo));
|
|
827
|
+
}
|
|
828
|
+
return [2, this.responseHandler.successResponse({
|
|
829
|
+
data: {},
|
|
830
|
+
})];
|
|
831
|
+
}
|
|
832
|
+
});
|
|
833
|
+
});
|
|
834
|
+
};
|
|
835
|
+
return BankOne_1;
|
|
836
|
+
}(_classSuper));
|
|
837
|
+
__setFunctionName(_classThis, "BankOne");
|
|
838
|
+
(function () {
|
|
839
|
+
var _a;
|
|
840
|
+
var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_a = _classSuper[Symbol.metadata]) !== null && _a !== void 0 ? _a : null) : void 0;
|
|
841
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
842
|
+
BankOne = _classThis = _classDescriptor.value;
|
|
843
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
844
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
845
|
+
})();
|
|
846
|
+
return BankOne = _classThis;
|
|
847
|
+
}();
|
|
848
|
+
exports.BankOne = BankOne;
|