@n3oltd/umbraco-payments-directdebituk-client 12.0.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/README.md +1 -0
- package/dist/esm/index.d.ts +105 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +122 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/index.d.ts +105 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +122 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +1 -0
- package/dist/index.min.js.map +1 -0
- package/esm/index.d.ts +105 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +122 -0
- package/esm/index.js.map +1 -0
- package/package.json +40 -0
- package/src/index.ts +193 -0
- package/tsconfig.json +21 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
TODO
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export declare class DirectDebitUKClient {
|
|
2
|
+
private http;
|
|
3
|
+
private baseUrl;
|
|
4
|
+
protected jsonParseReviver: ((key: string, value: any) => any) | undefined;
|
|
5
|
+
constructor(baseUrl?: string, http?: {
|
|
6
|
+
fetch(url: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
7
|
+
});
|
|
8
|
+
storeCard(flowId: string, req: UKBankAccountReq): Promise<PaymentFlowResOfDirectDebitUKCredential>;
|
|
9
|
+
protected processStoreCard(response: Response): Promise<PaymentFlowResOfDirectDebitUKCredential>;
|
|
10
|
+
}
|
|
11
|
+
export interface PaymentFlowResOfDirectDebitUKCredential {
|
|
12
|
+
flowRevision?: number;
|
|
13
|
+
result?: DirectDebitUKCredential | undefined;
|
|
14
|
+
}
|
|
15
|
+
export interface DirectDebitUKCredential {
|
|
16
|
+
advancePayment?: Payment | undefined;
|
|
17
|
+
setupAt?: Date | undefined;
|
|
18
|
+
isSetUp?: boolean;
|
|
19
|
+
type?: PaymentObjectType | undefined;
|
|
20
|
+
completeAt?: Date | undefined;
|
|
21
|
+
errorAt?: Date | undefined;
|
|
22
|
+
errorMessage?: string | undefined;
|
|
23
|
+
exceptionDetails?: string | undefined;
|
|
24
|
+
status?: PaymentObjectStatus | undefined;
|
|
25
|
+
method?: string | undefined;
|
|
26
|
+
bankAccount?: UKBankAccount | undefined;
|
|
27
|
+
}
|
|
28
|
+
export interface Payment {
|
|
29
|
+
completeAt?: Date | undefined;
|
|
30
|
+
errorAt?: Date | undefined;
|
|
31
|
+
errorMessage?: string | undefined;
|
|
32
|
+
exceptionDetails?: string | undefined;
|
|
33
|
+
status?: PaymentObjectStatus | undefined;
|
|
34
|
+
card?: CardPayment | undefined;
|
|
35
|
+
paidAt?: Date | undefined;
|
|
36
|
+
declinedAt?: Date | undefined;
|
|
37
|
+
declinedReason?: string | undefined;
|
|
38
|
+
isDeclined?: boolean;
|
|
39
|
+
isPaid?: boolean;
|
|
40
|
+
type?: PaymentObjectType | undefined;
|
|
41
|
+
}
|
|
42
|
+
/** One of 'complete', 'error', 'inProgress' */
|
|
43
|
+
export declare enum PaymentObjectStatus {
|
|
44
|
+
Complete = "complete",
|
|
45
|
+
Error = "error",
|
|
46
|
+
InProgress = "inProgress"
|
|
47
|
+
}
|
|
48
|
+
export interface CardPayment {
|
|
49
|
+
threeDSecureRequired?: boolean;
|
|
50
|
+
threeDSecureCompleted?: boolean;
|
|
51
|
+
threeDSecureV1?: ThreeDSecureV1 | undefined;
|
|
52
|
+
threeDSecureV2?: ThreeDSecureV2 | undefined;
|
|
53
|
+
}
|
|
54
|
+
export interface ThreeDSecureV1 {
|
|
55
|
+
acsUrl?: string | undefined;
|
|
56
|
+
md?: string | undefined;
|
|
57
|
+
paReq?: string | undefined;
|
|
58
|
+
paRes?: string | undefined;
|
|
59
|
+
}
|
|
60
|
+
export interface ThreeDSecureV2 {
|
|
61
|
+
acsUrl?: string | undefined;
|
|
62
|
+
acsTransId?: string | undefined;
|
|
63
|
+
sessionData?: string | undefined;
|
|
64
|
+
cReq?: string | undefined;
|
|
65
|
+
cRes?: string | undefined;
|
|
66
|
+
html?: string | undefined;
|
|
67
|
+
}
|
|
68
|
+
/** One of 'credential', 'payment' */
|
|
69
|
+
export declare enum PaymentObjectType {
|
|
70
|
+
Credential = "credential",
|
|
71
|
+
Payment = "payment"
|
|
72
|
+
}
|
|
73
|
+
export interface UKBankAccount {
|
|
74
|
+
accountHolder?: string | undefined;
|
|
75
|
+
accountNumber?: string | undefined;
|
|
76
|
+
sortCode?: string | undefined;
|
|
77
|
+
}
|
|
78
|
+
export interface ProblemDetails {
|
|
79
|
+
type?: string | undefined;
|
|
80
|
+
title?: string | undefined;
|
|
81
|
+
status?: number | undefined;
|
|
82
|
+
detail?: string | undefined;
|
|
83
|
+
instance?: string | undefined;
|
|
84
|
+
[key: string]: any;
|
|
85
|
+
}
|
|
86
|
+
export interface UKBankAccountReq {
|
|
87
|
+
accountHolder?: string | undefined;
|
|
88
|
+
accountNumber?: string | undefined;
|
|
89
|
+
sortCode?: string | undefined;
|
|
90
|
+
}
|
|
91
|
+
export declare class ApiException extends Error {
|
|
92
|
+
message: string;
|
|
93
|
+
status: number;
|
|
94
|
+
response: string;
|
|
95
|
+
headers: {
|
|
96
|
+
[key: string]: any;
|
|
97
|
+
};
|
|
98
|
+
result: any;
|
|
99
|
+
constructor(message: string, status: number, response: string, headers: {
|
|
100
|
+
[key: string]: any;
|
|
101
|
+
}, result: any);
|
|
102
|
+
protected isApiException: boolean;
|
|
103
|
+
static isApiException(obj: any): obj is ApiException;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,qBAAa,mBAAmB;IAC5B,OAAO,CAAC,IAAI,CAAqE;IACjF,OAAO,CAAC,OAAO,CAAS;IACxB,SAAS,CAAC,gBAAgB,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAA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IAU5G,SAAS,CAAC,cAAc,UAAQ;IAEhC,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,YAAY;CAGvD"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
//----------------------
|
|
2
|
+
// <auto-generated>
|
|
3
|
+
// Generated using the NSwag toolchain v13.18.0.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0)) (http://NSwag.org)
|
|
4
|
+
// </auto-generated>
|
|
5
|
+
//----------------------
|
|
6
|
+
var __extends = (this && this.__extends) || (function () {
|
|
7
|
+
var extendStatics = function (d, b) {
|
|
8
|
+
extendStatics = Object.setPrototypeOf ||
|
|
9
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
10
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
11
|
+
return extendStatics(d, b);
|
|
12
|
+
};
|
|
13
|
+
return function (d, b) {
|
|
14
|
+
extendStatics(d, b);
|
|
15
|
+
function __() { this.constructor = d; }
|
|
16
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
17
|
+
};
|
|
18
|
+
})();
|
|
19
|
+
/* tslint:disable */
|
|
20
|
+
/* eslint-disable */
|
|
21
|
+
// ReSharper disable InconsistentNaming
|
|
22
|
+
var DirectDebitUKClient = /** @class */ (function () {
|
|
23
|
+
function DirectDebitUKClient(baseUrl, http) {
|
|
24
|
+
this.jsonParseReviver = undefined;
|
|
25
|
+
this.http = http ? http : window;
|
|
26
|
+
this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : "https://localhost:6001";
|
|
27
|
+
}
|
|
28
|
+
DirectDebitUKClient.prototype.storeCard = function (flowId, req) {
|
|
29
|
+
var _this = this;
|
|
30
|
+
var url_ = this.baseUrl + "/umbraco/api/DirectDebitUK/credentials/{flowId}/store";
|
|
31
|
+
if (flowId === undefined || flowId === null)
|
|
32
|
+
throw new Error("The parameter 'flowId' must be defined.");
|
|
33
|
+
url_ = url_.replace("{flowId}", encodeURIComponent("" + flowId));
|
|
34
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
35
|
+
var content_ = JSON.stringify(req);
|
|
36
|
+
var options_ = {
|
|
37
|
+
body: content_,
|
|
38
|
+
method: "POST",
|
|
39
|
+
headers: {
|
|
40
|
+
"Content-Type": "application/json",
|
|
41
|
+
"Accept": "application/json"
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return this.http.fetch(url_, options_).then(function (_response) {
|
|
45
|
+
return _this.processStoreCard(_response);
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
DirectDebitUKClient.prototype.processStoreCard = function (response) {
|
|
49
|
+
var _this = this;
|
|
50
|
+
var status = response.status;
|
|
51
|
+
var _headers = {};
|
|
52
|
+
if (response.headers && response.headers.forEach) {
|
|
53
|
+
response.headers.forEach(function (v, k) { return _headers[k] = v; });
|
|
54
|
+
}
|
|
55
|
+
;
|
|
56
|
+
if (status === 200) {
|
|
57
|
+
return response.text().then(function (_responseText) {
|
|
58
|
+
var result200 = null;
|
|
59
|
+
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
|
|
60
|
+
return result200;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
else if (status === 400) {
|
|
64
|
+
return response.text().then(function (_responseText) {
|
|
65
|
+
var result400 = null;
|
|
66
|
+
result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
|
|
67
|
+
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
else if (status === 500) {
|
|
71
|
+
return response.text().then(function (_responseText) {
|
|
72
|
+
return throwException("A server side error occurred.", status, _responseText, _headers);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
else if (status !== 200 && status !== 204) {
|
|
76
|
+
return response.text().then(function (_responseText) {
|
|
77
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return Promise.resolve(null);
|
|
81
|
+
};
|
|
82
|
+
return DirectDebitUKClient;
|
|
83
|
+
}());
|
|
84
|
+
export { DirectDebitUKClient };
|
|
85
|
+
/** One of 'complete', 'error', 'inProgress' */
|
|
86
|
+
export var PaymentObjectStatus;
|
|
87
|
+
(function (PaymentObjectStatus) {
|
|
88
|
+
PaymentObjectStatus["Complete"] = "complete";
|
|
89
|
+
PaymentObjectStatus["Error"] = "error";
|
|
90
|
+
PaymentObjectStatus["InProgress"] = "inProgress";
|
|
91
|
+
})(PaymentObjectStatus || (PaymentObjectStatus = {}));
|
|
92
|
+
/** One of 'credential', 'payment' */
|
|
93
|
+
export var PaymentObjectType;
|
|
94
|
+
(function (PaymentObjectType) {
|
|
95
|
+
PaymentObjectType["Credential"] = "credential";
|
|
96
|
+
PaymentObjectType["Payment"] = "payment";
|
|
97
|
+
})(PaymentObjectType || (PaymentObjectType = {}));
|
|
98
|
+
var ApiException = /** @class */ (function (_super) {
|
|
99
|
+
__extends(ApiException, _super);
|
|
100
|
+
function ApiException(message, status, response, headers, result) {
|
|
101
|
+
var _this = _super.call(this) || this;
|
|
102
|
+
_this.isApiException = true;
|
|
103
|
+
_this.message = message;
|
|
104
|
+
_this.status = status;
|
|
105
|
+
_this.response = response;
|
|
106
|
+
_this.headers = headers;
|
|
107
|
+
_this.result = result;
|
|
108
|
+
return _this;
|
|
109
|
+
}
|
|
110
|
+
ApiException.isApiException = function (obj) {
|
|
111
|
+
return obj.isApiException === true;
|
|
112
|
+
};
|
|
113
|
+
return ApiException;
|
|
114
|
+
}(Error));
|
|
115
|
+
export { ApiException };
|
|
116
|
+
function throwException(message, status, response, headers, result) {
|
|
117
|
+
if (result !== null && result !== undefined)
|
|
118
|
+
throw result;
|
|
119
|
+
else
|
|
120
|
+
throw new ApiException(message, status, response, headers, null);
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL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AC;QACzB,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;IACzB,CAAC;IAIM,2BAAc,GAArB,UAAsB,GAAQ;QAC1B,OAAO,GAAG,CAAC,cAAc,KAAK,IAAI,CAAC;IACvC,CAAC;IACL,mBAAC;AAAD,CAAC,AAtBD,CAAkC,KAAK,GAsBtC;;AAED,SAAS,cAAc,CAAC,OAAe,EAAE,MAAc,EAAE,QAAgB,EAAE,OAAgC,EAAE,MAAY;IACrH,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS;QACvC,MAAM,MAAM,CAAC;;QAEb,MAAM,IAAI,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AACzE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export declare class DirectDebitUKClient {
|
|
2
|
+
private http;
|
|
3
|
+
private baseUrl;
|
|
4
|
+
protected jsonParseReviver: ((key: string, value: any) => any) | undefined;
|
|
5
|
+
constructor(baseUrl?: string, http?: {
|
|
6
|
+
fetch(url: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
7
|
+
});
|
|
8
|
+
storeCard(flowId: string, req: UKBankAccountReq): Promise<PaymentFlowResOfDirectDebitUKCredential>;
|
|
9
|
+
protected processStoreCard(response: Response): Promise<PaymentFlowResOfDirectDebitUKCredential>;
|
|
10
|
+
}
|
|
11
|
+
export interface PaymentFlowResOfDirectDebitUKCredential {
|
|
12
|
+
flowRevision?: number;
|
|
13
|
+
result?: DirectDebitUKCredential | undefined;
|
|
14
|
+
}
|
|
15
|
+
export interface DirectDebitUKCredential {
|
|
16
|
+
advancePayment?: Payment | undefined;
|
|
17
|
+
setupAt?: Date | undefined;
|
|
18
|
+
isSetUp?: boolean;
|
|
19
|
+
type?: PaymentObjectType | undefined;
|
|
20
|
+
completeAt?: Date | undefined;
|
|
21
|
+
errorAt?: Date | undefined;
|
|
22
|
+
errorMessage?: string | undefined;
|
|
23
|
+
exceptionDetails?: string | undefined;
|
|
24
|
+
status?: PaymentObjectStatus | undefined;
|
|
25
|
+
method?: string | undefined;
|
|
26
|
+
bankAccount?: UKBankAccount | undefined;
|
|
27
|
+
}
|
|
28
|
+
export interface Payment {
|
|
29
|
+
completeAt?: Date | undefined;
|
|
30
|
+
errorAt?: Date | undefined;
|
|
31
|
+
errorMessage?: string | undefined;
|
|
32
|
+
exceptionDetails?: string | undefined;
|
|
33
|
+
status?: PaymentObjectStatus | undefined;
|
|
34
|
+
card?: CardPayment | undefined;
|
|
35
|
+
paidAt?: Date | undefined;
|
|
36
|
+
declinedAt?: Date | undefined;
|
|
37
|
+
declinedReason?: string | undefined;
|
|
38
|
+
isDeclined?: boolean;
|
|
39
|
+
isPaid?: boolean;
|
|
40
|
+
type?: PaymentObjectType | undefined;
|
|
41
|
+
}
|
|
42
|
+
/** One of 'complete', 'error', 'inProgress' */
|
|
43
|
+
export declare enum PaymentObjectStatus {
|
|
44
|
+
Complete = "complete",
|
|
45
|
+
Error = "error",
|
|
46
|
+
InProgress = "inProgress"
|
|
47
|
+
}
|
|
48
|
+
export interface CardPayment {
|
|
49
|
+
threeDSecureRequired?: boolean;
|
|
50
|
+
threeDSecureCompleted?: boolean;
|
|
51
|
+
threeDSecureV1?: ThreeDSecureV1 | undefined;
|
|
52
|
+
threeDSecureV2?: ThreeDSecureV2 | undefined;
|
|
53
|
+
}
|
|
54
|
+
export interface ThreeDSecureV1 {
|
|
55
|
+
acsUrl?: string | undefined;
|
|
56
|
+
md?: string | undefined;
|
|
57
|
+
paReq?: string | undefined;
|
|
58
|
+
paRes?: string | undefined;
|
|
59
|
+
}
|
|
60
|
+
export interface ThreeDSecureV2 {
|
|
61
|
+
acsUrl?: string | undefined;
|
|
62
|
+
acsTransId?: string | undefined;
|
|
63
|
+
sessionData?: string | undefined;
|
|
64
|
+
cReq?: string | undefined;
|
|
65
|
+
cRes?: string | undefined;
|
|
66
|
+
html?: string | undefined;
|
|
67
|
+
}
|
|
68
|
+
/** One of 'credential', 'payment' */
|
|
69
|
+
export declare enum PaymentObjectType {
|
|
70
|
+
Credential = "credential",
|
|
71
|
+
Payment = "payment"
|
|
72
|
+
}
|
|
73
|
+
export interface UKBankAccount {
|
|
74
|
+
accountHolder?: string | undefined;
|
|
75
|
+
accountNumber?: string | undefined;
|
|
76
|
+
sortCode?: string | undefined;
|
|
77
|
+
}
|
|
78
|
+
export interface ProblemDetails {
|
|
79
|
+
type?: string | undefined;
|
|
80
|
+
title?: string | undefined;
|
|
81
|
+
status?: number | undefined;
|
|
82
|
+
detail?: string | undefined;
|
|
83
|
+
instance?: string | undefined;
|
|
84
|
+
[key: string]: any;
|
|
85
|
+
}
|
|
86
|
+
export interface UKBankAccountReq {
|
|
87
|
+
accountHolder?: string | undefined;
|
|
88
|
+
accountNumber?: string | undefined;
|
|
89
|
+
sortCode?: string | undefined;
|
|
90
|
+
}
|
|
91
|
+
export declare class ApiException extends Error {
|
|
92
|
+
message: string;
|
|
93
|
+
status: number;
|
|
94
|
+
response: string;
|
|
95
|
+
headers: {
|
|
96
|
+
[key: string]: any;
|
|
97
|
+
};
|
|
98
|
+
result: any;
|
|
99
|
+
constructor(message: string, status: number, response: string, headers: {
|
|
100
|
+
[key: string]: any;
|
|
101
|
+
}, result: any);
|
|
102
|
+
protected isApiException: boolean;
|
|
103
|
+
static isApiException(obj: any): obj is ApiException;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,qBAAa,mBAAmB;IAC5B,OAAO,CAAC,IAAI,CAAqE;IACjF,OAAO,CAAC,OAAO,CAAS;IACxB,SAAS,CAAC,gBAAgB,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EA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G,SAAS,CAAC,cAAc,UAAQ;IAEhC,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,YAAY;CAGvD"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
//----------------------
|
|
2
|
+
// <auto-generated>
|
|
3
|
+
// Generated using the NSwag toolchain v13.18.0.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0)) (http://NSwag.org)
|
|
4
|
+
// </auto-generated>
|
|
5
|
+
//----------------------
|
|
6
|
+
var __extends = (this && this.__extends) || (function () {
|
|
7
|
+
var extendStatics = function (d, b) {
|
|
8
|
+
extendStatics = Object.setPrototypeOf ||
|
|
9
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
10
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
11
|
+
return extendStatics(d, b);
|
|
12
|
+
};
|
|
13
|
+
return function (d, b) {
|
|
14
|
+
extendStatics(d, b);
|
|
15
|
+
function __() { this.constructor = d; }
|
|
16
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
17
|
+
};
|
|
18
|
+
})();
|
|
19
|
+
/* tslint:disable */
|
|
20
|
+
/* eslint-disable */
|
|
21
|
+
// ReSharper disable InconsistentNaming
|
|
22
|
+
var DirectDebitUKClient = /** @class */ (function () {
|
|
23
|
+
function DirectDebitUKClient(baseUrl, http) {
|
|
24
|
+
this.jsonParseReviver = undefined;
|
|
25
|
+
this.http = http ? http : window;
|
|
26
|
+
this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : "https://localhost:6001";
|
|
27
|
+
}
|
|
28
|
+
DirectDebitUKClient.prototype.storeCard = function (flowId, req) {
|
|
29
|
+
var _this = this;
|
|
30
|
+
var url_ = this.baseUrl + "/umbraco/api/DirectDebitUK/credentials/{flowId}/store";
|
|
31
|
+
if (flowId === undefined || flowId === null)
|
|
32
|
+
throw new Error("The parameter 'flowId' must be defined.");
|
|
33
|
+
url_ = url_.replace("{flowId}", encodeURIComponent("" + flowId));
|
|
34
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
35
|
+
var content_ = JSON.stringify(req);
|
|
36
|
+
var options_ = {
|
|
37
|
+
body: content_,
|
|
38
|
+
method: "POST",
|
|
39
|
+
headers: {
|
|
40
|
+
"Content-Type": "application/json",
|
|
41
|
+
"Accept": "application/json"
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return this.http.fetch(url_, options_).then(function (_response) {
|
|
45
|
+
return _this.processStoreCard(_response);
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
DirectDebitUKClient.prototype.processStoreCard = function (response) {
|
|
49
|
+
var _this = this;
|
|
50
|
+
var status = response.status;
|
|
51
|
+
var _headers = {};
|
|
52
|
+
if (response.headers && response.headers.forEach) {
|
|
53
|
+
response.headers.forEach(function (v, k) { return _headers[k] = v; });
|
|
54
|
+
}
|
|
55
|
+
;
|
|
56
|
+
if (status === 200) {
|
|
57
|
+
return response.text().then(function (_responseText) {
|
|
58
|
+
var result200 = null;
|
|
59
|
+
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
|
|
60
|
+
return result200;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
else if (status === 400) {
|
|
64
|
+
return response.text().then(function (_responseText) {
|
|
65
|
+
var result400 = null;
|
|
66
|
+
result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
|
|
67
|
+
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
else if (status === 500) {
|
|
71
|
+
return response.text().then(function (_responseText) {
|
|
72
|
+
return throwException("A server side error occurred.", status, _responseText, _headers);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
else if (status !== 200 && status !== 204) {
|
|
76
|
+
return response.text().then(function (_responseText) {
|
|
77
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return Promise.resolve(null);
|
|
81
|
+
};
|
|
82
|
+
return DirectDebitUKClient;
|
|
83
|
+
}());
|
|
84
|
+
export { DirectDebitUKClient };
|
|
85
|
+
/** One of 'complete', 'error', 'inProgress' */
|
|
86
|
+
export var PaymentObjectStatus;
|
|
87
|
+
(function (PaymentObjectStatus) {
|
|
88
|
+
PaymentObjectStatus["Complete"] = "complete";
|
|
89
|
+
PaymentObjectStatus["Error"] = "error";
|
|
90
|
+
PaymentObjectStatus["InProgress"] = "inProgress";
|
|
91
|
+
})(PaymentObjectStatus || (PaymentObjectStatus = {}));
|
|
92
|
+
/** One of 'credential', 'payment' */
|
|
93
|
+
export var PaymentObjectType;
|
|
94
|
+
(function (PaymentObjectType) {
|
|
95
|
+
PaymentObjectType["Credential"] = "credential";
|
|
96
|
+
PaymentObjectType["Payment"] = "payment";
|
|
97
|
+
})(PaymentObjectType || (PaymentObjectType = {}));
|
|
98
|
+
var ApiException = /** @class */ (function (_super) {
|
|
99
|
+
__extends(ApiException, _super);
|
|
100
|
+
function ApiException(message, status, response, headers, result) {
|
|
101
|
+
var _this = _super.call(this) || this;
|
|
102
|
+
_this.isApiException = true;
|
|
103
|
+
_this.message = message;
|
|
104
|
+
_this.status = status;
|
|
105
|
+
_this.response = response;
|
|
106
|
+
_this.headers = headers;
|
|
107
|
+
_this.result = result;
|
|
108
|
+
return _this;
|
|
109
|
+
}
|
|
110
|
+
ApiException.isApiException = function (obj) {
|
|
111
|
+
return obj.isApiException === true;
|
|
112
|
+
};
|
|
113
|
+
return ApiException;
|
|
114
|
+
}(Error));
|
|
115
|
+
export { ApiException };
|
|
116
|
+
function throwException(message, status, response, headers, result) {
|
|
117
|
+
if (result !== null && result !== undefined)
|
|
118
|
+
throw result;
|
|
119
|
+
else
|
|
120
|
+
throw new ApiException(message, status, response, headers, null);
|
|
121
|
+
}
|
|
122
|
+
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G,QAAQ,CAAC;QACzB,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;IACzB,CAAC;IAIM,2BAAc,GAArB,UAAsB,GAAQ;QAC1B,OAAO,GAAG,CAAC,cAAc,KAAK,IAAI,CAAC;IACvC,CAAC;IACL,mBAAC;AAAD,CAAC,AAtBD,CAAkC,KAAK,GAsBtC;;AAED,SAAS,cAAc,CAAC,OAAe,EAAE,MAAc,EAAE,QAAgB,EAAE,OAAgC,EAAE,MAAY;IACrH,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS;QACvC,MAAM,MAAM,CAAC;;QAEb,MAAM,IAAI,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var PaymentObjectStatus,PaymentObjectType,__extends=this&&this.__extends||function(){var n=function(e,t){return(n=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])}))(e,t)};return function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}}(),DirectDebitUKClient=function(){function e(e,t){this.jsonParseReviver=void 0,this.http=t||window,this.baseUrl=null!=e?e:"https://localhost:6001"}return e.prototype.storeCard=function(e,t){var r=this,n=this.baseUrl+"/umbraco/api/DirectDebitUK/credentials/{flowId}/store";if(null==e)throw new Error("The parameter 'flowId' must be defined.");n=(n=n.replace("{flowId}",encodeURIComponent(""+e))).replace(/[?&]$/,""),e=JSON.stringify(t);return this.http.fetch(n,{body:e,method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"}}).then(function(e){return r.processStoreCard(e)})},e.prototype.processStoreCard=function(e){var r=this,n=e.status,o={};return e.headers&&e.headers.forEach&&e.headers.forEach(function(e,t){return o[t]=e}),200===n?e.text().then(function(e){return""===e?null:JSON.parse(e,r.jsonParseReviver)}):400===n?e.text().then(function(e){var t=""===e?null:JSON.parse(e,r.jsonParseReviver);return throwException("A server side error occurred.",n,e,o,t)}):500===n?e.text().then(function(e){return throwException("A server side error occurred.",n,e,o)}):200!==n&&204!==n?e.text().then(function(e){return throwException("An unexpected server error occurred.",n,e,o)}):Promise.resolve(null)},e}(),ApiException=(!function(e){e.Complete="complete",e.Error="error",e.InProgress="inProgress"}(PaymentObjectStatus=PaymentObjectStatus||{}),!function(e){e.Credential="credential",e.Payment="payment"}(PaymentObjectType=PaymentObjectType||{}),function(c){function e(e,t,r,n,o){var i=c.call(this)||this;return i.isApiException=!0,i.message=e,i.status=t,i.response=r,i.headers=n,i.result=o,i}return __extends(e,c),e.isApiException=function(e){return!0===e.isApiException},e}(Error));function throwException(e,t,r,n,o){throw null!=o?o:new ApiException(e,t,r,n,null)}export{DirectDebitUKClient,PaymentObjectStatus,PaymentObjectType,ApiException};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["PaymentObjectStatus","PaymentObjectType","DirectDebitUKClient","baseUrl","http","this","jsonParseReviver","undefined","window","prototype","storeCard","flowId","req","_this","url_","Error","replace","encodeURIComponent","content_","JSON","stringify","fetch","body","method","headers","Content-Type","Accept","then","_response","processStoreCard","response","status","_headers","forEach","v","k","text","_responseText","parse","result400","throwException","Promise","resolve","ApiException","_super","message","result","call","isApiException","__extends","obj"],"mappings":"IA0GYA,oBA8BAC,kB,yWA9HZC,oBAAA,WAKI,SAAAA,EAAYC,EAAkBC,GAFpBC,KAAAC,iBAAmEC,KAAAA,EAGzEF,KAAKD,KAAOA,GAAcI,OAC1BH,KAAKF,QAAUA,MAAAA,EAA4CA,EAAU,wBACzE,CAmDJ,OAjDID,EAAAO,UAAAC,UAAA,SAAUC,EAAgBC,GAA1B,IAAAC,EAAAR,KACQS,EAAOT,KAAKF,QAAU,wDAC1B,G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3DA,EAyJAyC,cAzDA,CAAA,SAAY3C,GACRA,EAAA,SAAA,WACAA,EAAA,MAAA,QACAA,EAAA,WAAA,YACH,EAJWA,oBAAAA,qBAAmB,EAAA,EA8B/B,CAAA,SAAYC,GACRA,EAAA,WAAA,aACAA,EAAA,QAAA,SACH,EAHWA,kBAAAA,mBAAiB,EAAA,EA2B7B,SAAA2C,GAOI,SAAAD,EAAYE,EAAiBd,EAAgBD,EAAkBN,EAAkCsB,GAAjG,IAAAjC,EACI+B,EAAAG,KAAA1C,IAAA,GAAOA,K,OASDQ,EAAAmC,eAAiB,CAAA,EAPvBnC,EAAKgC,QAAUA,EACfhC,EAAKkB,OAASA,EACdlB,EAAKiB,SAAWA,EAChBjB,EAAKW,QAAUA,EACfX,EAAKiC,OAASA,E,CAClB,CAOJ,OAtBkCG,UAAAN,EAAAC,CAAA,EAmBvBD,EAAAK,eAAP,SAAsBE,GAClB,MAA8B,CAAA,IAAvBA,EAAIF,cACf,EACJL,CAAA,EAtBkC5B,KAAK,GAwBvC,SAASyB,eAAeK,EAAiBd,EAAgBD,EAAkBN,EAAkCsB,GACzG,MAAIA,MAAAA,EACMA,EAEA,IAAIH,aAAaE,EAASd,EAAQD,EAAUN,EAAS,IAAI,CACvE,Q,oBAtFYxB,oBA8BAC,kB,YAwDZ"}
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export declare class DirectDebitUKClient {
|
|
2
|
+
private http;
|
|
3
|
+
private baseUrl;
|
|
4
|
+
protected jsonParseReviver: ((key: string, value: any) => any) | undefined;
|
|
5
|
+
constructor(baseUrl?: string, http?: {
|
|
6
|
+
fetch(url: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
7
|
+
});
|
|
8
|
+
storeCard(flowId: string, req: UKBankAccountReq): Promise<PaymentFlowResOfDirectDebitUKCredential>;
|
|
9
|
+
protected processStoreCard(response: Response): Promise<PaymentFlowResOfDirectDebitUKCredential>;
|
|
10
|
+
}
|
|
11
|
+
export interface PaymentFlowResOfDirectDebitUKCredential {
|
|
12
|
+
flowRevision?: number;
|
|
13
|
+
result?: DirectDebitUKCredential | undefined;
|
|
14
|
+
}
|
|
15
|
+
export interface DirectDebitUKCredential {
|
|
16
|
+
advancePayment?: Payment | undefined;
|
|
17
|
+
setupAt?: Date | undefined;
|
|
18
|
+
isSetUp?: boolean;
|
|
19
|
+
type?: PaymentObjectType | undefined;
|
|
20
|
+
completeAt?: Date | undefined;
|
|
21
|
+
errorAt?: Date | undefined;
|
|
22
|
+
errorMessage?: string | undefined;
|
|
23
|
+
exceptionDetails?: string | undefined;
|
|
24
|
+
status?: PaymentObjectStatus | undefined;
|
|
25
|
+
method?: string | undefined;
|
|
26
|
+
bankAccount?: UKBankAccount | undefined;
|
|
27
|
+
}
|
|
28
|
+
export interface Payment {
|
|
29
|
+
completeAt?: Date | undefined;
|
|
30
|
+
errorAt?: Date | undefined;
|
|
31
|
+
errorMessage?: string | undefined;
|
|
32
|
+
exceptionDetails?: string | undefined;
|
|
33
|
+
status?: PaymentObjectStatus | undefined;
|
|
34
|
+
card?: CardPayment | undefined;
|
|
35
|
+
paidAt?: Date | undefined;
|
|
36
|
+
declinedAt?: Date | undefined;
|
|
37
|
+
declinedReason?: string | undefined;
|
|
38
|
+
isDeclined?: boolean;
|
|
39
|
+
isPaid?: boolean;
|
|
40
|
+
type?: PaymentObjectType | undefined;
|
|
41
|
+
}
|
|
42
|
+
/** One of 'complete', 'error', 'inProgress' */
|
|
43
|
+
export declare enum PaymentObjectStatus {
|
|
44
|
+
Complete = "complete",
|
|
45
|
+
Error = "error",
|
|
46
|
+
InProgress = "inProgress"
|
|
47
|
+
}
|
|
48
|
+
export interface CardPayment {
|
|
49
|
+
threeDSecureRequired?: boolean;
|
|
50
|
+
threeDSecureCompleted?: boolean;
|
|
51
|
+
threeDSecureV1?: ThreeDSecureV1 | undefined;
|
|
52
|
+
threeDSecureV2?: ThreeDSecureV2 | undefined;
|
|
53
|
+
}
|
|
54
|
+
export interface ThreeDSecureV1 {
|
|
55
|
+
acsUrl?: string | undefined;
|
|
56
|
+
md?: string | undefined;
|
|
57
|
+
paReq?: string | undefined;
|
|
58
|
+
paRes?: string | undefined;
|
|
59
|
+
}
|
|
60
|
+
export interface ThreeDSecureV2 {
|
|
61
|
+
acsUrl?: string | undefined;
|
|
62
|
+
acsTransId?: string | undefined;
|
|
63
|
+
sessionData?: string | undefined;
|
|
64
|
+
cReq?: string | undefined;
|
|
65
|
+
cRes?: string | undefined;
|
|
66
|
+
html?: string | undefined;
|
|
67
|
+
}
|
|
68
|
+
/** One of 'credential', 'payment' */
|
|
69
|
+
export declare enum PaymentObjectType {
|
|
70
|
+
Credential = "credential",
|
|
71
|
+
Payment = "payment"
|
|
72
|
+
}
|
|
73
|
+
export interface UKBankAccount {
|
|
74
|
+
accountHolder?: string | undefined;
|
|
75
|
+
accountNumber?: string | undefined;
|
|
76
|
+
sortCode?: string | undefined;
|
|
77
|
+
}
|
|
78
|
+
export interface ProblemDetails {
|
|
79
|
+
type?: string | undefined;
|
|
80
|
+
title?: string | undefined;
|
|
81
|
+
status?: number | undefined;
|
|
82
|
+
detail?: string | undefined;
|
|
83
|
+
instance?: string | undefined;
|
|
84
|
+
[key: string]: any;
|
|
85
|
+
}
|
|
86
|
+
export interface UKBankAccountReq {
|
|
87
|
+
accountHolder?: string | undefined;
|
|
88
|
+
accountNumber?: string | undefined;
|
|
89
|
+
sortCode?: string | undefined;
|
|
90
|
+
}
|
|
91
|
+
export declare class ApiException extends Error {
|
|
92
|
+
message: string;
|
|
93
|
+
status: number;
|
|
94
|
+
response: string;
|
|
95
|
+
headers: {
|
|
96
|
+
[key: string]: any;
|
|
97
|
+
};
|
|
98
|
+
result: any;
|
|
99
|
+
constructor(message: string, status: number, response: string, headers: {
|
|
100
|
+
[key: string]: any;
|
|
101
|
+
}, result: any);
|
|
102
|
+
protected isApiException: boolean;
|
|
103
|
+
static isApiException(obj: any): obj is ApiException;
|
|
104
|
+
}
|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M,CAAC;IACjB,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KAAE,CAAC;IACjC,MAAM,EAAE,GAAG,CAAC;gBAEA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KAAE,EAAE,MAAM,EAAE,GAAG;IAU5G,SAAS,CAAC,cAAc,UAAQ;IAEhC,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,YAAY;CAGvD"}
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
//----------------------
|
|
2
|
+
// <auto-generated>
|
|
3
|
+
// Generated using the NSwag toolchain v13.18.0.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0)) (http://NSwag.org)
|
|
4
|
+
// </auto-generated>
|
|
5
|
+
//----------------------
|
|
6
|
+
var __extends = (this && this.__extends) || (function () {
|
|
7
|
+
var extendStatics = function (d, b) {
|
|
8
|
+
extendStatics = Object.setPrototypeOf ||
|
|
9
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
10
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
11
|
+
return extendStatics(d, b);
|
|
12
|
+
};
|
|
13
|
+
return function (d, b) {
|
|
14
|
+
extendStatics(d, b);
|
|
15
|
+
function __() { this.constructor = d; }
|
|
16
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
17
|
+
};
|
|
18
|
+
})();
|
|
19
|
+
/* tslint:disable */
|
|
20
|
+
/* eslint-disable */
|
|
21
|
+
// ReSharper disable InconsistentNaming
|
|
22
|
+
var DirectDebitUKClient = /** @class */ (function () {
|
|
23
|
+
function DirectDebitUKClient(baseUrl, http) {
|
|
24
|
+
this.jsonParseReviver = undefined;
|
|
25
|
+
this.http = http ? http : window;
|
|
26
|
+
this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : "https://localhost:6001";
|
|
27
|
+
}
|
|
28
|
+
DirectDebitUKClient.prototype.storeCard = function (flowId, req) {
|
|
29
|
+
var _this = this;
|
|
30
|
+
var url_ = this.baseUrl + "/umbraco/api/DirectDebitUK/credentials/{flowId}/store";
|
|
31
|
+
if (flowId === undefined || flowId === null)
|
|
32
|
+
throw new Error("The parameter 'flowId' must be defined.");
|
|
33
|
+
url_ = url_.replace("{flowId}", encodeURIComponent("" + flowId));
|
|
34
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
35
|
+
var content_ = JSON.stringify(req);
|
|
36
|
+
var options_ = {
|
|
37
|
+
body: content_,
|
|
38
|
+
method: "POST",
|
|
39
|
+
headers: {
|
|
40
|
+
"Content-Type": "application/json",
|
|
41
|
+
"Accept": "application/json"
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return this.http.fetch(url_, options_).then(function (_response) {
|
|
45
|
+
return _this.processStoreCard(_response);
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
DirectDebitUKClient.prototype.processStoreCard = function (response) {
|
|
49
|
+
var _this = this;
|
|
50
|
+
var status = response.status;
|
|
51
|
+
var _headers = {};
|
|
52
|
+
if (response.headers && response.headers.forEach) {
|
|
53
|
+
response.headers.forEach(function (v, k) { return _headers[k] = v; });
|
|
54
|
+
}
|
|
55
|
+
;
|
|
56
|
+
if (status === 200) {
|
|
57
|
+
return response.text().then(function (_responseText) {
|
|
58
|
+
var result200 = null;
|
|
59
|
+
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
|
|
60
|
+
return result200;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
else if (status === 400) {
|
|
64
|
+
return response.text().then(function (_responseText) {
|
|
65
|
+
var result400 = null;
|
|
66
|
+
result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
|
|
67
|
+
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
else if (status === 500) {
|
|
71
|
+
return response.text().then(function (_responseText) {
|
|
72
|
+
return throwException("A server side error occurred.", status, _responseText, _headers);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
else if (status !== 200 && status !== 204) {
|
|
76
|
+
return response.text().then(function (_responseText) {
|
|
77
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return Promise.resolve(null);
|
|
81
|
+
};
|
|
82
|
+
return DirectDebitUKClient;
|
|
83
|
+
}());
|
|
84
|
+
export { DirectDebitUKClient };
|
|
85
|
+
/** One of 'complete', 'error', 'inProgress' */
|
|
86
|
+
export var PaymentObjectStatus;
|
|
87
|
+
(function (PaymentObjectStatus) {
|
|
88
|
+
PaymentObjectStatus["Complete"] = "complete";
|
|
89
|
+
PaymentObjectStatus["Error"] = "error";
|
|
90
|
+
PaymentObjectStatus["InProgress"] = "inProgress";
|
|
91
|
+
})(PaymentObjectStatus || (PaymentObjectStatus = {}));
|
|
92
|
+
/** One of 'credential', 'payment' */
|
|
93
|
+
export var PaymentObjectType;
|
|
94
|
+
(function (PaymentObjectType) {
|
|
95
|
+
PaymentObjectType["Credential"] = "credential";
|
|
96
|
+
PaymentObjectType["Payment"] = "payment";
|
|
97
|
+
})(PaymentObjectType || (PaymentObjectType = {}));
|
|
98
|
+
var ApiException = /** @class */ (function (_super) {
|
|
99
|
+
__extends(ApiException, _super);
|
|
100
|
+
function ApiException(message, status, response, headers, result) {
|
|
101
|
+
var _this = _super.call(this) || this;
|
|
102
|
+
_this.isApiException = true;
|
|
103
|
+
_this.message = message;
|
|
104
|
+
_this.status = status;
|
|
105
|
+
_this.response = response;
|
|
106
|
+
_this.headers = headers;
|
|
107
|
+
_this.result = result;
|
|
108
|
+
return _this;
|
|
109
|
+
}
|
|
110
|
+
ApiException.isApiException = function (obj) {
|
|
111
|
+
return obj.isApiException === true;
|
|
112
|
+
};
|
|
113
|
+
return ApiException;
|
|
114
|
+
}(Error));
|
|
115
|
+
export { ApiException };
|
|
116
|
+
function throwException(message, status, response, headers, result) {
|
|
117
|
+
if (result !== null && result !== undefined)
|
|
118
|
+
throw result;
|
|
119
|
+
else
|
|
120
|
+
throw new ApiException(message, status, response, headers, null);
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,mBAAmB;AACnB,4HAA4H;AAC5H,oBAAoB;AACpB,wBAAwB;;;;;;;;;;;;;;AAExB,oBAAoB;AACpB,oBAAoB;AACpB,uCAAuC;AAEvC;IAKI,6BAAY,OAAgB,EAAE,IAAyE;QAF7F,qBAAgB,GAAmD,SAAS,CAAC;QAGnF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAa,CAAC;QACxC,IAAI,CAAC,OAAO,GAAG,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;IAClG,CAAC;IAED,uCAAS,GAAT,UAAU,MAAc,EAAE,GAAqB;QAA/C,iBAqBC;QApBG,IAAI,IAAI,GAAG,IAAI,CAAC,OAAO,GAAG,uDAAuD,CAAC;QAClF,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI;YACvC,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC/D,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,kBAAkB,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;QACjE,IAAI,GAAG,IAAI,CAAC,OAAO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AACvB,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B;AAwBD;IAAkC,gCAAK;IAOnC,sBAAY,OAAe,EAAE,MAAc,EAAE,QAAgB,EAAE,OAAgC,EAAE,MAAW;QAA5G,YACI,iBAAO,SAOV;QAES,oBAAc,GAAG,IAAI,CAAC;QAP5B,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;IACzB,CAAC;IAIM,2BAAc,GAArB,UAAsB,GAAQ;QAC1B,OAAO,GAAG,CAAC,cAAc,KAAK,IAAI,CAAC;IACvC,CAAC;IACL,mBAAC;AAAD,CAAC,AAtBD,CAAkC,KAAK,GAsBtC;;AAED,SAAS,cAAc,CAAC,OAAe,EAAE,MAAc,EAAE,QAAgB,EAAE,OAAgC,EAAE,MAAY;IACrH,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS;QACvC,MAAM,MAAM,CAAC;;QAEb,MAAM,IAAI,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AACzE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@n3oltd/umbraco-payments-directdebituk-client",
|
|
3
|
+
"author": "N3O Ltd",
|
|
4
|
+
"description": "TODO",
|
|
5
|
+
"version": "12.0.0",
|
|
6
|
+
"dependencies": {},
|
|
7
|
+
"license": "UNLICENSED",
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"module": "./esm/index.js",
|
|
10
|
+
"types": "./esm/index.d.ts",
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"minimist": "^1.2.6",
|
|
13
|
+
"shx": "^0.3.4",
|
|
14
|
+
"typescript": "^3.5.3",
|
|
15
|
+
"uglify-js": "^3.6.0"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": ""
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist/**/*.js",
|
|
23
|
+
"dist/**/*.js.map",
|
|
24
|
+
"dist/**/*.d.ts",
|
|
25
|
+
"dist/**/*.d.ts.map",
|
|
26
|
+
"esm/**/*.js",
|
|
27
|
+
"esm/**/*.js.map",
|
|
28
|
+
"esm/**/*.d.ts",
|
|
29
|
+
"esm/**/*.d.ts.map",
|
|
30
|
+
"src/**/*.ts",
|
|
31
|
+
"README.md",
|
|
32
|
+
"tsconfig.json"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"tsc": "tsc",
|
|
36
|
+
"build": "tsc && shx cp -r esm dist && npm run minify",
|
|
37
|
+
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js"
|
|
38
|
+
},
|
|
39
|
+
"sideEffects": false
|
|
40
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
//----------------------
|
|
2
|
+
// <auto-generated>
|
|
3
|
+
// Generated using the NSwag toolchain v13.18.0.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v10.0.0.0)) (http://NSwag.org)
|
|
4
|
+
// </auto-generated>
|
|
5
|
+
//----------------------
|
|
6
|
+
|
|
7
|
+
/* tslint:disable */
|
|
8
|
+
/* eslint-disable */
|
|
9
|
+
// ReSharper disable InconsistentNaming
|
|
10
|
+
|
|
11
|
+
export class DirectDebitUKClient {
|
|
12
|
+
private http: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> };
|
|
13
|
+
private baseUrl: string;
|
|
14
|
+
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
|
|
15
|
+
|
|
16
|
+
constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> }) {
|
|
17
|
+
this.http = http ? http : window as any;
|
|
18
|
+
this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : "https://localhost:6001";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
storeCard(flowId: string, req: UKBankAccountReq): Promise<PaymentFlowResOfDirectDebitUKCredential> {
|
|
22
|
+
let url_ = this.baseUrl + "/umbraco/api/DirectDebitUK/credentials/{flowId}/store";
|
|
23
|
+
if (flowId === undefined || flowId === null)
|
|
24
|
+
throw new Error("The parameter 'flowId' must be defined.");
|
|
25
|
+
url_ = url_.replace("{flowId}", encodeURIComponent("" + flowId));
|
|
26
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
27
|
+
|
|
28
|
+
const content_ = JSON.stringify(req);
|
|
29
|
+
|
|
30
|
+
let options_: RequestInit = {
|
|
31
|
+
body: content_,
|
|
32
|
+
method: "POST",
|
|
33
|
+
headers: {
|
|
34
|
+
"Content-Type": "application/json",
|
|
35
|
+
"Accept": "application/json"
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return this.http.fetch(url_, options_).then((_response: Response) => {
|
|
40
|
+
return this.processStoreCard(_response);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
protected processStoreCard(response: Response): Promise<PaymentFlowResOfDirectDebitUKCredential> {
|
|
45
|
+
const status = response.status;
|
|
46
|
+
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
|
47
|
+
if (status === 200) {
|
|
48
|
+
return response.text().then((_responseText) => {
|
|
49
|
+
let result200: any = null;
|
|
50
|
+
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as PaymentFlowResOfDirectDebitUKCredential;
|
|
51
|
+
return result200;
|
|
52
|
+
});
|
|
53
|
+
} else if (status === 400) {
|
|
54
|
+
return response.text().then((_responseText) => {
|
|
55
|
+
let result400: any = null;
|
|
56
|
+
result400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
|
|
57
|
+
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
|
|
58
|
+
});
|
|
59
|
+
} else if (status === 500) {
|
|
60
|
+
return response.text().then((_responseText) => {
|
|
61
|
+
return throwException("A server side error occurred.", status, _responseText, _headers);
|
|
62
|
+
});
|
|
63
|
+
} else if (status !== 200 && status !== 204) {
|
|
64
|
+
return response.text().then((_responseText) => {
|
|
65
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return Promise.resolve<PaymentFlowResOfDirectDebitUKCredential>(null as any);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface PaymentFlowResOfDirectDebitUKCredential {
|
|
73
|
+
flowRevision?: number;
|
|
74
|
+
result?: DirectDebitUKCredential | undefined;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface DirectDebitUKCredential {
|
|
78
|
+
advancePayment?: Payment | undefined;
|
|
79
|
+
setupAt?: Date | undefined;
|
|
80
|
+
isSetUp?: boolean;
|
|
81
|
+
type?: PaymentObjectType | undefined;
|
|
82
|
+
completeAt?: Date | undefined;
|
|
83
|
+
errorAt?: Date | undefined;
|
|
84
|
+
errorMessage?: string | undefined;
|
|
85
|
+
exceptionDetails?: string | undefined;
|
|
86
|
+
status?: PaymentObjectStatus | undefined;
|
|
87
|
+
method?: string | undefined;
|
|
88
|
+
bankAccount?: UKBankAccount | undefined;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface Payment {
|
|
92
|
+
completeAt?: Date | undefined;
|
|
93
|
+
errorAt?: Date | undefined;
|
|
94
|
+
errorMessage?: string | undefined;
|
|
95
|
+
exceptionDetails?: string | undefined;
|
|
96
|
+
status?: PaymentObjectStatus | undefined;
|
|
97
|
+
card?: CardPayment | undefined;
|
|
98
|
+
paidAt?: Date | undefined;
|
|
99
|
+
declinedAt?: Date | undefined;
|
|
100
|
+
declinedReason?: string | undefined;
|
|
101
|
+
isDeclined?: boolean;
|
|
102
|
+
isPaid?: boolean;
|
|
103
|
+
type?: PaymentObjectType | undefined;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** One of 'complete', 'error', 'inProgress' */
|
|
107
|
+
export enum PaymentObjectStatus {
|
|
108
|
+
Complete = "complete",
|
|
109
|
+
Error = "error",
|
|
110
|
+
InProgress = "inProgress",
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface CardPayment {
|
|
114
|
+
threeDSecureRequired?: boolean;
|
|
115
|
+
threeDSecureCompleted?: boolean;
|
|
116
|
+
threeDSecureV1?: ThreeDSecureV1 | undefined;
|
|
117
|
+
threeDSecureV2?: ThreeDSecureV2 | undefined;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface ThreeDSecureV1 {
|
|
121
|
+
acsUrl?: string | undefined;
|
|
122
|
+
md?: string | undefined;
|
|
123
|
+
paReq?: string | undefined;
|
|
124
|
+
paRes?: string | undefined;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface ThreeDSecureV2 {
|
|
128
|
+
acsUrl?: string | undefined;
|
|
129
|
+
acsTransId?: string | undefined;
|
|
130
|
+
sessionData?: string | undefined;
|
|
131
|
+
cReq?: string | undefined;
|
|
132
|
+
cRes?: string | undefined;
|
|
133
|
+
html?: string | undefined;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** One of 'credential', 'payment' */
|
|
137
|
+
export enum PaymentObjectType {
|
|
138
|
+
Credential = "credential",
|
|
139
|
+
Payment = "payment",
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface UKBankAccount {
|
|
143
|
+
accountHolder?: string | undefined;
|
|
144
|
+
accountNumber?: string | undefined;
|
|
145
|
+
sortCode?: string | undefined;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface ProblemDetails {
|
|
149
|
+
type?: string | undefined;
|
|
150
|
+
title?: string | undefined;
|
|
151
|
+
status?: number | undefined;
|
|
152
|
+
detail?: string | undefined;
|
|
153
|
+
instance?: string | undefined;
|
|
154
|
+
|
|
155
|
+
[key: string]: any;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface UKBankAccountReq {
|
|
159
|
+
accountHolder?: string | undefined;
|
|
160
|
+
accountNumber?: string | undefined;
|
|
161
|
+
sortCode?: string | undefined;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export class ApiException extends Error {
|
|
165
|
+
message: string;
|
|
166
|
+
status: number;
|
|
167
|
+
response: string;
|
|
168
|
+
headers: { [key: string]: any; };
|
|
169
|
+
result: any;
|
|
170
|
+
|
|
171
|
+
constructor(message: string, status: number, response: string, headers: { [key: string]: any; }, result: any) {
|
|
172
|
+
super();
|
|
173
|
+
|
|
174
|
+
this.message = message;
|
|
175
|
+
this.status = status;
|
|
176
|
+
this.response = response;
|
|
177
|
+
this.headers = headers;
|
|
178
|
+
this.result = result;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
protected isApiException = true;
|
|
182
|
+
|
|
183
|
+
static isApiException(obj: any): obj is ApiException {
|
|
184
|
+
return obj.isApiException === true;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function throwException(message: string, status: number, response: string, headers: { [key: string]: any; }, result?: any): any {
|
|
189
|
+
if (result !== null && result !== undefined)
|
|
190
|
+
throw result;
|
|
191
|
+
else
|
|
192
|
+
throw new ApiException(message, status, response, headers, null);
|
|
193
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "es6",
|
|
4
|
+
"moduleResolution": "node",
|
|
5
|
+
"strict": true,
|
|
6
|
+
"target": "es5",
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"declarationMap": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"allowSyntheticDefaultImports": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"lib": ["es6", "dom"],
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"outDir": "./esm",
|
|
15
|
+
"importHelpers": false,
|
|
16
|
+
"noEmitHelpers": false,
|
|
17
|
+
"rootDir": "src"
|
|
18
|
+
},
|
|
19
|
+
"include": ["./src/**/*.ts"],
|
|
20
|
+
"exclude": ["node_modules"]
|
|
21
|
+
}
|