@airxpay/init-sdk 1.0.1 → 1.0.2
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/dist/api/sellerOnboard.d.ts +12 -0
- package/dist/api/sellerOnboard.js +34 -19
- package/dist/config/apiConfig.d.ts +6 -0
- package/dist/index.d.ts +5 -0
- package/dist/types/bank.d.ts +8 -0
- package/dist/types/developerTypes.d.ts +5 -0
- package/dist/types/developerTypes.ts +5 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/keys.d.ts +5 -0
- package/dist/types/kyc.d.ts +11 -0
- package/dist/types/seller.d.ts +46 -0
- package/dist/types/sellerTypes.d.ts +15 -0
- package/dist/types/sellerTypes.ts +15 -0
- package/dist/utils/uploadHelper.d.ts +1 -0
- package/dist/utils/validateKeys.d.ts +2 -0
- package/package.json +8 -16
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Seller } from "../types/sellerTypes";
|
|
2
|
+
import { DeveloperKeys } from "../types/developerTypes";
|
|
3
|
+
import { ApiConfig } from "../config/apiConfig";
|
|
4
|
+
export declare class AirXPay {
|
|
5
|
+
private config;
|
|
6
|
+
constructor(config?: Partial<ApiConfig>);
|
|
7
|
+
private request;
|
|
8
|
+
createSeller(seller: Seller, keys: DeveloperKeys): Promise<any>;
|
|
9
|
+
updateKyc(sellerId: string, docs: Record<string, string>): Promise<any>;
|
|
10
|
+
updateBank(sellerId: string, bankDetails: Record<string, string>): Promise<any>;
|
|
11
|
+
getPendingStatus(sellerId: string): Promise<any>;
|
|
12
|
+
}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
@@ -9,31 +18,37 @@ const validateKeys_1 = require("../utils/validateKeys");
|
|
|
9
18
|
const apiConfig_1 = require("../config/apiConfig");
|
|
10
19
|
class AirXPay {
|
|
11
20
|
constructor(config) {
|
|
12
|
-
this.config = {
|
|
21
|
+
this.config = Object.assign(Object.assign({}, apiConfig_1.defaultConfig), config);
|
|
13
22
|
}
|
|
14
|
-
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
secretKey: this.config.secretKey,
|
|
18
|
-
clientKey: this.config.clientKey,
|
|
23
|
+
request(endpoint, data) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
return axios_1.default.post(`${this.config.baseUrl}${endpoint}`, Object.assign(Object.assign({}, data), { secretKey: this.config.secretKey, clientKey: this.config.clientKey }));
|
|
19
26
|
});
|
|
20
27
|
}
|
|
21
|
-
|
|
22
|
-
(0,
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
createSeller(seller, keys) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
(0, validateKeys_1.validateKeys)(keys);
|
|
31
|
+
const response = yield this.request("/create", Object.assign(Object.assign({}, seller), { publicKey: keys.publicKey }));
|
|
32
|
+
return response.data;
|
|
33
|
+
});
|
|
25
34
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
updateKyc(sellerId, docs) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const response = yield this.request(`/${sellerId}/kyc`, docs);
|
|
38
|
+
return response.data;
|
|
39
|
+
});
|
|
29
40
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
41
|
+
updateBank(sellerId, bankDetails) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const response = yield this.request(`/${sellerId}/bank`, bankDetails);
|
|
44
|
+
return response.data;
|
|
45
|
+
});
|
|
33
46
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
47
|
+
getPendingStatus(sellerId) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const response = yield axios_1.default.get(`${this.config.baseUrl}/${sellerId}/status`);
|
|
50
|
+
return response.data;
|
|
51
|
+
});
|
|
37
52
|
}
|
|
38
53
|
}
|
|
39
54
|
exports.AirXPay = AirXPay;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare module 'airxpay' {
|
|
2
|
+
export * from './seller';
|
|
3
|
+
export * from './bank';
|
|
4
|
+
export * from './kyc';
|
|
5
|
+
export * from './keys';
|
|
6
|
+
}
|
|
7
|
+
export declare class AirXPay {
|
|
8
|
+
constructor(config: { baseUrl: string; secretKey: string; clientKey: string });
|
|
9
|
+
|
|
10
|
+
createSeller(seller: import('./seller').SellerData, keys: import('./keys').Keys): Promise<import('./seller').SellerData>;
|
|
11
|
+
updateKyc(sellerId: string, docs: Partial<import('./kyc').KycDocuments>): Promise<import('./seller').SellerData>;
|
|
12
|
+
updateBank(sellerId: string, bankDetails: Partial<import('./bank').BankDetails>): Promise<import('./seller').SellerData>;
|
|
13
|
+
getPendingStatus(sellerId: string): Promise<{ status: import('./kyc').KycStatus | import('./seller').SellerStatus }>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type KycStatus = "not_submitted" | "pending" | "verified" | "rejected";
|
|
2
|
+
|
|
3
|
+
export interface KycDocuments {
|
|
4
|
+
panCardUrl?: string;
|
|
5
|
+
aadhaarUrl?: string;
|
|
6
|
+
identityProofUrl?: string;
|
|
7
|
+
addressProofUrl?: string;
|
|
8
|
+
selfieUrl?: string;
|
|
9
|
+
businessRegistrationUrl?: string;
|
|
10
|
+
gstCertificateUrl?: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type BusinessType = "individual" | "company";
|
|
2
|
+
export type Mode = "test" | "live";
|
|
3
|
+
export type SellerStatus = "active" | "suspended" | "blocked";
|
|
4
|
+
|
|
5
|
+
export interface OnboardedPlatform {
|
|
6
|
+
platformName: string;
|
|
7
|
+
platformId: string;
|
|
8
|
+
onboardedAt: Date;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface SellerData {
|
|
12
|
+
sellerName: string;
|
|
13
|
+
sellerEmail: string;
|
|
14
|
+
sellerPhone?: string;
|
|
15
|
+
|
|
16
|
+
developerId: string;
|
|
17
|
+
developerUserId?: string;
|
|
18
|
+
developerClientKey: string;
|
|
19
|
+
|
|
20
|
+
sellerDID: string;
|
|
21
|
+
walletId: string;
|
|
22
|
+
|
|
23
|
+
businessName?: string;
|
|
24
|
+
businessType?: BusinessType;
|
|
25
|
+
businessCategory?: string;
|
|
26
|
+
country?: string;
|
|
27
|
+
dob?: Date;
|
|
28
|
+
nationality?: string;
|
|
29
|
+
|
|
30
|
+
mode: Mode;
|
|
31
|
+
|
|
32
|
+
kycStatus: "not_submitted" | "pending" | "verified" | "rejected";
|
|
33
|
+
isKycCompleted: boolean;
|
|
34
|
+
|
|
35
|
+
kycDocuments?: import("./kyc").KycDocuments;
|
|
36
|
+
bankDetails?: import("./bank").BankDetails;
|
|
37
|
+
isBankDetailsCompleted: boolean;
|
|
38
|
+
|
|
39
|
+
onboardedPlatforms: OnboardedPlatform[];
|
|
40
|
+
|
|
41
|
+
status: SellerStatus;
|
|
42
|
+
metadata?: any;
|
|
43
|
+
|
|
44
|
+
createdAt: Date;
|
|
45
|
+
updatedAt: Date;
|
|
46
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface Seller {
|
|
2
|
+
sellerName: string;
|
|
3
|
+
sellerEmail: string;
|
|
4
|
+
sellerPhone: string;
|
|
5
|
+
sellerDID?: string;
|
|
6
|
+
walletId?: string;
|
|
7
|
+
businessName: string;
|
|
8
|
+
businessType: string;
|
|
9
|
+
businessCategory?: string;
|
|
10
|
+
country: string;
|
|
11
|
+
dob?: string;
|
|
12
|
+
nationality?: string;
|
|
13
|
+
mode?: "test" | "live";
|
|
14
|
+
metadata?: Record<string, any>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface Seller {
|
|
2
|
+
sellerName: string;
|
|
3
|
+
sellerEmail: string;
|
|
4
|
+
sellerPhone: string;
|
|
5
|
+
sellerDID?: string;
|
|
6
|
+
walletId?: string;
|
|
7
|
+
businessName: string;
|
|
8
|
+
businessType: string;
|
|
9
|
+
businessCategory?: string;
|
|
10
|
+
country: string;
|
|
11
|
+
dob?: string;
|
|
12
|
+
nationality?: string;
|
|
13
|
+
mode?: "test" | "live";
|
|
14
|
+
metadata?: Record<string, any>;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function base64ToBlob(base64: string, type?: string): Blob;
|
package/package.json
CHANGED
|
@@ -1,35 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airxpay/init-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "AirXPay Flixora SDK - Seller Onboard",
|
|
5
5
|
"author": "Tafseel Khan",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
|
|
7
|
+
"types": "dist/types/index.d.ts",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
|
-
|
|
10
9
|
"files": [
|
|
11
|
-
"dist"
|
|
12
|
-
"types"
|
|
10
|
+
"dist"
|
|
13
11
|
],
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc --project tsconfig.json --outDir dist && cpx \"src/types/**/*\" dist/types",
|
|
14
|
+
"prepare": "npm run build"
|
|
15
|
+
},
|
|
20
16
|
"dependencies": {
|
|
21
17
|
"axios": "^1.13.5"
|
|
22
18
|
},
|
|
23
|
-
|
|
24
19
|
"devDependencies": {
|
|
20
|
+
"cpx": "^1.5.0",
|
|
25
21
|
"typescript": "^5.9.3"
|
|
26
22
|
},
|
|
27
|
-
|
|
28
23
|
"repository": {
|
|
29
24
|
"type": "git",
|
|
30
25
|
"url": "https://github.com/tafseelkhan/airxpay-sdk.git"
|
|
31
26
|
},
|
|
32
|
-
|
|
33
27
|
"keywords": [
|
|
34
28
|
"airxpay",
|
|
35
29
|
"flixora",
|
|
@@ -37,10 +31,8 @@
|
|
|
37
31
|
"seller",
|
|
38
32
|
"onboard"
|
|
39
33
|
],
|
|
40
|
-
|
|
41
34
|
"bugs": {
|
|
42
35
|
"url": "https://github.com/tafseelkhan/airxpay-sdk/issues"
|
|
43
36
|
},
|
|
44
|
-
|
|
45
37
|
"homepage": "https://github.com/tafseelkhan/airxpay-sdk#readme"
|
|
46
38
|
}
|