@emilgroup/payment-sdk-node 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/api.ts +0 -5
- package/base.ts +4 -3
- package/dist/api.d.ts +0 -4
- package/dist/api.js +0 -6
- package/dist/base.d.ts +3 -2
- package/dist/base.js +4 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/index.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,11 +17,11 @@ Although this package can be used in both TypeScript and JavaScript, it is inten
|
|
|
17
17
|
Navigate to the folder of your consuming project and run one of the following commands:
|
|
18
18
|
|
|
19
19
|
```
|
|
20
|
-
npm install @emilgroup/payment-sdk-node@1.
|
|
20
|
+
npm install @emilgroup/payment-sdk-node@1.3.0 --save
|
|
21
21
|
```
|
|
22
22
|
or
|
|
23
23
|
```
|
|
24
|
-
yarn add @emilgroup/payment-sdk-node@1.
|
|
24
|
+
yarn add @emilgroup/payment-sdk-node@1.3.0
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
And then you can import `PaymentsApi`.
|
package/api.ts
CHANGED
package/base.ts
CHANGED
|
@@ -47,6 +47,7 @@ export interface LoginClass {
|
|
|
47
47
|
export enum Environment {
|
|
48
48
|
Production = 'https://apiv2.emil.de',
|
|
49
49
|
Test = 'https://apiv2-test.emil.de',
|
|
50
|
+
Development = 'https://apiv2-dev.emil.de',
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
let _retry_count = 0
|
|
@@ -169,7 +170,7 @@ export class BaseAPI {
|
|
|
169
170
|
this.configuration.refreshToken = refreshToken;
|
|
170
171
|
}
|
|
171
172
|
|
|
172
|
-
async
|
|
173
|
+
async refreshTokenInternal(): Promise<string> {
|
|
173
174
|
const { username, refreshToken } = this.configuration;
|
|
174
175
|
|
|
175
176
|
|
|
@@ -219,7 +220,7 @@ export class BaseAPI {
|
|
|
219
220
|
if (err.response.status === 401 && !originalConfig._retry) {
|
|
220
221
|
originalConfig._retry = true;
|
|
221
222
|
try {
|
|
222
|
-
const tokenString = await this.
|
|
223
|
+
const tokenString = await this.refreshTokenInternal();
|
|
223
224
|
const accessToken = `Bearer ${tokenString}`;
|
|
224
225
|
|
|
225
226
|
originalConfig.headers['Authorization'] = `Bearer ${accessToken}`
|
|
@@ -244,7 +245,7 @@ export class BaseAPI {
|
|
|
244
245
|
){
|
|
245
246
|
_retry_count++;
|
|
246
247
|
try {
|
|
247
|
-
const tokenString = await this.
|
|
248
|
+
const tokenString = await this.refreshTokenInternal();
|
|
248
249
|
const accessToken = `Bearer ${tokenString}`;
|
|
249
250
|
|
|
250
251
|
_retry = true;
|
package/dist/api.d.ts
CHANGED
|
@@ -16,7 +16,3 @@ export * from './api/payment-service-providers-api';
|
|
|
16
16
|
export * from './api/payment-setup-api';
|
|
17
17
|
export * from './api/payments-api';
|
|
18
18
|
export * from './api/webhooks-api';
|
|
19
|
-
export declare enum Environment {
|
|
20
|
-
Production = "https://apiv2.emil.de",
|
|
21
|
-
Test = "https://apiv2-test.emil.de"
|
|
22
|
-
}
|
package/dist/api.js
CHANGED
|
@@ -27,7 +27,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
27
27
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.Environment = void 0;
|
|
31
30
|
__exportStar(require("./api/bank-accounts-api"), exports);
|
|
32
31
|
__exportStar(require("./api/payment-methods-api"), exports);
|
|
33
32
|
__exportStar(require("./api/payment-reminders-api"), exports);
|
|
@@ -35,8 +34,3 @@ __exportStar(require("./api/payment-service-providers-api"), exports);
|
|
|
35
34
|
__exportStar(require("./api/payment-setup-api"), exports);
|
|
36
35
|
__exportStar(require("./api/payments-api"), exports);
|
|
37
36
|
__exportStar(require("./api/webhooks-api"), exports);
|
|
38
|
-
var Environment;
|
|
39
|
-
(function (Environment) {
|
|
40
|
-
Environment["Production"] = "https://apiv2.emil.de";
|
|
41
|
-
Environment["Test"] = "https://apiv2-test.emil.de";
|
|
42
|
-
})(Environment = exports.Environment || (exports.Environment = {}));
|
package/dist/base.d.ts
CHANGED
|
@@ -28,7 +28,8 @@ export interface LoginClass {
|
|
|
28
28
|
}
|
|
29
29
|
export declare enum Environment {
|
|
30
30
|
Production = "https://apiv2.emil.de",
|
|
31
|
-
Test = "https://apiv2-test.emil.de"
|
|
31
|
+
Test = "https://apiv2-test.emil.de",
|
|
32
|
+
Development = "https://apiv2-dev.emil.de"
|
|
32
33
|
}
|
|
33
34
|
export declare function resetRetry(): void;
|
|
34
35
|
/**
|
|
@@ -58,7 +59,7 @@ export declare class BaseAPI {
|
|
|
58
59
|
private readEnvVariables;
|
|
59
60
|
selectEnvironment(env: Environment): void;
|
|
60
61
|
authorize(username: string, password: string): Promise<void>;
|
|
61
|
-
|
|
62
|
+
refreshTokenInternal(): Promise<string>;
|
|
62
63
|
private extractRefreshToken;
|
|
63
64
|
getConfiguration(): Configuration;
|
|
64
65
|
private attachInterceptor;
|
package/dist/base.js
CHANGED
|
@@ -129,6 +129,7 @@ var Environment;
|
|
|
129
129
|
(function (Environment) {
|
|
130
130
|
Environment["Production"] = "https://apiv2.emil.de";
|
|
131
131
|
Environment["Test"] = "https://apiv2-test.emil.de";
|
|
132
|
+
Environment["Development"] = "https://apiv2-dev.emil.de";
|
|
132
133
|
})(Environment = exports.Environment || (exports.Environment = {}));
|
|
133
134
|
var _retry_count = 0;
|
|
134
135
|
var _retry = null;
|
|
@@ -269,7 +270,7 @@ var BaseAPI = /** @class */ (function () {
|
|
|
269
270
|
});
|
|
270
271
|
});
|
|
271
272
|
};
|
|
272
|
-
BaseAPI.prototype.
|
|
273
|
+
BaseAPI.prototype.refreshTokenInternal = function () {
|
|
273
274
|
return __awaiter(this, void 0, void 0, function () {
|
|
274
275
|
var _a, username, refreshToken, options, accessToken;
|
|
275
276
|
return __generator(this, function (_b) {
|
|
@@ -323,7 +324,7 @@ var BaseAPI = /** @class */ (function () {
|
|
|
323
324
|
_a.label = 1;
|
|
324
325
|
case 1:
|
|
325
326
|
_a.trys.push([1, 3, , 4]);
|
|
326
|
-
return [4 /*yield*/, this.
|
|
327
|
+
return [4 /*yield*/, this.refreshTokenInternal()];
|
|
327
328
|
case 2:
|
|
328
329
|
tokenString = _a.sent();
|
|
329
330
|
accessToken = "Bearer ".concat(tokenString);
|
|
@@ -350,7 +351,7 @@ var BaseAPI = /** @class */ (function () {
|
|
|
350
351
|
_a.label = 6;
|
|
351
352
|
case 6:
|
|
352
353
|
_a.trys.push([6, 8, , 9]);
|
|
353
|
-
return [4 /*yield*/, this.
|
|
354
|
+
return [4 /*yield*/, this.refreshTokenInternal()];
|
|
354
355
|
case 7:
|
|
355
356
|
tokenString = _a.sent();
|
|
356
357
|
accessToken = "Bearer ".concat(tokenString);
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -27,8 +27,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
27
27
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.BaseAPI = void 0;
|
|
30
|
+
exports.BaseAPI = exports.Environment = void 0;
|
|
31
31
|
var base_1 = require("./base");
|
|
32
|
+
Object.defineProperty(exports, "Environment", { enumerable: true, get: function () { return base_1.Environment; } });
|
|
32
33
|
Object.defineProperty(exports, "BaseAPI", { enumerable: true, get: function () { return base_1.BaseAPI; } });
|
|
33
34
|
__exportStar(require("./api"), exports);
|
|
34
35
|
__exportStar(require("./configuration"), exports);
|
package/index.ts
CHANGED