dk_payment_gateway 1.0.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.
- checksums.yaml +7 -0
- data/.rspec +4 -0
- data/.rspec_status +11 -0
- data/API_REFERENCE.md +458 -0
- data/CHANGELOG.md +64 -0
- data/DEVELOPMENT.md +380 -0
- data/EXAMPLES.md +491 -0
- data/FILE_STRUCTURE.md +407 -0
- data/Gemfile +13 -0
- data/INSTALLATION.md +460 -0
- data/LICENSE +22 -0
- data/PROJECT_OVERVIEW.md +314 -0
- data/QUICK_START.md +186 -0
- data/README.md +296 -0
- data/Rakefile +9 -0
- data/SUMMARY.md +285 -0
- data/dk_payment_gateway.gemspec +40 -0
- data/examples/README.md +199 -0
- data/examples/generate_qr.rb +110 -0
- data/examples/intra_transfer.rb +114 -0
- data/examples/simple_payment.rb +102 -0
- data/lib/dk_payment_gateway/authentication.rb +102 -0
- data/lib/dk_payment_gateway/client.rb +139 -0
- data/lib/dk_payment_gateway/configuration.rb +32 -0
- data/lib/dk_payment_gateway/errors.rb +39 -0
- data/lib/dk_payment_gateway/intra_transaction.rb +147 -0
- data/lib/dk_payment_gateway/pull_payment.rb +155 -0
- data/lib/dk_payment_gateway/qr_payment.rb +98 -0
- data/lib/dk_payment_gateway/signature.rb +72 -0
- data/lib/dk_payment_gateway/transaction_status.rb +127 -0
- data/lib/dk_payment_gateway/utils.rb +161 -0
- data/lib/dk_payment_gateway/version.rb +5 -0
- data/lib/dk_payment_gateway.rb +28 -0
- metadata +160 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 1adb745b88e5764958d079bc263f64a4053f2ceb29be5e4b8ebc46263665144d
|
|
4
|
+
data.tar.gz: b8f28758e6253f0a6d62088297361b9dbfd873fa2d3a8c91a26099947587b5a7
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 3eec783de887096d8b1390667c8e28a39832285bb408a806f1e911e38400c06d58e5b8cc2037fc55f5208bd42a886494876f9ea953ce57d5bf7fd185c394b351
|
|
7
|
+
data.tar.gz: 5347fc6912607f342e00a4b4c3d9b922cb50ad1e76ddbad6d9de5fc247a06f02784875fe3a654cf1d6b0d6e313907b54cfaca2968e5919c5626cbd80fd615036
|
data/.rspec
ADDED
data/.rspec_status
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
example_id | status | run_time |
|
|
2
|
+
---------------------------------------- | ------ | --------------- |
|
|
3
|
+
./spec/configuration_spec.rb[1:1:1] | passed | 0.00037 seconds |
|
|
4
|
+
./spec/configuration_spec.rb[1:2:1:1] | passed | 0.00027 seconds |
|
|
5
|
+
./spec/configuration_spec.rb[1:2:2:1] | passed | 0.00006 seconds |
|
|
6
|
+
./spec/configuration_spec.rb[1:3:1] | passed | 0.00095 seconds |
|
|
7
|
+
./spec/configuration_spec.rb[1:3:2] | passed | 0.00082 seconds |
|
|
8
|
+
./spec/dk_payment_gateway_spec.rb[1:1] | passed | 0.00005 seconds |
|
|
9
|
+
./spec/dk_payment_gateway_spec.rb[1:2:1] | passed | 0.00081 seconds |
|
|
10
|
+
./spec/dk_payment_gateway_spec.rb[1:2:2] | passed | 0.00005 seconds |
|
|
11
|
+
./spec/dk_payment_gateway_spec.rb[1:3:1] | passed | 0.00021 seconds |
|
data/API_REFERENCE.md
ADDED
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
# DK Payment Gateway API Reference
|
|
2
|
+
|
|
3
|
+
Complete API reference for the DK Payment Gateway Ruby gem.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
1. [Configuration](#configuration)
|
|
8
|
+
2. [Client](#client)
|
|
9
|
+
3. [Authentication](#authentication)
|
|
10
|
+
4. [Pull Payment](#pull-payment)
|
|
11
|
+
5. [Intra Transaction](#intra-transaction)
|
|
12
|
+
6. [QR Payment](#qr-payment)
|
|
13
|
+
7. [Transaction Status](#transaction-status)
|
|
14
|
+
8. [Errors](#errors)
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Configuration
|
|
19
|
+
|
|
20
|
+
### DkPaymentGateway.configure
|
|
21
|
+
|
|
22
|
+
Configure the gem with your API credentials.
|
|
23
|
+
|
|
24
|
+
```ruby
|
|
25
|
+
DkPaymentGateway.configure do |config|
|
|
26
|
+
config.base_url = String # API base URL
|
|
27
|
+
config.api_key = String # X-gravitee-api-key
|
|
28
|
+
config.username = String # Authentication username
|
|
29
|
+
config.password = String # Authentication password
|
|
30
|
+
config.client_id = String # OAuth client ID
|
|
31
|
+
config.client_secret = String # OAuth client secret
|
|
32
|
+
config.source_app = String # Source application identifier
|
|
33
|
+
config.timeout = Integer # Request timeout in seconds (default: 30)
|
|
34
|
+
config.open_timeout = Integer # Connection timeout in seconds (default: 10)
|
|
35
|
+
end
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Configuration Methods
|
|
39
|
+
|
|
40
|
+
#### `#valid?`
|
|
41
|
+
Returns `true` if all required configuration fields are set.
|
|
42
|
+
|
|
43
|
+
#### `#missing_fields`
|
|
44
|
+
Returns an array of missing required configuration field names.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Client
|
|
49
|
+
|
|
50
|
+
### DkPaymentGateway.client
|
|
51
|
+
|
|
52
|
+
Returns a new client instance with the current configuration.
|
|
53
|
+
|
|
54
|
+
```ruby
|
|
55
|
+
client = DkPaymentGateway.client
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Client Methods
|
|
59
|
+
|
|
60
|
+
#### `#authenticate!`
|
|
61
|
+
Fetches access token and private key for signing requests.
|
|
62
|
+
|
|
63
|
+
```ruby
|
|
64
|
+
client.authenticate!
|
|
65
|
+
# => Returns self
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Raises:**
|
|
69
|
+
- `DkPaymentGateway::ConfigurationError` - Invalid configuration
|
|
70
|
+
- `DkPaymentGateway::AuthenticationError` - Authentication failed
|
|
71
|
+
|
|
72
|
+
#### `#pull_payment`
|
|
73
|
+
Returns a `PullPayment` instance for pull payment operations.
|
|
74
|
+
|
|
75
|
+
```ruby
|
|
76
|
+
client.pull_payment
|
|
77
|
+
# => DkPaymentGateway::PullPayment
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
#### `#intra_transaction`
|
|
81
|
+
Returns an `IntraTransaction` instance for intra-bank operations.
|
|
82
|
+
|
|
83
|
+
```ruby
|
|
84
|
+
client.intra_transaction
|
|
85
|
+
# => DkPaymentGateway::IntraTransaction
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### `#qr_payment`
|
|
89
|
+
Returns a `QrPayment` instance for QR code operations.
|
|
90
|
+
|
|
91
|
+
```ruby
|
|
92
|
+
client.qr_payment
|
|
93
|
+
# => DkPaymentGateway::QrPayment
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### `#transaction_status`
|
|
97
|
+
Returns a `TransactionStatus` instance for status verification.
|
|
98
|
+
|
|
99
|
+
```ruby
|
|
100
|
+
client.transaction_status
|
|
101
|
+
# => DkPaymentGateway::TransactionStatus
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Authentication
|
|
107
|
+
|
|
108
|
+
Authentication is handled automatically when calling `client.authenticate!`.
|
|
109
|
+
|
|
110
|
+
### Methods
|
|
111
|
+
|
|
112
|
+
#### `Authentication#fetch_token`
|
|
113
|
+
Fetches OAuth access token.
|
|
114
|
+
|
|
115
|
+
**Returns:** `String` - Access token
|
|
116
|
+
|
|
117
|
+
**Raises:**
|
|
118
|
+
- `DkPaymentGateway::AuthenticationError`
|
|
119
|
+
|
|
120
|
+
#### `Authentication#fetch_private_key`
|
|
121
|
+
Fetches RSA private key for request signing.
|
|
122
|
+
|
|
123
|
+
**Returns:** `String` - RSA private key in PEM format
|
|
124
|
+
|
|
125
|
+
**Raises:**
|
|
126
|
+
- `DkPaymentGateway::AuthenticationError`
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Pull Payment
|
|
131
|
+
|
|
132
|
+
### PullPayment#authorize
|
|
133
|
+
|
|
134
|
+
Initiates payment authorization and sends OTP to remitter.
|
|
135
|
+
|
|
136
|
+
**Parameters:**
|
|
137
|
+
|
|
138
|
+
| Name | Type | Required | Description |
|
|
139
|
+
|------|------|----------|-------------|
|
|
140
|
+
| `transaction_datetime` | String | Yes | ISO 8601 timestamp |
|
|
141
|
+
| `stan_number` | String | Yes | 12-digit unique transaction number |
|
|
142
|
+
| `transaction_amount` | Numeric | Yes | Transaction amount |
|
|
143
|
+
| `transaction_fee` | Numeric | No | Transaction fee (default: 0) |
|
|
144
|
+
| `payment_desc` | String | Yes | Payment description |
|
|
145
|
+
| `account_number` | String | Yes | Beneficiary account number |
|
|
146
|
+
| `account_name` | String | Yes | Beneficiary account name |
|
|
147
|
+
| `email_id` | String | No | Beneficiary email |
|
|
148
|
+
| `phone_number` | String | Yes | Beneficiary phone number |
|
|
149
|
+
| `remitter_account_number` | String | Yes | Remitter account number |
|
|
150
|
+
| `remitter_account_name` | String | Yes | Remitter account name |
|
|
151
|
+
| `remitter_bank_id` | String | Yes | Remitter bank ID |
|
|
152
|
+
|
|
153
|
+
**Returns:** `Hash`
|
|
154
|
+
```ruby
|
|
155
|
+
{
|
|
156
|
+
"bfs_txn_id" => "523400081332",
|
|
157
|
+
"stan_number" => "020111571912",
|
|
158
|
+
"account_number" => "110158212197",
|
|
159
|
+
"remitter_account_number" => "770182571"
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Raises:**
|
|
164
|
+
- `DkPaymentGateway::InvalidParameterError`
|
|
165
|
+
- `DkPaymentGateway::TransactionError`
|
|
166
|
+
- `DkPaymentGateway::SignatureError`
|
|
167
|
+
|
|
168
|
+
### PullPayment#debit
|
|
169
|
+
|
|
170
|
+
Completes payment with OTP verification.
|
|
171
|
+
|
|
172
|
+
**Parameters:**
|
|
173
|
+
|
|
174
|
+
| Name | Type | Required | Description |
|
|
175
|
+
|------|------|----------|-------------|
|
|
176
|
+
| `request_id` | String | Yes | Unique request identifier |
|
|
177
|
+
| `bfs_txn_id` | String | Yes | Transaction ID from authorization |
|
|
178
|
+
| `bfs_remitter_otp` | String | Yes | OTP from remitter |
|
|
179
|
+
| `bfs_order_no` | String | No | Order number |
|
|
180
|
+
|
|
181
|
+
**Returns:** `Hash`
|
|
182
|
+
```ruby
|
|
183
|
+
{
|
|
184
|
+
"bfs_txn_id" => "523700081429",
|
|
185
|
+
"code" => "00",
|
|
186
|
+
"description" => "Approved"
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Raises:**
|
|
191
|
+
- `DkPaymentGateway::InvalidParameterError`
|
|
192
|
+
- `DkPaymentGateway::TransactionError`
|
|
193
|
+
|
|
194
|
+
### PullPayment.generate_stan
|
|
195
|
+
|
|
196
|
+
Class method to generate STAN number.
|
|
197
|
+
|
|
198
|
+
**Parameters:**
|
|
199
|
+
- `source_app_suffix` (String) - Last 4 digits of source_app
|
|
200
|
+
- `transaction_identifier` (String, optional) - 8-digit identifier
|
|
201
|
+
|
|
202
|
+
**Returns:** `String` - 12-digit STAN number
|
|
203
|
+
|
|
204
|
+
```ruby
|
|
205
|
+
DkPaymentGateway::PullPayment.generate_stan("0201")
|
|
206
|
+
# => "020111571912"
|
|
207
|
+
|
|
208
|
+
DkPaymentGateway::PullPayment.generate_stan("0201", "12345678")
|
|
209
|
+
# => "020112345678"
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Intra Transaction
|
|
215
|
+
|
|
216
|
+
### IntraTransaction#account_inquiry
|
|
217
|
+
|
|
218
|
+
Validates beneficiary account before transfer.
|
|
219
|
+
|
|
220
|
+
**Parameters:**
|
|
221
|
+
|
|
222
|
+
| Name | Type | Required | Description |
|
|
223
|
+
|------|------|----------|-------------|
|
|
224
|
+
| `request_id` | String | Yes | Unique request identifier |
|
|
225
|
+
| `amount` | Numeric | Yes | Transaction amount |
|
|
226
|
+
| `currency` | String | Yes | Currency code (e.g., "BTN") |
|
|
227
|
+
| `bene_bank_code` | String | Yes | Beneficiary bank code |
|
|
228
|
+
| `bene_account_number` | String | Yes | Beneficiary account number |
|
|
229
|
+
| `source_account_name` | String | No | Source account name |
|
|
230
|
+
| `source_account_number` | String | Yes | Source account number |
|
|
231
|
+
|
|
232
|
+
**Returns:** `Hash`
|
|
233
|
+
```ruby
|
|
234
|
+
{
|
|
235
|
+
"inquiry_id" => "DKBT--ptr2aseR2Ch85QY-AufVg-776768",
|
|
236
|
+
"account_name" => "Rinzin Jamtsho"
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### IntraTransaction#fund_transfer
|
|
241
|
+
|
|
242
|
+
Initiates fund transfer between DK accounts.
|
|
243
|
+
|
|
244
|
+
**Parameters:**
|
|
245
|
+
|
|
246
|
+
| Name | Type | Required | Description |
|
|
247
|
+
|------|------|----------|-------------|
|
|
248
|
+
| `request_id` | String | Yes | Unique request identifier |
|
|
249
|
+
| `inquiry_id` | String | Yes | Inquiry ID from account_inquiry |
|
|
250
|
+
| `source_app` | String | No | Source app (uses config default) |
|
|
251
|
+
| `transaction_amount` | Numeric | Yes | Transfer amount |
|
|
252
|
+
| `currency` | String | Yes | Currency code |
|
|
253
|
+
| `transaction_datetime` | String | Yes | ISO 8601 timestamp |
|
|
254
|
+
| `bene_bank_code` | String | Yes | Beneficiary bank code |
|
|
255
|
+
| `bene_account_number` | String | Yes | Beneficiary account number |
|
|
256
|
+
| `bene_cust_name` | String | Yes | Beneficiary name |
|
|
257
|
+
| `source_account_name` | String | No | Source account name |
|
|
258
|
+
| `source_account_number` | String | Yes | Source account number |
|
|
259
|
+
| `payment_type` | String | No | Payment type (default: "INTRA") |
|
|
260
|
+
| `narration` | String | Yes | Transaction description |
|
|
261
|
+
|
|
262
|
+
**Returns:** `Hash`
|
|
263
|
+
```ruby
|
|
264
|
+
{
|
|
265
|
+
"inquiry_id" => "DKBT-gllIxZ7rSoqkAOzZj4i2HQ-554567",
|
|
266
|
+
"txn_status_id" => "6f67d4ca-c8f9-49a5-8c2d-96c8b07c74e5"
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## QR Payment
|
|
273
|
+
|
|
274
|
+
### QrPayment#generate_qr
|
|
275
|
+
|
|
276
|
+
Generates QR code for payment.
|
|
277
|
+
|
|
278
|
+
**Parameters:**
|
|
279
|
+
|
|
280
|
+
| Name | Type | Required | Description |
|
|
281
|
+
|------|------|----------|-------------|
|
|
282
|
+
| `request_id` | String | Yes | Unique request identifier |
|
|
283
|
+
| `currency` | String | Yes | Currency code |
|
|
284
|
+
| `bene_account_number` | String | Yes | Beneficiary account number |
|
|
285
|
+
| `amount` | Numeric | Yes | Amount (0 for static QR) |
|
|
286
|
+
| `mcc_code` | String | Yes | Merchant Category Code |
|
|
287
|
+
| `remarks` | String | No | Optional remarks |
|
|
288
|
+
|
|
289
|
+
**Returns:** `Hash`
|
|
290
|
+
```ruby
|
|
291
|
+
{
|
|
292
|
+
"image" => "base64_encoded_image_data"
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### QrPayment#save_qr_image
|
|
297
|
+
|
|
298
|
+
Saves base64 QR image to file.
|
|
299
|
+
|
|
300
|
+
**Parameters:**
|
|
301
|
+
- `base64_image` (String) - Base64 encoded image
|
|
302
|
+
- `file_path` (String) - Path to save image
|
|
303
|
+
|
|
304
|
+
**Returns:** `String` - File path
|
|
305
|
+
|
|
306
|
+
```ruby
|
|
307
|
+
client.qr_payment.save_qr_image(response["image"], "qr_code.png")
|
|
308
|
+
# => "qr_code.png"
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Transaction Status
|
|
314
|
+
|
|
315
|
+
### TransactionStatus#check_current_day
|
|
316
|
+
|
|
317
|
+
Checks transaction status for current day.
|
|
318
|
+
|
|
319
|
+
**Parameters:**
|
|
320
|
+
|
|
321
|
+
| Name | Type | Required | Description |
|
|
322
|
+
|------|------|----------|-------------|
|
|
323
|
+
| `request_id` | String | Yes | Unique request identifier |
|
|
324
|
+
| `transaction_id` | String | Yes | Transaction ID |
|
|
325
|
+
| `bene_account_number` | String | Yes | Beneficiary account number |
|
|
326
|
+
|
|
327
|
+
**Returns:** `Hash`
|
|
328
|
+
```ruby
|
|
329
|
+
{
|
|
330
|
+
"meta_info" => {...},
|
|
331
|
+
"status" => {
|
|
332
|
+
"status" => "0",
|
|
333
|
+
"status_desc" => "Successfully completed",
|
|
334
|
+
"txn_ts" => "2025-09-18 12:32:21",
|
|
335
|
+
"amount" => "150.00",
|
|
336
|
+
"debit_account" => "200133679",
|
|
337
|
+
"credit_account" => "100100365856"
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### TransactionStatus#check_previous_days
|
|
343
|
+
|
|
344
|
+
Checks transaction status for previous business days.
|
|
345
|
+
|
|
346
|
+
**Parameters:**
|
|
347
|
+
|
|
348
|
+
| Name | Type | Required | Description |
|
|
349
|
+
|------|------|----------|-------------|
|
|
350
|
+
| `request_id` | String | Yes | Unique request identifier |
|
|
351
|
+
| `transaction_id` | String | Yes | Transaction ID |
|
|
352
|
+
| `transaction_date` | String | Yes | Date (YYYY-MM-DD format) |
|
|
353
|
+
| `bene_account_number` | String | Yes | Beneficiary account number |
|
|
354
|
+
|
|
355
|
+
**Returns:** `Array<Hash>` - Array of transaction status records
|
|
356
|
+
|
|
357
|
+
### Aliases
|
|
358
|
+
|
|
359
|
+
- `check_status` - Alias for `check_current_day`
|
|
360
|
+
- `check_historical_status` - Alias for `check_previous_days`
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## Errors
|
|
365
|
+
|
|
366
|
+
All errors inherit from `DkPaymentGateway::Error`.
|
|
367
|
+
|
|
368
|
+
### ConfigurationError
|
|
369
|
+
|
|
370
|
+
Raised when configuration is invalid or missing.
|
|
371
|
+
|
|
372
|
+
```ruby
|
|
373
|
+
rescue DkPaymentGateway::ConfigurationError => e
|
|
374
|
+
puts e.message
|
|
375
|
+
end
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### AuthenticationError
|
|
379
|
+
|
|
380
|
+
Raised when authentication fails.
|
|
381
|
+
|
|
382
|
+
```ruby
|
|
383
|
+
rescue DkPaymentGateway::AuthenticationError => e
|
|
384
|
+
puts e.message
|
|
385
|
+
end
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### InvalidParameterError
|
|
389
|
+
|
|
390
|
+
Raised when request parameters are invalid.
|
|
391
|
+
|
|
392
|
+
**Attributes:**
|
|
393
|
+
- `response_code` - API response code
|
|
394
|
+
- `response_detail` - Error details
|
|
395
|
+
|
|
396
|
+
```ruby
|
|
397
|
+
rescue DkPaymentGateway::InvalidParameterError => e
|
|
398
|
+
puts e.message
|
|
399
|
+
puts e.response_code
|
|
400
|
+
puts e.response_detail
|
|
401
|
+
end
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### TransactionError
|
|
405
|
+
|
|
406
|
+
Raised when transaction fails.
|
|
407
|
+
|
|
408
|
+
**Attributes:**
|
|
409
|
+
- `response_code` - API response code
|
|
410
|
+
- `response_message` - Error message
|
|
411
|
+
- `response_description` - Error description
|
|
412
|
+
- `response_detail` - Error details
|
|
413
|
+
|
|
414
|
+
```ruby
|
|
415
|
+
rescue DkPaymentGateway::TransactionError => e
|
|
416
|
+
puts e.message
|
|
417
|
+
puts e.response_code
|
|
418
|
+
puts e.response_description
|
|
419
|
+
end
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### NetworkError
|
|
423
|
+
|
|
424
|
+
Raised when network communication fails.
|
|
425
|
+
|
|
426
|
+
```ruby
|
|
427
|
+
rescue DkPaymentGateway::NetworkError => e
|
|
428
|
+
puts e.message
|
|
429
|
+
end
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### SignatureError
|
|
433
|
+
|
|
434
|
+
Raised when signature generation fails.
|
|
435
|
+
|
|
436
|
+
```ruby
|
|
437
|
+
rescue DkPaymentGateway::SignatureError => e
|
|
438
|
+
puts e.message
|
|
439
|
+
end
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
### APIError
|
|
443
|
+
|
|
444
|
+
Generic API error (parent of TransactionError).
|
|
445
|
+
|
|
446
|
+
**Attributes:**
|
|
447
|
+
- `response_code`
|
|
448
|
+
- `response_message`
|
|
449
|
+
- `response_description`
|
|
450
|
+
- `response_detail`
|
|
451
|
+
|
|
452
|
+
```ruby
|
|
453
|
+
rescue DkPaymentGateway::APIError => e
|
|
454
|
+
puts e.message
|
|
455
|
+
puts e.response_code
|
|
456
|
+
end
|
|
457
|
+
```
|
|
458
|
+
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2025-10-31
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial release of DK Payment Gateway Ruby gem
|
|
12
|
+
- Authentication module for token and RSA key management
|
|
13
|
+
- Signature generation using RS256 algorithm
|
|
14
|
+
- Pull payment support (authorization and debit)
|
|
15
|
+
- Intra-bank transaction support (account inquiry and fund transfer)
|
|
16
|
+
- QR code generation (static and dynamic)
|
|
17
|
+
- Transaction status verification (current day and historical)
|
|
18
|
+
- Comprehensive error handling with custom exception classes
|
|
19
|
+
- Configuration management
|
|
20
|
+
- Full documentation and usage examples
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
- **Authentication**
|
|
24
|
+
- Fetch authorization token with configurable scopes
|
|
25
|
+
- Retrieve RSA private key for request signing
|
|
26
|
+
|
|
27
|
+
- **Pull Payment**
|
|
28
|
+
- Payment gateway authorization with OTP request
|
|
29
|
+
- Debit request with OTP verification
|
|
30
|
+
- STAN number generation utility
|
|
31
|
+
|
|
32
|
+
- **Intra-Bank Transactions**
|
|
33
|
+
- Beneficiary account inquiry
|
|
34
|
+
- Fund transfer between DK accounts
|
|
35
|
+
|
|
36
|
+
- **QR Payments**
|
|
37
|
+
- Static QR generation (customer enters amount)
|
|
38
|
+
- Dynamic QR generation (fixed amount)
|
|
39
|
+
- QR image saving utility
|
|
40
|
+
|
|
41
|
+
- **Transaction Status**
|
|
42
|
+
- Current day transaction status check
|
|
43
|
+
- Historical transaction status check
|
|
44
|
+
|
|
45
|
+
- **Error Handling**
|
|
46
|
+
- ConfigurationError
|
|
47
|
+
- AuthenticationError
|
|
48
|
+
- InvalidParameterError
|
|
49
|
+
- TransactionError
|
|
50
|
+
- NetworkError
|
|
51
|
+
- SignatureError
|
|
52
|
+
- APIError
|
|
53
|
+
|
|
54
|
+
### Dependencies
|
|
55
|
+
- faraday ~> 2.0 (HTTP client)
|
|
56
|
+
- jwt ~> 2.7 (JWT encoding for signatures)
|
|
57
|
+
|
|
58
|
+
### Development Dependencies
|
|
59
|
+
- rake ~> 13.0
|
|
60
|
+
- rspec ~> 3.0
|
|
61
|
+
- webmock ~> 3.18
|
|
62
|
+
- vcr ~> 6.1
|
|
63
|
+
- rubocop ~> 1.21
|
|
64
|
+
|