@houlak/plexo-sdk 0.1.3 → 0.1.4-h
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/handler/PlexoHandler.d.ts +17 -7
- package/lib/handler/PlexoHandler.js +168 -15
- package/lib/index.d.ts +1 -0
- package/lib/index.js +4 -1
- package/lib/lib/logger.lib.d.ts +1 -6
- package/lib/lib/logger.lib.js +10 -6
- package/lib/sdk/IPaymentGatewayClient.d.ts +2 -2
- package/lib/sdk/PaymentGatewayClient.d.ts +2 -2
- package/lib/sdk/PaymentGatewayClient.js +9 -8
- package/lib/sdk/PaymentGatewayMock.d.ts +2 -2
- package/lib/sdk/PaymentGatewayMock.js +2 -8
- package/lib/sdk/enums/plexo-error-enum.d.ts +1 -0
- package/lib/sdk/enums/plexo-error-enum.js +1 -0
- package/lib/sdk/helpers/signature/signatureHelper.d.ts +3 -7
- package/lib/sdk/helpers/signature/signatureHelper.js +65 -195
- package/lib/sdk/helpers/signature/signatureUtils.d.ts +10 -0
- package/lib/{helpers/signature/signatureHelper.js → sdk/helpers/signature/signatureUtils.js} +50 -66
- package/lib/sdk/helpers/signature/stringifyWithFloats.js +2 -0
- package/lib/sdk/models/Authorization.d.ts +4 -5
- package/lib/sdk/models/Authorization.js +2 -1
- package/lib/sdk/models/BuiltInPagesOptions.d.ts +5 -0
- package/lib/sdk/models/BuiltInPagesOptions.js +11 -0
- package/lib/sdk/models/DisplayOptions.d.ts +8 -0
- package/lib/sdk/models/DisplayOptions.js +14 -0
- package/lib/sdk/models/ExpressCheckoutSettings.d.ts +7 -0
- package/lib/{models/ExpressCheckoutSettingsDto.js → sdk/models/ExpressCheckoutSettings.js} +3 -1
- package/lib/sdk/models/FieldType.d.ts +23 -14
- package/lib/sdk/models/FieldType.js +23 -14
- package/lib/sdk/models/IndexSDK.d.ts +8 -6
- package/lib/sdk/models/IndexSDK.js +16 -14
- package/lib/sdk/models/IssuerData.d.ts +2 -0
- package/lib/sdk/models/TokenizationSettings.d.ts +5 -0
- package/lib/sdk/models/TokenizationSettings.js +10 -0
- package/lib/sdk/models/TransactionsCSV.d.ts +3 -0
- package/lib/sdk/models/{UIOptionsDto.d.ts → UIOptions.d.ts} +2 -2
- package/lib/{models/UIOptionsDto.js → sdk/models/UIOptions.js} +5 -5
- package/lib/sdk/models/WebFormSettings.d.ts +9 -0
- package/lib/sdk/models/WebFormSettings.js +12 -0
- package/lib/sdk/models/webhook/Address.d.ts +9 -0
- package/lib/sdk/models/webhook/Address.js +15 -0
- package/lib/sdk/models/webhook/CancellationInfo.d.ts +11 -0
- package/lib/sdk/models/webhook/CancellationInfo.js +17 -0
- package/lib/sdk/models/webhook/Client.d.ts +9 -0
- package/lib/sdk/models/webhook/Client.js +14 -0
- package/lib/sdk/models/webhook/Commerce.d.ts +6 -0
- package/lib/sdk/models/webhook/Commerce.js +12 -0
- package/lib/sdk/models/webhook/Currency.d.ts +8 -0
- package/lib/sdk/models/webhook/Currency.js +14 -0
- package/lib/sdk/models/webhook/Customer.d.ts +17 -0
- package/lib/sdk/models/webhook/Customer.js +22 -0
- package/lib/sdk/models/webhook/Document.d.ts +5 -0
- package/lib/sdk/models/webhook/Document.js +11 -0
- package/lib/sdk/models/webhook/Instrument.d.ts +17 -0
- package/lib/sdk/models/webhook/Instrument.js +21 -0
- package/lib/sdk/models/webhook/Issuer.d.ts +8 -0
- package/lib/sdk/models/webhook/Issuer.js +14 -0
- package/lib/sdk/models/webhook/IssuerData.d.ts +8 -0
- package/lib/sdk/models/webhook/IssuerData.js +13 -0
- package/lib/sdk/models/webhook/IssuerDto.d.ts +5 -0
- package/lib/sdk/models/webhook/IssuerDto.js +11 -0
- package/lib/sdk/models/webhook/Item.d.ts +14 -0
- package/lib/sdk/models/webhook/Item.js +19 -0
- package/lib/sdk/models/webhook/PartialRefundsInfo.d.ts +12 -0
- package/lib/sdk/models/webhook/PartialRefundsInfo.js +18 -0
- package/lib/sdk/models/webhook/PaymentFacilitator.d.ts +8 -0
- package/lib/sdk/models/webhook/PaymentFacilitator.js +13 -0
- package/lib/sdk/models/webhook/PaymentProcessor.d.ts +5 -0
- package/lib/{models → sdk/models/webhook}/PaymentProcessor.js +2 -2
- package/lib/sdk/models/webhook/PurchaseInfo.d.ts +16 -0
- package/lib/sdk/models/webhook/PurchaseInfo.js +22 -0
- package/lib/sdk/models/webhook/RefundInfo.d.ts +12 -0
- package/lib/sdk/models/webhook/RefundInfo.js +18 -0
- package/lib/sdk/models/webhook/ReserveInfo.d.ts +13 -0
- package/lib/sdk/models/webhook/ReserveInfo.js +19 -0
- package/lib/sdk/models/webhook/Shipping.d.ts +7 -0
- package/lib/sdk/models/webhook/Shipping.js +12 -0
- package/lib/sdk/models/webhook/Transaction.d.ts +31 -0
- package/lib/sdk/models/webhook/Transaction.js +36 -0
- package/lib/sdk/models/webhook/TransactionResult.d.ts +5 -0
- package/lib/sdk/models/webhook/TransactionResult.js +10 -0
- package/lib/sdk/models/webhook/index.d.ts +21 -0
- package/lib/sdk/models/webhook/index.js +45 -0
- package/lib/utils/boolean.utils.d.ts +4 -0
- package/lib/utils/boolean.utils.js +53 -0
- package/lib/utils/case.util.d.ts +4 -0
- package/lib/utils/case.util.js +61 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +5 -0
- package/package.json +3 -3
- package/lib/IPaymentGatewayClient.d.ts +0 -31
- package/lib/PaymentGatewayClient.d.ts +0 -33
- package/lib/PaymentGatewayClient.js +0 -179
- package/lib/helpers/signature/signatureHelper.d.ts +0 -5
- package/lib/models/ActionType.d.ts +0 -9
- package/lib/models/ActionType.js +0 -13
- package/lib/models/AmountLimit.d.ts +0 -7
- package/lib/models/AmountLimit.js +0 -2
- package/lib/models/Authorization.d.ts +0 -16
- package/lib/models/Authorization.js +0 -32
- package/lib/models/AuthorizationInfo.d.ts +0 -6
- package/lib/models/AuthorizationInfo.js +0 -11
- package/lib/models/AuthorizationType.d.ts +0 -5
- package/lib/models/AuthorizationType.js +0 -9
- package/lib/models/BaseServerResponse.d.ts +0 -7
- package/lib/models/BaseServerResponse.js +0 -12
- package/lib/models/BuiltInPagesOptionsDto.d.ts +0 -4
- package/lib/models/BuiltInPagesOptionsDto.js +0 -9
- package/lib/models/CancelRequest.d.ts +0 -6
- package/lib/models/CancelRequest.js +0 -29
- package/lib/models/CardStatus.d.ts +0 -7
- package/lib/models/CardStatus.js +0 -11
- package/lib/models/CardTypes.d.ts +0 -9
- package/lib/models/CardTypes.js +0 -13
- package/lib/models/CertificateHelper.d.ts +0 -0
- package/lib/models/CertificateHelper.js +0 -152
- package/lib/models/CertificateHelperFactory.js +0 -12
- package/lib/models/ClientRequest.d.ts +0 -4
- package/lib/models/ClientRequest.js +0 -10
- package/lib/models/ClientResponse.d.ts +0 -6
- package/lib/models/ClientResponse.js +0 -29
- package/lib/models/ClientSignedRequest.d.ts +0 -4
- package/lib/models/ClientSignedRequest.js +0 -27
- package/lib/models/ClientSignedResponse.d.ts +0 -4
- package/lib/models/ClientSignedResponse.js +0 -27
- package/lib/models/CodeAction.d.ts +0 -10
- package/lib/models/CodeAction.js +0 -10
- package/lib/models/CodeRequest.d.ts +0 -5
- package/lib/models/CodeRequest.js +0 -2
- package/lib/models/Commerce.d.ts +0 -4
- package/lib/models/Commerce.js +0 -2
- package/lib/models/CommerceIdRequest.d.ts +0 -3
- package/lib/models/CommerceIdRequest.js +0 -2
- package/lib/models/CommerceIssuerIdRequest.d.ts +0 -4
- package/lib/models/CommerceIssuerIdRequest.js +0 -2
- package/lib/models/CommerceModifyRequest.d.ts +0 -4
- package/lib/models/CommerceModifyRequest.js +0 -2
- package/lib/models/CommerceRequest.d.ts +0 -3
- package/lib/models/CommerceRequest.js +0 -2
- package/lib/models/CreateBankInstrumentRequest.d.ts +0 -6
- package/lib/models/CreateBankInstrumentRequest.js +0 -2
- package/lib/models/Currency.d.ts +0 -6
- package/lib/models/Currency.js +0 -2
- package/lib/models/DeleteInstrumentRequest.d.ts +0 -6
- package/lib/models/DeleteInstrumentRequest.js +0 -29
- package/lib/models/DisplayOptionsDto.d.ts +0 -7
- package/lib/models/DisplayOptionsDto.js +0 -9
- package/lib/models/ExpressCheckoutRequest.d.ts +0 -6
- package/lib/models/ExpressCheckoutRequest.js +0 -2
- package/lib/models/ExpressCheckoutSettingsDto.d.ts +0 -6
- package/lib/models/ExtendedCredit.d.ts +0 -4
- package/lib/models/ExtendedCredit.js +0 -2
- package/lib/models/FieldInfo.d.ts +0 -6
- package/lib/models/FieldInfo.js +0 -2
- package/lib/models/FieldInfoPaymentProcessors.d.ts +0 -6
- package/lib/models/FieldInfoPaymentProcessors.js +0 -11
- package/lib/models/FieldType.d.ts +0 -76
- package/lib/models/FieldType.js +0 -89
- package/lib/models/FinancialInclusion.d.ts +0 -8
- package/lib/models/FinancialInclusion.js +0 -2
- package/lib/models/FinancialInclusionResult.d.ts +0 -6
- package/lib/models/FinancialInclusionResult.js +0 -2
- package/lib/models/GenericClientRequest.d.ts +0 -5
- package/lib/models/GenericClientRequest.js +0 -29
- package/lib/models/GenericClientSignedRequest.d.ts +0 -4
- package/lib/models/GenericClientSignedRequest.js +0 -27
- package/lib/models/GenericIssuerRequest.d.ts +0 -5
- package/lib/models/GenericIssuerRequest.js +0 -29
- package/lib/models/GenericIssuerSignedRequest.d.ts +0 -4
- package/lib/models/GenericIssuerSignedRequest.js +0 -27
- package/lib/models/GenericServerSignedResponse.d.ts +0 -4
- package/lib/models/GenericServerSignedResponse.js +0 -27
- package/lib/models/GenericSignedObject.d.ts +0 -6
- package/lib/models/GenericSignedObject.js +0 -11
- package/lib/models/GenericStateObject.d.ts +0 -5
- package/lib/models/GenericStateObject.js +0 -29
- package/lib/models/IClientCallback.d.ts +0 -3
- package/lib/models/IClientCallback.js +0 -2
- package/lib/models/IdentificationType.d.ts +0 -6
- package/lib/models/IdentificationType.js +0 -10
- package/lib/models/InclusionType.d.ts +0 -5
- package/lib/models/InclusionType.js +0 -9
- package/lib/models/IndexSDK.d.ts +0 -33
- package/lib/models/IndexSDK.js +0 -39
- package/lib/models/InfoLine.d.ts +0 -4
- package/lib/models/InfoLine.js +0 -2
- package/lib/models/InstrumentCallback.d.ts +0 -9
- package/lib/models/InstrumentCallback.js +0 -31
- package/lib/models/InstrumentWithMetadata.d.ts +0 -6
- package/lib/models/InstrumentWithMetadata.js +0 -11
- package/lib/models/IssuerData.d.ts +0 -5
- package/lib/models/IssuerData.js +0 -2
- package/lib/models/IssuerInfo.d.ts +0 -14
- package/lib/models/IssuerInfo.js +0 -2
- package/lib/models/IssuerProcessor.d.ts +0 -7
- package/lib/models/IssuerProcessor.js +0 -12
- package/lib/models/IssuerRequest.d.ts +0 -4
- package/lib/models/IssuerRequest.js +0 -10
- package/lib/models/IssuerSignedRequest.d.ts +0 -4
- package/lib/models/IssuerSignedRequest.js +0 -27
- package/lib/models/Item.d.ts +0 -8
- package/lib/models/Item.js +0 -2
- package/lib/models/PaymentInstrument.d.ts +0 -20
- package/lib/models/PaymentInstrument.js +0 -2
- package/lib/models/PaymentInstrumentInput.d.ts +0 -6
- package/lib/models/PaymentInstrumentInput.js +0 -2
- package/lib/models/PaymentProcessor.d.ts +0 -6
- package/lib/models/PaymentRequest.d.ts +0 -17
- package/lib/models/PaymentRequest.js +0 -20
- package/lib/models/PlexoSdkSettings.d.ts +0 -8
- package/lib/models/PlexoSdkSettings.js +0 -14
- package/lib/models/PublicKeyInfo.d.ts +0 -4
- package/lib/models/PublicKeyInfo.js +0 -2
- package/lib/models/Reference.d.ts +0 -6
- package/lib/models/Reference.js +0 -11
- package/lib/models/ReferenceType.d.ts +0 -6
- package/lib/models/ReferenceType.js +0 -10
- package/lib/models/Reserve.d.ts +0 -6
- package/lib/models/Reserve.js +0 -29
- package/lib/models/ReserveRequest.d.ts +0 -6
- package/lib/models/ReserveRequest.js +0 -29
- package/lib/models/ResultCodes.d.ts +0 -30
- package/lib/models/ResultCodes.js +0 -35
- package/lib/models/ServerResponse.d.ts +0 -6
- package/lib/models/ServerResponse.js +0 -29
- package/lib/models/ServerSignedCallback.d.ts +0 -3
- package/lib/models/ServerSignedCallback.js +0 -27
- package/lib/models/ServerSignedRequest.d.ts +0 -3
- package/lib/models/ServerSignedRequest.js +0 -27
- package/lib/models/ServerSignedResponse.d.ts +0 -4
- package/lib/models/ServerSignedResponse.js +0 -27
- package/lib/models/Session.d.ts +0 -5
- package/lib/models/Session.js +0 -2
- package/lib/models/Settings.d.ts +0 -11
- package/lib/models/Settings.js +0 -19
- package/lib/models/SignedObject.d.ts +0 -6
- package/lib/models/SignedObject.js +0 -11
- package/lib/models/StateObject.d.ts +0 -5
- package/lib/models/StateObject.js +0 -11
- package/lib/models/TimeLimit.d.ts +0 -5
- package/lib/models/TimeLimit.js +0 -2
- package/lib/models/TokenizationSettingsDto.d.ts +0 -4
- package/lib/models/TokenizationSettingsDto.js +0 -9
- package/lib/models/Transaction.d.ts +0 -26
- package/lib/models/Transaction.js +0 -26
- package/lib/models/TransactionCallback.d.ts +0 -7
- package/lib/models/TransactionCallback.js +0 -29
- package/lib/models/TransactionCursor.d.ts +0 -6
- package/lib/models/TransactionCursor.js +0 -2
- package/lib/models/TransactionInfo.d.ts +0 -12
- package/lib/models/TransactionInfo.js +0 -2
- package/lib/models/TransactionOrder.d.ts +0 -5
- package/lib/models/TransactionOrder.js +0 -2
- package/lib/models/TransactionQuery.d.ts +0 -54
- package/lib/models/TransactionQuery.js +0 -47
- package/lib/models/TransactionResult.d.ts +0 -13
- package/lib/models/TransactionResult.js +0 -17
- package/lib/models/TransactionType.d.ts +0 -5
- package/lib/models/TransactionType.js +0 -9
- package/lib/models/UIOptionsDto.d.ts +0 -7
- package/lib/models/WebFormSettingsDto.d.ts +0 -8
- package/lib/models/WebFormSettingsDto.js +0 -9
- package/lib/sdk/models/BuiltInPagesOptionsDto.d.ts +0 -4
- package/lib/sdk/models/BuiltInPagesOptionsDto.js +0 -9
- package/lib/sdk/models/DisplayOptionsDto.d.ts +0 -7
- package/lib/sdk/models/DisplayOptionsDto.js +0 -9
- package/lib/sdk/models/ExpressCheckoutSettingsDto.d.ts +0 -6
- package/lib/sdk/models/ExpressCheckoutSettingsDto.js +0 -9
- package/lib/sdk/models/TokenizationSettingsDto.d.ts +0 -4
- package/lib/sdk/models/TokenizationSettingsDto.js +0 -9
- package/lib/sdk/models/UIOptionsDto.js +0 -13
- package/lib/sdk/models/WebFormSettingsDto.d.ts +0 -8
- package/lib/sdk/models/WebFormSettingsDto.js +0 -9
- /package/lib/{IPaymentGatewayClient.js → sdk/models/TransactionsCSV.js} +0 -0
|
@@ -36,159 +36,25 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.SignatureHelper =
|
|
39
|
+
exports.SignatureHelper = void 0;
|
|
40
40
|
var axios_1 = require("axios");
|
|
41
|
-
var fs = require("fs");
|
|
42
|
-
var pem = require("pem");
|
|
43
41
|
var crypto_1 = require("crypto");
|
|
44
|
-
var js_convert_case_1 = require("js-convert-case");
|
|
45
|
-
var util_1 = require("util");
|
|
46
|
-
var logger_lib_1 = require("../../../lib/logger.lib");
|
|
47
|
-
var config_1 = require("../../../config/config");
|
|
48
42
|
var __1 = require("../..");
|
|
49
|
-
var
|
|
43
|
+
var config_1 = require("../../../config/config");
|
|
44
|
+
var logger_lib_1 = require("../../../lib/logger.lib");
|
|
45
|
+
var utils_1 = require("../../../utils");
|
|
46
|
+
var boolean_utils_1 = require("../../../utils/boolean.utils");
|
|
47
|
+
var signatureUtils_1 = require("./signatureUtils");
|
|
50
48
|
var client = axios_1.default.create({
|
|
51
49
|
baseURL: config_1.config.plexoUrl,
|
|
52
50
|
});
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
{ word: 'VatAmount', substitute: 'VATAmount' },
|
|
56
|
-
];
|
|
57
|
-
var canonizeJson = function (object) {
|
|
58
|
-
var cleanObject = deleteObjectUndefined(object);
|
|
59
|
-
return sort(cleanObject);
|
|
60
|
-
};
|
|
61
|
-
exports.canonizeJson = canonizeJson;
|
|
62
|
-
var toCamelKeys = function (object) {
|
|
63
|
-
var parsedObject = (0, js_convert_case_1.camelKeys)(object, { recursive: true, recursiveInArray: true });
|
|
64
|
-
return parsedObject;
|
|
65
|
-
};
|
|
66
|
-
function substituteWordRecursively(theParsedObject, word, substitute) {
|
|
67
|
-
var deleteObject = function (obj, key) {
|
|
68
|
-
delete obj[key];
|
|
69
|
-
};
|
|
70
|
-
if (typeof theParsedObject === 'object') {
|
|
71
|
-
Object.keys(theParsedObject).map(function (key) {
|
|
72
|
-
if (key === word) {
|
|
73
|
-
Object.defineProperty(theParsedObject, substitute, Object.getOwnPropertyDescriptor(theParsedObject, word) || '');
|
|
74
|
-
deleteObject(theParsedObject, word);
|
|
75
|
-
}
|
|
76
|
-
if (typeof theParsedObject[key] === 'object') {
|
|
77
|
-
substituteWordRecursively(theParsedObject[key], word, substitute);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
var toPascalKeys = function (object) {
|
|
83
|
-
var parsedObject = (0, js_convert_case_1.pascalKeys)(object, { recursive: true, recursiveInArray: true });
|
|
84
|
-
specialWords.forEach(function (specialWord) {
|
|
85
|
-
if (JSON.stringify(parsedObject).includes(specialWord.word)) {
|
|
86
|
-
substituteWordRecursively(parsedObject, specialWord.word, specialWord.substitute);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
return parsedObject;
|
|
90
|
-
};
|
|
91
|
-
var sort = function (object) {
|
|
92
|
-
if (Array.isArray(object)) {
|
|
93
|
-
var newArray_1 = [];
|
|
94
|
-
object.map(function (item) { return newArray_1.push(sort(item)); });
|
|
95
|
-
return newArray_1;
|
|
96
|
-
}
|
|
97
|
-
if (typeof object === 'object') {
|
|
98
|
-
var newObject_1 = {};
|
|
99
|
-
Object.keys(object)
|
|
100
|
-
.sort()
|
|
101
|
-
.map(function (key) { return (newObject_1[key] = sort(object[key])); });
|
|
102
|
-
return newObject_1;
|
|
103
|
-
}
|
|
104
|
-
return object;
|
|
105
|
-
};
|
|
106
|
-
// TODO:
|
|
107
|
-
// const parseDateToISO = (object: any) => {}
|
|
108
|
-
var deleteObjectUndefined = function (object) {
|
|
109
|
-
if (Array.isArray(object)) {
|
|
110
|
-
object = object
|
|
111
|
-
.filter(function (item) { return item !== undefined || !item.length; })
|
|
112
|
-
.map(function (item) {
|
|
113
|
-
return typeof item === 'object' || Array.isArray(item) ? deleteObjectUndefined(item) : null;
|
|
114
|
-
});
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
if (typeof object === 'object') {
|
|
118
|
-
Object.keys(object).map(function (key) {
|
|
119
|
-
if (typeof object[key] === 'object') {
|
|
120
|
-
if (Object.entries(object[key]).length === 0) {
|
|
121
|
-
delete object[key];
|
|
122
|
-
}
|
|
123
|
-
deleteObjectUndefined(object[key]);
|
|
124
|
-
}
|
|
125
|
-
if ((!object[key] && object[key] !== 0 && typeof object[key] !== 'boolean') ||
|
|
126
|
-
(!object[key].length && Array.isArray(object[key]))) {
|
|
127
|
-
delete object[key];
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
if (Array.isArray(object[key]) && object[key].length) {
|
|
131
|
-
deleteObjectUndefined(object[key]);
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
return object;
|
|
136
|
-
};
|
|
137
|
-
var getFingerprint = function (content, algorithm, inputEncoding, outputEncoding) {
|
|
138
|
-
if (algorithm === void 0) { algorithm = 'sha1'; }
|
|
139
|
-
if (inputEncoding === void 0) { inputEncoding = 'utf8'; }
|
|
140
|
-
if (outputEncoding === void 0) { outputEncoding = 'base64'; }
|
|
141
|
-
var shaSum = (0, crypto_1.createHash)(algorithm);
|
|
142
|
-
shaSum.update(content, inputEncoding);
|
|
143
|
-
var res = shaSum.digest(outputEncoding);
|
|
144
|
-
return res;
|
|
145
|
-
};
|
|
146
|
-
var getCertificate = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
147
|
-
var pathPfx, pfx, certs;
|
|
51
|
+
var signRequest = function (objectToSign) { return __awaiter(void 0, void 0, void 0, function () {
|
|
52
|
+
var cert, privateKey, stringifiedCert, signedObject, thumbnail, canonizedObject, objectoToPascalKeys, objectWithStringBooleans, signKey;
|
|
148
53
|
return __generator(this, function (_a) {
|
|
149
54
|
switch (_a.label) {
|
|
150
|
-
case 0:
|
|
151
|
-
pathPfx = config_1.config.plexoClient.certificatePath;
|
|
152
|
-
pfx = fs.readFileSync(pathPfx);
|
|
153
|
-
return [4 /*yield*/, new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
|
|
154
|
-
return __generator(this, function (_a) {
|
|
155
|
-
switch (_a.label) {
|
|
156
|
-
case 0: return [4 /*yield*/, pem.readPkcs12(pfx, { p12Password: config_1.config.plexoClient.certificatePassword }, function (_err, cert) { return __awaiter(void 0, void 0, void 0, function () {
|
|
157
|
-
var privateKey, stringifiedCert;
|
|
158
|
-
return __generator(this, function (_a) {
|
|
159
|
-
privateKey = cert.key;
|
|
160
|
-
stringifiedCert = cert.cert;
|
|
161
|
-
resolve({ privateKey: privateKey, cert: stringifiedCert });
|
|
162
|
-
return [2 /*return*/];
|
|
163
|
-
});
|
|
164
|
-
}); })];
|
|
165
|
-
case 1:
|
|
166
|
-
_a.sent();
|
|
167
|
-
return [2 /*return*/];
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
}); })];
|
|
171
|
-
case 1:
|
|
172
|
-
certs = _a.sent();
|
|
173
|
-
return [2 /*return*/, certs];
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
}); };
|
|
177
|
-
var generateSignature = function (object, privateKey) {
|
|
178
|
-
var canonizedString = (0, stringifyWithFloats_1.stringifyAmountsWithFloats)(object);
|
|
179
|
-
logger_lib_1.default.debug('STRING TO SIGN --> ' + canonizedString);
|
|
180
|
-
var canonizedStringEncoded = new util_1.TextEncoder().encode(canonizedString);
|
|
181
|
-
var signKey = (0, crypto_1.sign)('SHA512', canonizedStringEncoded, privateKey).toString('base64');
|
|
182
|
-
return signKey;
|
|
183
|
-
};
|
|
184
|
-
var getSignatureFromPlexo = function (objectToSign) { return __awaiter(void 0, void 0, void 0, function () {
|
|
185
|
-
var cert, privateKey, stringifiedCert, signedObject, thumbnail, canonizedObject, objectoToPascalKeys, signKey;
|
|
186
|
-
return __generator(this, function (_a) {
|
|
187
|
-
switch (_a.label) {
|
|
188
|
-
case 0: return [4 /*yield*/, getCertificate()];
|
|
55
|
+
case 0: return [4 /*yield*/, signatureUtils_1.signatureUtils.getCertificate()];
|
|
189
56
|
case 1:
|
|
190
57
|
cert = _a.sent();
|
|
191
|
-
logger_lib_1.default.debug({ cert: cert });
|
|
192
58
|
privateKey = cert.privateKey;
|
|
193
59
|
stringifiedCert = cert.cert
|
|
194
60
|
.toString()
|
|
@@ -200,54 +66,21 @@ var getSignatureFromPlexo = function (objectToSign) { return __awaiter(void 0, v
|
|
|
200
66
|
object: objectToSign,
|
|
201
67
|
signature: '',
|
|
202
68
|
};
|
|
203
|
-
thumbnail =
|
|
69
|
+
thumbnail = signatureUtils_1.signatureUtils
|
|
70
|
+
.getFingerprint(stringifiedCert, 'sha1', 'base64', 'hex')
|
|
71
|
+
.toUpperCase();
|
|
204
72
|
objectToSign.fingerprint = thumbnail;
|
|
205
|
-
canonizedObject =
|
|
206
|
-
objectoToPascalKeys = toPascalKeys(canonizedObject);
|
|
207
|
-
|
|
73
|
+
canonizedObject = signatureUtils_1.signatureUtils.canonizeJson(objectToSign);
|
|
74
|
+
objectoToPascalKeys = utils_1.caseUtils.toPascalKeys(canonizedObject);
|
|
75
|
+
objectWithStringBooleans = boolean_utils_1.booleanUtils.stringifyBooleans(objectoToPascalKeys);
|
|
76
|
+
signKey = signatureUtils_1.signatureUtils.generateSignature(objectWithStringBooleans, privateKey);
|
|
77
|
+
logger_lib_1.default.debug(objectWithStringBooleans, 'Object to sign');
|
|
208
78
|
signedObject.signature = signKey;
|
|
209
|
-
signedObject.object =
|
|
79
|
+
signedObject.object = objectWithStringBooleans;
|
|
210
80
|
return [2 /*return*/, signedObject];
|
|
211
81
|
}
|
|
212
82
|
});
|
|
213
83
|
}); };
|
|
214
|
-
var getSignatureFromCallback = function (response) { return __awaiter(void 0, void 0, void 0, function () {
|
|
215
|
-
var object, stateObject, objectSignature, serverResponse;
|
|
216
|
-
return __generator(this, function (_a) {
|
|
217
|
-
switch (_a.label) {
|
|
218
|
-
case 0:
|
|
219
|
-
object = {
|
|
220
|
-
client: response.response.client,
|
|
221
|
-
request: response,
|
|
222
|
-
};
|
|
223
|
-
stateObject = {
|
|
224
|
-
fingerprint: '',
|
|
225
|
-
utcUnixTimeExpiration: Date.parse(new Date().toString()),
|
|
226
|
-
object: object,
|
|
227
|
-
};
|
|
228
|
-
return [4 /*yield*/, getSignatureFromPlexo(stateObject)];
|
|
229
|
-
case 1:
|
|
230
|
-
objectSignature = _a.sent();
|
|
231
|
-
serverResponse = {
|
|
232
|
-
response: {
|
|
233
|
-
object: {
|
|
234
|
-
object: {
|
|
235
|
-
client: objectSignature.object.object.client,
|
|
236
|
-
resultCode: response.resultCode,
|
|
237
|
-
},
|
|
238
|
-
fingerprint: objectSignature.object.fingerprint,
|
|
239
|
-
utcUnixTimeExpiration: objectSignature.object.utcUnixTimeExpiration,
|
|
240
|
-
},
|
|
241
|
-
signature: objectSignature.signature,
|
|
242
|
-
},
|
|
243
|
-
resultCode: response.resultCode,
|
|
244
|
-
errorMessage: response.errorMessage,
|
|
245
|
-
i18ErrorMessages: response.i18ErrorMessages,
|
|
246
|
-
};
|
|
247
|
-
return [2 /*return*/, serverResponse];
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
}); };
|
|
251
84
|
var getPlexoKey = function (fingerprint) { return __awaiter(void 0, void 0, void 0, function () {
|
|
252
85
|
var plexoResponse;
|
|
253
86
|
return __generator(this, function (_a) {
|
|
@@ -262,8 +95,8 @@ var getPlexoKey = function (fingerprint) { return __awaiter(void 0, void 0, void
|
|
|
262
95
|
}
|
|
263
96
|
});
|
|
264
97
|
}); };
|
|
265
|
-
var
|
|
266
|
-
var serverResponse, plexoResponse, err_1, key, objectBuffer, verifySignature;
|
|
98
|
+
var unwrapCallback = function (fingerprint, response) { return __awaiter(void 0, void 0, void 0, function () {
|
|
99
|
+
var serverResponse, plexoResponse, err_1, certificate, key, canonizedObject, objectInPascalCase, objectWithStringBooleans, objectSorted, objectBuffer, verifySignature;
|
|
267
100
|
return __generator(this, function (_a) {
|
|
268
101
|
switch (_a.label) {
|
|
269
102
|
case 0:
|
|
@@ -282,24 +115,61 @@ var getPlexoSignature = function (fingerprint, response) { return __awaiter(void
|
|
|
282
115
|
};
|
|
283
116
|
return [2 /*return*/, serverResponse];
|
|
284
117
|
case 3:
|
|
285
|
-
|
|
286
|
-
|
|
118
|
+
certificate = new crypto_1.X509Certificate(Buffer.from(plexoResponse.Object.Object.Response.Key, 'base64'));
|
|
119
|
+
key = certificate.publicKey.export({ format: 'pem', type: 'pkcs1' });
|
|
120
|
+
canonizedObject = signatureUtils_1.signatureUtils.canonizeJson(response.object, [
|
|
121
|
+
'CreditLimits',
|
|
122
|
+
'creditLimits',
|
|
123
|
+
]);
|
|
124
|
+
objectInPascalCase = utils_1.caseUtils.toPascalKeys(canonizedObject);
|
|
125
|
+
objectWithStringBooleans = boolean_utils_1.booleanUtils.stringifyBooleans(objectInPascalCase);
|
|
126
|
+
objectSorted = signatureUtils_1.signatureUtils.sortObject(objectWithStringBooleans);
|
|
127
|
+
objectBuffer = Buffer.from(JSON.stringify(objectSorted));
|
|
287
128
|
verifySignature = (0, crypto_1.createVerify)('SHA512')
|
|
288
129
|
.update(objectBuffer)
|
|
289
130
|
.verify(key, response.signature, 'base64');
|
|
290
131
|
serverResponse = {
|
|
291
132
|
response: response.object.object,
|
|
292
133
|
resultCode: verifySignature ? __1.ResultCodes.Ok : __1.ResultCodes.InvalidSignature,
|
|
293
|
-
errorMessage: verifySignature ?
|
|
134
|
+
errorMessage: verifySignature ? 'Success' : 'Signature do not match',
|
|
294
135
|
};
|
|
295
136
|
return [2 /*return*/, serverResponse];
|
|
296
137
|
}
|
|
297
138
|
});
|
|
298
139
|
}); };
|
|
140
|
+
var signCallback = function (response) { return __awaiter(void 0, void 0, void 0, function () {
|
|
141
|
+
var clientResponse, stateObject, signedObject, clientSignedResponse;
|
|
142
|
+
return __generator(this, function (_a) {
|
|
143
|
+
switch (_a.label) {
|
|
144
|
+
case 0:
|
|
145
|
+
clientResponse = {
|
|
146
|
+
resultCode: response.resultCode,
|
|
147
|
+
errorMessage: response.errorMessage,
|
|
148
|
+
client: response.response.client,
|
|
149
|
+
i18ErrorMessages: response.i18ErrorMessages,
|
|
150
|
+
};
|
|
151
|
+
stateObject = {
|
|
152
|
+
fingerprint: '',
|
|
153
|
+
object: clientResponse,
|
|
154
|
+
utcUnixTimeExpiration: Date.parse(new Date().toString()),
|
|
155
|
+
};
|
|
156
|
+
return [4 /*yield*/, signRequest(stateObject)];
|
|
157
|
+
case 1:
|
|
158
|
+
signedObject = _a.sent();
|
|
159
|
+
clientSignedResponse = {
|
|
160
|
+
signature: signedObject.signature,
|
|
161
|
+
object: {
|
|
162
|
+
fingerprint: signedObject.object.fingerprint,
|
|
163
|
+
utcUnixTimeExpiration: signedObject.object.utcUnixTimeExpiration,
|
|
164
|
+
object: clientResponse,
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
return [2 /*return*/, clientSignedResponse];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}); };
|
|
299
171
|
exports.SignatureHelper = {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
getPlexoSignature: getPlexoSignature,
|
|
304
|
-
toCamelKeys: toCamelKeys,
|
|
172
|
+
signRequest: signRequest,
|
|
173
|
+
unwrapCallback: unwrapCallback,
|
|
174
|
+
signCallback: signCallback,
|
|
305
175
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BinaryToTextEncoding, Encoding } from 'crypto';
|
|
2
|
+
import { Certificate } from '../../types/signatureHelper.type';
|
|
3
|
+
export declare const signatureUtils: {
|
|
4
|
+
canonizeJson: <T>(object: T, keysToSkip?: string[]) => T;
|
|
5
|
+
sortObject: (object: any | any[]) => any | any[];
|
|
6
|
+
deleteObjectUndefined: (object: any, keysToSkip?: string[]) => any;
|
|
7
|
+
getFingerprint: (content: string, algorithm?: string, inputEncoding?: Encoding, outputEncoding?: BinaryToTextEncoding) => string;
|
|
8
|
+
getCertificate: () => Promise<Certificate>;
|
|
9
|
+
generateSignature: <T_1 extends object>(object: T_1, privateKey: string) => string;
|
|
10
|
+
};
|
package/lib/{helpers/signature/signatureHelper.js → sdk/helpers/signature/signatureUtils.js}
RENAMED
|
@@ -36,63 +36,54 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.signatureUtils = void 0;
|
|
40
|
+
var crypto_1 = require("crypto");
|
|
40
41
|
var fs = require("fs");
|
|
41
|
-
var path = require("path");
|
|
42
42
|
var pem = require("pem");
|
|
43
|
-
var crypto_1 = require("crypto");
|
|
44
|
-
var js_convert_case_1 = require("js-convert-case");
|
|
45
43
|
var util_1 = require("util");
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
var toPascalKeys = function (object) {
|
|
53
|
-
var parsedObject = (0, js_convert_case_1.pascalKeys)(object, { recursive: true, recursiveInArray: true });
|
|
54
|
-
if (parsedObject.hasOwnProperty('UtcUnixTimeExpiration')) {
|
|
55
|
-
var deleteObject = function (obj, key) {
|
|
56
|
-
delete obj[key];
|
|
57
|
-
};
|
|
58
|
-
Object.defineProperty(parsedObject, 'UTCUnixTimeExpiration', Object.getOwnPropertyDescriptor(parsedObject, 'UtcUnixTimeExpiration'));
|
|
59
|
-
deleteObject(parsedObject, 'UtcUnixTimeExpiration');
|
|
60
|
-
}
|
|
61
|
-
return parsedObject;
|
|
44
|
+
var config_1 = require("../../../config/config");
|
|
45
|
+
var logger_lib_1 = require("../../../lib/logger.lib");
|
|
46
|
+
var stringifyWithFloats_1 = require("./stringifyWithFloats");
|
|
47
|
+
var canonizeJson = function (object, keysToSkip) {
|
|
48
|
+
var cleanObject = deleteObjectUndefined(object, keysToSkip);
|
|
49
|
+
return sortObject(cleanObject);
|
|
62
50
|
};
|
|
63
|
-
var
|
|
51
|
+
var sortObject = function (object) {
|
|
64
52
|
if (Array.isArray(object)) {
|
|
65
53
|
var newArray_1 = [];
|
|
66
|
-
object.map(function (item) { return newArray_1.push(
|
|
54
|
+
object.map(function (item) { return newArray_1.push(sortObject(item)); });
|
|
67
55
|
return newArray_1;
|
|
68
56
|
}
|
|
69
|
-
if (typeof object === 'object') {
|
|
57
|
+
if (object && typeof object === 'object') {
|
|
70
58
|
var newObject_1 = {};
|
|
71
59
|
Object.keys(object)
|
|
72
60
|
.sort()
|
|
73
|
-
.map(function (key) { return (newObject_1[key] =
|
|
61
|
+
.map(function (key) { return (newObject_1[key] = sortObject(object[key])); });
|
|
74
62
|
return newObject_1;
|
|
75
63
|
}
|
|
76
64
|
return object;
|
|
77
65
|
};
|
|
78
|
-
|
|
79
|
-
// const parseDateToISO = (object: any) => {}
|
|
80
|
-
var deleteObjectUndefined = function (object) {
|
|
66
|
+
var deleteObjectUndefined = function (object, keysToSkip) {
|
|
81
67
|
if (Array.isArray(object)) {
|
|
82
68
|
object = object
|
|
83
69
|
.filter(function (item) { return item !== undefined || !item.length; })
|
|
84
70
|
.map(function (item) {
|
|
85
|
-
return typeof item === 'object' || Array.isArray(item)
|
|
71
|
+
return (item && typeof item === 'object') || Array.isArray(item)
|
|
72
|
+
? deleteObjectUndefined(item, keysToSkip)
|
|
73
|
+
: null;
|
|
86
74
|
});
|
|
87
75
|
return;
|
|
88
76
|
}
|
|
89
|
-
if (typeof object === 'object') {
|
|
77
|
+
if (object && typeof object === 'object') {
|
|
90
78
|
Object.keys(object).map(function (key) {
|
|
91
|
-
if (
|
|
79
|
+
if (keysToSkip === null || keysToSkip === void 0 ? void 0 : keysToSkip.includes(key)) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (object[key] && typeof object[key] === 'object') {
|
|
92
83
|
if (Object.entries(object[key]).length === 0) {
|
|
93
84
|
delete object[key];
|
|
94
85
|
}
|
|
95
|
-
deleteObjectUndefined(object[key]);
|
|
86
|
+
deleteObjectUndefined(object[key], keysToSkip);
|
|
96
87
|
}
|
|
97
88
|
if ((!object[key] && object[key] !== 0 && typeof object[key] !== 'boolean') ||
|
|
98
89
|
(!object[key].length && Array.isArray(object[key]))) {
|
|
@@ -100,13 +91,13 @@ var deleteObjectUndefined = function (object) {
|
|
|
100
91
|
return;
|
|
101
92
|
}
|
|
102
93
|
if (Array.isArray(object[key]) && object[key].length) {
|
|
103
|
-
deleteObjectUndefined(object[key]);
|
|
94
|
+
deleteObjectUndefined(object[key], keysToSkip);
|
|
104
95
|
}
|
|
105
96
|
});
|
|
106
97
|
}
|
|
107
98
|
return object;
|
|
108
99
|
};
|
|
109
|
-
var
|
|
100
|
+
var getFingerprint = function (content, algorithm, inputEncoding, outputEncoding) {
|
|
110
101
|
if (algorithm === void 0) { algorithm = 'sha1'; }
|
|
111
102
|
if (inputEncoding === void 0) { inputEncoding = 'utf8'; }
|
|
112
103
|
if (outputEncoding === void 0) { outputEncoding = 'base64'; }
|
|
@@ -115,59 +106,52 @@ var getHash = function (content, algorithm, inputEncoding, outputEncoding) {
|
|
|
115
106
|
var res = shaSum.digest(outputEncoding);
|
|
116
107
|
return res;
|
|
117
108
|
};
|
|
118
|
-
var
|
|
119
|
-
var pathPfx, pfx,
|
|
109
|
+
var getCertificate = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
110
|
+
var pathPfx, pfx, certs;
|
|
120
111
|
return __generator(this, function (_a) {
|
|
121
112
|
switch (_a.label) {
|
|
122
113
|
case 0:
|
|
123
|
-
pathPfx =
|
|
114
|
+
pathPfx = config_1.config.plexoClient.certificatePath;
|
|
124
115
|
pfx = fs.readFileSync(pathPfx);
|
|
125
|
-
signedObject = {
|
|
126
|
-
object: objectToSign,
|
|
127
|
-
signature: '',
|
|
128
|
-
};
|
|
129
116
|
return [4 /*yield*/, new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
|
|
130
117
|
return __generator(this, function (_a) {
|
|
131
118
|
switch (_a.label) {
|
|
132
|
-
case 0:
|
|
133
|
-
|
|
134
|
-
return [4 /*yield*/, pem.readPkcs12(pfx, { p12Password: '1C97MOfustztkNfOtuET' }, function (_err, cert) { return __awaiter(void 0, void 0, void 0, function () {
|
|
135
|
-
var privateKey, stringifiedCert, thumbnail, canonizedObject, objectoToPascalKeys, canonizedString, canonizedEncodedString, signKey;
|
|
119
|
+
case 0: return [4 /*yield*/, pem.readPkcs12(pfx, { p12Password: config_1.config.plexoClient.certificatePassword }, function (_err, cert) { return __awaiter(void 0, void 0, void 0, function () {
|
|
120
|
+
var privateKey, stringifiedCert;
|
|
136
121
|
return __generator(this, function (_a) {
|
|
122
|
+
if (_err) {
|
|
123
|
+
return [2 /*return*/, reject(_err)];
|
|
124
|
+
}
|
|
137
125
|
privateKey = cert.key;
|
|
138
|
-
stringifiedCert = cert.cert
|
|
139
|
-
|
|
140
|
-
.split('\n')
|
|
141
|
-
.filter(function (line) { return !line.includes('-----'); })
|
|
142
|
-
.map(function (line) { return line.trim(); })
|
|
143
|
-
.join('');
|
|
144
|
-
thumbnail = getHash(stringifiedCert, 'sha1', 'base64', 'hex').toUpperCase();
|
|
145
|
-
objectToSign.fingerprint = thumbnail;
|
|
146
|
-
canonizedObject = (0, exports.canonizeJson)(objectToSign);
|
|
147
|
-
objectoToPascalKeys = toPascalKeys(canonizedObject);
|
|
148
|
-
logger_lib_1.default.debug({ objectoToPascalKeys: objectoToPascalKeys });
|
|
149
|
-
canonizedString = JSON.stringify(objectoToPascalKeys);
|
|
150
|
-
canonizedEncodedString = new util_1.TextEncoder().encode(canonizedString);
|
|
151
|
-
signKey = (0, crypto_1.sign)('SHA512', canonizedEncodedString, privateKey).toString('base64');
|
|
152
|
-
signedObject.signature = signKey;
|
|
153
|
-
signedObject.object = canonizedObject;
|
|
154
|
-
resolve(signedObject);
|
|
126
|
+
stringifiedCert = cert.cert;
|
|
127
|
+
resolve({ privateKey: privateKey, cert: stringifiedCert });
|
|
155
128
|
return [2 /*return*/];
|
|
156
129
|
});
|
|
157
130
|
}); })];
|
|
158
131
|
case 1:
|
|
159
|
-
// TODO: Add password to envs
|
|
160
132
|
_a.sent();
|
|
161
133
|
return [2 /*return*/];
|
|
162
134
|
}
|
|
163
135
|
});
|
|
164
136
|
}); })];
|
|
165
137
|
case 1:
|
|
166
|
-
_a.sent();
|
|
167
|
-
return [2 /*return*/,
|
|
138
|
+
certs = _a.sent();
|
|
139
|
+
return [2 /*return*/, certs];
|
|
168
140
|
}
|
|
169
141
|
});
|
|
170
142
|
}); };
|
|
171
|
-
|
|
172
|
-
|
|
143
|
+
var generateSignature = function (object, privateKey) {
|
|
144
|
+
var canonizedString = (0, stringifyWithFloats_1.stringifyAmountsWithFloats)(object);
|
|
145
|
+
logger_lib_1.default.debug(canonizedString, 'String to sign');
|
|
146
|
+
var canonizedStringEncoded = new util_1.TextEncoder().encode(canonizedString);
|
|
147
|
+
var signKey = (0, crypto_1.sign)('SHA512', canonizedStringEncoded, privateKey).toString('base64');
|
|
148
|
+
return signKey;
|
|
149
|
+
};
|
|
150
|
+
exports.signatureUtils = {
|
|
151
|
+
canonizeJson: canonizeJson,
|
|
152
|
+
sortObject: sortObject,
|
|
153
|
+
deleteObjectUndefined: deleteObjectUndefined,
|
|
154
|
+
getFingerprint: getFingerprint,
|
|
155
|
+
getCertificate: getCertificate,
|
|
156
|
+
generateSignature: generateSignature,
|
|
173
157
|
};
|
|
@@ -62,10 +62,12 @@ var stringifyAmountsWithFloats = function (object) {
|
|
|
62
62
|
billedAmount: 'float',
|
|
63
63
|
taxedAmount: 'float',
|
|
64
64
|
vatAmount: 'float',
|
|
65
|
+
tipAmount: 'float',
|
|
65
66
|
Amount: 'float',
|
|
66
67
|
BilledAmount: 'float',
|
|
67
68
|
TaxedAmount: 'float',
|
|
68
69
|
VATAmount: 'float',
|
|
70
|
+
TipAmount: 'float',
|
|
69
71
|
}, 1)(object, null, 0);
|
|
70
72
|
};
|
|
71
73
|
exports.stringifyAmountsWithFloats = stringifyAmountsWithFloats;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { ESMap } from 'typescript';
|
|
2
1
|
import { AuthorizationType } from '..';
|
|
3
2
|
import { ActionType } from './ActionType';
|
|
4
3
|
import { AuthorizationInfo } from './AuthorizationInfo';
|
|
5
|
-
import {
|
|
4
|
+
import { WebFormSettings } from './WebFormSettings';
|
|
6
5
|
export declare class Authorization extends AuthorizationInfo {
|
|
7
6
|
action: ActionType;
|
|
8
7
|
redirectUri: string;
|
|
9
8
|
limitIssuers: string[];
|
|
10
9
|
optionalCommerceId: number;
|
|
10
|
+
webFormSettings?: WebFormSettings;
|
|
11
11
|
doNotUseCallback?: boolean;
|
|
12
12
|
clientInformation?: any;
|
|
13
13
|
optionalMetadata?: string;
|
|
14
|
-
promotionInfoIssuers?:
|
|
14
|
+
promotionInfoIssuers?: Record<string, string>;
|
|
15
15
|
extendableInstrumentToken?: string;
|
|
16
|
-
webFormSettings
|
|
17
|
-
constructor(action: ActionType, redirectUri: string, limitIssuers: string[], optionalCommerceId: number, type: AuthorizationType, metaReference: string);
|
|
16
|
+
constructor(action: ActionType, redirectUri: string, limitIssuers: string[], optionalCommerceId: number, type: AuthorizationType, metaReference: string, webFormSettings: WebFormSettings);
|
|
18
17
|
}
|
|
@@ -19,12 +19,13 @@ exports.Authorization = void 0;
|
|
|
19
19
|
var AuthorizationInfo_1 = require("./AuthorizationInfo");
|
|
20
20
|
var Authorization = /** @class */ (function (_super) {
|
|
21
21
|
__extends(Authorization, _super);
|
|
22
|
-
function Authorization(action, redirectUri, limitIssuers, optionalCommerceId, type, metaReference) {
|
|
22
|
+
function Authorization(action, redirectUri, limitIssuers, optionalCommerceId, type, metaReference, webFormSettings) {
|
|
23
23
|
var _this = _super.call(this, type, metaReference) || this;
|
|
24
24
|
_this.action = action;
|
|
25
25
|
_this.redirectUri = redirectUri;
|
|
26
26
|
_this.limitIssuers = limitIssuers;
|
|
27
27
|
_this.optionalCommerceId = optionalCommerceId;
|
|
28
|
+
_this.webFormSettings = webFormSettings || null;
|
|
28
29
|
return _this;
|
|
29
30
|
}
|
|
30
31
|
return Authorization;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BuiltInPagesOptions = void 0;
|
|
4
|
+
var BuiltInPagesOptions = /** @class */ (function () {
|
|
5
|
+
function BuiltInPagesOptions(checkoutSuccessPage, checkoutErrorPage) {
|
|
6
|
+
this.checkoutSuccessPage = checkoutSuccessPage;
|
|
7
|
+
this.checkoutErrorPage = checkoutErrorPage;
|
|
8
|
+
}
|
|
9
|
+
return BuiltInPagesOptions;
|
|
10
|
+
}());
|
|
11
|
+
exports.BuiltInPagesOptions = BuiltInPagesOptions;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DisplayOptions = void 0;
|
|
4
|
+
var DisplayOptions = /** @class */ (function () {
|
|
5
|
+
function DisplayOptions(titles, details, footer, logo, accessibility) {
|
|
6
|
+
this.titles = titles;
|
|
7
|
+
this.details = details;
|
|
8
|
+
this.footer = footer;
|
|
9
|
+
this.logo = logo;
|
|
10
|
+
this.accessibility = accessibility;
|
|
11
|
+
}
|
|
12
|
+
return DisplayOptions;
|
|
13
|
+
}());
|
|
14
|
+
exports.DisplayOptions = DisplayOptions;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BuiltInPagesOptions } from './BuiltInPagesOptions';
|
|
2
|
+
import { DisplayOptions } from './DisplayOptions';
|
|
3
|
+
export declare class ExpressCheckoutSettingsDto {
|
|
4
|
+
displayOptions: DisplayOptions;
|
|
5
|
+
builtInPages: BuiltInPagesOptions;
|
|
6
|
+
constructor(displayOptions: DisplayOptions, builtInPages: BuiltInPagesOptions);
|
|
7
|
+
}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ExpressCheckoutSettingsDto = void 0;
|
|
4
4
|
var ExpressCheckoutSettingsDto = /** @class */ (function () {
|
|
5
|
-
function ExpressCheckoutSettingsDto() {
|
|
5
|
+
function ExpressCheckoutSettingsDto(displayOptions, builtInPages) {
|
|
6
|
+
this.displayOptions = displayOptions;
|
|
7
|
+
this.builtInPages = builtInPages;
|
|
6
8
|
}
|
|
7
9
|
return ExpressCheckoutSettingsDto;
|
|
8
10
|
}());
|