@houlak/plexo-sdk 0.1.45 → 0.1.47
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/lib/models/Authorization.d.ts +2 -0
- package/lib/models/BuiltInPagesOptionsDto.d.ts +4 -0
- package/lib/models/BuiltInPagesOptionsDto.js +9 -0
- package/lib/models/DisplayOptionsDto.d.ts +7 -0
- package/lib/models/DisplayOptionsDto.js +9 -0
- package/lib/models/ExpressCheckoutSettingsDto.d.ts +6 -0
- package/lib/models/ExpressCheckoutSettingsDto.js +9 -0
- package/lib/models/IssuerProcessor.d.ts +4 -4
- package/lib/models/IssuerProcessor.js +4 -4
- package/lib/models/TokenizationSettingsDto.d.ts +4 -0
- package/lib/models/TokenizationSettingsDto.js +9 -0
- package/lib/models/UIOptionsDto.d.ts +7 -0
- package/lib/models/UIOptionsDto.js +13 -0
- package/lib/models/WebFormSettingsDto.d.ts +8 -0
- package/lib/models/WebFormSettingsDto.js +9 -0
- package/lib/sdk/helpers/signature/signatureHelper.js +2 -9
- package/lib/sdk/helpers/signature/stringifyWithFloats.js +1 -3
- package/lib/sdk/models/IssuerData.d.ts +2 -0
- package/lib/utils/case.util.js +0 -2
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import { ESMap } from 'typescript';
|
|
|
2
2
|
import { AuthorizationType } from '..';
|
|
3
3
|
import { ActionType } from './ActionType';
|
|
4
4
|
import { AuthorizationInfo } from './AuthorizationInfo';
|
|
5
|
+
import { WebFormSettingsDto } from './WebFormSettingsDto';
|
|
5
6
|
export declare class Authorization extends AuthorizationInfo {
|
|
6
7
|
action: ActionType;
|
|
7
8
|
redirectUri: string;
|
|
@@ -12,5 +13,6 @@ export declare class Authorization extends AuthorizationInfo {
|
|
|
12
13
|
optionalMetadata?: string;
|
|
13
14
|
promotionInfoIssuers?: ESMap<string, string>;
|
|
14
15
|
extendableInstrumentToken?: string;
|
|
16
|
+
webFormSettings?: WebFormSettingsDto;
|
|
15
17
|
constructor(action: ActionType, redirectUri: string, limitIssuers: string[], optionalCommerceId: number, type: AuthorizationType, metaReference: string);
|
|
16
18
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BuiltInPagesOptionsDto = void 0;
|
|
4
|
+
var BuiltInPagesOptionsDto = /** @class */ (function () {
|
|
5
|
+
function BuiltInPagesOptionsDto() {
|
|
6
|
+
}
|
|
7
|
+
return BuiltInPagesOptionsDto;
|
|
8
|
+
}());
|
|
9
|
+
exports.BuiltInPagesOptionsDto = BuiltInPagesOptionsDto;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DisplayOptionsDto = void 0;
|
|
4
|
+
var DisplayOptionsDto = /** @class */ (function () {
|
|
5
|
+
function DisplayOptionsDto() {
|
|
6
|
+
}
|
|
7
|
+
return DisplayOptionsDto;
|
|
8
|
+
}());
|
|
9
|
+
exports.DisplayOptionsDto = DisplayOptionsDto;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExpressCheckoutSettingsDto = void 0;
|
|
4
|
+
var ExpressCheckoutSettingsDto = /** @class */ (function () {
|
|
5
|
+
function ExpressCheckoutSettingsDto() {
|
|
6
|
+
}
|
|
7
|
+
return ExpressCheckoutSettingsDto;
|
|
8
|
+
}());
|
|
9
|
+
exports.ExpressCheckoutSettingsDto = ExpressCheckoutSettingsDto;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PaymentProcessor } from './PaymentProcessor';
|
|
2
2
|
export declare class IssuerProcessor {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
constructor(
|
|
3
|
+
issuerId: number;
|
|
4
|
+
name: string;
|
|
5
|
+
paymentProcessors: PaymentProcessor[];
|
|
6
|
+
constructor(issuerId: number, name: string, paymentProcessors: PaymentProcessor[]);
|
|
7
7
|
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IssuerProcessor = void 0;
|
|
4
4
|
var IssuerProcessor = /** @class */ (function () {
|
|
5
|
-
function IssuerProcessor(
|
|
6
|
-
this.
|
|
7
|
-
this.
|
|
8
|
-
this.
|
|
5
|
+
function IssuerProcessor(issuerId, name, paymentProcessors) {
|
|
6
|
+
this.issuerId = issuerId;
|
|
7
|
+
this.name = name;
|
|
8
|
+
this.paymentProcessors = paymentProcessors;
|
|
9
9
|
}
|
|
10
10
|
return IssuerProcessor;
|
|
11
11
|
}());
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TokenizationSettingsDto = void 0;
|
|
4
|
+
var TokenizationSettingsDto = /** @class */ (function () {
|
|
5
|
+
function TokenizationSettingsDto() {
|
|
6
|
+
}
|
|
7
|
+
return TokenizationSettingsDto;
|
|
8
|
+
}());
|
|
9
|
+
exports.TokenizationSettingsDto = TokenizationSettingsDto;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UIOptionsDto = void 0;
|
|
4
|
+
var UIOptionsDto = /** @class */ (function () {
|
|
5
|
+
function UIOptionsDto(colors, theme, autoDarkTheme, logoURL) {
|
|
6
|
+
this.colors = colors;
|
|
7
|
+
this.theme = theme;
|
|
8
|
+
this.autoDarkTheme = autoDarkTheme;
|
|
9
|
+
this.logoURL = logoURL;
|
|
10
|
+
}
|
|
11
|
+
return UIOptionsDto;
|
|
12
|
+
}());
|
|
13
|
+
exports.UIOptionsDto = UIOptionsDto;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ExpressCheckoutSettingsDto } from './ExpressCheckoutSettingsDto';
|
|
2
|
+
import { TokenizationSettingsDto } from './TokenizationSettingsDto';
|
|
3
|
+
import { UIOptionsDto } from './UIOptionsDto';
|
|
4
|
+
export declare class WebFormSettingsDto {
|
|
5
|
+
ui?: UIOptionsDto;
|
|
6
|
+
expressCheckout?: ExpressCheckoutSettingsDto;
|
|
7
|
+
tokenization?: TokenizationSettingsDto;
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebFormSettingsDto = void 0;
|
|
4
|
+
var WebFormSettingsDto = /** @class */ (function () {
|
|
5
|
+
function WebFormSettingsDto() {
|
|
6
|
+
}
|
|
7
|
+
return WebFormSettingsDto;
|
|
8
|
+
}());
|
|
9
|
+
exports.WebFormSettingsDto = WebFormSettingsDto;
|
|
@@ -44,7 +44,6 @@ var config_1 = require("../../../config/config");
|
|
|
44
44
|
var __1 = require("../..");
|
|
45
45
|
var utils_1 = require("../../../utils");
|
|
46
46
|
var signatureUtils_1 = require("./signatureUtils");
|
|
47
|
-
var stringifyWithFloats_1 = require("./stringifyWithFloats");
|
|
48
47
|
var client = axios_1.default.create({
|
|
49
48
|
baseURL: config_1.config.plexoUrl,
|
|
50
49
|
});
|
|
@@ -94,7 +93,7 @@ var getPlexoKey = function (fingerprint) { return __awaiter(void 0, void 0, void
|
|
|
94
93
|
});
|
|
95
94
|
}); };
|
|
96
95
|
var unwrapCallback = function (fingerprint, response) { return __awaiter(void 0, void 0, void 0, function () {
|
|
97
|
-
var serverResponse, plexoResponse, err_1, certificate, key, canonizedObject, objectInPascalCase, objectSorted,
|
|
96
|
+
var serverResponse, plexoResponse, err_1, certificate, key, canonizedObject, objectInPascalCase, objectSorted, objectBuffer, verifySignature;
|
|
98
97
|
return __generator(this, function (_a) {
|
|
99
98
|
switch (_a.label) {
|
|
100
99
|
case 0:
|
|
@@ -115,27 +114,21 @@ var unwrapCallback = function (fingerprint, response) { return __awaiter(void 0,
|
|
|
115
114
|
case 3:
|
|
116
115
|
certificate = new crypto_1.X509Certificate(Buffer.from(plexoResponse.Object.Object.Response.Key, 'base64'));
|
|
117
116
|
key = certificate.publicKey.export({ format: 'pem', type: 'pkcs1' });
|
|
118
|
-
logger_lib_1.default.info(response, 'Callback de Plexo');
|
|
119
117
|
canonizedObject = signatureUtils_1.signatureUtils.canonizeJson(response.object, [
|
|
120
118
|
'CreditLimits',
|
|
121
119
|
'creditLimits',
|
|
122
120
|
]);
|
|
123
|
-
logger_lib_1.default.info(canonizedObject, 'Objeto canonizado');
|
|
124
121
|
objectInPascalCase = utils_1.caseUtils.toPascalKeys(canonizedObject);
|
|
125
122
|
objectSorted = signatureUtils_1.signatureUtils.sortObject(objectInPascalCase);
|
|
126
|
-
|
|
127
|
-
logger_lib_1.default.info(objectWithAmounts, 'Objeto a verificar');
|
|
128
|
-
objectBuffer = Buffer.from(JSON.stringify(objectWithAmounts));
|
|
123
|
+
objectBuffer = Buffer.from(JSON.stringify(objectSorted));
|
|
129
124
|
verifySignature = (0, crypto_1.createVerify)('SHA512')
|
|
130
125
|
.update(objectBuffer)
|
|
131
126
|
.verify(key, response.signature, 'base64');
|
|
132
|
-
logger_lib_1.default.info(verifySignature, 'Verify Signature');
|
|
133
127
|
serverResponse = {
|
|
134
128
|
response: response.object.object,
|
|
135
129
|
resultCode: verifySignature ? __1.ResultCodes.Ok : __1.ResultCodes.InvalidSignature,
|
|
136
130
|
errorMessage: verifySignature ? 'Success' : 'Signature do not match',
|
|
137
131
|
};
|
|
138
|
-
logger_lib_1.default.info(serverResponse, 'Server response, end of unwrap');
|
|
139
132
|
return [2 /*return*/, serverResponse];
|
|
140
133
|
}
|
|
141
134
|
});
|
|
@@ -62,12 +62,10 @@ var stringifyAmountsWithFloats = function (object) {
|
|
|
62
62
|
billedAmount: 'float',
|
|
63
63
|
taxedAmount: 'float',
|
|
64
64
|
vatAmount: 'float',
|
|
65
|
-
returnAmount: 'float',
|
|
66
65
|
Amount: 'float',
|
|
67
66
|
BilledAmount: 'float',
|
|
68
67
|
TaxedAmount: 'float',
|
|
69
68
|
VATAmount: 'float',
|
|
70
|
-
|
|
71
|
-
}, 2)(object, null, 0);
|
|
69
|
+
}, 1)(object, null, 0);
|
|
72
70
|
};
|
|
73
71
|
exports.stringifyAmountsWithFloats = stringifyAmountsWithFloats;
|
package/lib/utils/case.util.js
CHANGED
|
@@ -5,10 +5,8 @@ var js_convert_case_1 = require("js-convert-case");
|
|
|
5
5
|
var specialWords = [
|
|
6
6
|
{ word: 'UtcUnixTimeExpiration', substitute: 'UTCUnixTimeExpiration' },
|
|
7
7
|
{ word: 'UtcunixTimeExpiration', substitute: 'UTCUnixTimeExpiration' },
|
|
8
|
-
{ word: 'utcunixTimeExpiration', substitute: 'UTCUnixTimeExpiration' },
|
|
9
8
|
{ word: 'VatAmount', substitute: 'VATAmount' },
|
|
10
9
|
{ word: 'InstrumentExpirationUtc', substitute: 'InstrumentExpirationUTC' },
|
|
11
|
-
{ word: 'ExecutionDateUtc', substitute: 'ExecutionDateUTC' },
|
|
12
10
|
];
|
|
13
11
|
var camelCaseSpecialWords = [
|
|
14
12
|
{
|