Tests and package name updated

This commit is contained in:
Savya Bikram Shah
2026-05-07 17:42:48 +05:45
commit 270d6a69ae
92 changed files with 2169 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
# Fonepay Unity
See [README](../README.md) for setup, API reference, and examples.
## Architecture
| Layer | Type | Purpose |
|---|---|---|
| Public | `FonepayClient` | Façade. Auto-loads config + secrets. |
| API | `FonepayApiClient` | Signed REST calls (QR, status, tax refund). |
| Websocket | `FonepayWebsocketClient` | Receive-loop for QR verification + payment frames. |
| Crypto | `HmacSha512Signer` | HMAC-SHA512 dataValidation. |
| Models | `QrRequest`/`QrResult`/`QRPaymentStatus`/... | Serializable DTOs. |
## Flow
```
PurchaseAsync(req) ── POST QR ──▶ QrResult { qrCode, thirdpartyQrWebSocketUrl }
AwaitPaymentAsync(url) ── WS ──▶ QRPaymentStatus { Outcome }
├─ qrVerified frame → onQrVerified callback
└─ paymentSuccess frame → resolve
```
## Outcome rules
| `success` | `paymentSuccess` | `Outcome` |
|---|---|---|
| true | true | Complete |
| true | false | CancelledByUser |
| false | * | Failed |
## Termination
- Payment frame received → resolve normally.
- `CancellationToken` cancelled → `OperationCanceledException`, socket disconnects.
- Server closes socket before payment → `InvalidOperationException`.