@esolve/ng-esolve-connect 0.16.2 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/auth/esolve-auth.service.mjs +15 -10
- package/esm2020/lib/payment/classes/esolve-banking-details.model.mjs +11 -0
- package/esm2020/lib/payment/classes/esolve-payment-method.model.mjs +36 -0
- package/esm2020/lib/payment/classes/esolve-payment-result.model.mjs +37 -0
- package/esm2020/lib/payment/classes/esolve-vault-item-result.model.mjs +20 -0
- package/esm2020/lib/payment/classes/esolve-vault-item.model.mjs +20 -0
- package/esm2020/lib/payment/classes/index.mjs +6 -0
- package/esm2020/lib/payment/esolve-payment.service.mjs +44 -5
- package/esm2020/lib/payment/index.mjs +4 -14
- package/esm2020/lib/payment/interfaces/esolve-card-data.interface.mjs +2 -0
- package/esm2020/lib/payment/interfaces/esolve-payment-form-input.interface.mjs +2 -0
- package/esm2020/lib/payment/interfaces/esolve-payment-method-options.interface.mjs +2 -0
- package/esm2020/lib/payment/interfaces/esolve-payment-method-record.interface.mjs +2 -0
- package/esm2020/lib/payment/interfaces/esolve-payment-response.interface.mjs +2 -0
- package/esm2020/lib/payment/interfaces/esolve-payment-set-body.interface.mjs +2 -0
- package/esm2020/lib/payment/interfaces/esolve-payment-status.interface.mjs +2 -0
- package/esm2020/lib/payment/interfaces/esolve-vault-record.interface.mjs +2 -0
- package/esm2020/lib/payment/interfaces/esolve-vault-response.interface.mjs +2 -0
- package/esm2020/lib/payment/interfaces/index.mjs +9 -0
- package/esm2020/lib/payment/types/esolve-integration-type.type.mjs +2 -0
- package/esm2020/lib/payment/types/esolve-service-provider.type.mjs +2 -0
- package/esm2020/lib/payment/types/index.mjs +3 -0
- package/fesm2015/esolve-ng-esolve-connect.mjs +134 -66
- package/fesm2015/esolve-ng-esolve-connect.mjs.map +1 -1
- package/fesm2020/esolve-ng-esolve-connect.mjs +129 -65
- package/fesm2020/esolve-ng-esolve-connect.mjs.map +1 -1
- package/lib/payment/{esolve-banking-details.model.d.ts → classes/esolve-banking-details.model.d.ts} +0 -0
- package/lib/payment/{esolve-payment-method.model.d.ts → classes/esolve-payment-method.model.d.ts} +2 -2
- package/lib/payment/classes/esolve-payment-result.model.d.ts +28 -0
- package/lib/payment/{esolve-vault-item-result.model.d.ts → classes/esolve-vault-item-result.model.d.ts} +2 -2
- package/lib/payment/{esolve-vault-item.model.d.ts → classes/esolve-vault-item.model.d.ts} +0 -0
- package/lib/payment/classes/index.d.ts +5 -0
- package/lib/payment/esolve-payment.service.d.ts +35 -6
- package/lib/payment/index.d.ts +3 -13
- package/lib/payment/{esolve-card-data.interface.d.ts → interfaces/esolve-card-data.interface.d.ts} +0 -0
- package/lib/payment/interfaces/esolve-payment-form-input.interface.d.ts +4 -0
- package/lib/payment/{esolve-payment-method-options.interface.d.ts → interfaces/esolve-payment-method-options.interface.d.ts} +0 -0
- package/lib/payment/{esolve-payment-method-record.interface.d.ts → interfaces/esolve-payment-method-record.interface.d.ts} +1 -1
- package/lib/payment/interfaces/esolve-payment-response.interface.d.ts +28 -0
- package/lib/payment/{esolve-payment-set-body.interface.d.ts → interfaces/esolve-payment-set-body.interface.d.ts} +0 -0
- package/lib/payment/interfaces/esolve-payment-status.interface.d.ts +3 -0
- package/lib/payment/{esolve-vault-record.interface.d.ts → interfaces/esolve-vault-record.interface.d.ts} +0 -0
- package/lib/payment/{esolve-vault-response.interface.d.ts → interfaces/esolve-vault-response.interface.d.ts} +1 -1
- package/lib/payment/interfaces/index.d.ts +7 -0
- package/lib/payment/{esolve-integration-type.type.d.ts → types/esolve-integration-type.type.d.ts} +0 -0
- package/lib/payment/types/esolve-service-provider.type.d.ts +1 -0
- package/lib/payment/types/index.d.ts +2 -0
- package/package.json +1 -1
- package/esm2020/lib/payment/esolve-banking-details.model.mjs +0 -11
- package/esm2020/lib/payment/esolve-card-data.interface.mjs +0 -2
- package/esm2020/lib/payment/esolve-integration-type.type.mjs +0 -2
- package/esm2020/lib/payment/esolve-paygate-form-input.interface.mjs +0 -2
- package/esm2020/lib/payment/esolve-payment-method-options.interface.mjs +0 -2
- package/esm2020/lib/payment/esolve-payment-method-record.interface.mjs +0 -2
- package/esm2020/lib/payment/esolve-payment-method.model.mjs +0 -36
- package/esm2020/lib/payment/esolve-payment-response.interface.mjs +0 -2
- package/esm2020/lib/payment/esolve-payment-result.model.mjs +0 -22
- package/esm2020/lib/payment/esolve-payment-set-body.interface.mjs +0 -2
- package/esm2020/lib/payment/esolve-vault-item-result.model.mjs +0 -20
- package/esm2020/lib/payment/esolve-vault-item.model.mjs +0 -20
- package/esm2020/lib/payment/esolve-vault-record.interface.mjs +0 -2
- package/esm2020/lib/payment/esolve-vault-response.interface.mjs +0 -2
- package/lib/payment/esolve-paygate-form-input.interface.d.ts +0 -4
- package/lib/payment/esolve-payment-response.interface.d.ts +0 -10
- package/lib/payment/esolve-payment-result.model.d.ts +0 -11
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXNvbHZlLXZhdWx0LXJlY29yZC5pbnRlcmZhY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9uZy1lc29sdmUtY29ubmVjdC9zcmMvbGliL3BheW1lbnQvaW50ZXJmYWNlcy9lc29sdmUtdmF1bHQtcmVjb3JkLmludGVyZmFjZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGludGVyZmFjZSBFc29sdmVWYXVsdFJlY29yZCB7XHJcbiAgICBpZDogbnVtYmVyO1xyXG4gICAgcGF5bWVudF9tZXRob2RzX2lkOiBudW1iZXI7XHJcbiAgICBkZXNjcmlwdGlvbjogc3RyaW5nO1xyXG4gICAgdG9rZW46IHN0cmluZztcclxuICAgIGJyYW5kOiBzdHJpbmc7XHJcbiAgICBsYXN0NDogc3RyaW5nO1xyXG4gICAgZXhwaXJ5OiBzdHJpbmc7XHJcbiAgICBleHBpcnlfdGltZXN0YW1wOiBudW1iZXI7XHJcbiAgICBkZWZhdWx0OiBib29sZWFuO1xyXG59XHJcbiJdfQ==
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXNvbHZlLXZhdWx0LXJlc3BvbnNlLmludGVyZmFjZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL25nLWVzb2x2ZS1jb25uZWN0L3NyYy9saWIvcGF5bWVudC9pbnRlcmZhY2VzL2Vzb2x2ZS12YXVsdC1yZXNwb25zZS5pbnRlcmZhY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEVzb2x2ZVBvc3RSZXNwb25zZUl0ZW0gfSBmcm9tICcuLi8uLi9zaGFyZWQvcmVzcG9uc2UnO1xyXG5cclxuZXhwb3J0IGludGVyZmFjZSBFc29sdmVWYXVsdFJlc3BvbnNlIGV4dGVuZHMgRXNvbHZlUG9zdFJlc3BvbnNlSXRlbSB7XHJcbiAgICBlc29sdmVfaWQ6IG51bWJlcjtcclxuICAgIGNhcmRfdmFsaWQ/OiBib29sZWFuO1xyXG4gICAgY2FyZF9kZXRhaWxzX3ZhbGlkYXRlZD86IGJvb2xlYW47XHJcbiAgICBnYXRld2F5X2Vycm9yX21lc3NhZ2U/OiBzdHJpbmc7XHJcbiAgICB1c2VyX3ZhdWx0X2lkPzogbnVtYmVyO1xyXG4gICAgdG9rZW4/OiBzdHJpbmc7XHJcbn1cclxuIl19
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Only export the types that are accessible to the public API
|
|
2
|
+
export * from './esolve-card-data.interface';
|
|
3
|
+
export * from './esolve-payment-form-input.interface';
|
|
4
|
+
export * from './esolve-vault-response.interface';
|
|
5
|
+
export * from './esolve-vault-record.interface';
|
|
6
|
+
export * from './esolve-payment-response.interface';
|
|
7
|
+
export * from './esolve-payment-method-options.interface';
|
|
8
|
+
export * from './esolve-payment-method-record.interface';
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9uZy1lc29sdmUtY29ubmVjdC9zcmMvbGliL3BheW1lbnQvaW50ZXJmYWNlcy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSw4REFBOEQ7QUFDOUQsY0FBYyw4QkFBOEIsQ0FBQztBQUM3QyxjQUFjLHVDQUF1QyxDQUFDO0FBQ3RELGNBQWMsbUNBQW1DLENBQUM7QUFDbEQsY0FBYyxpQ0FBaUMsQ0FBQztBQUNoRCxjQUFjLHFDQUFxQyxDQUFDO0FBQ3BELGNBQWMsMkNBQTJDLENBQUM7QUFDMUQsY0FBYywwQ0FBMEMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8vIE9ubHkgZXhwb3J0IHRoZSB0eXBlcyB0aGF0IGFyZSBhY2Nlc3NpYmxlIHRvIHRoZSBwdWJsaWMgQVBJXHJcbmV4cG9ydCAqIGZyb20gJy4vZXNvbHZlLWNhcmQtZGF0YS5pbnRlcmZhY2UnO1xyXG5leHBvcnQgKiBmcm9tICcuL2Vzb2x2ZS1wYXltZW50LWZvcm0taW5wdXQuaW50ZXJmYWNlJztcclxuZXhwb3J0ICogZnJvbSAnLi9lc29sdmUtdmF1bHQtcmVzcG9uc2UuaW50ZXJmYWNlJztcclxuZXhwb3J0ICogZnJvbSAnLi9lc29sdmUtdmF1bHQtcmVjb3JkLmludGVyZmFjZSc7XHJcbmV4cG9ydCAqIGZyb20gJy4vZXNvbHZlLXBheW1lbnQtcmVzcG9uc2UuaW50ZXJmYWNlJztcclxuZXhwb3J0ICogZnJvbSAnLi9lc29sdmUtcGF5bWVudC1tZXRob2Qtb3B0aW9ucy5pbnRlcmZhY2UnO1xyXG5leHBvcnQgKiBmcm9tICcuL2Vzb2x2ZS1wYXltZW50LW1ldGhvZC1yZWNvcmQuaW50ZXJmYWNlJztcclxuIl19
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXNvbHZlLWludGVncmF0aW9uLXR5cGUudHlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL25nLWVzb2x2ZS1jb25uZWN0L3NyYy9saWIvcGF5bWVudC90eXBlcy9lc29sdmUtaW50ZWdyYXRpb24tdHlwZS50eXBlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgdHlwZSBFc29sdmVJbnRlZ3JhdGlvblR5cGUgPSAnVmlydHVhbCcgfCAnRGlyZWN0JztcclxuIl19
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXNvbHZlLXNlcnZpY2UtcHJvdmlkZXIudHlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL25nLWVzb2x2ZS1jb25uZWN0L3NyYy9saWIvcGF5bWVudC90eXBlcy9lc29sdmUtc2VydmljZS1wcm92aWRlci50eXBlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgdHlwZSBFc29sdmVTZXJ2aWNlUHJvdmlkZXIgPSAncGF5Z2F0ZScgfCAncGF5ZmFzdCcgfCAnc25hcHNjYW4nIHwgJ296b3cnO1xyXG4iXX0=
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export * from './esolve-integration-type.type';
|
|
2
|
+
export * from './esolve-service-provider.type';
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9uZy1lc29sdmUtY29ubmVjdC9zcmMvbGliL3BheW1lbnQvdHlwZXMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxnQ0FBZ0MsQ0FBQztBQUMvQyxjQUFjLGdDQUFnQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9lc29sdmUtaW50ZWdyYXRpb24tdHlwZS50eXBlJztcclxuZXhwb3J0ICogZnJvbSAnLi9lc29sdmUtc2VydmljZS1wcm92aWRlci50eXBlJztcclxuIl19
|
|
@@ -8,6 +8,7 @@ import { CookieService } from 'ngx-cookie-service';
|
|
|
8
8
|
import { BehaviorSubject, throwError, of, iif } from 'rxjs';
|
|
9
9
|
import * as i1$1 from '@angular/platform-browser';
|
|
10
10
|
import { map, catchError, tap, switchMap } from 'rxjs/operators';
|
|
11
|
+
import { __awaiter } from 'tslib';
|
|
11
12
|
|
|
12
13
|
const ESOLVE_CONNECT_CONFIG = new InjectionToken('esolve.connect.config');
|
|
13
14
|
|
|
@@ -1549,9 +1550,15 @@ class EsolveAuthService {
|
|
|
1549
1550
|
}));
|
|
1550
1551
|
}
|
|
1551
1552
|
logout() {
|
|
1552
|
-
this
|
|
1553
|
-
|
|
1554
|
-
|
|
1553
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1554
|
+
this.session.clearTimer();
|
|
1555
|
+
this.cookieService.delete('_ws_id');
|
|
1556
|
+
const response = yield this.getAccessToken('', '', true).toPromise();
|
|
1557
|
+
if (response) {
|
|
1558
|
+
return response;
|
|
1559
|
+
}
|
|
1560
|
+
throw new Error('Invalid response');
|
|
1561
|
+
});
|
|
1555
1562
|
}
|
|
1556
1563
|
checkAccessToken(session) {
|
|
1557
1564
|
var _a;
|
|
@@ -1561,7 +1568,7 @@ class EsolveAuthService {
|
|
|
1561
1568
|
.get(`${this.config.api_url}/get-access-token.php`, {
|
|
1562
1569
|
params: { key: token },
|
|
1563
1570
|
headers: new HttpHeaders({
|
|
1564
|
-
'Accept-Language': '*'
|
|
1571
|
+
'Accept-Language': '*',
|
|
1565
1572
|
}),
|
|
1566
1573
|
})
|
|
1567
1574
|
.pipe(map((responseData) => {
|
|
@@ -1579,14 +1586,15 @@ class EsolveAuthService {
|
|
|
1579
1586
|
user_id: additional_data.user_id,
|
|
1580
1587
|
};
|
|
1581
1588
|
return result;
|
|
1582
|
-
}))
|
|
1583
|
-
.toPromise();
|
|
1589
|
+
}));
|
|
1584
1590
|
}
|
|
1585
1591
|
// Handlers
|
|
1586
1592
|
handleExpiration() {
|
|
1587
1593
|
return (session) => {
|
|
1588
|
-
this.checkAccessToken(session).then((response) => {
|
|
1589
|
-
|
|
1594
|
+
this.checkAccessToken(session).toPromise().then((response) => {
|
|
1595
|
+
if (response) {
|
|
1596
|
+
this.handleAuthentication(response);
|
|
1597
|
+
}
|
|
1590
1598
|
}, () => {
|
|
1591
1599
|
this.logout();
|
|
1592
1600
|
});
|
|
@@ -1606,7 +1614,7 @@ class EsolveAuthService {
|
|
|
1606
1614
|
if ((!errorRes.type) ||
|
|
1607
1615
|
(!errorRes.service_type) ||
|
|
1608
1616
|
(!errorRes.message)) {
|
|
1609
|
-
return throwError(error);
|
|
1617
|
+
return throwError(() => error);
|
|
1610
1618
|
}
|
|
1611
1619
|
if (errorRes.message.trim() !== '') {
|
|
1612
1620
|
error.message = errorRes.message;
|
|
@@ -1614,7 +1622,7 @@ class EsolveAuthService {
|
|
|
1614
1622
|
if (errorRes.additional_data) {
|
|
1615
1623
|
error.data = errorRes.additional_data;
|
|
1616
1624
|
}
|
|
1617
|
-
return throwError(error);
|
|
1625
|
+
return throwError(() => error);
|
|
1618
1626
|
}
|
|
1619
1627
|
}
|
|
1620
1628
|
EsolveAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAuthService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }, { token: EsolveCookieService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -4047,6 +4055,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
4047
4055
|
}] }, { type: i1$2.HttpClient }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }];
|
|
4048
4056
|
} });
|
|
4049
4057
|
|
|
4058
|
+
// Only export the types that are accessible to the public API
|
|
4059
|
+
|
|
4050
4060
|
class EsolveBankingDetails {
|
|
4051
4061
|
constructor(bank_name, account_holder, account, account_type, swift_number, branch_code) {
|
|
4052
4062
|
this.bank_name = bank_name;
|
|
@@ -4058,6 +4068,78 @@ class EsolveBankingDetails {
|
|
|
4058
4068
|
}
|
|
4059
4069
|
}
|
|
4060
4070
|
|
|
4071
|
+
class EsolvePaymentMethod {
|
|
4072
|
+
constructor(record) {
|
|
4073
|
+
this.id = +record.id;
|
|
4074
|
+
this.location_id = +record.location_id;
|
|
4075
|
+
this.paymethod_name = record.paymethod_name;
|
|
4076
|
+
this.description = record.description;
|
|
4077
|
+
this.display_banking_details = record.display_banking_details;
|
|
4078
|
+
this.currency_code = record.currency_code;
|
|
4079
|
+
this.merchant_id = record.merchant_id;
|
|
4080
|
+
this.application_id = record.application_id;
|
|
4081
|
+
this.api_signature = record.api_signature;
|
|
4082
|
+
this.is_gateway = record.is_gateway;
|
|
4083
|
+
this.must_store_card_details = record.must_store_card_details;
|
|
4084
|
+
this.allow_budget = record.allow_budget;
|
|
4085
|
+
this.integration_type = record.integration_type;
|
|
4086
|
+
this.bank_gateway_id = record.bank_gateway_id;
|
|
4087
|
+
this.accepted_card_types = record.accepted_card_types;
|
|
4088
|
+
this.post_transactions_to_gateway = record.post_transactions_to_gateway;
|
|
4089
|
+
this.three_d_secure_url = record.three_d_secure_url;
|
|
4090
|
+
this.gateway_url = record.gateway_url;
|
|
4091
|
+
this.generate_token_url = record.generate_token_url;
|
|
4092
|
+
this.widget_url = record.widget_url;
|
|
4093
|
+
this.successful_url = record.successful_url;
|
|
4094
|
+
this.failed_url = record.failed_url;
|
|
4095
|
+
this.enable_callback = record.enable_callback;
|
|
4096
|
+
this.live = record.live;
|
|
4097
|
+
this.default_module_id = +record.default_module_id;
|
|
4098
|
+
this.service_provider = record.service_provider;
|
|
4099
|
+
this.on_account = record.on_account;
|
|
4100
|
+
this.sort_priority = +record.sort_priority;
|
|
4101
|
+
this.image_url = record.image_url;
|
|
4102
|
+
this.banking_details = new EsolveBankingDetails(record.bank_name, record.account_holder, record.account, record.account_type, record.swift_number, record.branch_code);
|
|
4103
|
+
}
|
|
4104
|
+
}
|
|
4105
|
+
|
|
4106
|
+
class EsolvePaymentResult extends EsolveResponseResult {
|
|
4107
|
+
constructor(response) {
|
|
4108
|
+
var _a;
|
|
4109
|
+
super(response);
|
|
4110
|
+
this.redirect_required = false;
|
|
4111
|
+
if (typeof response.service_provider !== 'undefined') {
|
|
4112
|
+
this.service_provider = response.service_provider;
|
|
4113
|
+
}
|
|
4114
|
+
if (typeof response.redirect_required !== 'undefined') {
|
|
4115
|
+
this.redirect_required = response.redirect_required;
|
|
4116
|
+
}
|
|
4117
|
+
this.gateway_error_message = (_a = response.gateway_error_message) !== null && _a !== void 0 ? _a : '';
|
|
4118
|
+
// Check if redirect settings need to be set
|
|
4119
|
+
if (this.redirect_required && this.service_provider) {
|
|
4120
|
+
if (typeof response.redirect_url !== 'undefined') {
|
|
4121
|
+
this.redirect_url = response.redirect_url;
|
|
4122
|
+
}
|
|
4123
|
+
// Check integration specific settings
|
|
4124
|
+
if (this.service_provider === 'snapscan') {
|
|
4125
|
+
// QR code scan is required
|
|
4126
|
+
if (typeof response.qr_code_url !== 'undefined') {
|
|
4127
|
+
this.qr_code_url = response.qr_code_url;
|
|
4128
|
+
}
|
|
4129
|
+
}
|
|
4130
|
+
else {
|
|
4131
|
+
// Normal form posting redirect
|
|
4132
|
+
if (typeof response.form_inputs !== 'undefined') {
|
|
4133
|
+
this.form_inputs = response.form_inputs;
|
|
4134
|
+
}
|
|
4135
|
+
if (typeof response.form_enctype !== 'undefined') {
|
|
4136
|
+
this.form_enctype = response.form_enctype;
|
|
4137
|
+
}
|
|
4138
|
+
}
|
|
4139
|
+
}
|
|
4140
|
+
}
|
|
4141
|
+
}
|
|
4142
|
+
|
|
4061
4143
|
class EsolveVaultItemResult extends EsolveResponseResult {
|
|
4062
4144
|
constructor(response) {
|
|
4063
4145
|
super(response);
|
|
@@ -4097,62 +4179,6 @@ class EsolveVaultItem {
|
|
|
4097
4179
|
}
|
|
4098
4180
|
}
|
|
4099
4181
|
|
|
4100
|
-
class EsolvePaymentResult extends EsolveResponseResult {
|
|
4101
|
-
constructor(response) {
|
|
4102
|
-
super(response);
|
|
4103
|
-
if (typeof response.gateway_error_message !== 'undefined') {
|
|
4104
|
-
this.gateway_error_message = response.gateway_error_message;
|
|
4105
|
-
}
|
|
4106
|
-
if (typeof response.three_d_secure !== 'undefined') {
|
|
4107
|
-
this.three_d_secure = response.three_d_secure;
|
|
4108
|
-
}
|
|
4109
|
-
if (typeof response.redirect_url !== 'undefined') {
|
|
4110
|
-
this.redirect_url = response.redirect_url;
|
|
4111
|
-
}
|
|
4112
|
-
if (typeof response.form_inputs !== 'undefined') {
|
|
4113
|
-
this.form_inputs = response.form_inputs;
|
|
4114
|
-
}
|
|
4115
|
-
if (typeof response.form_html !== 'undefined') {
|
|
4116
|
-
this.form_html = response.form_html;
|
|
4117
|
-
}
|
|
4118
|
-
}
|
|
4119
|
-
}
|
|
4120
|
-
|
|
4121
|
-
class EsolvePaymentMethod {
|
|
4122
|
-
constructor(record) {
|
|
4123
|
-
this.id = +record.id;
|
|
4124
|
-
this.location_id = +record.location_id;
|
|
4125
|
-
this.paymethod_name = record.paymethod_name;
|
|
4126
|
-
this.description = record.description;
|
|
4127
|
-
this.display_banking_details = record.display_banking_details;
|
|
4128
|
-
this.currency_code = record.currency_code;
|
|
4129
|
-
this.merchant_id = record.merchant_id;
|
|
4130
|
-
this.application_id = record.application_id;
|
|
4131
|
-
this.api_signature = record.api_signature;
|
|
4132
|
-
this.is_gateway = record.is_gateway;
|
|
4133
|
-
this.must_store_card_details = record.must_store_card_details;
|
|
4134
|
-
this.allow_budget = record.allow_budget;
|
|
4135
|
-
this.integration_type = record.integration_type;
|
|
4136
|
-
this.bank_gateway_id = record.bank_gateway_id;
|
|
4137
|
-
this.accepted_card_types = record.accepted_card_types;
|
|
4138
|
-
this.post_transactions_to_gateway = record.post_transactions_to_gateway;
|
|
4139
|
-
this.three_d_secure_url = record.three_d_secure_url;
|
|
4140
|
-
this.gateway_url = record.gateway_url;
|
|
4141
|
-
this.generate_token_url = record.generate_token_url;
|
|
4142
|
-
this.widget_url = record.widget_url;
|
|
4143
|
-
this.successful_url = record.successful_url;
|
|
4144
|
-
this.failed_url = record.failed_url;
|
|
4145
|
-
this.enable_callback = record.enable_callback;
|
|
4146
|
-
this.live = record.live;
|
|
4147
|
-
this.default_module_id = +record.default_module_id;
|
|
4148
|
-
this.service_provider = record.service_provider;
|
|
4149
|
-
this.on_account = record.on_account;
|
|
4150
|
-
this.sort_priority = +record.sort_priority;
|
|
4151
|
-
this.image_url = record.image_url;
|
|
4152
|
-
this.banking_details = new EsolveBankingDetails(record.bank_name, record.account_holder, record.account, record.account_type, record.swift_number, record.branch_code);
|
|
4153
|
-
}
|
|
4154
|
-
}
|
|
4155
|
-
|
|
4156
4182
|
class EsolvePaymentService {
|
|
4157
4183
|
constructor(config, http, errorHandler, responseHandler) {
|
|
4158
4184
|
this.config = config;
|
|
@@ -4162,7 +4188,9 @@ class EsolvePaymentService {
|
|
|
4162
4188
|
}
|
|
4163
4189
|
/**
|
|
4164
4190
|
* Retrieves a list of payment methods.
|
|
4191
|
+
*
|
|
4165
4192
|
* @param options Filter options
|
|
4193
|
+
*
|
|
4166
4194
|
* @returns An `Observable` with an array of payment methods
|
|
4167
4195
|
*/
|
|
4168
4196
|
getPaymentMethods(options) {
|
|
@@ -4175,9 +4203,28 @@ class EsolvePaymentService {
|
|
|
4175
4203
|
return this.processPaymentMethods(response.records);
|
|
4176
4204
|
}));
|
|
4177
4205
|
}
|
|
4206
|
+
/**
|
|
4207
|
+
* Retrieve the payment status of the specified transaction
|
|
4208
|
+
*
|
|
4209
|
+
* @param transaction_id ID of the transaction
|
|
4210
|
+
*
|
|
4211
|
+
* @returns An `Observable` with the success status of the payment
|
|
4212
|
+
*/
|
|
4213
|
+
getPaymentStatus(transaction_id) {
|
|
4214
|
+
return this.http
|
|
4215
|
+
.get(`${this.config.api_url}/get-payment-status.php`, { params: { cart_id: transaction_id } })
|
|
4216
|
+
.pipe(map((response) => {
|
|
4217
|
+
if (response.records === undefined) {
|
|
4218
|
+
throw response;
|
|
4219
|
+
}
|
|
4220
|
+
return response.records.success;
|
|
4221
|
+
}));
|
|
4222
|
+
}
|
|
4178
4223
|
/**
|
|
4179
4224
|
* Retrieves a list of saved cards from the vault.
|
|
4225
|
+
*
|
|
4180
4226
|
* @param payment_methods_id eSolve ID of a payment method
|
|
4227
|
+
*
|
|
4181
4228
|
* @returns An `Observable` with an array of saved bank cards
|
|
4182
4229
|
*/
|
|
4183
4230
|
getVault(payment_methods_id) {
|
|
@@ -4196,8 +4243,10 @@ class EsolvePaymentService {
|
|
|
4196
4243
|
}
|
|
4197
4244
|
/**
|
|
4198
4245
|
* Sets a new card in the vault OR updates an existing one.
|
|
4246
|
+
*
|
|
4199
4247
|
* @param payment_methods_id Selected payment method
|
|
4200
4248
|
* @param card_data Information of bank card
|
|
4249
|
+
*
|
|
4201
4250
|
* @returns An `Observable` with the result of the vault set.
|
|
4202
4251
|
*/
|
|
4203
4252
|
setVaultItem(payment_methods_id, card_data) {
|
|
@@ -4222,6 +4271,13 @@ class EsolvePaymentService {
|
|
|
4222
4271
|
return this.errorHandler.handleHttpPostError('set-vault', errorRes);
|
|
4223
4272
|
}));
|
|
4224
4273
|
}
|
|
4274
|
+
/**
|
|
4275
|
+
* Delete a card in the vault
|
|
4276
|
+
*
|
|
4277
|
+
* @param id ID of the vault item
|
|
4278
|
+
*
|
|
4279
|
+
* @returns An `Observable` with the result of the vault delete.
|
|
4280
|
+
*/
|
|
4225
4281
|
deleteVaultItem(id) {
|
|
4226
4282
|
return this.http
|
|
4227
4283
|
.delete(`${this.config.api_url}/delete-vault.php`, {
|
|
@@ -4247,6 +4303,7 @@ class EsolvePaymentService {
|
|
|
4247
4303
|
* @param transaction_id eSolve ID to the transaction
|
|
4248
4304
|
* @param payment_methods_id eSolve ID to the selected payment method
|
|
4249
4305
|
* @param card ID of selected card from the vault or information to a brand new card
|
|
4306
|
+
*
|
|
4250
4307
|
* @returns An `Observable` with the result of the payment
|
|
4251
4308
|
*/
|
|
4252
4309
|
setPayment(transaction_id, payment_methods_id, card) {
|
|
@@ -4281,7 +4338,9 @@ class EsolvePaymentService {
|
|
|
4281
4338
|
}
|
|
4282
4339
|
/**
|
|
4283
4340
|
* Processes the eSolve payment method records.
|
|
4341
|
+
*
|
|
4284
4342
|
* @param records Records to process
|
|
4343
|
+
*
|
|
4285
4344
|
* @returns An array of processed payment methods.
|
|
4286
4345
|
*/
|
|
4287
4346
|
processPaymentMethods(records) {
|
|
@@ -4296,7 +4355,9 @@ class EsolvePaymentService {
|
|
|
4296
4355
|
}
|
|
4297
4356
|
/**
|
|
4298
4357
|
* Processes the eSolve vault records.
|
|
4358
|
+
*
|
|
4299
4359
|
* @param records Records to process
|
|
4360
|
+
*
|
|
4300
4361
|
* @returns An array of processed vault items (a.k.a. cards)
|
|
4301
4362
|
*/
|
|
4302
4363
|
processVaultItems(records) {
|
|
@@ -4309,6 +4370,13 @@ class EsolvePaymentService {
|
|
|
4309
4370
|
}
|
|
4310
4371
|
return vault;
|
|
4311
4372
|
}
|
|
4373
|
+
/**
|
|
4374
|
+
* Generate a concatenated string with the expiry month and year
|
|
4375
|
+
*
|
|
4376
|
+
* @param card_data Credit card data
|
|
4377
|
+
*
|
|
4378
|
+
* @returns Expiry string
|
|
4379
|
+
*/
|
|
4312
4380
|
generateExpiry(card_data) {
|
|
4313
4381
|
const month_string = card_data.expiry_month.padStart(2, '0');
|
|
4314
4382
|
const year_string = card_data.expiry_year.padStart(4, '0');
|