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;AA8J9B,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,IAAI,CAAC,IAAI,CAC9B,yBAAyB,aAAa,UAAU,EAChD,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,kBAAkB,CACtB,SAAiB,EACjB,OAA8B;QAE9B,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAC9B,8BAA8B,EAC9B,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,gBAAgB,CACpB,SAAiB,EACjB,MAA2B;QAE3B,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAC7B,uCAAuC,EACvC;YACE,MAAM;YACN,OAAO,EAAE;gBACP,aAAa,EAAE,SAAS;aACzB;SACF,CACF,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAa,EAAC,SAAS,CAAC,CAAC;QAChD,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF,CAAA;AAlGY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,mBAAU,GAAE;qCAEwB,mBAAW;GADnC,yBAAyB,CAkGrC"}
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;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CAAC;CACF,CAAA;AAlGY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,mBAAU,GAAE;qCAEwB,mBAAW;GADnC,yBAAyB,CAkGrC"}
package/manual.txt CHANGED
@@ -1,73 +1,58 @@
1
- ProspayAuthService
2
- - authenticate(): POST {baseUrl}/auth/api/v1.0/authenz/token?action=verify
3
- Inputs: headers => timestamp (epoch seconds), resourceId (productId), keyhash (bcrypt of `${timestamp}.${productId}.${productApiKey}`); no body.
4
- Success: `{ status, message?, token?, ... }` (auth token payload). Base URL defaults to https://sandbox.prospay.tech.
5
-
6
- ProspayCustomerService
7
- - createCustomer(authToken, payload): POST /customer/api/v3.0/customers
8
- Inputs (body): productId, productCustomerId, orgName, customerType, contacts { email, mobileNumber }.
9
- Success: `{ status, message, data: { customerId, customerData, virtualAccountNo, uin, qrString, isDeliveryAllowed, creditPeriodInDays } }`.
10
-
11
- - updateCustomer(authToken, customerId, payload): PATCH /customer/api/v3.0/customers/{customerId}/
12
- Inputs (body): any subset of creditPeriodInDays, uin, preferences { isMainOrg, mainOrgCustomerId, shareWallet, customerIdForWallet, shareKYC, customerIdForKYC, paymentType }, isDeliveryAllowed, billingType, invoiceGenerationPeriod, CIN, status, creditlimit, contacts { email, mobileNumber }, industryType, KYC { businessType, isGSTRegistered, GST, customerConsent }, address { line1, line2, city, state, pincode, stateCode }, productId.
13
- Success: `{ status, message, data: { uin, creditPeriodInDays, customerId, customerData, kycData, creditLimit: { walletId, oldCreditLimit, newCreditLimit, newAvailableBalance, currency, updatedAt } } }`.
14
-
15
- - updateCustomerStatus(authToken, customerId, payload): PATCH /customer/api/v3.0/customers/{customerId}/
16
- Inputs (body): productId, status.
17
- Success: `{ status, message, data: { uin, creditPeriodInDays, customerId, customerData } }`.
18
-
19
- - getCustomerById(authToken, customerId): GET /customer/api/v3.0/customers/{customerId}?filter=all
20
- Inputs: headers => Authorization; query => filter=all.
21
- Success: `{ status, message, data: [customerProfile...], cached }` (profiles include contact, KYC, credit, bank, address, flags).
22
-
23
- - searchCustomers(authToken, params): GET /customer/api/v3.0/customers/search
24
- Inputs (query): filter?, mobileNumber?, productCustomerId?, customerType?; headers => Authorization.
25
- Success: `{ status, message, data }` (structure depends on search result).
26
-
27
- ProspayInvoiceService
28
- - generateBulkInvoice(authToken, payload, callbackUrl?): POST /invoices/api/v2.0/generateBulkInvoice
29
- Inputs (body): templateName, productId, startDate (YYYY-MM-DD), endDate (YYYY-MM-DD), buyer_customerId, seller_customerId, due_date (YYYY-MM-DD), invoice_no, invoice_date (DD-MM-YYYY), invoice_period; headers => Authorization, Content-Type, optional callback-url.
30
- Success: `{ status: "ok", message: "Process initiated for generating invoice", refId }`.
31
-
32
- - generateInvoice(authToken, payload, callbackUrl?): POST /invoices/api/v2.0/generateInvoice
33
- Inputs (body): templateName, productId, startDate (YYYY-MM-DD), endDate (YYYY-MM-DD), buyer_customerId, seller_customerId, due_date (YYYY-MM-DD), invoice_no, invoice_date (DD-MM-YYYY), invoice_period; headers => Authorization, Content-Type, optional callback-url.
34
- Success: `{ status: "ok", message: "Process initiated for generating invoice", refId }`.
35
-
36
- - getInvoiceStatus(authToken, refId): GET /invoices/api/v2.0/invoice-status/{refId}
37
- Inputs: path => refId; headers => Authorization, Content-Type.
38
- Success: `{ refId, overallStatus, templateName, productId, statistics: { total, success, failed, processing }, invoices: [{ invoiceId, status, createdAt, customerId, pdfUrl?, completedAt?, error?, errorDetails? }] }`.
39
-
40
- ProspayTransactionService
41
- - createTransaction(authToken, payload): POST /uts/api/transactions
42
- Inputs (body): customerId, entityType (e.g., "order"), referenceId, currency (e.g., "INR"), vertical (e.g., "customer"), charges: [{ head, amount, hsnOrSac, isBillable, absorbedBy, transactionType, chargedAt?, appliedOn?, tags?, breakup?, metadata? }].
43
- Success: `{ success: true, requestId, path, timestamp, data: { transactionId, summary: { transactionAmount, billableAmount, totalCreditAmount, totalDebitAmount } } }`.
44
-
45
- - addChargesToTransaction(authToken, transactionId, payload): POST /uts/api/transactions/{transactionId}/charges
46
- Inputs (body): charges: [{ head, amount, hsnOrSac, isBillable, absorbedBy, transactionType, chargedAt?, appliedOn?, tags?, breakup?, metadata? }]; path => transactionId.
47
- Success: `{ success: true, requestId, path, timestamp, data: { transactionId, addedChargesSummary: { transactionAmount, billableAmount, totalCreditAmount, totalDebitAmount }, transactionSummary: { transactionAmount, billableAmount, totalCreditAmount, totalDebitAmount } } }`.
48
-
49
- - searchTransactions(authToken, payload): POST /uts/api/transactions/search
50
- Inputs (body): page, limit, transactionFilters { customerIds?, transactionDateRange? { start, end } }.
51
- Success: `{ success: true, requestId, path, timestamp, data: { items: [...], pagination: { total, page, limit, totalPages } } }`.
52
-
53
- - getChargeSummary(authToken, params): GET /uts/api/transactions/charge-summary/
54
- Inputs (query): startDate (YYYY-MM-DD), endDate (YYYY-MM-DD); headers => Authorization.
55
- Success: `{ success: true, requestId, path, timestamp, data: [{ chargeHead, hsnOrSac, vertical, taxableAmount, cgstRate, cgst, sgstRate, sgst, igstRate, igst, totalTaxRate, totalTax, netAmount }, ...] }`.
56
-
57
- ProspayPaymentService
58
- - generateQr(authToken, payload): POST /payments/api/v2.0/QR
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prospay-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "NestJS-based SDK for Prospay customer onboarding, order, and invoicing APIs.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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
- // vertical: string; // e.g. "customer"
38
+ vertical?: string; // e.g. "customer"
39
+ fromStateCode?: string;
40
+ toStateCode?: string;
39
41
  charges: TransactionCharge[];
40
42
  }
41
43