@n3oltd/umbraco-payments-stripe-client 9.0.0-beta-94
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/build/esm/index.d.ts +32 -0
- package/build/esm/index.d.ts.map +1 -0
- package/build/esm/index.js +99 -0
- package/build/esm/index.js.map +1 -0
- package/build/index.d.ts +32 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +99 -0
- package/build/index.js.map +1 -0
- package/build/index.min.js +1 -0
- package/build/index.min.js.map +1 -0
- package/esm/index.d.ts +32 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +99 -0
- package/esm/index.js.map +1 -0
- package/package.json +40 -0
- package/src/index.ts +98 -0
- package/tsconfig.json +21 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
TypeScript client for the N3O Umbraco Payments Stripe
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare class StripeClient {
|
|
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
|
+
none(): Promise<void>;
|
|
9
|
+
protected processNone(response: Response): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export interface ProblemDetails {
|
|
12
|
+
type?: string | undefined;
|
|
13
|
+
title?: string | undefined;
|
|
14
|
+
status?: number | undefined;
|
|
15
|
+
detail?: string | undefined;
|
|
16
|
+
instance?: string | undefined;
|
|
17
|
+
}
|
|
18
|
+
export declare class ApiException extends Error {
|
|
19
|
+
message: string;
|
|
20
|
+
status: number;
|
|
21
|
+
response: string;
|
|
22
|
+
headers: {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
};
|
|
25
|
+
result: any;
|
|
26
|
+
constructor(message: string, status: number, response: string, headers: {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}, result: any);
|
|
29
|
+
protected isApiException: boolean;
|
|
30
|
+
static isApiException(obj: any): obj is ApiException;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,qBAAa,YAAY;IACrB,OAAO,CAAC,IAAI,CAAqE;IACjF,OAAO,CAAC,OAAO,CAAS;IACxB,SAAS,CAAC,gBAAgB,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC,GAAG,SAAS,CAAa;gBAE3E,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;KAAE;IAKvG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAerB,SAAS,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAwB3D;AAED,MAAM,WAAW,cAAc;IAC3B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAED,qBAAa,YAAa,SAAQ,KAAK;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,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"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
//----------------------
|
|
4
|
+
// <auto-generated>
|
|
5
|
+
// Generated using the NSwag toolchain v13.15.5.0 (NJsonSchema v10.6.6.0 (Newtonsoft.Json v9.0.0.0)) (http://NSwag.org)
|
|
6
|
+
// </auto-generated>
|
|
7
|
+
//----------------------
|
|
8
|
+
// ReSharper disable InconsistentNaming
|
|
9
|
+
var __extends = (this && this.__extends) || (function () {
|
|
10
|
+
var extendStatics = function (d, b) {
|
|
11
|
+
extendStatics = Object.setPrototypeOf ||
|
|
12
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
13
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
14
|
+
return extendStatics(d, b);
|
|
15
|
+
};
|
|
16
|
+
return function (d, b) {
|
|
17
|
+
extendStatics(d, b);
|
|
18
|
+
function __() { this.constructor = d; }
|
|
19
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
20
|
+
};
|
|
21
|
+
})();
|
|
22
|
+
var StripeClient = /** @class */ (function () {
|
|
23
|
+
function StripeClient(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
|
+
StripeClient.prototype.none = function () {
|
|
29
|
+
var _this = this;
|
|
30
|
+
var url_ = this.baseUrl + "/umbraco/api/Stripe";
|
|
31
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
32
|
+
var options_ = {
|
|
33
|
+
method: "GET",
|
|
34
|
+
headers: {}
|
|
35
|
+
};
|
|
36
|
+
return this.http.fetch(url_, options_).then(function (_response) {
|
|
37
|
+
return _this.processNone(_response);
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
StripeClient.prototype.processNone = function (response) {
|
|
41
|
+
var _this = this;
|
|
42
|
+
var status = response.status;
|
|
43
|
+
var _headers = {};
|
|
44
|
+
if (response.headers && response.headers.forEach) {
|
|
45
|
+
response.headers.forEach(function (v, k) { return _headers[k] = v; });
|
|
46
|
+
}
|
|
47
|
+
;
|
|
48
|
+
if (status === 200) {
|
|
49
|
+
return response.text().then(function (_responseText) {
|
|
50
|
+
return;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
else if (status === 400) {
|
|
54
|
+
return response.text().then(function (_responseText) {
|
|
55
|
+
var result400 = null;
|
|
56
|
+
result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
|
|
57
|
+
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
else if (status === 500) {
|
|
61
|
+
return response.text().then(function (_responseText) {
|
|
62
|
+
return throwException("A server side error occurred.", status, _responseText, _headers);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
else if (status !== 200 && status !== 204) {
|
|
66
|
+
return response.text().then(function (_responseText) {
|
|
67
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return Promise.resolve(null);
|
|
71
|
+
};
|
|
72
|
+
return StripeClient;
|
|
73
|
+
}());
|
|
74
|
+
export { StripeClient };
|
|
75
|
+
var ApiException = /** @class */ (function (_super) {
|
|
76
|
+
__extends(ApiException, _super);
|
|
77
|
+
function ApiException(message, status, response, headers, result) {
|
|
78
|
+
var _this = _super.call(this) || this;
|
|
79
|
+
_this.isApiException = true;
|
|
80
|
+
_this.message = message;
|
|
81
|
+
_this.status = status;
|
|
82
|
+
_this.response = response;
|
|
83
|
+
_this.headers = headers;
|
|
84
|
+
_this.result = result;
|
|
85
|
+
return _this;
|
|
86
|
+
}
|
|
87
|
+
ApiException.isApiException = function (obj) {
|
|
88
|
+
return obj.isApiException === true;
|
|
89
|
+
};
|
|
90
|
+
return ApiException;
|
|
91
|
+
}(Error));
|
|
92
|
+
export { ApiException };
|
|
93
|
+
function throwException(message, status, response, headers, result) {
|
|
94
|
+
if (result !== null && result !== undefined)
|
|
95
|
+
throw result;
|
|
96
|
+
else
|
|
97
|
+
throw new ApiException(message, status, response, headers, null);
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,oBAAoB;AACpB,wBAAwB;AACxB,mBAAmB;AACnB,2HAA2H;AAC3H,oBAAoB;AACpB,wBAAwB;AACxB,uCAAuC;;;;;;;;;;;;;;AAEvC;IAKI,sBAAY,OAAgB,EAAE,IAAyE;QAF7F,qBAAgB,GAAmD,SAAS,CAAC;QAGnF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAM,MAAM,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;IAClG,CAAC;IAED,2BAAI,GAAJ;QAAA,iBAaC;QAZG,IAAI,IAAI,GAAG,IAAI,CAAC,OAAO,GAAG,qBAAqB,CAAC;QAChD,IAAI,GAAG,IAAI,CAA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,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/build/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare class StripeClient {
|
|
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
|
+
none(): Promise<void>;
|
|
9
|
+
protected processNone(response: Response): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export interface ProblemDetails {
|
|
12
|
+
type?: string | undefined;
|
|
13
|
+
title?: string | undefined;
|
|
14
|
+
status?: number | undefined;
|
|
15
|
+
detail?: string | undefined;
|
|
16
|
+
instance?: string | undefined;
|
|
17
|
+
}
|
|
18
|
+
export declare class ApiException extends Error {
|
|
19
|
+
message: string;
|
|
20
|
+
status: number;
|
|
21
|
+
response: string;
|
|
22
|
+
headers: {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
};
|
|
25
|
+
result: any;
|
|
26
|
+
constructor(message: string, status: number, response: string, headers: {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}, result: any);
|
|
29
|
+
protected isApiException: boolean;
|
|
30
|
+
static isApiException(obj: any): obj is ApiException;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,qBAAa,YAAY;IACrB,OAAO,CAAC,IAAI,CAAqE;IACjF,OAAO,CAAC,OAAO,CAAS;IACxB,SAAS,CAAC,gBAAgB,EAAE,CAAC,CAAC,GAAG,EAAE,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
+
/* eslint-disable */
|
|
3
|
+
//----------------------
|
|
4
|
+
// <auto-generated>
|
|
5
|
+
// Generated using the NSwag toolchain v13.15.5.0 (NJsonSchema v10.6.6.0 (Newtonsoft.Json v9.0.0.0)) (http://NSwag.org)
|
|
6
|
+
// </auto-generated>
|
|
7
|
+
//----------------------
|
|
8
|
+
// ReSharper disable InconsistentNaming
|
|
9
|
+
var __extends = (this && this.__extends) || (function () {
|
|
10
|
+
var extendStatics = function (d, b) {
|
|
11
|
+
extendStatics = Object.setPrototypeOf ||
|
|
12
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
13
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
14
|
+
return extendStatics(d, b);
|
|
15
|
+
};
|
|
16
|
+
return function (d, b) {
|
|
17
|
+
extendStatics(d, b);
|
|
18
|
+
function __() { this.constructor = d; }
|
|
19
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
20
|
+
};
|
|
21
|
+
})();
|
|
22
|
+
var StripeClient = /** @class */ (function () {
|
|
23
|
+
function StripeClient(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
|
+
StripeClient.prototype.none = function () {
|
|
29
|
+
var _this = this;
|
|
30
|
+
var url_ = this.baseUrl + "/umbraco/api/Stripe";
|
|
31
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
32
|
+
var options_ = {
|
|
33
|
+
method: "GET",
|
|
34
|
+
headers: {}
|
|
35
|
+
};
|
|
36
|
+
return this.http.fetch(url_, options_).then(function (_response) {
|
|
37
|
+
return _this.processNone(_response);
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
StripeClient.prototype.processNone = function (response) {
|
|
41
|
+
var _this = this;
|
|
42
|
+
var status = response.status;
|
|
43
|
+
var _headers = {};
|
|
44
|
+
if (response.headers && response.headers.forEach) {
|
|
45
|
+
response.headers.forEach(function (v, k) { return _headers[k] = v; });
|
|
46
|
+
}
|
|
47
|
+
;
|
|
48
|
+
if (status === 200) {
|
|
49
|
+
return response.text().then(function (_responseText) {
|
|
50
|
+
return;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
else if (status === 400) {
|
|
54
|
+
return response.text().then(function (_responseText) {
|
|
55
|
+
var result400 = null;
|
|
56
|
+
result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
|
|
57
|
+
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
else if (status === 500) {
|
|
61
|
+
return response.text().then(function (_responseText) {
|
|
62
|
+
return throwException("A server side error occurred.", status, _responseText, _headers);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
else if (status !== 200 && status !== 204) {
|
|
66
|
+
return response.text().then(function (_responseText) {
|
|
67
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return Promise.resolve(null);
|
|
71
|
+
};
|
|
72
|
+
return StripeClient;
|
|
73
|
+
}());
|
|
74
|
+
export { StripeClient };
|
|
75
|
+
var ApiException = /** @class */ (function (_super) {
|
|
76
|
+
__extends(ApiException, _super);
|
|
77
|
+
function ApiException(message, status, response, headers, result) {
|
|
78
|
+
var _this = _super.call(this) || this;
|
|
79
|
+
_this.isApiException = true;
|
|
80
|
+
_this.message = message;
|
|
81
|
+
_this.status = status;
|
|
82
|
+
_this.response = response;
|
|
83
|
+
_this.headers = headers;
|
|
84
|
+
_this.result = result;
|
|
85
|
+
return _this;
|
|
86
|
+
}
|
|
87
|
+
ApiException.isApiException = function (obj) {
|
|
88
|
+
return obj.isApiException === true;
|
|
89
|
+
};
|
|
90
|
+
return ApiException;
|
|
91
|
+
}(Error));
|
|
92
|
+
export { ApiException };
|
|
93
|
+
function throwException(message, status, response, headers, result) {
|
|
94
|
+
if (result !== null && result !== undefined)
|
|
95
|
+
throw result;
|
|
96
|
+
else
|
|
97
|
+
throw new ApiException(message, status, response, headers, null);
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,oBAAoB;AACpB,wBAAwB;AACxB,mBAAmB;AACnB,2HAA2H;AAC3H,oBAAoB;AACpB,wBAAwB;AACxB,uCAAuC;;;;;;;;;;;;;;AAEvC;IAKI,sBAAY,OAAgB,EAAE,IAAyE;QAF7F,qBAAgB,GAAmD,SAAS,CAAC;QAGnF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAM,MAAM,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;IAClG,CAAC;IAED,2BAAI,GAAJ;QAAA,iBAaC;QAZG,IAAI,IAAI,GAAG,IAAI,CAAC,OAAO,GAAG,qBAAqB,CAAC;QAChD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAEjC,IAAI,QAAQ,GAAgB;YACxB,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,EACR;SACJ,CAAC;QAEF,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,UAAC,SAAmB;YAC5D,OAAO,KAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACP,CAAC;IAES,kCAAW,GAArB,UAAsB,QAAkB;QAAxC,iBAuB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Aa;gBAC1C,OAAO,cAAc,CAAC,sCAAsC,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC;YAC/F,CAAC,CAAC,CAAC;SACN;QACD,OAAO,OAAO,CAAC,OAAO,CAAY,IAAI,CAAC,CAAC;IAC5C,CAAC;IACL,mBAAC;AAAD,CAAC,AAjDD,IAiDC;;AAUD;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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __extends=this&&this.__extends||function(){var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};return function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),StripeClient=function(){function t(t,e){this.jsonParseReviver=void 0,this.http=e||window,this.baseUrl=null!=t?t:"https://localhost:6001"}return t.prototype.none=function(){var e=this,t=(t=this.baseUrl+"/umbraco/api/Stripe").replace(/[?&]$/,"");return this.http.fetch(t,{method:"GET",headers:{}}).then(function(t){return e.processNone(t)})},t.prototype.processNone=function(t){var r=this,n=t.status,o={};return t.headers&&t.headers.forEach&&t.headers.forEach(function(t,e){return o[e]=t}),200===n?t.text().then(function(t){}):400===n?t.text().then(function(t){var e=""===t?null:JSON.parse(t,r.jsonParseReviver);return throwException("A server side error occurred.",n,t,o,e)}):500===n?t.text().then(function(t){return throwException("A server side error occurred.",n,t,o)}):200!==n&&204!==n?t.text().then(function(t){return throwException("An unexpected server error occurred.",n,t,o)}):Promise.resolve(null)},t}(),ApiException=function(s){function t(t,e,r,n,o){var i=s.call(this)||this;return i.isApiException=!0,i.message=t,i.status=e,i.response=r,i.headers=n,i.result=o,i}return __extends(t,s),t.isApiException=function(t){return!0===t.isApiException},t}(Error);function throwException(t,e,r,n,o){throw null!=o?o:new ApiException(t,e,r,n,null)}export{StripeClient,ApiException};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["StripeClient","baseUrl","http","this","jsonParseReviver","undefined","window","prototype","none","_this","url_","replace","fetch","method","headers","then","_response","processNone","response","status","_headers","forEach","v","k","text","_responseText","result400","JSON","parse","throwException","Promise","resolve","ApiException","_super","message","result","call","isApiException","__extends","obj","Error"],"mappings":"6WASAA,aAAA,WAKI,SAAAA,EAAYC,EAAkBC,GAFpBC,KAAAC,sBAAmEC,EAGzEF,KAAKD,KAAOA,GAAmBI,OAC/BH,KAAKF,QAAUA,MAAAA,EAA4CA,EAAU,yBA0C7E,OAvCID,EAAAO,UAAAC,KAAA,WAAA,IAAAC,EAAAN,KAEIO,GAAOA,EADIP,KAAKF,QAAU,uBACdU,QAAQ,Q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AA,EACMA,EAEA,IAAIH,aAAaE,EAASf,EAAQD,EAAUJ,EAAS,a"}
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare class StripeClient {
|
|
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
|
+
none(): Promise<void>;
|
|
9
|
+
protected processNone(response: Response): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export interface ProblemDetails {
|
|
12
|
+
type?: string | undefined;
|
|
13
|
+
title?: string | undefined;
|
|
14
|
+
status?: number | undefined;
|
|
15
|
+
detail?: string | undefined;
|
|
16
|
+
instance?: string | undefined;
|
|
17
|
+
}
|
|
18
|
+
export declare class ApiException extends Error {
|
|
19
|
+
message: string;
|
|
20
|
+
status: number;
|
|
21
|
+
response: string;
|
|
22
|
+
headers: {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
};
|
|
25
|
+
result: any;
|
|
26
|
+
constructor(message: string, status: number, response: string, headers: {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}, result: any);
|
|
29
|
+
protected isApiException: boolean;
|
|
30
|
+
static isApiException(obj: any): obj is ApiException;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,qBAAa,YAAY;IACrB,OAAO,CAAC,IAAI,CAAqE;IACjF,OAAO,CAAC,OAAO,CAAS;IACxB,SAAS,CAAC,gBAAgB,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC,GAAG,SAAS,CAAa;gBAE3E,OAAO,CAAC,EAAE,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.5.0 (NJsonSchema v10.6.6.0 (Newtonsoft.Json v9.0.0.0)) (http://NSwag.org)
|
|
6
|
+
// </auto-generated>
|
|
7
|
+
//----------------------
|
|
8
|
+
// ReSharper disable InconsistentNaming
|
|
9
|
+
var __extends = (this && this.__extends) || (function () {
|
|
10
|
+
var extendStatics = function (d, b) {
|
|
11
|
+
extendStatics = Object.setPrototypeOf ||
|
|
12
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
13
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
14
|
+
return extendStatics(d, b);
|
|
15
|
+
};
|
|
16
|
+
return function (d, b) {
|
|
17
|
+
extendStatics(d, b);
|
|
18
|
+
function __() { this.constructor = d; }
|
|
19
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
20
|
+
};
|
|
21
|
+
})();
|
|
22
|
+
var StripeClient = /** @class */ (function () {
|
|
23
|
+
function StripeClient(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
|
+
StripeClient.prototype.none = function () {
|
|
29
|
+
var _this = this;
|
|
30
|
+
var url_ = this.baseUrl + "/umbraco/api/Stripe";
|
|
31
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
32
|
+
var options_ = {
|
|
33
|
+
method: "GET",
|
|
34
|
+
headers: {}
|
|
35
|
+
};
|
|
36
|
+
return this.http.fetch(url_, options_).then(function (_response) {
|
|
37
|
+
return _this.processNone(_response);
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
StripeClient.prototype.processNone = function (response) {
|
|
41
|
+
var _this = this;
|
|
42
|
+
var status = response.status;
|
|
43
|
+
var _headers = {};
|
|
44
|
+
if (response.headers && response.headers.forEach) {
|
|
45
|
+
response.headers.forEach(function (v, k) { return _headers[k] = v; });
|
|
46
|
+
}
|
|
47
|
+
;
|
|
48
|
+
if (status === 200) {
|
|
49
|
+
return response.text().then(function (_responseText) {
|
|
50
|
+
return;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
else if (status === 400) {
|
|
54
|
+
return response.text().then(function (_responseText) {
|
|
55
|
+
var result400 = null;
|
|
56
|
+
result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
|
|
57
|
+
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
else if (status === 500) {
|
|
61
|
+
return response.text().then(function (_responseText) {
|
|
62
|
+
return throwException("A server side error occurred.", status, _responseText, _headers);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
else if (status !== 200 && status !== 204) {
|
|
66
|
+
return response.text().then(function (_responseText) {
|
|
67
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return Promise.resolve(null);
|
|
71
|
+
};
|
|
72
|
+
return StripeClient;
|
|
73
|
+
}());
|
|
74
|
+
export { StripeClient };
|
|
75
|
+
var ApiException = /** @class */ (function (_super) {
|
|
76
|
+
__extends(ApiException, _super);
|
|
77
|
+
function ApiException(message, status, response, headers, result) {
|
|
78
|
+
var _this = _super.call(this) || this;
|
|
79
|
+
_this.isApiException = true;
|
|
80
|
+
_this.message = message;
|
|
81
|
+
_this.status = status;
|
|
82
|
+
_this.response = response;
|
|
83
|
+
_this.headers = headers;
|
|
84
|
+
_this.result = result;
|
|
85
|
+
return _this;
|
|
86
|
+
}
|
|
87
|
+
ApiException.isApiException = function (obj) {
|
|
88
|
+
return obj.isApiException === true;
|
|
89
|
+
};
|
|
90
|
+
return ApiException;
|
|
91
|
+
}(Error));
|
|
92
|
+
export { ApiException };
|
|
93
|
+
function throwException(message, status, response, headers, result) {
|
|
94
|
+
if (result !== null && result !== undefined)
|
|
95
|
+
throw result;
|
|
96
|
+
else
|
|
97
|
+
throw new ApiException(message, status, response, headers, null);
|
|
98
|
+
}
|
|
99
|
+
//# 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,oBAAoB;AACpB,oBAAoB;AACpB,wBAAwB;AACxB,mBAAmB;AACnB,2HAA2H;AAC3H,oBAAoB;AACpB,wBAAwB;AACxB,uCAAuC;;;;;;;;;;;;;;AAEvC;IAKI,sBAAY,OAAgB,EAAE,IAAyE;QAF7F,qBAAgB,GAAmD,SAAS,CAAC;QAGnF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAM,MAAM,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;IAClG,CAAC;IAED,2BAAI,GAAJ;QAAA,iBAaC;QAZG,IAAI,IAAI,GAAG,IAAI,CAAC,OAAO,GAAG,qBAAqB,CAAC;QAChD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAEjC,IAAI,QAAQ,GAAgB;YACxB,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,EACR;SACJ,CAAC;QAEF,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,UAAC,SAAmB;YAC5D,OAAO,KAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACP,CAAC;IAES,kCAAW,GAArB,UAAsB,QAAkB;QAAxC,iBAuBC;QAtBG,IAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QAC/B,IAAI,QAAQ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Q,CAAC,CAAC;YAC/F,CAAC,CAAC,CAAC;SACN;QACD,OAAO,OAAO,CAAC,OAAO,CAAY,IAAI,CAAC,CAAC;IAC5C,CAAC;IACL,mBAAC;AAAD,CAAC,AAjDD,IAiDC;;AAUD;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-stripe-client",
|
|
3
|
+
"author": "N3O Ltd",
|
|
4
|
+
"description": "TypeScript client for the N3O Umbraco Payments Stripe",
|
|
5
|
+
"version": "9.0.0-beta-94",
|
|
6
|
+
"dependencies": {},
|
|
7
|
+
"license": "UNLICENSED",
|
|
8
|
+
"main": "./build/index.js",
|
|
9
|
+
"module": "./esm/index.js",
|
|
10
|
+
"types": "./esm/index.d.ts",
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"shx": "^0.3.4",
|
|
13
|
+
"typescript": "^3.5.3",
|
|
14
|
+
"uglify-js": "^3.6.0"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": ""
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"build/**/*.js",
|
|
22
|
+
"build/**/*.js.map",
|
|
23
|
+
"build/**/*.d.ts",
|
|
24
|
+
"build/**/*.d.ts.map",
|
|
25
|
+
"esm/**/*.js",
|
|
26
|
+
"esm/**/*.js.map",
|
|
27
|
+
"esm/**/*.d.ts",
|
|
28
|
+
"esm/**/*.d.ts.map",
|
|
29
|
+
"src/**/*.ts",
|
|
30
|
+
"README.md",
|
|
31
|
+
"tsconfig.json"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"tsc": "tsc",
|
|
35
|
+
"build": "tsc && shx cp -r esm build && npm run minify",
|
|
36
|
+
"minify": "uglifyjs -c -m --comments --source-map \"content='./build/index.js.map'\" -o ./build/index.min.js ./build/index.js",
|
|
37
|
+
"prepack": "npm install && npm run build"
|
|
38
|
+
},
|
|
39
|
+
"sideEffects": false
|
|
40
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
//----------------------
|
|
4
|
+
// <auto-generated>
|
|
5
|
+
// Generated using the NSwag toolchain v13.15.5.0 (NJsonSchema v10.6.6.0 (Newtonsoft.Json v9.0.0.0)) (http://NSwag.org)
|
|
6
|
+
// </auto-generated>
|
|
7
|
+
//----------------------
|
|
8
|
+
// ReSharper disable InconsistentNaming
|
|
9
|
+
|
|
10
|
+
export class StripeClient {
|
|
11
|
+
private http: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> };
|
|
12
|
+
private baseUrl: string;
|
|
13
|
+
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
|
|
14
|
+
|
|
15
|
+
constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> }) {
|
|
16
|
+
this.http = http ? http : <any>window;
|
|
17
|
+
this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : "https://localhost:6001";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
none(): Promise<void> {
|
|
21
|
+
let url_ = this.baseUrl + "/umbraco/api/Stripe";
|
|
22
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
23
|
+
|
|
24
|
+
let options_ = <RequestInit>{
|
|
25
|
+
method: "GET",
|
|
26
|
+
headers: {
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return this.http.fetch(url_, options_).then((_response: Response) => {
|
|
31
|
+
return this.processNone(_response);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
protected processNone(response: Response): Promise<void> {
|
|
36
|
+
const status = response.status;
|
|
37
|
+
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
|
38
|
+
if (status === 200) {
|
|
39
|
+
return response.text().then((_responseText) => {
|
|
40
|
+
return;
|
|
41
|
+
});
|
|
42
|
+
} else if (status === 400) {
|
|
43
|
+
return response.text().then((_responseText) => {
|
|
44
|
+
let result400: any = null;
|
|
45
|
+
result400 = _responseText === "" ? null : <ProblemDetails>JSON.parse(_responseText, this.jsonParseReviver);
|
|
46
|
+
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
|
|
47
|
+
});
|
|
48
|
+
} else if (status === 500) {
|
|
49
|
+
return response.text().then((_responseText) => {
|
|
50
|
+
return throwException("A server side error occurred.", status, _responseText, _headers);
|
|
51
|
+
});
|
|
52
|
+
} else if (status !== 200 && status !== 204) {
|
|
53
|
+
return response.text().then((_responseText) => {
|
|
54
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return Promise.resolve<void>(<any>null);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface ProblemDetails {
|
|
62
|
+
type?: string | undefined;
|
|
63
|
+
title?: string | undefined;
|
|
64
|
+
status?: number | undefined;
|
|
65
|
+
detail?: string | undefined;
|
|
66
|
+
instance?: string | undefined;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export class ApiException extends Error {
|
|
70
|
+
message: string;
|
|
71
|
+
status: number;
|
|
72
|
+
response: string;
|
|
73
|
+
headers: { [key: string]: any; };
|
|
74
|
+
result: any;
|
|
75
|
+
|
|
76
|
+
constructor(message: string, status: number, response: string, headers: { [key: string]: any; }, result: any) {
|
|
77
|
+
super();
|
|
78
|
+
|
|
79
|
+
this.message = message;
|
|
80
|
+
this.status = status;
|
|
81
|
+
this.response = response;
|
|
82
|
+
this.headers = headers;
|
|
83
|
+
this.result = result;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
protected isApiException = true;
|
|
87
|
+
|
|
88
|
+
static isApiException(obj: any): obj is ApiException {
|
|
89
|
+
return obj.isApiException === true;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function throwException(message: string, status: number, response: string, headers: { [key: string]: any; }, result?: any): any {
|
|
94
|
+
if (result !== null && result !== undefined)
|
|
95
|
+
throw result;
|
|
96
|
+
else
|
|
97
|
+
throw new ApiException(message, status, response, headers, null);
|
|
98
|
+
}
|
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
|
+
}
|