@kushki/js 1.40.1-alpha.14317.3 → 1.40.2-alpha
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/README.md +1 -0
- package/lib/Kushki.d.ts +119 -23
- package/lib/Kushki.js +119 -20
- package/lib/KushkiInfo.js +3 -2
- package/lib/constant/Identifiers.d.ts +1 -3
- package/lib/constant/Identifiers.js +1 -3
- package/lib/gateway/KushkiGateway.d.ts +9 -14
- package/lib/gateway/KushkiGateway.js +19 -39
- package/lib/gateway/SiftScience.d.ts +1 -0
- package/lib/gateway/SiftScience.js +5 -0
- package/lib/infrastructure/CardBrandsEnum.d.ts +2 -1
- package/lib/infrastructure/CardBrandsEnum.js +1 -0
- package/lib/infrastructure/CardinalValidated.d.ts +10 -0
- package/lib/infrastructure/CardinalValidated.js +8 -0
- package/lib/infrastructure/Container.js +3 -7
- package/lib/infrastructure/EnvironmentEnum.d.ts +1 -1
- package/lib/infrastructure/EnvironmentEnum.js +1 -1
- package/lib/infrastructure/ErrorEnum.d.ts +4 -1
- package/lib/infrastructure/ErrorEnum.js +19 -1
- package/lib/infrastructure/PathEnum.d.ts +4 -6
- package/lib/infrastructure/PathEnum.js +3 -5
- package/lib/repository/IApplePayService.d.ts +40 -0
- package/lib/repository/ICardService.d.ts +3 -5
- package/lib/repository/IKushkiGateway.d.ts +23 -36
- package/lib/service/ApplePayService.d.ts +36 -0
- package/lib/service/ApplePayService.js +189 -0
- package/lib/service/CardService.d.ts +8 -9
- package/lib/service/CardService.js +103 -112
- package/lib/types/apple_pay_get_token_events.d.ts +46 -0
- package/lib/types/apple_pay_get_token_options.d.ts +12 -0
- package/lib/types/apple_pay_options.d.ts +25 -0
- package/lib/types/apple_pay_start_session_request.d.ts +8 -0
- package/lib/types/kushki_subscription_tokens_request.d.ts +0 -10
- package/lib/types/subscription_token_request.d.ts +0 -10
- package/package.json +5 -6
- package/lib/infrastructure/KPayUserPoolEnum.d.ts +0 -5
- package/lib/infrastructure/KPayUserPoolEnum.js +0 -8
- package/lib/infrastructure/KpayPaymentKind.d.ts +0 -6
- package/lib/infrastructure/KpayPaymentKind.js +0 -9
- package/lib/repository/IAuthService.d.ts +0 -20
- package/lib/repository/IKPayService.d.ts +0 -26
- package/lib/repository/IKPayService.js +0 -2
- package/lib/repository/IMobileProcessorService.d.ts +0 -16
- package/lib/repository/IMobileProcessorService.js +0 -2
- package/lib/service/AuthService.d.ts +0 -31
- package/lib/service/AuthService.js +0 -161
- package/lib/service/KPayService.d.ts +0 -19
- package/lib/service/KPayService.js +0 -45
- package/lib/service/MobileProcessorService.d.ts +0 -35
- package/lib/service/MobileProcessorService.js +0 -126
- package/lib/types/delete_payment_method_request.d.ts +0 -6
- package/lib/types/delete_payment_method_response.d.ts +0 -7
- package/lib/types/init_auth_request.d.ts +0 -6
- package/lib/types/init_auth_response.d.ts +0 -6
- package/lib/types/mobile_processor_charge_request.d.ts +0 -13
- package/lib/types/mobile_processor_charge_response.d.ts +0 -7
- package/lib/types/mobile_processor_token.d.ts +0 -66
- package/lib/types/mobile_processor_token_request.d.ts +0 -11
- package/lib/types/mobile_processor_token_response.d.ts +0 -15
- package/lib/types/payment_data_response.d.ts +0 -37
- package/lib/types/saved_payment_data_request.d.ts +0 -10
- package/lib/types/subscription_token_kpay_request.d.ts +0 -13
- package/lib/types/token_kpay_request.d.ts +0 -12
- package/lib/types/validate_session_response.d.ts +0 -6
- package/lib/types/verify_auth_request.d.ts +0 -7
- package/lib/types/verify_auth_response.d.ts +0 -7
- /package/lib/repository/{IAuthService.js → IApplePayService.js} +0 -0
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* MobileProcessor Service file
|
|
4
|
-
*/
|
|
5
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
6
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
-
};
|
|
11
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
12
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
13
|
-
};
|
|
14
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
15
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
16
|
-
};
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.MobileProcessorService = void 0;
|
|
19
|
-
const Identifiers_1 = require("./../../lib/constant/Identifiers");
|
|
20
|
-
const KushkiError_1 = require("./../../lib/generic/KushkiError");
|
|
21
|
-
const ErrorEnum_1 = require("./../../lib/infrastructure/ErrorEnum");
|
|
22
|
-
const inversify_1 = require("inversify");
|
|
23
|
-
const rxjs_1 = require("rxjs");
|
|
24
|
-
const operators_1 = require("rxjs/operators");
|
|
25
|
-
let MobileProcessorService = class MobileProcessorService {
|
|
26
|
-
constructor(gateway) {
|
|
27
|
-
this._gateway = gateway;
|
|
28
|
-
}
|
|
29
|
-
// istanbul ignore next
|
|
30
|
-
requestToken(request, publicCredential, isTest, regional) {
|
|
31
|
-
let token;
|
|
32
|
-
const apple_request = this.createAppleRequest(request);
|
|
33
|
-
return rxjs_1.of(1).pipe(operators_1.mergeMap(() => new rxjs_1.Observable((observer) => {
|
|
34
|
-
// tslint:disable-next-line:no-any
|
|
35
|
-
const apple_session = new window.ApplePaySession(2, apple_request);
|
|
36
|
-
apple_session.onvalidatemerchant = (event) => this.onvalidatemerchant(event, observer, apple_session);
|
|
37
|
-
apple_session.begin();
|
|
38
|
-
})), operators_1.mergeMap((session) => this.requestGatewayToken(request, session, publicCredential, isTest, regional)), operators_1.mergeMap(([session, response]) => {
|
|
39
|
-
token = response.token;
|
|
40
|
-
delete response.token;
|
|
41
|
-
session.session.completeMerchantValidation(response);
|
|
42
|
-
return rxjs_1.of(session);
|
|
43
|
-
}), operators_1.mergeMap((session) => new rxjs_1.Observable((observer) => {
|
|
44
|
-
session.session.onpaymentauthorized = (event) => {
|
|
45
|
-
observer.next({
|
|
46
|
-
payment_token: event.payment,
|
|
47
|
-
session: session.session,
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
})), operators_1.mergeMap((session) => {
|
|
51
|
-
session.session.completePayment(
|
|
52
|
-
// tslint:disable-next-line:no-any
|
|
53
|
-
window.ApplePaySession.STATUS_SUCCESS);
|
|
54
|
-
return rxjs_1.of({
|
|
55
|
-
token,
|
|
56
|
-
paymentToken: session.payment_token,
|
|
57
|
-
});
|
|
58
|
-
}), operators_1.catchError((error) => {
|
|
59
|
-
if (error.message ===
|
|
60
|
-
"The object does not support the operation or argument.")
|
|
61
|
-
return rxjs_1.throwError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E006));
|
|
62
|
-
return rxjs_1.throwError(error);
|
|
63
|
-
}));
|
|
64
|
-
}
|
|
65
|
-
requestGatewayToken(request, session, publicCredential, isTest, regional) {
|
|
66
|
-
request.validationUrl = session.validation_url;
|
|
67
|
-
request.domainName = session.current_url;
|
|
68
|
-
delete request.description;
|
|
69
|
-
return rxjs_1.forkJoin([
|
|
70
|
-
rxjs_1.of(session),
|
|
71
|
-
this._gateway.requestMobileProcessorToken(request, publicCredential, isTest, regional),
|
|
72
|
-
]).pipe(operators_1.catchError((err) => {
|
|
73
|
-
session.session.abort();
|
|
74
|
-
return rxjs_1.throwError(err);
|
|
75
|
-
}));
|
|
76
|
-
}
|
|
77
|
-
requestGatewayCharge(token, publicCredential, isTest, regional, request, session) {
|
|
78
|
-
const charge_request = {
|
|
79
|
-
token,
|
|
80
|
-
amount: request.totalAmount,
|
|
81
|
-
currency: request.currency,
|
|
82
|
-
encodedPaymentToken: session.payment_token,
|
|
83
|
-
softDescriptor: "KushkiPagos",
|
|
84
|
-
};
|
|
85
|
-
return rxjs_1.forkJoin([
|
|
86
|
-
rxjs_1.of(session),
|
|
87
|
-
this._gateway.chargeMobileProcessor(charge_request, publicCredential, isTest, regional),
|
|
88
|
-
]);
|
|
89
|
-
}
|
|
90
|
-
createAppleRequest(request) {
|
|
91
|
-
return {
|
|
92
|
-
countryCode: "US",
|
|
93
|
-
currencyCode: "USD",
|
|
94
|
-
merchantCapabilities: ["supports3DS"],
|
|
95
|
-
requiredBillingContactFields: ["postalAddress", "name"],
|
|
96
|
-
requiredShippingContactFields: ["postalAddress", "email", "phone"],
|
|
97
|
-
supportedNetworks: ["amex", "discover", "jcb", "masterCard", "visa"],
|
|
98
|
-
total: {
|
|
99
|
-
amount: request.totalAmount,
|
|
100
|
-
label: request.description,
|
|
101
|
-
type: "final",
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
completePayment(session, response) {
|
|
106
|
-
session.session.completePayment(
|
|
107
|
-
// tslint:disable-next-line:no-any
|
|
108
|
-
window.ApplePaySession.STATUS_SUCCESS);
|
|
109
|
-
return rxjs_1.of(response);
|
|
110
|
-
}
|
|
111
|
-
onvalidatemerchant(event, observer, session) {
|
|
112
|
-
const validation_url = event.validationURL;
|
|
113
|
-
const current_url = window.location.host;
|
|
114
|
-
observer.next({ current_url, validation_url, session });
|
|
115
|
-
}
|
|
116
|
-
paymentAuthorized(event, observer, session) {
|
|
117
|
-
const payment_token = event.payment;
|
|
118
|
-
observer.next({ payment_token, session: session.session });
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
MobileProcessorService = __decorate([
|
|
122
|
-
inversify_1.injectable(),
|
|
123
|
-
__param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
|
|
124
|
-
__metadata("design:paramtypes", [Object])
|
|
125
|
-
], MobileProcessorService);
|
|
126
|
-
exports.MobileProcessorService = MobileProcessorService;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/* tslint:disable:all */
|
|
2
|
-
/* tslint:disable:all */
|
|
3
|
-
|
|
4
|
-
export interface MobileProcessorChargeRequest {
|
|
5
|
-
token: string;
|
|
6
|
-
softDescriptor: string;
|
|
7
|
-
amount: number;
|
|
8
|
-
currency: "USD" | "COP" | "PEN" | "CLP" | "UF" | "MXN" | "BRL";
|
|
9
|
-
encodedPaymentToken: {
|
|
10
|
-
[k: string]: any;
|
|
11
|
-
};
|
|
12
|
-
[k: string]: any;
|
|
13
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/* tslint:disable:all */
|
|
2
|
-
/* tslint:disable:all */
|
|
3
|
-
|
|
4
|
-
export interface MobileProcessorToken {
|
|
5
|
-
token: string;
|
|
6
|
-
paymentToken: PaymentToken;
|
|
7
|
-
[k: string]: any;
|
|
8
|
-
}
|
|
9
|
-
export interface PaymentToken {
|
|
10
|
-
billingContact: BillingContact;
|
|
11
|
-
shippingContact: ShippingContact;
|
|
12
|
-
token: Token;
|
|
13
|
-
[k: string]: any;
|
|
14
|
-
}
|
|
15
|
-
export interface BillingContact {
|
|
16
|
-
addressLines: string[];
|
|
17
|
-
administrativeArea: string;
|
|
18
|
-
country: string;
|
|
19
|
-
countryCode: string;
|
|
20
|
-
familyName: string;
|
|
21
|
-
givenName: string;
|
|
22
|
-
locality: string;
|
|
23
|
-
postalCode: string;
|
|
24
|
-
subAdministrativeArea: string;
|
|
25
|
-
subLocality: string;
|
|
26
|
-
[k: string]: any;
|
|
27
|
-
}
|
|
28
|
-
export interface ShippingContact {
|
|
29
|
-
addressLines: string[];
|
|
30
|
-
administrativeArea: string;
|
|
31
|
-
country: string;
|
|
32
|
-
countryCode: string;
|
|
33
|
-
emailAddress: string;
|
|
34
|
-
familyName: string;
|
|
35
|
-
givenName: string;
|
|
36
|
-
locality: string;
|
|
37
|
-
phoneNumber: string;
|
|
38
|
-
postalCode: string;
|
|
39
|
-
subAdministrativeArea: string;
|
|
40
|
-
subLocality: string;
|
|
41
|
-
[k: string]: any;
|
|
42
|
-
}
|
|
43
|
-
export interface Token {
|
|
44
|
-
paymentData: PaymentData;
|
|
45
|
-
paymentMethod: PaymentMethod;
|
|
46
|
-
transactionIdentifier: string;
|
|
47
|
-
[k: string]: any;
|
|
48
|
-
}
|
|
49
|
-
export interface PaymentData {
|
|
50
|
-
data: string;
|
|
51
|
-
header: {
|
|
52
|
-
ephemeralPublicKey: string;
|
|
53
|
-
publicKeyHash: string;
|
|
54
|
-
transactionId: string;
|
|
55
|
-
[k: string]: any;
|
|
56
|
-
};
|
|
57
|
-
signature: string;
|
|
58
|
-
version: string;
|
|
59
|
-
[k: string]: any;
|
|
60
|
-
}
|
|
61
|
-
export interface PaymentMethod {
|
|
62
|
-
displayName: string;
|
|
63
|
-
network: string;
|
|
64
|
-
type: string;
|
|
65
|
-
[k: string]: any;
|
|
66
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* tslint:disable:all */
|
|
2
|
-
/* tslint:disable:all */
|
|
3
|
-
|
|
4
|
-
export interface MobileProcessorTokenRequest {
|
|
5
|
-
validationUrl: string;
|
|
6
|
-
totalAmount: number;
|
|
7
|
-
domainName: string;
|
|
8
|
-
currency: "USD" | "COP" | "PEN" | "CLP" | "UF" | "MXN" | "BRL";
|
|
9
|
-
description: string;
|
|
10
|
-
[k: string]: any;
|
|
11
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/* tslint:disable:all */
|
|
2
|
-
/* tslint:disable:all */
|
|
3
|
-
|
|
4
|
-
export interface MobileProcessorTokenResponse {
|
|
5
|
-
token: string;
|
|
6
|
-
epochTimestamp: number;
|
|
7
|
-
expiresAt: number;
|
|
8
|
-
merchantSessionIdentifier: string;
|
|
9
|
-
nonce: string;
|
|
10
|
-
merchantIdentifier: string;
|
|
11
|
-
domainName: string;
|
|
12
|
-
displayName: string;
|
|
13
|
-
signature: string;
|
|
14
|
-
[k: string]: any;
|
|
15
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/* tslint:disable:all */
|
|
2
|
-
/* tslint:disable:all */
|
|
3
|
-
|
|
4
|
-
export type PaymentDataResponse = CardPaymentDataResponse | TransferPaymentDataResponse | CashPaymentDataResponse;
|
|
5
|
-
|
|
6
|
-
export interface CardPaymentDataResponse {
|
|
7
|
-
id: string;
|
|
8
|
-
email: string;
|
|
9
|
-
kind: "card";
|
|
10
|
-
brand: string;
|
|
11
|
-
cardHolderName: string;
|
|
12
|
-
expDate: string;
|
|
13
|
-
lastFourDigits: string;
|
|
14
|
-
maskedCardNumber: string;
|
|
15
|
-
}
|
|
16
|
-
export interface TransferPaymentDataResponse {
|
|
17
|
-
id: string;
|
|
18
|
-
bankId: string;
|
|
19
|
-
brand: string;
|
|
20
|
-
documentNumber: string;
|
|
21
|
-
documentType: string;
|
|
22
|
-
email: string;
|
|
23
|
-
kind: "transfer";
|
|
24
|
-
name: string;
|
|
25
|
-
userType: string;
|
|
26
|
-
}
|
|
27
|
-
export interface CashPaymentDataResponse {
|
|
28
|
-
id: string;
|
|
29
|
-
brand: string;
|
|
30
|
-
documentNumber: string;
|
|
31
|
-
documentType: string;
|
|
32
|
-
email: string;
|
|
33
|
-
kind: "cash";
|
|
34
|
-
name: string;
|
|
35
|
-
firstName?: string;
|
|
36
|
-
lastName?: string;
|
|
37
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/* tslint:disable:all */
|
|
2
|
-
/* tslint:disable:all */
|
|
3
|
-
|
|
4
|
-
export interface SubscriptionTokenKPayRequest {
|
|
5
|
-
walletId: string;
|
|
6
|
-
currency?: "USD" | "COP" | "CLP" | "UF" | "PEN" | "MXN" | "CRC" | "GTQ" | "HNL" | "NIO" | "PAB" | "BRL";
|
|
7
|
-
userId?: string;
|
|
8
|
-
sessionId?: string;
|
|
9
|
-
card?: {
|
|
10
|
-
cvc: string;
|
|
11
|
-
};
|
|
12
|
-
[k: string]: any;
|
|
13
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/* tslint:disable:all */
|
|
2
|
-
/* tslint:disable:all */
|
|
3
|
-
|
|
4
|
-
export interface TokenKPayRequest {
|
|
5
|
-
walletId: string;
|
|
6
|
-
currency?: "USD" | "COP" | "CLP" | "UF" | "PEN" | "MXN" | "BRL" | "CRC" | "GTQ" | "HNL" | "NIO" | "PAB";
|
|
7
|
-
isDeferred?: boolean;
|
|
8
|
-
amount: number | string;
|
|
9
|
-
months?: number;
|
|
10
|
-
cvv?: string;
|
|
11
|
-
[k: string]: any;
|
|
12
|
-
}
|
|
File without changes
|