@riocrypto/common-server 1.0.576 → 1.0.578
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.
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { BusinessUser, User } from "@riocrypto/common";
|
|
1
2
|
declare class KapstarClient {
|
|
2
3
|
constructor();
|
|
3
4
|
getBRLExchangeRateUSD(): Promise<number>;
|
|
5
|
+
createInvoice(amount: number, orderId: string, user: User | BusinessUser): Promise<any>;
|
|
4
6
|
}
|
|
5
7
|
export declare const kapstarClient: KapstarClient;
|
|
6
8
|
export {};
|
|
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.kapstarClient = void 0;
|
|
16
|
+
const common_1 = require("@riocrypto/common");
|
|
16
17
|
const axios_1 = __importDefault(require("axios"));
|
|
17
18
|
class KapstarClient {
|
|
18
19
|
constructor() { }
|
|
@@ -22,5 +23,18 @@ class KapstarClient {
|
|
|
22
23
|
return 1 / kapstarResponse.data;
|
|
23
24
|
});
|
|
24
25
|
}
|
|
26
|
+
createInvoice(amount, orderId, user) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const kapstarResponse = yield axios_1.default.post(`https://api.ecsa.finance/transaction-service/v1/external/invoice`, {
|
|
29
|
+
amount,
|
|
30
|
+
name: user.type === common_1.UserType.Business
|
|
31
|
+
? user.companyName
|
|
32
|
+
: user.firstName + " " + user.lastName,
|
|
33
|
+
tax_id: user.cpf,
|
|
34
|
+
tags: [orderId],
|
|
35
|
+
});
|
|
36
|
+
return kapstarResponse.data;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
25
39
|
}
|
|
26
40
|
exports.kapstarClient = new KapstarClient();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.578",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@aws-sdk/client-s3": "^3.297.0",
|
|
25
25
|
"@google-cloud/storage": "^6.9.5",
|
|
26
|
-
"@riocrypto/common": "^1.0.
|
|
26
|
+
"@riocrypto/common": "^1.0.560",
|
|
27
27
|
"@types/express": "^4.17.13",
|
|
28
28
|
"axios": "^0.27.2",
|
|
29
29
|
"ccxt": "^3.0.30",
|