@smartsoft001/revolut 1.1.72 → 1.1.75
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/package.json +14 -14
- package/src/lib/revolut.service.js +50 -57
- package/src/lib/revolut.service.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartsoft001/revolut",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.75",
|
|
4
4
|
"description": "This library was generated with [Nx](https://nx.dev).",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,28 +13,28 @@
|
|
|
13
13
|
},
|
|
14
14
|
"homepage": "https://github.com/emiljuchnikowski/smartsoft#readme",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@angular/common": "
|
|
17
|
-
"@angular/core": "
|
|
18
|
-
"@angular/platform-browser-dynamic": "
|
|
19
|
-
"@nestjs/axios": "
|
|
20
|
-
"@nestjs/common": "
|
|
21
|
-
"@nestjs/core": "
|
|
16
|
+
"@angular/common": "16.1.3",
|
|
17
|
+
"@angular/core": "16.1.3",
|
|
18
|
+
"@angular/platform-browser-dynamic": "16.1.3",
|
|
19
|
+
"@nestjs/axios": "3.0.0",
|
|
20
|
+
"@nestjs/common": "^10.0.5",
|
|
21
|
+
"@nestjs/core": "^10.0.5",
|
|
22
22
|
"flatted": "^3.2.4",
|
|
23
23
|
"guid-typescript": "1.0.9",
|
|
24
24
|
"lodash": "^4.17.20",
|
|
25
25
|
"md5": "2.3.0",
|
|
26
26
|
"reflect-metadata": "0.1.13",
|
|
27
27
|
"rxjs": "7.8.1",
|
|
28
|
-
"typeorm": "0.
|
|
28
|
+
"typeorm": "0.3.17"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@smartsoft001/domain-core": "1.1.
|
|
32
|
-
"@smartsoft001/models": "1.1.
|
|
33
|
-
"@smartsoft001/trans-domain": "1.1.
|
|
34
|
-
"@smartsoft001/users": "1.1.
|
|
35
|
-
"@smartsoft001/utils": "1.1.
|
|
31
|
+
"@smartsoft001/domain-core": "1.1.75",
|
|
32
|
+
"@smartsoft001/models": "1.1.75",
|
|
33
|
+
"@smartsoft001/trans-domain": "1.1.75",
|
|
34
|
+
"@smartsoft001/users": "1.1.75",
|
|
35
|
+
"@smartsoft001/utils": "1.1.75",
|
|
36
36
|
"util": "0.12.5",
|
|
37
|
-
"tslib": "2.
|
|
37
|
+
"tslib": "2.5.3"
|
|
38
38
|
},
|
|
39
39
|
"main": "./src/index.js",
|
|
40
40
|
"types": "./src/index.d.ts"
|
|
@@ -7,56 +7,52 @@ const common_1 = require("@nestjs/common");
|
|
|
7
7
|
const core_1 = require("@nestjs/core");
|
|
8
8
|
const axios_1 = require("@nestjs/axios");
|
|
9
9
|
const revolut_config_1 = require("./revolut.config");
|
|
10
|
-
let RevolutService = RevolutService_1 = class RevolutService {
|
|
10
|
+
let RevolutService = exports.RevolutService = RevolutService_1 = class RevolutService {
|
|
11
11
|
constructor(httpService, moduleRef, config) {
|
|
12
12
|
this.httpService = httpService;
|
|
13
13
|
this.moduleRef = moduleRef;
|
|
14
14
|
this.config = config;
|
|
15
15
|
}
|
|
16
|
-
create(obj) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
});
|
|
16
|
+
async create(obj) {
|
|
17
|
+
const config = await this.getConfig(obj.data);
|
|
18
|
+
const data = {
|
|
19
|
+
amount: obj.amount,
|
|
20
|
+
description: obj.name,
|
|
21
|
+
capture_mode: "AUTOMATIC",
|
|
22
|
+
merchant_order_ext_ref: obj.id,
|
|
23
|
+
customer_email: obj.email,
|
|
24
|
+
currency: "PLN",
|
|
25
|
+
};
|
|
26
|
+
const response = await this.httpService
|
|
27
|
+
.post(this.getBaseUrl(config) + "/api/1.0/orders", data, {
|
|
28
|
+
headers: {
|
|
29
|
+
"Content-Type": "application/json",
|
|
30
|
+
Authorization: "Bearer " + config.token
|
|
31
|
+
},
|
|
32
|
+
maxRedirects: 0,
|
|
33
|
+
})
|
|
34
|
+
.toPromise();
|
|
35
|
+
return {
|
|
36
|
+
responseData: response.data,
|
|
37
|
+
orderId: response.data["public_id"],
|
|
38
|
+
};
|
|
41
39
|
}
|
|
42
|
-
getStatus(trans) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
};
|
|
59
|
-
});
|
|
40
|
+
async getStatus(trans) {
|
|
41
|
+
const config = await this.getConfig(trans.data);
|
|
42
|
+
const historyItem = trans.history.find(h => h.status === 'started');
|
|
43
|
+
const response = await this.httpService
|
|
44
|
+
.get(this.getBaseUrl(config) + "/api/1.0/orders/" + historyItem.data.responseData.id, {
|
|
45
|
+
headers: {
|
|
46
|
+
"Content-Type": "application/json",
|
|
47
|
+
Authorization: "Bearer " + config.token
|
|
48
|
+
},
|
|
49
|
+
maxRedirects: 0,
|
|
50
|
+
})
|
|
51
|
+
.toPromise();
|
|
52
|
+
return {
|
|
53
|
+
data: response.data,
|
|
54
|
+
status: this.getStatusFromExternal(response.data["state"]),
|
|
55
|
+
};
|
|
60
56
|
}
|
|
61
57
|
refund(trans, comment) {
|
|
62
58
|
return Promise.reject('Revolut not support');
|
|
@@ -66,17 +62,15 @@ let RevolutService = RevolutService_1 = class RevolutService {
|
|
|
66
62
|
return "https://sandbox-merchant.revolut.com";
|
|
67
63
|
return "https://merchant.revolut.com/api";
|
|
68
64
|
}
|
|
69
|
-
getConfig(data) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return this.config;
|
|
79
|
-
});
|
|
65
|
+
async getConfig(data) {
|
|
66
|
+
try {
|
|
67
|
+
const provider = this.moduleRef.get(revolut_config_1.REVOLUT_CONFIG_PROVIDER, { strict: false });
|
|
68
|
+
return await provider.get(data);
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
common_1.Logger.warn("Revolut config provider not found", RevolutService_1.name);
|
|
72
|
+
}
|
|
73
|
+
return this.config;
|
|
80
74
|
}
|
|
81
75
|
getStatusFromExternal(status) {
|
|
82
76
|
switch (status) {
|
|
@@ -93,12 +87,11 @@ let RevolutService = RevolutService_1 = class RevolutService {
|
|
|
93
87
|
}
|
|
94
88
|
}
|
|
95
89
|
};
|
|
96
|
-
RevolutService = RevolutService_1 = tslib_1.__decorate([
|
|
90
|
+
exports.RevolutService = RevolutService = RevolutService_1 = tslib_1.__decorate([
|
|
97
91
|
(0, common_1.Injectable)(),
|
|
98
92
|
tslib_1.__param(2, (0, common_1.Optional)()),
|
|
99
93
|
tslib_1.__metadata("design:paramtypes", [axios_1.HttpService,
|
|
100
94
|
core_1.ModuleRef,
|
|
101
95
|
revolut_config_1.RevolutConfig])
|
|
102
96
|
], RevolutService);
|
|
103
|
-
exports.RevolutService = RevolutService;
|
|
104
97
|
//# sourceMappingURL=revolut.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revolut.service.js","sourceRoot":"","sources":["../../../../../../libs/shared/revolut/src/lib/revolut.service.ts"],"names":[],"mappings":";;;;;AAAA,2CAA8D;AAC9D,uCAAyC;AACzC,yCAA0C;AAQ1C,qDAI0B;AAGnB,IAAM,cAAc,
|
|
1
|
+
{"version":3,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