@lacspace/esewa 1.1.0 → 1.1.1

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.
Files changed (2) hide show
  1. package/README.md +16 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -49,6 +49,17 @@ const form = await buildForm(
49
49
 
50
50
  `total_amount` defaults to `amount + taxAmount + productServiceCharge + productDeliveryCharge`.
51
51
 
52
+ > **eSewa amounts are in RUPEES, not paisa.** The rest of the @lacspace commerce suite (cart, order, tax, invoice, money…) stores integer **paisa**. Convert at this boundary with `paisaToRupees` — passing paisa straight through overcharges the customer 100×.
53
+ >
54
+ > ```ts
55
+ > import { buildForm, paisaToRupees } from "@lacspace/esewa";
56
+ >
57
+ > paisaToRupees(12345); // → 123.45
58
+ >
59
+ > // a Rs 123.45 order stored as 12345 paisa:
60
+ > await buildForm({ amount: paisaToRupees(12345), transactionUuid, productCode, successUrl, failureUrl }, { secret, env: "test" });
61
+ > ```
62
+
52
63
  ## Verify the success redirect
53
64
 
54
65
  ```ts
@@ -80,6 +91,7 @@ const status = await checkStatus(
80
91
  | Export | Description |
81
92
  | --- | --- |
82
93
  | `signPayment({ total_amount, transaction_uuid, product_code }, secret)` | base64 HMAC-SHA256 signature |
94
+ | `paisaToRupees(paisa)` | convert integer paisa → rupees for eSewa's amount fields (`12345` → `123.45`) |
83
95
  | `buildForm(input, { secret, env? })` | `{ action, method, fields }` ready to POST |
84
96
  | `verifyResponse(base64Data, secret)` | `{ valid, data }` — decode + timing-safe verify |
85
97
  | `checkStatus(params, { env?, fetch? })` | GET the status API, returns parsed JSON |
@@ -91,9 +103,9 @@ const status = await checkStatus(
91
103
 
92
104
  ## Licensing
93
105
 
94
- This package is **free** under the **[Lacspace Free Licence](https://lacspace.com/licenses/lacspace-free-1.0)** — permissive freedoms. Use it in personal and commercial projects at no cost; just keep the notice.
106
+ This package is **free** under the **[Lacspace Free Licence](https://developer.lacspace.com/licenses/lacspace-free-1.0)** — permissive freedoms. Use it in personal and commercial projects at no cost; just keep the notice.
95
107
 
96
- Not every Lacspace package is free. We also offer **Commercial** (paid), **Client-specific**, and **Private** (proprietary) packages under separate terms. See the full **[Lacspace Licence Centre](https://lacspace.com/licenses)**.
108
+ Not every Lacspace package is free. We also offer **Commercial** (paid), **Client-specific**, and **Private** (proprietary) packages under separate terms. See the full **[Lacspace Licence Centre](https://developer.lacspace.com/licenses)**.
97
109
 
98
110
  <!-- LACSPACE-DEV-PLATFORM -->
99
111
 
@@ -101,7 +113,7 @@ Not every Lacspace package is free. We also offer **Commercial** (paid), **Clien
101
113
 
102
114
  ## The Lacspace Developer Platform
103
115
 
104
- `@lacspace/esewa` is part of **63+ zero-dependency, isomorphic TypeScript packages**. Explore the ecosystem:
116
+ `@lacspace/esewa` is part of **80+ zero-dependency, isomorphic TypeScript packages**. Explore the ecosystem:
105
117
 
106
118
  - 🗂️ **All packages** — https://developer.lacspace.com/packages
107
119
  - 🧭 **Developer handbook** — https://developer.lacspace.com/handbook
@@ -109,4 +121,4 @@ Not every Lacspace package is free. We also offer **Commercial** (paid), **Clien
109
121
  - 🖥️ **Finished app templates** — https://templates.lacspace.com
110
122
  - 🚀 **Scaffold a full app** — `npm create lacspace-app@latest`
111
123
 
112
- Free under the **[Lacspace Free Licence](https://lacspace.com/licenses/lacspace-free-1.0)** — a permissive, free-to-use licence.
124
+ Free under the **[Lacspace Free Licence](https://developer.lacspace.com/licenses/lacspace-free-1.0)** — a permissive, free-to-use licence.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacspace/esewa",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "eSewa ePay v2 (Nepal) payment gateway toolkit over Web Crypto — HMAC-SHA256 signing, form building, response verification and transaction status checks. Zero-dependency, isomorphic (Node, edge, browser).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",