@airxpay/init-sdk 1.0.0 → 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.
@@ -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 = { ...apiConfig_1.defaultConfig, ...config };
21
+ this.config = Object.assign(Object.assign({}, apiConfig_1.defaultConfig), config);
13
22
  }
14
- async request(endpoint, data) {
15
- return axios_1.default.post(`${this.config.baseUrl}${endpoint}`, {
16
- ...data,
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
- async createSeller(seller, keys) {
22
- (0, validateKeys_1.validateKeys)(keys);
23
- const response = await this.request("/create", { ...seller, publicKey: keys.publicKey });
24
- return response.data;
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
- async updateKyc(sellerId, docs) {
27
- const response = await this.request(`/${sellerId}/kyc`, docs);
28
- return response.data;
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
- async updateBank(sellerId, bankDetails) {
31
- const response = await this.request(`/${sellerId}/bank`, bankDetails);
32
- return response.data;
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
- async getPendingStatus(sellerId) {
35
- const response = await axios_1.default.get(`${this.config.baseUrl}/${sellerId}/status`);
36
- return response.data;
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;
@@ -0,0 +1,6 @@
1
+ export interface ApiConfig {
2
+ baseUrl: string;
3
+ secretKey: string;
4
+ clientKey: string;
5
+ }
6
+ export declare const defaultConfig: ApiConfig;
@@ -0,0 +1,5 @@
1
+ export * from "./api/sellerOnboard";
2
+ export * from "./types/sellerTypes";
3
+ export * from "./types/developerTypes";
4
+ export * from "./utils/validateKeys";
5
+ export * from "./utils/uploadHelper";
@@ -0,0 +1,8 @@
1
+ export interface BankDetails {
2
+ accountHolderName?: string;
3
+ bankName?: string;
4
+ accountNumber?: string;
5
+ ifscCode?: string;
6
+ upiId?: string;
7
+ cancelledChequeUrl?: string;
8
+ }
@@ -0,0 +1,5 @@
1
+ export interface DeveloperKeys {
2
+ publicKey: string;
3
+ secretKey: string;
4
+ clientKey: string;
5
+ }
@@ -0,0 +1,5 @@
1
+ export interface DeveloperKeys {
2
+ publicKey: string;
3
+ secretKey: string;
4
+ clientKey: string;
5
+ }
@@ -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,5 @@
1
+ export interface Keys {
2
+ publicKey: string;
3
+ secretKey: string;
4
+ clientKey: string;
5
+ }
@@ -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;
@@ -0,0 +1,2 @@
1
+ import { DeveloperKeys } from "../types/developerTypes";
2
+ export declare function validateKeys(keys: DeveloperKeys): boolean;
package/package.json CHANGED
@@ -1,34 +1,29 @@
1
1
  {
2
2
  "name": "@airxpay/init-sdk",
3
- "version": "1.0.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
10
  "dist"
12
11
  ],
13
-
14
- "scripts": {
15
- "build": "tsc --project tsconfig.json --outDir dist --declaration false",
16
- "prepare": "npm run build"
17
- },
18
-
12
+ "scripts": {
13
+ "build": "tsc --project tsconfig.json --outDir dist && cpx \"src/types/**/*\" dist/types",
14
+ "prepare": "npm run build"
15
+ },
19
16
  "dependencies": {
20
17
  "axios": "^1.13.5"
21
18
  },
22
-
23
19
  "devDependencies": {
20
+ "cpx": "^1.5.0",
24
21
  "typescript": "^5.9.3"
25
22
  },
26
-
27
23
  "repository": {
28
24
  "type": "git",
29
25
  "url": "https://github.com/tafseelkhan/airxpay-sdk.git"
30
26
  },
31
-
32
27
  "keywords": [
33
28
  "airxpay",
34
29
  "flixora",
@@ -36,10 +31,8 @@
36
31
  "seller",
37
32
  "onboard"
38
33
  ],
39
-
40
34
  "bugs": {
41
35
  "url": "https://github.com/tafseelkhan/airxpay-sdk/issues"
42
36
  },
43
-
44
37
  "homepage": "https://github.com/tafseelkhan/airxpay-sdk#readme"
45
38
  }