connect-sdk-nodejs 4.1.0 → 4.3.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/lib/index.js +8 -1
- package/lib/index.js.map +1 -1
- package/lib/model/domain/payment/definitions/index.d.ts +8 -22
- package/lib/model/domain/services/index.d.ts +1 -7
- package/lib/model/index.d.ts +2 -1
- package/lib/model/index.js.map +1 -1
- package/lib/model/services/index.d.ts +0 -7
- package/lib/model/types.d.ts +22 -0
- package/lib/services/index.js +1 -3
- package/lib/services/index.js.map +1 -1
- package/lib/utils/headers.js +1 -1
- package/lib/utils/obfuscate.d.ts +17 -1
- package/lib/utils/obfuscate.js +83 -57
- package/lib/utils/obfuscate.js.map +1 -1
- package/package.json +1 -1
- package/schemas/hostedcheckout/CreateHostedCheckoutRequest.json +4 -0
- package/schemas/payment/CompletePaymentRequest.json +4 -0
- package/schemas/payment/CreatePaymentRequest.json +4 -36
- package/lib/services/settlementdetails.d.ts +0 -3
- package/lib/services/settlementdetails.js +0 -17
- package/lib/services/settlementdetails.js.map +0 -1
package/lib/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const sdkcontext = require("./utils/context");
|
|
3
|
+
const obfuscate = require("./utils/obfuscate");
|
|
3
4
|
const hostedcheckouts = require("./hostedcheckouts");
|
|
4
5
|
const hostedmandatemanagements = require("./hostedmandatemanagements");
|
|
5
6
|
const payments = require("./payments");
|
|
@@ -79,7 +80,13 @@ const connectSdk = {
|
|
|
79
80
|
sessions: sessions,
|
|
80
81
|
files: files,
|
|
81
82
|
context: sdkcontext,
|
|
82
|
-
webhooks: webhooks
|
|
83
|
+
webhooks: webhooks,
|
|
84
|
+
obfuscate: {
|
|
85
|
+
all: obfuscate.all,
|
|
86
|
+
allButLast: obfuscate.allButLast,
|
|
87
|
+
allButFirst: obfuscate.allButFirst,
|
|
88
|
+
withFixedLength: obfuscate.withFixedLength
|
|
89
|
+
}
|
|
83
90
|
};
|
|
84
91
|
module.exports = connectSdk;
|
|
85
92
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAMA,8CAA+C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAMA,8CAA+C;AAC/C,+CAAgD;AAEhD,qDAAsD;AACtD,uEAAwE;AACxE,uCAAwC;AACxC,uCAAwC;AACxC,qCAAsC;AACtC,uCAAwC;AACxC,qCAAsC;AACtC,iDAAkD;AAClD,uCAAwC;AACxC,qDAAsD;AACtD,uCAAwC;AACxC,mCAAoC;AACpC,uCAAwC;AACxC,uCAAwC;AACxC,iCAAkC;AAElC,uCAAwC;AAExC,IAAI,OAAuC,CAAC;AAC5C,IAAI,QAAiB,CAAC;AAEtB,MAAM,WAAW,GAAyB;IACxC,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,SAAS;IACnB,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE;QACP,cAAc,EAAE,kBAAkB;KACnC;CACF,CAAC;AAEF,MAAM,eAAe,GAAG,GAAS,EAAE;IACjC,WAAW,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;IACjC,WAAW,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;IACjC,WAAW,CAAC,QAAQ,GAAG,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC;AAC/C,CAAC,CAAC;AAEF,MAAM,UAAU,GAAe;IAC7B,IAAI,CAAC,OAAgB;QACnB,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;QACzB,QAAQ,GAAG,OAAO,CAAC;QACnB,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,WAAW,EAAE;YACzC,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC;SAC3B;Q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,EAAE,UAAU;IAEnB,QAAQ,EAAE,QAAQ;IAElB,SAAS,EAAE;QACT,GAAG,EAAE,SAAS,CAAC,GAAG;QAClB,UAAU,EAAE,SAAS,CAAC,UAAU;QAChC,WAAW,EAAE,SAAS,CAAC,WAAW;QAClC,eAAe,EAAE,SAAS,CAAC,eAAe;KAC3C;CACF,CAAC;AACF,iBAAS,UAAU,CAAC"}
|
|
@@ -164,9 +164,6 @@ export interface CashPaymentMethodSpecificInput extends AbstractCashPaymentMetho
|
|
|
164
164
|
*/
|
|
165
165
|
paymentProduct1503SpecificInput?: CashPaymentProduct1503SpecificInput | null;
|
|
166
166
|
paymentProduct1504SpecificInput?: CashPaymentProduct1504SpecificInput | null;
|
|
167
|
-
paymentProduct1506SpecificInput?: CashPaymentProduct1506SpecificInput | null;
|
|
168
|
-
paymentProduct1508SpecificInput?: CashPaymentProduct1508SpecificInput | null;
|
|
169
|
-
paymentProduct1511SpecificInput?: CashPaymentProduct1511SpecificInput | null;
|
|
170
167
|
paymentProduct1521SpecificInput?: CashPaymentProduct1521SpecificInput | null;
|
|
171
168
|
paymentProduct1522SpecificInput?: CashPaymentProduct1522SpecificInput | null;
|
|
172
169
|
paymentProduct1523SpecificInput?: CashPaymentProduct1523SpecificInput | null;
|
|
@@ -187,31 +184,19 @@ export interface CashPaymentProduct1503SpecificInput {
|
|
|
187
184
|
*/
|
|
188
185
|
returnUrl?: string | null;
|
|
189
186
|
}
|
|
190
|
-
export interface CashPaymentProduct1504SpecificInput {
|
|
191
|
-
returnUrl?: string | null;
|
|
192
|
-
}
|
|
193
|
-
export interface CashPaymentProduct1506SpecificInput {
|
|
194
|
-
returnUrl?: string | null;
|
|
195
|
-
}
|
|
196
|
-
export interface CashPaymentProduct1508SpecificInput {
|
|
197
|
-
returnUrl?: string | null;
|
|
187
|
+
export interface CashPaymentProduct1504SpecificInput extends CashPaymentProductWithRedirectSpecificInputBase {
|
|
198
188
|
}
|
|
199
|
-
export interface
|
|
200
|
-
returnUrl?: string | null;
|
|
189
|
+
export interface CashPaymentProduct1521SpecificInput extends CashPaymentProductWithRedirectSpecificInputBase {
|
|
201
190
|
}
|
|
202
|
-
export interface
|
|
203
|
-
returnUrl?: string | null;
|
|
191
|
+
export interface CashPaymentProduct1522SpecificInput extends CashPaymentProductWithRedirectSpecificInputBase {
|
|
204
192
|
}
|
|
205
|
-
export interface
|
|
206
|
-
returnUrl?: string | null;
|
|
193
|
+
export interface CashPaymentProduct1523SpecificInput extends CashPaymentProductWithRedirectSpecificInputBase {
|
|
207
194
|
}
|
|
208
|
-
export interface
|
|
209
|
-
returnUrl?: string | null;
|
|
195
|
+
export interface CashPaymentProduct1524SpecificInput extends CashPaymentProductWithRedirectSpecificInputBase {
|
|
210
196
|
}
|
|
211
|
-
export interface
|
|
212
|
-
returnUrl?: string | null;
|
|
197
|
+
export interface CashPaymentProduct1526SpecificInput extends CashPaymentProductWithRedirectSpecificInputBase {
|
|
213
198
|
}
|
|
214
|
-
export interface
|
|
199
|
+
export interface CashPaymentProductWithRedirectSpecificInputBase {
|
|
215
200
|
returnUrl?: string | null;
|
|
216
201
|
}
|
|
217
202
|
export interface CompletePaymentCardPaymentMethodSpecificInput {
|
|
@@ -356,6 +341,7 @@ export interface HostedCheckoutSpecificOutput {
|
|
|
356
341
|
export interface Installments {
|
|
357
342
|
amountOfMoneyPerInstallment?: AmountOfMoney | null;
|
|
358
343
|
frequencyOfInstallments?: string | null;
|
|
344
|
+
installmentPlanCode?: number | null;
|
|
359
345
|
interestRate?: string | null;
|
|
360
346
|
numberOfInstallments?: number | null;
|
|
361
347
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BankAccountBban, BankAccountIban } from "../definitions";
|
|
2
2
|
import { BankData, BankDetails, IINDetail, PaymentContext, Swift } from "./definitions";
|
|
3
3
|
export interface BankDetailsRequest extends BankDetails {
|
|
4
4
|
}
|
|
@@ -24,12 +24,6 @@ export interface GetIINDetailsResponse {
|
|
|
24
24
|
export interface GetPrivacyPolicyResponse {
|
|
25
25
|
htmlContent?: string | null;
|
|
26
26
|
}
|
|
27
|
-
export interface SettlementDetails {
|
|
28
|
-
acquirerReferenceNumber?: string | null;
|
|
29
|
-
amountOfMoney?: AmountOfMoney | null;
|
|
30
|
-
paymentId?: string | null;
|
|
31
|
-
retrievalReferenceNumber?: string | null;
|
|
32
|
-
}
|
|
33
27
|
export interface TestConnection {
|
|
34
28
|
result?: string | null;
|
|
35
29
|
}
|
package/lib/model/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context, SdkContext } from "./types";
|
|
1
|
+
import { Context, ObfuscationRules, SdkContext } from "./types";
|
|
2
2
|
import { HostedcheckoutsClient } from "./hostedcheckouts";
|
|
3
3
|
import { HostedmandatemanagementsClient } from "./hostedmandatemanagements";
|
|
4
4
|
import { PaymentsClient } from "./payments";
|
|
@@ -34,5 +34,6 @@ export interface ConnectSdk {
|
|
|
34
34
|
readonly files: FilesClient;
|
|
35
35
|
readonly context: SdkContext;
|
|
36
36
|
readonly webhooks: WebhooksHelper;
|
|
37
|
+
readonly obfuscate: ObfuscationRules;
|
|
37
38
|
}
|
|
38
39
|
export * from "./types";
|
package/lib/model/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgDA,0CAAwB"}
|
|
@@ -36,13 +36,6 @@ export interface ServicesClient {
|
|
|
36
36
|
* If the call was not successful, the response body type will be {@link ErrorResponse}.
|
|
37
37
|
*/
|
|
38
38
|
testconnection(merchantId: string, paymentContext: PaymentContext | null, cb: SdkCallback): void;
|
|
39
|
-
/**
|
|
40
|
-
* Resource /{merchantId}/services/settlementdetails/{paymentId} - <a href="https://epayments-api.developer-ingenico.com/s2sapi/v1/en_US/nodejs/services/settlementdetails.html">Get Settlement details</a>
|
|
41
|
-
* @param cb The callback for the response.
|
|
42
|
-
* If the call was successfull, the response body type will be {@link SettlementDetails}.
|
|
43
|
-
* If the call was not successful, the response body type will be {@link ErrorResponse}.
|
|
44
|
-
*/
|
|
45
|
-
settlementdetails(merchantId: string, paymentId: string, paymentContext: PaymentContext | null, cb: SdkCallback): void;
|
|
46
39
|
}
|
|
47
40
|
export interface ConvertAmountParams extends PaymentContext {
|
|
48
41
|
source?: string;
|
package/lib/model/types.d.ts
CHANGED
|
@@ -18,6 +18,9 @@ export interface Context {
|
|
|
18
18
|
integrator: string;
|
|
19
19
|
shoppingCartExtension?: ShoppingCartExtension;
|
|
20
20
|
httpOptions?: https.RequestOptions;
|
|
21
|
+
obfuscationRules?: {
|
|
22
|
+
[key: string]: ObfuscationRule;
|
|
23
|
+
};
|
|
21
24
|
}
|
|
22
25
|
export interface FileMetaData {
|
|
23
26
|
contentType: string | null;
|
|
@@ -42,6 +45,25 @@ export interface MultipartFormDataObject {
|
|
|
42
45
|
export interface MultipartFormDataRequest extends SdkRequest {
|
|
43
46
|
body: MultipartFormDataObject;
|
|
44
47
|
}
|
|
48
|
+
export interface ObfuscationRules {
|
|
49
|
+
/**
|
|
50
|
+
* @returns An obfuscation rule that will replace all characters with *.
|
|
51
|
+
*/
|
|
52
|
+
all(): ObfuscationRule;
|
|
53
|
+
/**
|
|
54
|
+
* @returns An obfuscation rule that will keep a fixed number of characters at the end, then replaces all other characters with *.
|
|
55
|
+
*/
|
|
56
|
+
allButLast(count: number): ObfuscationRule;
|
|
57
|
+
/**
|
|
58
|
+
* @returns An obfuscation rule that will keep a fixed number of characters at the start, then replaces all other characters with *.
|
|
59
|
+
*/
|
|
60
|
+
allButFirst(count: number): ObfuscationRule;
|
|
61
|
+
/**
|
|
62
|
+
* @returns An obfuscation rule that will replace values with a fixed length string containing only *.
|
|
63
|
+
*/
|
|
64
|
+
withFixedLength(count: number): ObfuscationRule;
|
|
65
|
+
}
|
|
66
|
+
export declare type ObfuscationRule = (value: string) => string;
|
|
45
67
|
export interface PaymentContext {
|
|
46
68
|
extraHeaders?: Header[];
|
|
47
69
|
idemPotence?: IdemPotence;
|
package/lib/services/index.js
CHANGED
|
@@ -8,14 +8,12 @@ const bankaccount = require("./bankaccount");
|
|
|
8
8
|
const getIINdetails = require("./getIINdetails");
|
|
9
9
|
const privacypolicy = require("./privacypolicy");
|
|
10
10
|
const testconnection = require("./testconnection");
|
|
11
|
-
const settlementdetails = require("./settlementdetails");
|
|
12
11
|
const servicesClient = {
|
|
13
12
|
convertAmount: convertAmount,
|
|
14
13
|
bankaccount: bankaccount,
|
|
15
14
|
getIINdetails: getIINdetails,
|
|
16
15
|
privacypolicy: privacypolicy,
|
|
17
|
-
testconnection: testconnection
|
|
18
|
-
settlementdetails: settlementdetails
|
|
16
|
+
testconnection: testconnection
|
|
19
17
|
};
|
|
20
18
|
module.exports = servicesClient;
|
|
21
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,iDAAkD;AAClD,6CAA8C;AAC9C,iDAAkD;AAClD,iDAAkD;AAClD,mDAAoD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,iDAAkD;AAClD,6CAA8C;AAC9C,iDAAkD;AAClD,iDAAkD;AAClD,mDAAoD;AAGpD,MAAM,cAAc,GAAmB;IACrC,aAAa,EAAE,aAAa;IAC5B,WAAW,EAAE,WAAW;IACxB,aAAa,EAAE,aAAa;IAC5B,aAAa,EAAE,aAAa;IAC5B,cAAc,EAAE,cAAc;CAC/B,CAAC;AACF,iBAAS,cAAc,CAAC"}
|
package/lib/utils/headers.js
CHANGED
|
@@ -9,7 +9,7 @@ exports.date = date;
|
|
|
9
9
|
function serverMetaInfo(sdkContext) {
|
|
10
10
|
const info = {
|
|
11
11
|
sdkCreator: "Ingenico",
|
|
12
|
-
sdkIdentifier: "NodejsServerSDK/v4.
|
|
12
|
+
sdkIdentifier: "NodejsServerSDK/v4.3.0",
|
|
13
13
|
platformIdentifier: process.env["OS"] + " Node.js/" + process.versions.node
|
|
14
14
|
};
|
|
15
15
|
if (sdkContext.getIntegrator() !== null) {
|
package/lib/utils/obfuscate.d.ts
CHANGED
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
import { SdkContext } from "../model";
|
|
1
|
+
import { ObfuscationRule, SdkContext } from "../model";
|
|
2
|
+
/**
|
|
3
|
+
* @returns An obfuscation rule that will keep a fixed number of characters at the end, then replaces all other characters with *.
|
|
4
|
+
*/
|
|
5
|
+
export declare function allButLast(count: number): ObfuscationRule;
|
|
6
|
+
/**
|
|
7
|
+
* @returns An obfuscation rule that will replace all characters with *.
|
|
8
|
+
*/
|
|
9
|
+
export declare function all(): ObfuscationRule;
|
|
10
|
+
/**
|
|
11
|
+
* @returns An obfuscation rule that will keep a fixed number of characters at the start, then replaces all other characters with *.
|
|
12
|
+
*/
|
|
13
|
+
export declare function allButFirst(count: number): ObfuscationRule;
|
|
14
|
+
/**
|
|
15
|
+
* @returns An obfuscation rule that will replace values with a fixed length string containing only *.
|
|
16
|
+
*/
|
|
17
|
+
export declare function withFixedLength(count: number): ObfuscationRule;
|
|
2
18
|
export declare function getObfuscated(input: any, context?: SdkContext | null, caseInsensitive?: boolean): string;
|
package/lib/utils/obfuscate.js
CHANGED
|
@@ -1,50 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getObfuscated = void 0;
|
|
3
|
+
exports.getObfuscated = exports.withFixedLength = exports.allButFirst = exports.all = exports.allButLast = void 0;
|
|
4
4
|
const traverse = require("traverse");
|
|
5
5
|
const _ = require("lodash");
|
|
6
6
|
const sdkContext = require("./context");
|
|
7
7
|
const REPLACECHAR = "*";
|
|
8
8
|
const INDENT = 2;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const ALL = value => {
|
|
10
|
+
const l = value.length;
|
|
11
|
+
return _.padStart("", l, REPLACECHAR);
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @returns An obfuscation rule that will keep a fixed number of characters at the end, then replaces all other characters with *.
|
|
15
|
+
*/
|
|
16
|
+
function allButLast(count) {
|
|
17
|
+
const rule = value => {
|
|
18
|
+
const l = value.length;
|
|
19
|
+
const end = value.substring(l - count);
|
|
20
|
+
return _.padStart(end, l, REPLACECHAR);
|
|
21
|
+
};
|
|
22
|
+
return rule;
|
|
11
23
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
this.update(_.padStart(end, l, REPLACECHAR));
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
return json;
|
|
24
|
+
exports.allButLast = allButLast;
|
|
25
|
+
/**
|
|
26
|
+
* @returns An obfuscation rule that will replace all characters with *.
|
|
27
|
+
*/
|
|
28
|
+
function all() {
|
|
29
|
+
return ALL;
|
|
22
30
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
exports.all = all;
|
|
32
|
+
/**
|
|
33
|
+
* @returns An obfuscation rule that will keep a fixed number of characters at the start, then replaces all other characters with *.
|
|
34
|
+
*/
|
|
35
|
+
function allButFirst(count) {
|
|
36
|
+
const rule = value => {
|
|
37
|
+
const l = value.length;
|
|
38
|
+
const start = value.substring(0, count);
|
|
39
|
+
return _.padEnd(start, l, REPLACECHAR);
|
|
40
|
+
};
|
|
41
|
+
return rule;
|
|
32
42
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
return
|
|
43
|
+
exports.allButFirst = allButFirst;
|
|
44
|
+
/**
|
|
45
|
+
* @returns An obfuscation rule that will replace values with a fixed length string containing only *.
|
|
46
|
+
*/
|
|
47
|
+
function withFixedLength(count) {
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
49
|
+
const rule = _value => {
|
|
50
|
+
return _.padEnd("", count, REPLACECHAR);
|
|
51
|
+
};
|
|
52
|
+
return rule;
|
|
43
53
|
}
|
|
44
|
-
|
|
54
|
+
exports.withFixedLength = withFixedLength;
|
|
55
|
+
function obfuscationRuleKey(name, toLowerCase) {
|
|
56
|
+
return toLowerCase ? name.toLowerCase() : name;
|
|
57
|
+
}
|
|
58
|
+
function applyObfuscationRules(json, obfuscationRules, toLowerCase) {
|
|
45
59
|
traverse(json).forEach(function (node) {
|
|
46
|
-
if (this.key &&
|
|
47
|
-
this.
|
|
60
|
+
if (this.key && typeof node !== "object") {
|
|
61
|
+
const obfuscationRule = obfuscationRules[obfuscationRuleKey(this.key, toLowerCase)];
|
|
62
|
+
if (obfuscationRule) {
|
|
63
|
+
const value = "" + node; // make sure it's a string
|
|
64
|
+
this.update(obfuscationRule(value));
|
|
65
|
+
}
|
|
48
66
|
}
|
|
49
67
|
});
|
|
50
68
|
return json;
|
|
@@ -69,33 +87,41 @@ function getObfuscated(input, context, caseInsensitive = false) {
|
|
|
69
87
|
return input;
|
|
70
88
|
}
|
|
71
89
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
90
|
+
const obfuscationRules = {};
|
|
91
|
+
obfuscationRules[obfuscationRuleKey("cardNumber", caseInsensitive)] = allButLast(4);
|
|
92
|
+
obfuscationRules[obfuscationRuleKey("expiryDate", caseInsensitive)] = allButLast(2);
|
|
93
|
+
obfuscationRules[obfuscationRuleKey("cvv", caseInsensitive)] = all();
|
|
94
|
+
obfuscationRules[obfuscationRuleKey("iban", caseInsensitive)] = allButLast(4);
|
|
95
|
+
obfuscationRules[obfuscationRuleKey("accountNumber", caseInsensitive)] = allButLast(4);
|
|
96
|
+
obfuscationRules[obfuscationRuleKey("reformattedAccountNumber", caseInsensitive)] = allButLast(4);
|
|
97
|
+
obfuscationRules[obfuscationRuleKey("bin", caseInsensitive)] = allButFirst(6);
|
|
80
98
|
// key-value pairs can contain any value, like credit card numbers or other private data; mask all values
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
99
|
+
obfuscationRules[obfuscationRuleKey("value", caseInsensitive)] = all();
|
|
100
|
+
obfuscationRules[obfuscationRuleKey("keyId", caseInsensitive)] = withFixedLength(8);
|
|
101
|
+
obfuscationRules[obfuscationRuleKey("secretKey", caseInsensitive)] = withFixedLength(8);
|
|
102
|
+
obfuscationRules[obfuscationRuleKey("publicKey", caseInsensitive)] = withFixedLength(8);
|
|
103
|
+
obfuscationRules[obfuscationRuleKey("userAuthenticationToken", caseInsensitive)] = withFixedLength(8);
|
|
86
104
|
// encrypted payload is a base64 string that contains an encrypted value; to make decrypting even harder, just mask the entire thing
|
|
87
|
-
|
|
105
|
+
obfuscationRules[obfuscationRuleKey("encryptedPayload", caseInsensitive)] = withFixedLength(8);
|
|
88
106
|
// decrypted payload is a simple base64 string that may contain credit card numbers or other private data; just mask the entire thing
|
|
89
|
-
|
|
107
|
+
obfuscationRules[obfuscationRuleKey("decryptedPayload", caseInsensitive)] = withFixedLength(8);
|
|
90
108
|
// encrypted customer input is similar to encrypted payload
|
|
91
|
-
|
|
109
|
+
obfuscationRules[obfuscationRuleKey("encryptedCustomerInput", caseInsensitive)] = withFixedLength(8);
|
|
92
110
|
// headers
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
111
|
+
obfuscationRules[obfuscationRuleKey("Authorization", caseInsensitive)] = withFixedLength(8);
|
|
112
|
+
obfuscationRules[obfuscationRuleKey("WWW-Authenticate", caseInsensitive)] = withFixedLength(8);
|
|
113
|
+
obfuscationRules[obfuscationRuleKey("Proxy-Authenticate", caseInsensitive)] = withFixedLength(8);
|
|
114
|
+
obfuscationRules[obfuscationRuleKey("Proxy-Authorization", caseInsensitive)] = withFixedLength(8);
|
|
115
|
+
obfuscationRules[obfuscationRuleKey("X-GCS-Authentication-Token", caseInsensitive)] = withFixedLength(8);
|
|
116
|
+
obfuscationRules[obfuscationRuleKey("X-GCS-CallerPassword", caseInsensitive)] = withFixedLength(8);
|
|
117
|
+
const customObfuscationRules = context.getContext().obfuscationRules;
|
|
118
|
+
if (customObfuscationRules) {
|
|
119
|
+
for (const key in customObfuscationRules) {
|
|
120
|
+
obfuscationRules[obfuscationRuleKey(key, caseInsensitive)] = customObfuscationRules[key];
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
let obfuscated = JSON.parse(JSON.stringify(input));
|
|
124
|
+
obfuscated = applyObfuscationRules(obfuscated, obfuscationRules, caseInsensitive);
|
|
99
125
|
return JSON.stringify(obfuscated, null, INDENT);
|
|
100
126
|
}
|
|
101
127
|
exports.getObfuscated = getObfuscated;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obfuscate.js","sourceRoot":"","sources":["../../src/utils/obfuscate.ts"],"names":[],"mappings":";;;AAAA,qCAAsC;AACtC,4BAA6B;AAE7B,wCAAyC;AAEzC,MAAM,WAAW,GAAG,GAAG,CAAC;AACxB,MAAM,MAAM,GAAG,CAAC,CAAC;AAEjB,
|
|
1
|
+
{"version":3,"file":"obfuscate.js","sourceRoot":"","sources":["../../src/utils/obfuscate.ts"],"names":[],"mappings":";;;AAAA,qCAAsC;AACtC,4BAA6B;AAE7B,wCAAyC;AAEzC,MAAM,WAAW,GAAG,GAAG,CAAC;AACxB,MAAM,MAAM,GAAG,CAAC,CAAC;AAEjB,MAAM,GAAG,GAAoB,KAAK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,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IACnD,UAAU,GAAG,qBAAqB,CAAC,UAAU,EAAE,gBAAgB,EAAE,eAAe,CAAC,CAAC;IAElF,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAClD,CAAC;AA1DD,sCA0DC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "connect-sdk-nodejs",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "SDK to communicate with the Ingenico ePayments platform using the Ingenico Connect Server API",
|
|
5
5
|
"homepage": "https://github.com/Ingenico-ePayments/connect-sdk-nodejs#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -541,15 +541,6 @@
|
|
|
541
541
|
"paymentProduct1504SpecificInput" : {
|
|
542
542
|
"$ref" : "#/definitions/CashPaymentProduct1504SpecificInput"
|
|
543
543
|
},
|
|
544
|
-
"paymentProduct1506SpecificInput" : {
|
|
545
|
-
"$ref" : "#/definitions/CashPaymentProduct1506SpecificInput"
|
|
546
|
-
},
|
|
547
|
-
"paymentProduct1508SpecificInput" : {
|
|
548
|
-
"$ref" : "#/definitions/CashPaymentProduct1508SpecificInput"
|
|
549
|
-
},
|
|
550
|
-
"paymentProduct1511SpecificInput" : {
|
|
551
|
-
"$ref" : "#/definitions/CashPaymentProduct1511SpecificInput"
|
|
552
|
-
},
|
|
553
544
|
"paymentProduct1521SpecificInput" : {
|
|
554
545
|
"$ref" : "#/definitions/CashPaymentProduct1521SpecificInput"
|
|
555
546
|
},
|
|
@@ -590,33 +581,6 @@
|
|
|
590
581
|
},
|
|
591
582
|
"additionalProperties" : false
|
|
592
583
|
},
|
|
593
|
-
"CashPaymentProduct1506SpecificInput" : {
|
|
594
|
-
"type" : "object",
|
|
595
|
-
"properties" : {
|
|
596
|
-
"returnUrl" : {
|
|
597
|
-
"type" : "string"
|
|
598
|
-
}
|
|
599
|
-
},
|
|
600
|
-
"additionalProperties" : false
|
|
601
|
-
},
|
|
602
|
-
"CashPaymentProduct1508SpecificInput" : {
|
|
603
|
-
"type" : "object",
|
|
604
|
-
"properties" : {
|
|
605
|
-
"returnUrl" : {
|
|
606
|
-
"type" : "string"
|
|
607
|
-
}
|
|
608
|
-
},
|
|
609
|
-
"additionalProperties" : false
|
|
610
|
-
},
|
|
611
|
-
"CashPaymentProduct1511SpecificInput" : {
|
|
612
|
-
"type" : "object",
|
|
613
|
-
"properties" : {
|
|
614
|
-
"returnUrl" : {
|
|
615
|
-
"type" : "string"
|
|
616
|
-
}
|
|
617
|
-
},
|
|
618
|
-
"additionalProperties" : false
|
|
619
|
-
},
|
|
620
584
|
"CashPaymentProduct1521SpecificInput" : {
|
|
621
585
|
"type" : "object",
|
|
622
586
|
"properties" : {
|
|
@@ -1126,6 +1090,10 @@
|
|
|
1126
1090
|
"frequencyOfInstallments" : {
|
|
1127
1091
|
"type" : "string"
|
|
1128
1092
|
},
|
|
1093
|
+
"installmentPlanCode" : {
|
|
1094
|
+
"type" : "integer",
|
|
1095
|
+
"maximum" : 2147483647
|
|
1096
|
+
},
|
|
1129
1097
|
"interestRate" : {
|
|
1130
1098
|
"type" : "string"
|
|
1131
1099
|
},
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* This file was auto-generated from the API references found at
|
|
4
|
-
* https://epayments-api.developer-ingenico.com/s2sapi/v1/
|
|
5
|
-
*/
|
|
6
|
-
const communicator = require("../utils/communicator");
|
|
7
|
-
const getSettlementDetails = function (merchantId, paymentId, paymentContext, cb) {
|
|
8
|
-
communicator.json({
|
|
9
|
-
method: "GET",
|
|
10
|
-
modulePath: "/v1/" + merchantId + "/services/settlementdetails/" + paymentId,
|
|
11
|
-
body: null,
|
|
12
|
-
paymentContext: paymentContext,
|
|
13
|
-
cb: cb
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
module.exports = getSettlementDetails;
|
|
17
|
-
//# sourceMappingURL=settlementdetails.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"settlementdetails.js","sourceRoot":"","sources":["../../src/services/settlementdetails.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,sDAAuD;AAGvD,MAAM,oBAAoB,GAAG,UAAS,UAAkB,EAAE,SAAiB,EAAE,cAAqC,EAAE,EAAe;IACjI,YAAY,CAAC,IAAI,CAAC;QAChB,MAAM,EAAE,KAAK;QACb,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,8BAA8B,GAAG,SAAS;QAC5E,IAAI,EAAE,IAAI;QACV,cAAc,EAAE,cAAc;QAC9B,EAAE,EAAE,EAAE;KACP,CAAC,CAAC;AACL,CAAC,CAAC;AACF,iBAAS,oBAAoB,CAAC"}
|