@classytic/commerce-sdk 0.1.0
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.
Potentially problematic release.
This version of @classytic/commerce-sdk might be problematic. Click here for more details.
- package/LICENSE +14 -0
- package/README.md +104 -0
- package/dist/adjustment-DTSLM7AN.js +5 -0
- package/dist/adjustment-DTSLM7AN.js.map +1 -0
- package/dist/analytics/index.d.ts +27 -0
- package/dist/analytics/index.js +6 -0
- package/dist/analytics/index.js.map +1 -0
- package/dist/analytics-DMcD-o8w.d.ts +76 -0
- package/dist/api-factory-B_h4RKBm.d.ts +280 -0
- package/dist/auth/index.d.ts +39 -0
- package/dist/auth/index.js +5 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/catalog/index.d.ts +479 -0
- package/dist/catalog/index.js +9 -0
- package/dist/catalog/index.js.map +1 -0
- package/dist/chunk-4ZQK3FFN.js +40 -0
- package/dist/chunk-4ZQK3FFN.js.map +1 -0
- package/dist/chunk-5L6EXDGH.js +465 -0
- package/dist/chunk-5L6EXDGH.js.map +1 -0
- package/dist/chunk-5ZFW3FEI.js +183 -0
- package/dist/chunk-5ZFW3FEI.js.map +1 -0
- package/dist/chunk-66OQAZSL.js +94 -0
- package/dist/chunk-66OQAZSL.js.map +1 -0
- package/dist/chunk-6RYGA6MF.js +123 -0
- package/dist/chunk-6RYGA6MF.js.map +1 -0
- package/dist/chunk-B6MPVOV7.js +328 -0
- package/dist/chunk-B6MPVOV7.js.map +1 -0
- package/dist/chunk-BDA2WSJA.js +148 -0
- package/dist/chunk-BDA2WSJA.js.map +1 -0
- package/dist/chunk-EIVYT3HM.js +126 -0
- package/dist/chunk-EIVYT3HM.js.map +1 -0
- package/dist/chunk-EPQN7ZKZ.js +27 -0
- package/dist/chunk-EPQN7ZKZ.js.map +1 -0
- package/dist/chunk-FA7QFJ2G.js +177 -0
- package/dist/chunk-FA7QFJ2G.js.map +1 -0
- package/dist/chunk-I5TIKUIQ.js +261 -0
- package/dist/chunk-I5TIKUIQ.js.map +1 -0
- package/dist/chunk-ILQUH444.js +135 -0
- package/dist/chunk-ILQUH444.js.map +1 -0
- package/dist/chunk-IXMWZJLV.js +616 -0
- package/dist/chunk-IXMWZJLV.js.map +1 -0
- package/dist/chunk-KZIGRIQG.js +75 -0
- package/dist/chunk-KZIGRIQG.js.map +1 -0
- package/dist/chunk-OF5M6R2S.js +769 -0
- package/dist/chunk-OF5M6R2S.js.map +1 -0
- package/dist/chunk-PYYLHUV6.js +3 -0
- package/dist/chunk-PYYLHUV6.js.map +1 -0
- package/dist/chunk-QO5AGZFP.js +159 -0
- package/dist/chunk-QO5AGZFP.js.map +1 -0
- package/dist/chunk-QUMTBLNE.js +76 -0
- package/dist/chunk-QUMTBLNE.js.map +1 -0
- package/dist/chunk-R5Z7NYLH.js +126 -0
- package/dist/chunk-R5Z7NYLH.js.map +1 -0
- package/dist/chunk-SZYWG5IB.js +75 -0
- package/dist/chunk-SZYWG5IB.js.map +1 -0
- package/dist/chunk-U3XT35GZ.js +202 -0
- package/dist/chunk-U3XT35GZ.js.map +1 -0
- package/dist/chunk-UGELTUIZ.js +830 -0
- package/dist/chunk-UGELTUIZ.js.map +1 -0
- package/dist/chunk-VR36QVX2.js +122 -0
- package/dist/chunk-VR36QVX2.js.map +1 -0
- package/dist/chunk-WUOQK7BO.js +13 -0
- package/dist/chunk-WUOQK7BO.js.map +1 -0
- package/dist/chunk-X6PV5MHG.js +582 -0
- package/dist/chunk-X6PV5MHG.js.map +1 -0
- package/dist/chunk-ZWLMFLLH.js +534 -0
- package/dist/chunk-ZWLMFLLH.js.map +1 -0
- package/dist/content/index.d.ts +309 -0
- package/dist/content/index.js +6 -0
- package/dist/content/index.js.map +1 -0
- package/dist/core/index.d.ts +107 -0
- package/dist/core/index.js +5 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/react.d.ts +107 -0
- package/dist/core/react.js +5 -0
- package/dist/core/react.js.map +1 -0
- package/dist/coupon-CHFcw7cd.d.ts +632 -0
- package/dist/coupon-zGkvO-Xx.d.ts +129 -0
- package/dist/crud.factory-DyKaPHcU.d.ts +181 -0
- package/dist/finance/index.d.ts +81 -0
- package/dist/finance/index.js +5 -0
- package/dist/finance/index.js.map +1 -0
- package/dist/finance-BJdfKRw0.d.ts +135 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/inventory/index.d.ts +512 -0
- package/dist/inventory/index.js +16 -0
- package/dist/inventory/index.js.map +1 -0
- package/dist/inventory-DCiIZh8P.d.ts +742 -0
- package/dist/logistics/index.d.ts +226 -0
- package/dist/logistics/index.js +7 -0
- package/dist/logistics/index.js.map +1 -0
- package/dist/logistics-V8a9lUN3.d.ts +428 -0
- package/dist/media-CNLJK93J.d.ts +721 -0
- package/dist/movement-7MV3ADY5.js +5 -0
- package/dist/movement-7MV3ADY5.js.map +1 -0
- package/dist/payment-BRboLqvU.d.ts +127 -0
- package/dist/payments/index.d.ts +55 -0
- package/dist/payments/index.js +6 -0
- package/dist/payments/index.js.map +1 -0
- package/dist/platform/index.d.ts +645 -0
- package/dist/platform/index.js +8 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/pos-D1jkkFl0.d.ts +885 -0
- package/dist/product-p09zXkXB.d.ts +260 -0
- package/dist/purchase-24BGT2HA.js +5 -0
- package/dist/purchase-24BGT2HA.js.map +1 -0
- package/dist/request-652PS6VR.js +5 -0
- package/dist/request-652PS6VR.js.map +1 -0
- package/dist/sales/index.d.ts +585 -0
- package/dist/sales/index.js +9 -0
- package/dist/sales/index.js.map +1 -0
- package/dist/server.d.ts +120 -0
- package/dist/server.js +27 -0
- package/dist/server.js.map +1 -0
- package/dist/size-guide-DgjzjM5P.d.ts +554 -0
- package/dist/stock-DEApGC-w.d.ts +632 -0
- package/dist/stock-OOUW57VQ.js +5 -0
- package/dist/stock-OOUW57VQ.js.map +1 -0
- package/dist/supplier-OC6JAWV6.js +5 -0
- package/dist/supplier-OC6JAWV6.js.map +1 -0
- package/dist/transaction/index.d.ts +104 -0
- package/dist/transaction/index.js +8 -0
- package/dist/transaction/index.js.map +1 -0
- package/dist/transaction-BTmoHpWh.d.ts +428 -0
- package/dist/transaction-u5oaNuav.d.ts +84 -0
- package/dist/transfer-7SYSH3RG.js +5 -0
- package/dist/transfer-7SYSH3RG.js.map +1 -0
- package/dist/user-data-DdLjAGwO.d.ts +132 -0
- package/package.json +146 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { A as ApiResponse } from './api-factory-B_h4RKBm.js';
|
|
2
|
+
|
|
3
|
+
type PaymentStatus = "pending" | "verified" | "failed" | "refunded" | "partially_refunded" | "cancelled";
|
|
4
|
+
/**
|
|
5
|
+
* Transaction reference info
|
|
6
|
+
*/
|
|
7
|
+
interface TransactionEntity {
|
|
8
|
+
referenceModel: "Order";
|
|
9
|
+
referenceId: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Verification result returned from backend
|
|
13
|
+
*/
|
|
14
|
+
interface VerificationResult {
|
|
15
|
+
transactionId: string;
|
|
16
|
+
status: PaymentStatus;
|
|
17
|
+
amount: number;
|
|
18
|
+
category: string;
|
|
19
|
+
verifiedAt: string;
|
|
20
|
+
verifiedBy: string;
|
|
21
|
+
entity: TransactionEntity | null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Reject result returned from backend
|
|
25
|
+
*/
|
|
26
|
+
interface RejectResult {
|
|
27
|
+
transactionId: string;
|
|
28
|
+
status: "failed";
|
|
29
|
+
failedAt: string;
|
|
30
|
+
failureReason: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Verify payment request payload
|
|
34
|
+
*/
|
|
35
|
+
interface VerifyPaymentPayload {
|
|
36
|
+
/** Transaction ID (MongoDB ObjectId) */
|
|
37
|
+
transactionId: string;
|
|
38
|
+
/** Optional verification notes */
|
|
39
|
+
notes?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Reject payment request payload
|
|
43
|
+
*/
|
|
44
|
+
interface RejectPaymentPayload {
|
|
45
|
+
/** Transaction ID (MongoDB ObjectId) */
|
|
46
|
+
transactionId: string;
|
|
47
|
+
/** Reason for rejection */
|
|
48
|
+
reason: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface FetchOptions {
|
|
52
|
+
cache?: RequestCache;
|
|
53
|
+
revalidate?: number;
|
|
54
|
+
tags?: string[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Payment API for admin payment management
|
|
58
|
+
*
|
|
59
|
+
* Manual Payment Verification Flow:
|
|
60
|
+
* 1. Customer places order → Transaction created with status 'pending'
|
|
61
|
+
* 2. Customer pays via bKash/Nagad/bank transfer/cash
|
|
62
|
+
* 3. Admin verifies payment via verifyPayment() endpoint
|
|
63
|
+
* 4. Backend updates transaction to 'verified'
|
|
64
|
+
* 5. Order status auto-updates to 'confirmed', payment status to 'verified'
|
|
65
|
+
*
|
|
66
|
+
* Endpoints:
|
|
67
|
+
* - POST /webhooks/payments/manual/verify - Verify pending payment (superadmin)
|
|
68
|
+
* - POST /webhooks/payments/manual/reject - Reject pending payment (superadmin)
|
|
69
|
+
*/
|
|
70
|
+
declare class PaymentApi {
|
|
71
|
+
private baseUrl;
|
|
72
|
+
/**
|
|
73
|
+
* Verify a manual payment (Admin/Superadmin only)
|
|
74
|
+
* POST /webhooks/payments/manual/verify
|
|
75
|
+
*
|
|
76
|
+
* Use this when admin confirms a customer's manual payment
|
|
77
|
+
* (bKash, Nagad, bank transfer, cash, etc.)
|
|
78
|
+
*
|
|
79
|
+
* After verification:
|
|
80
|
+
* - Transaction status → 'verified'
|
|
81
|
+
* - Order payment status → 'verified'
|
|
82
|
+
* - Order status → 'confirmed' (if was 'pending')
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* const result = await paymentApi.verifyPayment({
|
|
86
|
+
* token: adminToken,
|
|
87
|
+
* data: {
|
|
88
|
+
* transactionId: '507f1f77bcf86cd799439011',
|
|
89
|
+
* notes: 'Verified bKash payment TrxID: ABC123'
|
|
90
|
+
* }
|
|
91
|
+
* });
|
|
92
|
+
*/
|
|
93
|
+
verifyPayment({ token, data, options, }: {
|
|
94
|
+
token: string;
|
|
95
|
+
data: VerifyPaymentPayload;
|
|
96
|
+
options?: FetchOptions;
|
|
97
|
+
}): Promise<ApiResponse<VerificationResult>>;
|
|
98
|
+
/**
|
|
99
|
+
* Reject a manual payment (Admin/Superadmin only)
|
|
100
|
+
* POST /webhooks/payments/manual/reject
|
|
101
|
+
*
|
|
102
|
+
* Use this when admin rejects a customer's payment claim
|
|
103
|
+
* (invalid reference, insufficient amount, fraud, etc.)
|
|
104
|
+
*
|
|
105
|
+
* After rejection:
|
|
106
|
+
* - Transaction status → 'failed'
|
|
107
|
+
* - Order payment status → 'failed'
|
|
108
|
+
* - Reason recorded in transaction
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* const result = await paymentApi.rejectPayment({
|
|
112
|
+
* token: adminToken,
|
|
113
|
+
* data: {
|
|
114
|
+
* transactionId: '507f1f77bcf86cd799439011',
|
|
115
|
+
* reason: 'Invalid bKash TrxID - payment not found'
|
|
116
|
+
* }
|
|
117
|
+
* });
|
|
118
|
+
*/
|
|
119
|
+
rejectPayment({ token, data, options, }: {
|
|
120
|
+
token: string;
|
|
121
|
+
data: RejectPaymentPayload;
|
|
122
|
+
options?: FetchOptions;
|
|
123
|
+
}): Promise<ApiResponse<RejectResult>>;
|
|
124
|
+
}
|
|
125
|
+
declare const paymentApi: PaymentApi;
|
|
126
|
+
|
|
127
|
+
export { PaymentApi as P, type RejectResult as R, type TransactionEntity as T, type VerificationResult as V, type VerifyPaymentPayload as a, type RejectPaymentPayload as b, paymentApi as p };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { a as VerifyPaymentPayload, V as VerificationResult, b as RejectPaymentPayload, R as RejectResult } from '../payment-BRboLqvU.js';
|
|
2
|
+
export { P as PaymentApi, T as TransactionEntity, p as paymentApi } from '../payment-BRboLqvU.js';
|
|
3
|
+
import '../api-factory-B_h4RKBm.js';
|
|
4
|
+
|
|
5
|
+
interface UsePaymentActionsReturn {
|
|
6
|
+
verifyPayment: (data: VerifyPaymentPayload) => Promise<VerificationResult>;
|
|
7
|
+
isVerifying: boolean;
|
|
8
|
+
rejectPayment: (data: RejectPaymentPayload) => Promise<RejectResult>;
|
|
9
|
+
isRejecting: boolean;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Payment verification actions for admin
|
|
15
|
+
*
|
|
16
|
+
* Manual Payment Verification Flow:
|
|
17
|
+
* 1. Customer places order → Transaction created with status 'pending'
|
|
18
|
+
* 2. Customer pays via bKash/Nagad/bank transfer/cash
|
|
19
|
+
* 3. Admin verifies payment via verifyPayment()
|
|
20
|
+
* 4. Backend updates transaction to 'verified'
|
|
21
|
+
* 5. Order status auto-updates to 'confirmed', payment status to 'verified'
|
|
22
|
+
*
|
|
23
|
+
* @param token - Auth token (admin/superadmin)
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* function PaymentVerifier({ transaction }) {
|
|
28
|
+
* const { verifyPayment, rejectPayment, isLoading } = usePaymentActions(token);
|
|
29
|
+
*
|
|
30
|
+
* const handleVerify = async () => {
|
|
31
|
+
* await verifyPayment({
|
|
32
|
+
* transactionId: transaction._id,
|
|
33
|
+
* notes: 'Verified bKash payment TrxID: ABC123',
|
|
34
|
+
* });
|
|
35
|
+
* };
|
|
36
|
+
*
|
|
37
|
+
* const handleReject = async () => {
|
|
38
|
+
* await rejectPayment({
|
|
39
|
+
* transactionId: transaction._id,
|
|
40
|
+
* reason: 'Invalid bKash TrxID - payment not found',
|
|
41
|
+
* });
|
|
42
|
+
* };
|
|
43
|
+
*
|
|
44
|
+
* return (
|
|
45
|
+
* <>
|
|
46
|
+
* <Button onClick={handleVerify} disabled={isLoading}>Verify</Button>
|
|
47
|
+
* <Button onClick={handleReject} disabled={isLoading}>Reject</Button>
|
|
48
|
+
* </>
|
|
49
|
+
* );
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
declare function usePaymentActions(token: string): UsePaymentActionsReturn;
|
|
54
|
+
|
|
55
|
+
export { RejectPaymentPayload, RejectResult, type UsePaymentActionsReturn, VerificationResult, VerifyPaymentPayload, usePaymentActions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|