prospay-sdk 1.1.0 → 1.1.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.
|
@@ -25,6 +25,9 @@ export interface CreateTransactionDto {
|
|
|
25
25
|
entityType: string;
|
|
26
26
|
referenceId: string;
|
|
27
27
|
currency: string;
|
|
28
|
+
vertical?: string;
|
|
29
|
+
fromStateCode?: string;
|
|
30
|
+
toStateCode?: string;
|
|
28
31
|
charges: TransactionCharge[];
|
|
29
32
|
}
|
|
30
33
|
export interface AddChargesToTransactionDto {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.service.js","sourceRoot":"","sources":["../../src/transaction/transaction.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,yCAA4C;AAC5C,+BAAqC;
|
|
1
|
+
{"version":3,"file":"transaction.service.js","sourceRoot":"","sources":["../../src/transaction/transaction.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,yCAA4C;AAC5C,+BAAqC;AAgK9B,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IACpC,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAOlD,KAAK,CAAC,iBAAiB,CACrB,SAAiB,EACjB,OAA6B;QAE7B,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAC9B,uBAAuB,EACvB,OAAO,EACP;YACE,OAAO,EAAE;gBACP,aAAa,EAAE,SAAS;gBACxB,cAAc,EAAE,kBAAkB;aACnC;SACF,CACF,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAa,EAAC,SAAS,CAAC,CAAC;QAChD,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAOD,KAAK,CAAC,uBAAuB,CAC3B,SAAiB,EACjB,aAAqB,EACrB,OAAmC;QAEnC,MAAM,SAAS,GAAG,IAAI,CAAC,I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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Inputs (body): customerId, amountInPaise, productId, productOrderId, callbackUrl, reason?, contacts { name?, email?, mobileNumber? }.
|
|
60
|
-
Success: `{ success, orderId, txnId, qrCode, providerName }`.
|
|
61
|
-
|
|
62
|
-
- generatePaymentLink(authToken, payload): POST /payments/api/v2.0/paymentLink
|
|
63
|
-
Inputs (body): customerId, amountInPaise, productId, productOrderId, callbackUrl, reason?, contacts { name?, email?, mobileNumber? }, orderInformation? { itemName, price, quantity }.
|
|
64
|
-
Success: `{ status, message, data }` (data may include payment link metadata).
|
|
65
|
-
|
|
66
|
-
- refundPayment(authToken, productOrderId, payload): POST /payments/api/v2.0/payment/{productOrderId}/refund
|
|
67
|
-
Inputs (path): productOrderId; body: productId, customerId, originalProductOrderId, productRefundId, amountWithGSTInPaise, amountWithoutGSTInPaise, reason?.
|
|
68
|
-
Success: `{ status, message, data }`.
|
|
69
|
-
|
|
70
|
-
- getPaymentStatus(authToken, productOrderId): GET /payments/api/v2.0/payment/{productOrderId}/status
|
|
71
|
-
Inputs: path => productOrderId; headers => Authorization.
|
|
72
|
-
Success: `{ status, message, data: { paymentTxnId, productOrderId, paymemtOrderId, payment_status, paymentTxnType, paymentAmount, paymentDate } }`.
|
|
73
|
-
Errors: e.g. `{ message: "orderId not found" }`.
|
|
1
|
+
Prospay SDK Manual
|
|
2
|
+
|
|
3
|
+
Purpose
|
|
4
|
+
- Provide a simple NestJS-based client for Prospay APIs: authentication, customers, invoices, transactions, and payments (QR, payment link, refund, status).
|
|
5
|
+
- Wrap HTTP calls with typed methods and consistent headers; default base URL is `https://sandbox.prospay.tech`.
|
|
6
|
+
|
|
7
|
+
Download
|
|
8
|
+
- npm: `https://www.npmjs.com/package/prospay-sdk`
|
|
9
|
+
- Install: `npm install prospay-sdk`
|
|
10
|
+
|
|
11
|
+
Setup
|
|
12
|
+
- Import the SDK module and register with your product credentials:
|
|
13
|
+
- `ProspaySdkModule.register({ productId, productApiKey, baseUrl?: 'https://sandbox.prospay.tech' })`
|
|
14
|
+
- Inject services (Auth, Customer, Invoice, Transaction, Payment) in your Nest providers.
|
|
15
|
+
|
|
16
|
+
Auth
|
|
17
|
+
- `authenticate()`: POST `{baseUrl}/auth/api/v1.0/authenz/token?action=verify`
|
|
18
|
+
- Headers: `timestamp` (epoch seconds), `resourceId` (productId), `keyhash` (bcrypt of `timestamp.productId.productApiKey`)
|
|
19
|
+
- Returns auth token payload.
|
|
20
|
+
|
|
21
|
+
Customers
|
|
22
|
+
- `createCustomer(authToken, payload)`: POST `/customer/api/v3.0/customers`
|
|
23
|
+
- `updateCustomer(authToken, customerId, payload)`: PATCH `/customer/api/v3.0/customers/{customerId}/`
|
|
24
|
+
- `updateCustomerStatus(authToken, customerId, payload)`: PATCH `/customer/api/v3.0/customers/{customerId}/`
|
|
25
|
+
- `getCustomerById(authToken, customerId)`: GET `/customer/api/v3.0/customers/{customerId}?filter=all`
|
|
26
|
+
- `searchCustomers(authToken, params)`: GET `/customer/api/v3.0/customers/search`
|
|
27
|
+
|
|
28
|
+
Invoices
|
|
29
|
+
- `generateBulkInvoice(authToken, payload, callbackUrl?)`: POST `/invoices/api/v2.0/generateBulkInvoice`
|
|
30
|
+
- `generateInvoice(authToken, payload, callbackUrl?)`: POST `/invoices/api/v2.0/generateInvoice`
|
|
31
|
+
- `getInvoiceStatus(authToken, refId)`: GET `/invoices/api/v2.0/invoice-status/{refId}`
|
|
32
|
+
- Returns `refId`, `overallStatus`, statistics, and detailed invoice items.
|
|
33
|
+
|
|
34
|
+
Transactions
|
|
35
|
+
- `createTransaction(authToken, payload)`: POST `/uts/api/transactions`
|
|
36
|
+
- Body: `customerId`, `entityType`, `referenceId`, `currency`, `charges`, optional `fromStateCode`, optional `toStateCode`, optional `vertical`
|
|
37
|
+
- `addChargesToTransaction(authToken, transactionId, payload)`: POST `/uts/api/transactions/{transactionId}/charges`
|
|
38
|
+
- `searchTransactions(authToken, payload)`: POST `/uts/api/transactions/search`
|
|
39
|
+
- `getChargeSummary(authToken, params)`: GET `/uts/api/transactions/charge-summary/`
|
|
40
|
+
|
|
41
|
+
Payments
|
|
42
|
+
- `generateQr(authToken, payload)`: POST `/payments/api/v2.0/QR`
|
|
43
|
+
- Body: `customerId`, `amountInPaise`, `productId`, `productOrderId`, `callbackUrl`, optional `reason`, `contacts { name?, email?, mobileNumber? }`
|
|
44
|
+
- Success: `{ success, orderId, txnId, qrCode, providerName }`
|
|
45
|
+
- `generatePaymentLink(authToken, payload)`: POST `/payments/api/v2.0/paymentLink`
|
|
46
|
+
- Body: `customerId`, `amountInPaise`, `productId`, `productOrderId`, `callbackUrl`, optional `reason`, `contacts`, `orderInformation { itemName, price, quantity }`
|
|
47
|
+
- Success: `{ status, message, data }`
|
|
48
|
+
- `refundPayment(authToken, productOrderId, payload)`: POST `/payments/api/v2.0/payment/{productOrderId}/refund`
|
|
49
|
+
- Body: `productId`, `customerId`, `originalProductOrderId`, `productRefundId`, `amountWithGSTInPaise`, `amountWithoutGSTInPaise`, optional `reason`
|
|
50
|
+
- Success: `{ status, message, data }`
|
|
51
|
+
- `getPaymentStatus(authToken, productOrderId)`: GET `/payments/api/v2.0/payment/{productOrderId}/status`
|
|
52
|
+
- Success: `{ status, message, data: { paymentTxnId, productOrderId, paymemtOrderId, payment_status, paymentTxnType, paymentAmount, paymentDate } }`
|
|
53
|
+
- Errors: `{ message: "orderId not found" }`, missing token returns `{"message":"No token provided"}`
|
|
54
|
+
|
|
55
|
+
Notes
|
|
56
|
+
- Always set `Authorization` header with the token from `authenticate()`.
|
|
57
|
+
- `amountInPaise` is an integer in paise (₹1 = 100).
|
|
58
|
+
- Avoid backticks and extra spaces around JSON values in requests.
|
package/package.json
CHANGED
|
@@ -35,7 +35,9 @@ export interface CreateTransactionDto {
|
|
|
35
35
|
entityType: string; // e.g. "order"
|
|
36
36
|
referenceId: string;
|
|
37
37
|
currency: string; // e.g. "INR"
|
|
38
|
-
|
|
38
|
+
vertical?: string; // e.g. "customer"
|
|
39
|
+
fromStateCode?: string;
|
|
40
|
+
toStateCode?: string;
|
|
39
41
|
charges: TransactionCharge[];
|
|
40
42
|
}
|
|
41
43
|
|