@zyacreatives/shared 2.2.85 → 2.2.87
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/constants.d.ts +4 -0
- package/dist/schemas/payout-method.d.ts +19 -1
- package/dist/schemas/payout-method.js +32 -4
- package/dist/schemas/seller.d.ts +0 -2
- package/dist/schemas/seller.js +2 -3
- package/package.json +1 -1
- package/src/constants.ts +5 -0
- package/src/schemas/payout-method.ts +54 -12
- package/src/schemas/seller.ts +2 -4
package/dist/constants.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ export declare const ROLES: {
|
|
|
4
4
|
readonly INVESTOR: "INVESTOR";
|
|
5
5
|
readonly ADMIN: "ADMIN";
|
|
6
6
|
};
|
|
7
|
+
export type PaystackBank = {
|
|
8
|
+
name: string;
|
|
9
|
+
code: string;
|
|
10
|
+
};
|
|
7
11
|
export declare const USER_STATUSES: {
|
|
8
12
|
readonly ACTIVE: "ACTIVE";
|
|
9
13
|
readonly SUSPENDED: "SUSPENDED";
|
|
@@ -8,7 +8,7 @@ export declare const PayoutMethodEntitySchema: z.ZodObject<{
|
|
|
8
8
|
}>;
|
|
9
9
|
currency: z.ZodString;
|
|
10
10
|
bankName: z.ZodString;
|
|
11
|
-
|
|
11
|
+
accountLast4: z.ZodString;
|
|
12
12
|
accountName: z.ZodString;
|
|
13
13
|
externalBankId: z.ZodNullable<z.ZodString>;
|
|
14
14
|
isDefault: z.ZodBoolean;
|
|
@@ -45,3 +45,21 @@ export declare const UpdatePayoutMethodEntitySchema: z.ZodObject<{
|
|
|
45
45
|
externalBankId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
46
|
}, z.core.$strip>;
|
|
47
47
|
export type UpdatePayoutMethodInput = z.infer<typeof UpdatePayoutMethodEntitySchema>;
|
|
48
|
+
export declare const GetBanksInputSchema: z.ZodObject<{
|
|
49
|
+
country: z.ZodDefault<z.ZodString>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
export type GetBanksInput = z.infer<typeof GetBanksInputSchema>;
|
|
52
|
+
export declare const VerifyAccountInputSchema: z.ZodObject<{
|
|
53
|
+
accountNumber: z.ZodString;
|
|
54
|
+
bankCode: z.ZodString;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
export type VerifyAccountInput = z.infer<typeof VerifyAccountInputSchema>;
|
|
57
|
+
export declare const VerifyAccountOutputSchema: z.ZodObject<{
|
|
58
|
+
accountName: z.ZodString;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
export type VerifyAccountOutput = z.infer<typeof VerifyAccountOutputSchema>;
|
|
61
|
+
export declare const BankListOutputSchema: z.ZodArray<z.ZodObject<{
|
|
62
|
+
name: z.ZodString;
|
|
63
|
+
code: z.ZodString;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
export type BankListOutput = z.infer<typeof BankListOutputSchema>;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.UpdatePayoutMethodEntitySchema = exports.CreatePayoutMethodEntitySchema = exports.PayoutMethodEntitySchema = void 0;
|
|
6
|
+
exports.BankListOutputSchema = exports.VerifyAccountOutputSchema = exports.VerifyAccountInputSchema = exports.GetBanksInputSchema = exports.UpdatePayoutMethodEntitySchema = exports.CreatePayoutMethodEntitySchema = exports.PayoutMethodEntitySchema = void 0;
|
|
7
7
|
const zod_1 = __importDefault(require("zod"));
|
|
8
8
|
const constants_1 = require("../constants");
|
|
9
9
|
exports.PayoutMethodEntitySchema = zod_1.default.object({
|
|
@@ -12,7 +12,7 @@ exports.PayoutMethodEntitySchema = zod_1.default.object({
|
|
|
12
12
|
provider: zod_1.default.enum(constants_1.GATEWAY_PROVIDER),
|
|
13
13
|
currency: zod_1.default.string(),
|
|
14
14
|
bankName: zod_1.default.string(),
|
|
15
|
-
|
|
15
|
+
accountLast4: zod_1.default.string(),
|
|
16
16
|
accountName: zod_1.default.string(),
|
|
17
17
|
externalBankId: zod_1.default.string().nullable(),
|
|
18
18
|
isDefault: zod_1.default.boolean(),
|
|
@@ -27,11 +27,39 @@ exports.CreatePayoutMethodEntitySchema = zod_1.default.object({
|
|
|
27
27
|
accountName: zod_1.default.string(),
|
|
28
28
|
isDefault: zod_1.default.boolean(),
|
|
29
29
|
});
|
|
30
|
-
exports.UpdatePayoutMethodEntitySchema = zod_1.default
|
|
30
|
+
exports.UpdatePayoutMethodEntitySchema = zod_1.default
|
|
31
|
+
.object({
|
|
31
32
|
bankName: zod_1.default.string(),
|
|
32
33
|
accountLast4: zod_1.default.string(),
|
|
33
34
|
accountName: zod_1.default.string(),
|
|
34
35
|
isDefault: zod_1.default.boolean(),
|
|
35
36
|
status: zod_1.default.enum(constants_1.PAYMENT_METHOD_STATUS),
|
|
36
37
|
externalBankId: zod_1.default.string().nullable(),
|
|
37
|
-
})
|
|
38
|
+
})
|
|
39
|
+
.partial();
|
|
40
|
+
exports.GetBanksInputSchema = zod_1.default.object({
|
|
41
|
+
country: zod_1.default
|
|
42
|
+
.string()
|
|
43
|
+
.default("nigeria")
|
|
44
|
+
.openapi({
|
|
45
|
+
param: { in: "query", name: "country" },
|
|
46
|
+
example: "nigeria",
|
|
47
|
+
}),
|
|
48
|
+
});
|
|
49
|
+
exports.VerifyAccountInputSchema = zod_1.default
|
|
50
|
+
.object({
|
|
51
|
+
accountNumber: zod_1.default.string().length(10, "Account number must be 10 digits"),
|
|
52
|
+
bankCode: zod_1.default.string().min(1, "Bank code is required"),
|
|
53
|
+
})
|
|
54
|
+
.openapi("VerifyAccountInput");
|
|
55
|
+
exports.VerifyAccountOutputSchema = zod_1.default
|
|
56
|
+
.object({
|
|
57
|
+
accountName: zod_1.default.string(),
|
|
58
|
+
})
|
|
59
|
+
.openapi("VerifyAccountOutput");
|
|
60
|
+
exports.BankListOutputSchema = zod_1.default
|
|
61
|
+
.array(zod_1.default.object({
|
|
62
|
+
name: zod_1.default.string(),
|
|
63
|
+
code: zod_1.default.string(),
|
|
64
|
+
}))
|
|
65
|
+
.openapi("BankListOutput");
|
package/dist/schemas/seller.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ export declare const SellerEntitySchema: z.ZodObject<{
|
|
|
18
18
|
}, z.core.$strip>;
|
|
19
19
|
export type SellerEntity = z.infer<typeof SellerEntitySchema>;
|
|
20
20
|
export declare const CreateSellerEntityInputSchema: z.ZodObject<{
|
|
21
|
-
businessName: z.ZodString;
|
|
22
21
|
countryOfOperation: z.ZodEnum<{
|
|
23
22
|
readonly NG: "NG";
|
|
24
23
|
readonly GB: "GB";
|
|
@@ -29,7 +28,6 @@ export declare const CreateSellerEntityInputSchema: z.ZodObject<{
|
|
|
29
28
|
}, z.core.$strip>;
|
|
30
29
|
export type CreateSellerInput = z.infer<typeof CreateSellerEntityInputSchema>;
|
|
31
30
|
export declare const UpdateSellerEntitySchema: z.ZodObject<{
|
|
32
|
-
businessName: z.ZodOptional<z.ZodString>;
|
|
33
31
|
countryOfOperation: z.ZodOptional<z.ZodEnum<{
|
|
34
32
|
readonly NG: "NG";
|
|
35
33
|
readonly GB: "GB";
|
package/dist/schemas/seller.js
CHANGED
|
@@ -8,7 +8,7 @@ const zod_1 = __importDefault(require("zod"));
|
|
|
8
8
|
const constants_1 = require("../constants");
|
|
9
9
|
exports.SellerEntitySchema = zod_1.default.object({
|
|
10
10
|
id: zod_1.default.cuid2(),
|
|
11
|
-
businessName: zod_1.default.string(),
|
|
11
|
+
businessName: zod_1.default.string(), // Kept here for the app to consume!
|
|
12
12
|
countryOfOperation: zod_1.default.enum(constants_1.COUNTRY_OF_OPERATION),
|
|
13
13
|
stripeConnectId: zod_1.default.string().nullable(),
|
|
14
14
|
paystackSubaccountCode: zod_1.default.string().nullable(),
|
|
@@ -16,8 +16,8 @@ exports.SellerEntitySchema = zod_1.default.object({
|
|
|
16
16
|
createdAt: zod_1.default.coerce.date(),
|
|
17
17
|
updatedAt: zod_1.default.coerce.date(),
|
|
18
18
|
});
|
|
19
|
+
// No businessName here, because the API doesn't accept it (it relies on the User table)
|
|
19
20
|
exports.CreateSellerEntityInputSchema = zod_1.default.object({
|
|
20
|
-
businessName: zod_1.default.string(),
|
|
21
21
|
countryOfOperation: zod_1.default.enum(constants_1.COUNTRY_OF_OPERATION),
|
|
22
22
|
bankCode: zod_1.default.string().nullable(),
|
|
23
23
|
accountNumber: zod_1.default.string(),
|
|
@@ -25,7 +25,6 @@ exports.CreateSellerEntityInputSchema = zod_1.default.object({
|
|
|
25
25
|
});
|
|
26
26
|
exports.UpdateSellerEntitySchema = zod_1.default
|
|
27
27
|
.object({
|
|
28
|
-
businessName: zod_1.default.string(),
|
|
29
28
|
countryOfOperation: zod_1.default.enum(constants_1.COUNTRY_OF_OPERATION),
|
|
30
29
|
stripeConnectId: zod_1.default.string().nullable(),
|
|
31
30
|
paystackSubaccountCode: zod_1.default.string().nullable(),
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
2
|
import { GATEWAY_PROVIDER, PAYMENT_METHOD_STATUS } from "../constants";
|
|
3
|
-
|
|
4
3
|
export const PayoutMethodEntitySchema = z.object({
|
|
5
4
|
id: z.cuid2(),
|
|
6
5
|
sellerId: z.cuid2(),
|
|
7
6
|
provider: z.enum(GATEWAY_PROVIDER),
|
|
8
7
|
currency: z.string(),
|
|
9
8
|
bankName: z.string(),
|
|
10
|
-
|
|
9
|
+
accountLast4: z.string(),
|
|
11
10
|
accountName: z.string(),
|
|
12
11
|
externalBankId: z.string().nullable(),
|
|
13
12
|
isDefault: z.boolean(),
|
|
@@ -15,7 +14,6 @@ export const PayoutMethodEntitySchema = z.object({
|
|
|
15
14
|
createdAt: z.coerce.date(),
|
|
16
15
|
updatedAt: z.coerce.date(),
|
|
17
16
|
});
|
|
18
|
-
|
|
19
17
|
export type PayoutMethodEntity = z.infer<typeof PayoutMethodEntitySchema>;
|
|
20
18
|
|
|
21
19
|
export const CreatePayoutMethodEntitySchema = z.object({
|
|
@@ -29,13 +27,57 @@ export type CreatePayoutMethodInput = z.infer<
|
|
|
29
27
|
typeof CreatePayoutMethodEntitySchema
|
|
30
28
|
>;
|
|
31
29
|
|
|
32
|
-
export const UpdatePayoutMethodEntitySchema = z
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
export const UpdatePayoutMethodEntitySchema = z
|
|
31
|
+
.object({
|
|
32
|
+
bankName: z.string(),
|
|
33
|
+
accountLast4: z.string(),
|
|
34
|
+
accountName: z.string(),
|
|
35
|
+
isDefault: z.boolean(),
|
|
36
|
+
status: z.enum(PAYMENT_METHOD_STATUS),
|
|
37
|
+
externalBankId: z.string().nullable(),
|
|
38
|
+
})
|
|
39
|
+
.partial();
|
|
40
|
+
|
|
41
|
+
export type UpdatePayoutMethodInput = z.infer<
|
|
42
|
+
typeof UpdatePayoutMethodEntitySchema
|
|
43
|
+
>;
|
|
44
|
+
|
|
45
|
+
export const GetBanksInputSchema = z.object({
|
|
46
|
+
country: z
|
|
47
|
+
.string()
|
|
48
|
+
.default("nigeria")
|
|
49
|
+
.openapi({
|
|
50
|
+
param: { in: "query", name: "country" },
|
|
51
|
+
example: "nigeria",
|
|
52
|
+
}),
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export type GetBanksInput = z.infer<typeof GetBanksInputSchema>;
|
|
56
|
+
|
|
57
|
+
export const VerifyAccountInputSchema = z
|
|
58
|
+
.object({
|
|
59
|
+
accountNumber: z.string().length(10, "Account number must be 10 digits"),
|
|
60
|
+
bankCode: z.string().min(1, "Bank code is required"),
|
|
61
|
+
})
|
|
62
|
+
.openapi("VerifyAccountInput");
|
|
63
|
+
|
|
64
|
+
export type VerifyAccountInput = z.infer<typeof VerifyAccountInputSchema>;
|
|
65
|
+
|
|
66
|
+
export const VerifyAccountOutputSchema = z
|
|
67
|
+
.object({
|
|
68
|
+
accountName: z.string(),
|
|
69
|
+
})
|
|
70
|
+
.openapi("VerifyAccountOutput");
|
|
71
|
+
|
|
72
|
+
export type VerifyAccountOutput = z.infer<typeof VerifyAccountOutputSchema>;
|
|
73
|
+
|
|
74
|
+
export const BankListOutputSchema = z
|
|
75
|
+
.array(
|
|
76
|
+
z.object({
|
|
77
|
+
name: z.string(),
|
|
78
|
+
code: z.string(),
|
|
79
|
+
}),
|
|
80
|
+
)
|
|
81
|
+
.openapi("BankListOutput");
|
|
40
82
|
|
|
41
|
-
export type
|
|
83
|
+
export type BankListOutput = z.infer<typeof BankListOutputSchema>;
|
package/src/schemas/seller.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { COUNTRY_OF_OPERATION, SELLER_STATUS } from "../constants";
|
|
|
3
3
|
|
|
4
4
|
export const SellerEntitySchema = z.object({
|
|
5
5
|
id: z.cuid2(),
|
|
6
|
-
businessName: z.string(),
|
|
6
|
+
businessName: z.string(), // Kept here for the app to consume!
|
|
7
7
|
countryOfOperation: z.enum(COUNTRY_OF_OPERATION),
|
|
8
8
|
stripeConnectId: z.string().nullable(),
|
|
9
9
|
paystackSubaccountCode: z.string().nullable(),
|
|
@@ -13,8 +13,8 @@ export const SellerEntitySchema = z.object({
|
|
|
13
13
|
});
|
|
14
14
|
export type SellerEntity = z.infer<typeof SellerEntitySchema>;
|
|
15
15
|
|
|
16
|
+
// No businessName here, because the API doesn't accept it (it relies on the User table)
|
|
16
17
|
export const CreateSellerEntityInputSchema = z.object({
|
|
17
|
-
businessName: z.string(),
|
|
18
18
|
countryOfOperation: z.enum(COUNTRY_OF_OPERATION),
|
|
19
19
|
bankCode: z.string().nullable(),
|
|
20
20
|
accountNumber: z.string(),
|
|
@@ -24,12 +24,10 @@ export type CreateSellerInput = z.infer<typeof CreateSellerEntityInputSchema>;
|
|
|
24
24
|
|
|
25
25
|
export const UpdateSellerEntitySchema = z
|
|
26
26
|
.object({
|
|
27
|
-
businessName: z.string(),
|
|
28
27
|
countryOfOperation: z.enum(COUNTRY_OF_OPERATION),
|
|
29
28
|
stripeConnectId: z.string().nullable(),
|
|
30
29
|
paystackSubaccountCode: z.string().nullable(),
|
|
31
30
|
status: z.enum(SELLER_STATUS),
|
|
32
31
|
})
|
|
33
32
|
.partial();
|
|
34
|
-
|
|
35
33
|
export type UpdateSellerInput = z.infer<typeof UpdateSellerEntitySchema>;
|