@kumbify/sdk 1.2.2 → 1.2.4
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.
|
@@ -32,7 +32,7 @@ class KMailClient {
|
|
|
32
32
|
},
|
|
33
33
|
headers: {
|
|
34
34
|
"kumbi-api-key": "Bearer " + this.config.apiKey,
|
|
35
|
-
|
|
35
|
+
lang: this.config.api.lang,
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
38
|
return response;
|
|
@@ -54,7 +54,7 @@ class KMailClient {
|
|
|
54
54
|
},
|
|
55
55
|
headers: {
|
|
56
56
|
"kumbi-api-key": "Bearer " + this.config.apiKey,
|
|
57
|
-
|
|
57
|
+
lang: this.config.api.lang,
|
|
58
58
|
},
|
|
59
59
|
});
|
|
60
60
|
return response;
|
|
@@ -48,7 +48,7 @@ class KOAuth2Client {
|
|
|
48
48
|
},
|
|
49
49
|
headers: {
|
|
50
50
|
"kumbi-app-key": `Bearer ${this.clientSecret}`,
|
|
51
|
-
|
|
51
|
+
lang: this.api.lang,
|
|
52
52
|
},
|
|
53
53
|
});
|
|
54
54
|
return response;
|
|
@@ -67,7 +67,7 @@ class KOAuth2Client {
|
|
|
67
67
|
},
|
|
68
68
|
headers: {
|
|
69
69
|
"kumbi-app-key": `Bearer ${this.clientSecret}`,
|
|
70
|
-
|
|
70
|
+
lang: this.api.lang,
|
|
71
71
|
},
|
|
72
72
|
});
|
|
73
73
|
return response;
|
|
@@ -10,12 +10,6 @@ const APIError_1 = __importDefault(require("../../errors/APIError"));
|
|
|
10
10
|
class KPaymentClient {
|
|
11
11
|
config = {
|
|
12
12
|
apiKey: "",
|
|
13
|
-
provider: {
|
|
14
|
-
angolan: {
|
|
15
|
-
seller: "paypay",
|
|
16
|
-
},
|
|
17
|
-
type: "angolan",
|
|
18
|
-
},
|
|
19
13
|
api: {
|
|
20
14
|
lang: "pt",
|
|
21
15
|
version: "v1",
|
|
@@ -27,12 +21,12 @@ class KPaymentClient {
|
|
|
27
21
|
async makeStripePayment({ ...data }) {
|
|
28
22
|
try {
|
|
29
23
|
const response = await (0, api_1.fetchRequest)({
|
|
30
|
-
url: `${helpers_1.APP_CONFIG.PAYMENT.API_BASE_URL}
|
|
24
|
+
url: `${helpers_1.APP_CONFIG.PAYMENT.API_BASE_URL}/stripe`,
|
|
31
25
|
method: "post",
|
|
32
26
|
body: data,
|
|
33
27
|
headers: {
|
|
34
28
|
"kumbi-api-key": `Bearer ${this.config.apiKey}`,
|
|
35
|
-
|
|
29
|
+
lang: this.config.api.lang,
|
|
36
30
|
},
|
|
37
31
|
});
|
|
38
32
|
return response;
|
|
@@ -44,12 +38,12 @@ class KPaymentClient {
|
|
|
44
38
|
async makeCryptoPayment({ ...data }) {
|
|
45
39
|
try {
|
|
46
40
|
const response = await (0, api_1.fetchRequest)({
|
|
47
|
-
url: `${helpers_1.APP_CONFIG.PAYMENT.API_BASE_URL}
|
|
41
|
+
url: `${helpers_1.APP_CONFIG.PAYMENT.API_BASE_URL}/crypto`,
|
|
48
42
|
method: "post",
|
|
49
43
|
body: data,
|
|
50
44
|
headers: {
|
|
51
45
|
"kumbi-api-key": `Bearer ${this.config.apiKey}`,
|
|
52
|
-
|
|
46
|
+
lang: this.config.api.lang,
|
|
53
47
|
},
|
|
54
48
|
});
|
|
55
49
|
return response;
|
|
@@ -60,18 +54,7 @@ class KPaymentClient {
|
|
|
60
54
|
}
|
|
61
55
|
async makeAngolanPayment({ ...data }) {
|
|
62
56
|
try {
|
|
63
|
-
|
|
64
|
-
data.method == "multicaixa") {
|
|
65
|
-
let message = {
|
|
66
|
-
pt: "O método de pagamento via multicaixa express está indisponível para PayPay",
|
|
67
|
-
en: "The Multicaixa Express payment method is unavailable for PayPay",
|
|
68
|
-
};
|
|
69
|
-
APIError_1.default.ErrorMessage({
|
|
70
|
-
section: "payment",
|
|
71
|
-
message: this.config.api.lang == "en" ? message.en : message.pt,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
const url = `${helpers_1.APP_CONFIG.PAYMENT.API_BASE_URL}/${this.config.provider.angolan}`;
|
|
57
|
+
const url = `${helpers_1.APP_CONFIG.PAYMENT.API_BASE_URL}/${data.provider}`;
|
|
75
58
|
const response = await (0, api_1.fetchRequest)({
|
|
76
59
|
url: url,
|
|
77
60
|
method: "post",
|
|
@@ -80,7 +63,7 @@ class KPaymentClient {
|
|
|
80
63
|
},
|
|
81
64
|
headers: {
|
|
82
65
|
"kumbi-api-key": `Bearer ${this.config.apiKey}`,
|
|
83
|
-
|
|
66
|
+
lang: this.config.api.lang,
|
|
84
67
|
},
|
|
85
68
|
});
|
|
86
69
|
return response;
|
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
import { IAPIConfig } from "../../utils/types";
|
|
2
2
|
type EAngolanPaymentProviders = "paypay";
|
|
3
|
-
type EInternationalPaymentProviders = "stripe" | "crypto";
|
|
4
3
|
export interface IPaymentParams {
|
|
5
4
|
api?: IAPIConfig;
|
|
6
5
|
apiKey: string;
|
|
7
|
-
provider: {
|
|
8
|
-
angolan?: {
|
|
9
|
-
seller: EAngolanPaymentProviders;
|
|
10
|
-
};
|
|
11
|
-
international?: {
|
|
12
|
-
seller: EInternationalPaymentProviders;
|
|
13
|
-
};
|
|
14
|
-
type: "angolan" | "international";
|
|
15
|
-
};
|
|
16
6
|
}
|
|
17
7
|
export interface IMakeAngolanPaymentParams {
|
|
18
8
|
amount: number;
|
|
19
9
|
subject: string;
|
|
20
10
|
method: "reference" | "multicaixa";
|
|
11
|
+
provider: EAngolanPaymentProviders;
|
|
21
12
|
transfer?: {
|
|
22
13
|
iban: string;
|
|
23
14
|
owner_name: string;
|
|
@@ -52,20 +43,20 @@ export interface IProduct {
|
|
|
52
43
|
*/
|
|
53
44
|
export type StripeCurrencies = "USD" | "EUR";
|
|
54
45
|
export interface IMakeStripePaymentParams {
|
|
55
|
-
amount: number;
|
|
56
46
|
transactionId: string;
|
|
57
47
|
customer: {
|
|
58
48
|
email: string;
|
|
59
49
|
name: string;
|
|
60
50
|
};
|
|
61
|
-
|
|
51
|
+
products: IProduct[];
|
|
62
52
|
redirect: {
|
|
63
53
|
success_url?: string;
|
|
64
54
|
cancel_url?: string;
|
|
65
55
|
};
|
|
66
|
-
|
|
56
|
+
stripeCurrency: StripeCurrencies;
|
|
67
57
|
}
|
|
68
58
|
export interface IMakeStripePaymentResponse {
|
|
59
|
+
success: boolean;
|
|
69
60
|
url: string;
|
|
70
61
|
}
|
|
71
62
|
/**
|
|
@@ -73,7 +64,6 @@ export interface IMakeStripePaymentResponse {
|
|
|
73
64
|
*/
|
|
74
65
|
type CryptoCurrencies = "USDC" | "ETH" | "BTC" | "USDT";
|
|
75
66
|
export interface IMakeCryptoPaymentParams {
|
|
76
|
-
amount: number;
|
|
77
67
|
transactionId: string;
|
|
78
68
|
customer: {
|
|
79
69
|
email?: string;
|
|
@@ -81,9 +71,11 @@ export interface IMakeCryptoPaymentParams {
|
|
|
81
71
|
phone?: string;
|
|
82
72
|
};
|
|
83
73
|
products: IProduct[];
|
|
84
|
-
|
|
74
|
+
cryptoCurrency: CryptoCurrencies;
|
|
85
75
|
}
|
|
86
76
|
export interface IMakeCryptoPaymentResponse {
|
|
77
|
+
success: boolean;
|
|
87
78
|
address: string;
|
|
79
|
+
checkoutLink: string;
|
|
88
80
|
}
|
|
89
81
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kumbify/sdk",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "Oficial Kumbify SDK to integrate our services in your applications",
|
|
5
5
|
"homepage": "https://github.com/kumbify-oficial/kumbi-sdk#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -25,10 +25,14 @@
|
|
|
25
25
|
"scripts": {
|
|
26
26
|
"changeset": "changeset",
|
|
27
27
|
"version-pack": "changeset version",
|
|
28
|
-
"publish-pack": "tsc && changeset publish"
|
|
28
|
+
"publish-pack": "tsc && changeset publish",
|
|
29
|
+
"test-mail": "ts-node-dev ./src/clients/kmail/KMailClient.ts",
|
|
30
|
+
"test-sms": "ts-node-dev ./src/clients/ksms/KSMSClient.ts",
|
|
31
|
+
"test-payment": "ts-node-dev ./src/clients/payment/KPaymentClient.ts"
|
|
29
32
|
},
|
|
30
33
|
"devDependencies": {
|
|
31
34
|
"@changesets/cli": "^2.29.8",
|
|
35
|
+
"ts-node-dev": "^2.0.0",
|
|
32
36
|
"typescript": "^5.9.3"
|
|
33
37
|
},
|
|
34
38
|
"dependencies": {
|