rma-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/CHANGELOG.md +60 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/README.md +446 -0
- data/Rakefile +12 -0
- data/docs/API.md +339 -0
- data/docs/EXAMPLES.md +650 -0
- data/docs/FLOW_DIAGRAM.md +440 -0
- data/docs/QUICK_REFERENCE.md +323 -0
- data/docs/README.md +259 -0
- data/docs/SECURITY.md +506 -0
- data/docs/USAGE_GUIDE.md +522 -0
- data/lib/rma/payment/gateway/account_inquiry.rb +69 -0
- data/lib/rma/payment/gateway/authorization.rb +81 -0
- data/lib/rma/payment/gateway/client.rb +124 -0
- data/lib/rma/payment/gateway/configuration.rb +42 -0
- data/lib/rma/payment/gateway/debit_request.rb +65 -0
- data/lib/rma/payment/gateway/errors.rb +42 -0
- data/lib/rma/payment/gateway/utils.rb +130 -0
- data/lib/rma/payment/gateway/version.rb +9 -0
- data/lib/rma/payment/gateway.rb +24 -0
- data/sig/rma/payment/gateway.rbs +8 -0
- metadata +65 -0
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
# Quick Reference Guide
|
|
2
|
+
|
|
3
|
+
A quick reference for the RMA Payment Gateway Ruby gem.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
gem install rma-payment-gateway
|
|
9
|
+
# or add to Gemfile
|
|
10
|
+
gem 'rma-payment-gateway'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Configuration
|
|
14
|
+
|
|
15
|
+
### Environment Variables
|
|
16
|
+
|
|
17
|
+
```env
|
|
18
|
+
RMA_BASE_URL=https://your-rma-gateway-url.com
|
|
19
|
+
RMA_RSA_KEY_PATH=/path/to/rsa_private_key.pem
|
|
20
|
+
RMA_BENEFICIARY_ID=your_beneficiary_id
|
|
21
|
+
RMA_PAYMENT_DESCRIPTION=Payment for services
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Code Configuration
|
|
25
|
+
|
|
26
|
+
```ruby
|
|
27
|
+
Rma::Payment::Gateway.configure do |config|
|
|
28
|
+
config.base_url = 'https://your-rma-gateway-url.com'
|
|
29
|
+
config.rsa_key_path = '/path/to/rsa_private_key.pem'
|
|
30
|
+
config.beneficiary_id = 'your_beneficiary_id'
|
|
31
|
+
config.payment_description = 'Payment for services'
|
|
32
|
+
config.timeout = 30
|
|
33
|
+
config.open_timeout = 10
|
|
34
|
+
end
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Payment Flow
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
1. Authorization → 2. Account Inquiry → 3. Debit Request
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Basic Usage
|
|
44
|
+
|
|
45
|
+
```ruby
|
|
46
|
+
require 'rma/payment/gateway'
|
|
47
|
+
|
|
48
|
+
client = Rma::Payment::Gateway::Client.new
|
|
49
|
+
|
|
50
|
+
# Step 1: Authorization
|
|
51
|
+
response = client.authorization.call("ORDER123", 100.50, "customer@email.com")
|
|
52
|
+
transaction_id = response["bfs_bfsTxnId"]
|
|
53
|
+
|
|
54
|
+
# Step 2: Account Inquiry
|
|
55
|
+
response = client.account_inquiry.call(transaction_id, "1010", "12345678")
|
|
56
|
+
|
|
57
|
+
# Step 3: Debit Request
|
|
58
|
+
response = client.debit_request.call(transaction_id, "123456")
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## API Methods
|
|
62
|
+
|
|
63
|
+
### Authorization
|
|
64
|
+
|
|
65
|
+
```ruby
|
|
66
|
+
client.authorization.call(order_no, amount, email)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Parameters:**
|
|
70
|
+
- `order_no` (String) - Unique order number
|
|
71
|
+
- `amount` (Numeric) - Payment amount
|
|
72
|
+
- `email` (String) - Customer email
|
|
73
|
+
|
|
74
|
+
**Returns:** Hash with transaction details
|
|
75
|
+
|
|
76
|
+
### Account Inquiry
|
|
77
|
+
|
|
78
|
+
```ruby
|
|
79
|
+
client.account_inquiry.call(transaction_id, bank_id, account_no)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Parameters:**
|
|
83
|
+
- `transaction_id` (String) - Transaction ID from authorization
|
|
84
|
+
- `bank_id` (String) - Bank code (1010-1060)
|
|
85
|
+
- `account_no` (String) - Customer account number
|
|
86
|
+
|
|
87
|
+
**Returns:** Hash with account details
|
|
88
|
+
|
|
89
|
+
### Debit Request
|
|
90
|
+
|
|
91
|
+
```ruby
|
|
92
|
+
client.debit_request.call(transaction_id, otp)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Parameters:**
|
|
96
|
+
- `transaction_id` (String) - Transaction ID from authorization
|
|
97
|
+
- `otp` (String) - OTP received by customer
|
|
98
|
+
|
|
99
|
+
**Returns:** Hash with payment confirmation
|
|
100
|
+
|
|
101
|
+
## Bank Codes
|
|
102
|
+
|
|
103
|
+
| Code | Bank Name |
|
|
104
|
+
|------|-----------|
|
|
105
|
+
| 1010 | Bank of Bhutan (BOBL) |
|
|
106
|
+
| 1020 | Bhutan National Bank (BNBL) |
|
|
107
|
+
| 1030 | Druk PNB Bank Limited (DPNBL) |
|
|
108
|
+
| 1040 | Tashi Bank (TBank) |
|
|
109
|
+
| 1050 | Bhutan Development Bank Limited (BDBL) |
|
|
110
|
+
| 1060 | Digital Kidu (DK Bank) |
|
|
111
|
+
|
|
112
|
+
## Response Codes
|
|
113
|
+
|
|
114
|
+
| Code | Description |
|
|
115
|
+
|------|-------------|
|
|
116
|
+
| 00 | Success |
|
|
117
|
+
| 01 | Invalid request |
|
|
118
|
+
| 02 | Invalid beneficiary |
|
|
119
|
+
| 03 | Invalid transaction |
|
|
120
|
+
| 04 | Insufficient funds |
|
|
121
|
+
| 05 | Invalid OTP |
|
|
122
|
+
| 06 | OTP expired |
|
|
123
|
+
| 99 | System error |
|
|
124
|
+
|
|
125
|
+
## Error Handling
|
|
126
|
+
|
|
127
|
+
```ruby
|
|
128
|
+
begin
|
|
129
|
+
client.authorization.call(order_no, amount, email)
|
|
130
|
+
rescue Rma::Payment::Gateway::ConfigurationError => e
|
|
131
|
+
# Configuration issue
|
|
132
|
+
rescue Rma::Payment::Gateway::InvalidParameterError => e
|
|
133
|
+
# Invalid input
|
|
134
|
+
rescue Rma::Payment::Gateway::AuthenticationError => e
|
|
135
|
+
# Authentication failed
|
|
136
|
+
rescue Rma::Payment::Gateway::NetworkError => e
|
|
137
|
+
# Network issue
|
|
138
|
+
rescue Rma::Payment::Gateway::APIError => e
|
|
139
|
+
# API error
|
|
140
|
+
rescue Rma::Payment::Gateway::Error => e
|
|
141
|
+
# Generic error
|
|
142
|
+
end
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Exception Classes
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
Rma::Payment::Gateway::Error (base)
|
|
149
|
+
├── ConfigurationError
|
|
150
|
+
├── AuthenticationError
|
|
151
|
+
├── InvalidParameterError
|
|
152
|
+
├── NetworkError
|
|
153
|
+
├── SignatureError
|
|
154
|
+
└── APIError
|
|
155
|
+
└── TransactionError
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Utility Methods
|
|
159
|
+
|
|
160
|
+
### Validation
|
|
161
|
+
|
|
162
|
+
```ruby
|
|
163
|
+
# Email
|
|
164
|
+
Rma::Payment::Gateway::Utils.valid_email?("user@example.com")
|
|
165
|
+
|
|
166
|
+
# Amount
|
|
167
|
+
Rma::Payment::Gateway::Utils.valid_amount?(100.50)
|
|
168
|
+
|
|
169
|
+
# Bank code
|
|
170
|
+
Rma::Payment::Gateway::Utils.valid_bank_code?("1010")
|
|
171
|
+
|
|
172
|
+
# Account number
|
|
173
|
+
Rma::Payment::Gateway::Utils.valid_account_number?("12345678")
|
|
174
|
+
|
|
175
|
+
# Phone number
|
|
176
|
+
Rma::Payment::Gateway::Utils.valid_phone_number?("17123456")
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Formatting
|
|
180
|
+
|
|
181
|
+
```ruby
|
|
182
|
+
# Format amount
|
|
183
|
+
Rma::Payment::Gateway::Utils.format_amount(100.5)
|
|
184
|
+
# => "100.50"
|
|
185
|
+
|
|
186
|
+
# Generate timestamp
|
|
187
|
+
Rma::Payment::Gateway::Utils.generate_timestamp
|
|
188
|
+
# => "20231215143022"
|
|
189
|
+
|
|
190
|
+
# Mask sensitive data
|
|
191
|
+
Rma::Payment::Gateway::Utils.mask_sensitive("1234567890", 2)
|
|
192
|
+
# => "12******90"
|
|
193
|
+
|
|
194
|
+
# Get bank name
|
|
195
|
+
Rma::Payment::Gateway::Utils.bank_name("1010")
|
|
196
|
+
# => "Bank of Bhutan (BOBL)"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Common Patterns
|
|
200
|
+
|
|
201
|
+
### With Error Handling
|
|
202
|
+
|
|
203
|
+
```ruby
|
|
204
|
+
def process_payment(order_no, amount, email, bank_id, account_no, otp)
|
|
205
|
+
client = Rma::Payment::Gateway::Client.new
|
|
206
|
+
|
|
207
|
+
# Step 1
|
|
208
|
+
auth = client.authorization.call(order_no, amount, email)
|
|
209
|
+
txn_id = auth["bfs_bfsTxnId"]
|
|
210
|
+
|
|
211
|
+
# Step 2
|
|
212
|
+
client.account_inquiry.call(txn_id, bank_id, account_no)
|
|
213
|
+
|
|
214
|
+
# Step 3
|
|
215
|
+
client.debit_request.call(txn_id, otp)
|
|
216
|
+
rescue Rma::Payment::Gateway::Error => e
|
|
217
|
+
Rails.logger.error("Payment failed: #{e.message}")
|
|
218
|
+
raise
|
|
219
|
+
end
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### With Retry Logic
|
|
223
|
+
|
|
224
|
+
```ruby
|
|
225
|
+
def authorize_with_retry(order_no, amount, email, retries: 3)
|
|
226
|
+
client = Rma::Payment::Gateway::Client.new
|
|
227
|
+
attempt = 0
|
|
228
|
+
|
|
229
|
+
begin
|
|
230
|
+
client.authorization.call(order_no, amount, email)
|
|
231
|
+
rescue Rma::Payment::Gateway::NetworkError => e
|
|
232
|
+
attempt += 1
|
|
233
|
+
retry if attempt < retries
|
|
234
|
+
raise
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Rails Service Object
|
|
240
|
+
|
|
241
|
+
```ruby
|
|
242
|
+
class PaymentService
|
|
243
|
+
def initialize(order)
|
|
244
|
+
@order = order
|
|
245
|
+
@client = Rma::Payment::Gateway::Client.new
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
def authorize
|
|
249
|
+
response = @client.authorization.call(
|
|
250
|
+
@order.number,
|
|
251
|
+
@order.total,
|
|
252
|
+
@order.customer_email
|
|
253
|
+
)
|
|
254
|
+
@order.update!(transaction_id: response["bfs_bfsTxnId"])
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Testing
|
|
260
|
+
|
|
261
|
+
### RSpec Mock
|
|
262
|
+
|
|
263
|
+
```ruby
|
|
264
|
+
let(:client) { instance_double(Rma::Payment::Gateway::Client) }
|
|
265
|
+
|
|
266
|
+
before do
|
|
267
|
+
allow(Rma::Payment::Gateway::Client).to receive(:new).and_return(client)
|
|
268
|
+
allow(client).to receive_message_chain(:authorization, :call).and_return({
|
|
269
|
+
"bfs_bfsTxnId" => "TXN123",
|
|
270
|
+
"bfs_responseCode" => "00"
|
|
271
|
+
})
|
|
272
|
+
end
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## Security Checklist
|
|
276
|
+
|
|
277
|
+
- [ ] RSA key stored securely (not in repo)
|
|
278
|
+
- [ ] Environment variables configured
|
|
279
|
+
- [ ] HTTPS enforced
|
|
280
|
+
- [ ] Input validation enabled
|
|
281
|
+
- [ ] Sensitive data masked in logs
|
|
282
|
+
- [ ] Error messages don't leak info
|
|
283
|
+
- [ ] Rate limiting implemented
|
|
284
|
+
- [ ] Audit logging enabled
|
|
285
|
+
|
|
286
|
+
## Common Issues
|
|
287
|
+
|
|
288
|
+
### Configuration Error
|
|
289
|
+
|
|
290
|
+
```ruby
|
|
291
|
+
# Check configuration
|
|
292
|
+
config = Rma::Payment::Gateway.configuration
|
|
293
|
+
puts config.missing_fields
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Network Timeout
|
|
297
|
+
|
|
298
|
+
```ruby
|
|
299
|
+
# Increase timeout
|
|
300
|
+
config.timeout = 60
|
|
301
|
+
config.open_timeout = 20
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Invalid OTP
|
|
305
|
+
|
|
306
|
+
- Verify OTP is correct
|
|
307
|
+
- Check if OTP expired
|
|
308
|
+
- Restart payment flow if needed
|
|
309
|
+
|
|
310
|
+
## Links
|
|
311
|
+
|
|
312
|
+
- [Full Documentation](../README.md)
|
|
313
|
+
- [API Reference](API.md)
|
|
314
|
+
- [Usage Guide](USAGE_GUIDE.md)
|
|
315
|
+
- [Security Guide](SECURITY.md)
|
|
316
|
+
- [Code Examples](EXAMPLES.md)
|
|
317
|
+
- [GitHub Repository](https://github.com/dcplbt/rma-payment-gateway)
|
|
318
|
+
|
|
319
|
+
## Support
|
|
320
|
+
|
|
321
|
+
- GitHub Issues: https://github.com/dcplbt/rma-payment-gateway/issues
|
|
322
|
+
- Email: tashii.dendupp@gmail.com
|
|
323
|
+
|
data/docs/README.md
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# RMA Payment Gateway Documentation
|
|
2
|
+
|
|
3
|
+
Welcome to the RMA Payment Gateway Ruby gem documentation. This directory contains comprehensive guides and references to help you integrate the RMA Payment Gateway into your Ruby application.
|
|
4
|
+
|
|
5
|
+
## Documentation Overview
|
|
6
|
+
|
|
7
|
+
### 📚 Getting Started
|
|
8
|
+
|
|
9
|
+
- **[Main README](../README.md)** - Start here! Installation, configuration, and basic usage
|
|
10
|
+
- **[Quick Reference](QUICK_REFERENCE.md)** - Cheat sheet for common tasks and API methods
|
|
11
|
+
|
|
12
|
+
### 📖 Guides
|
|
13
|
+
|
|
14
|
+
- **[Usage Guide](USAGE_GUIDE.md)** - Detailed integration examples for Rails and Sinatra
|
|
15
|
+
- **[API Documentation](API.md)** - Complete API reference with request/response formats
|
|
16
|
+
- **[Code Examples](EXAMPLES.md)** - Practical code examples for common scenarios
|
|
17
|
+
- **[Security Guide](SECURITY.md)** - Security best practices and compliance guidelines
|
|
18
|
+
|
|
19
|
+
### 📋 Reference
|
|
20
|
+
|
|
21
|
+
- **[CHANGELOG](../CHANGELOG.md)** - Version history and release notes
|
|
22
|
+
- **[Code of Conduct](../CODE_OF_CONDUCT.md)** - Community guidelines
|
|
23
|
+
|
|
24
|
+
## Quick Links
|
|
25
|
+
|
|
26
|
+
### For New Users
|
|
27
|
+
|
|
28
|
+
1. Read the [Main README](../README.md) for installation and setup
|
|
29
|
+
2. Check the [Quick Reference](QUICK_REFERENCE.md) for common tasks
|
|
30
|
+
3. Review [Code Examples](EXAMPLES.md) for your use case
|
|
31
|
+
4. Read the [Security Guide](SECURITY.md) before going to production
|
|
32
|
+
|
|
33
|
+
### For Developers
|
|
34
|
+
|
|
35
|
+
1. [Usage Guide](USAGE_GUIDE.md) - Integration patterns
|
|
36
|
+
2. [API Documentation](API.md) - API details
|
|
37
|
+
3. [Code Examples](EXAMPLES.md) - Implementation examples
|
|
38
|
+
4. [CHANGELOG](../CHANGELOG.md) - What's new
|
|
39
|
+
|
|
40
|
+
### For Security Teams
|
|
41
|
+
|
|
42
|
+
1. [Security Guide](SECURITY.md) - Security best practices
|
|
43
|
+
2. [API Documentation](API.md) - API security details
|
|
44
|
+
3. [Main README](../README.md) - Configuration security
|
|
45
|
+
|
|
46
|
+
## Payment Flow Overview
|
|
47
|
+
|
|
48
|
+
The RMA Payment Gateway uses a three-step payment flow:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
┌─────────────────────┐
|
|
52
|
+
│ 1. Authorization │ Merchant initiates payment
|
|
53
|
+
│ (AR Message) │ Returns: Transaction ID
|
|
54
|
+
└──────────┬──────────┘
|
|
55
|
+
│
|
|
56
|
+
▼
|
|
57
|
+
┌─────────────────────┐
|
|
58
|
+
│ 2. Account Inquiry │ Customer provides bank details
|
|
59
|
+
│ (AE Message) │ Returns: Account info, sends OTP
|
|
60
|
+
└──────────┬──────────┘
|
|
61
|
+
│
|
|
62
|
+
▼
|
|
63
|
+
┌─────────────────────┐
|
|
64
|
+
│ 3. Debit Request │ Customer provides OTP
|
|
65
|
+
│ (DR Message) │ Returns: Payment confirmation
|
|
66
|
+
└─────────────────────┘
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Key Features
|
|
70
|
+
|
|
71
|
+
- ✅ **Simple API** - Three methods for complete payment flow
|
|
72
|
+
- ✅ **Error Handling** - Comprehensive exception classes
|
|
73
|
+
- ✅ **Validation** - Built-in input validation
|
|
74
|
+
- ✅ **Security** - RSA authentication and HTTPS
|
|
75
|
+
- ✅ **Utilities** - Helper methods for common tasks
|
|
76
|
+
- ✅ **Well Documented** - Extensive guides and examples
|
|
77
|
+
|
|
78
|
+
## Common Use Cases
|
|
79
|
+
|
|
80
|
+
### E-commerce Checkout
|
|
81
|
+
See: [Usage Guide - E-commerce Checkout](USAGE_GUIDE.md#1-e-commerce-checkout)
|
|
82
|
+
|
|
83
|
+
### Subscription Payments
|
|
84
|
+
See: [Usage Guide - Subscription Payments](USAGE_GUIDE.md#2-subscription-payments)
|
|
85
|
+
|
|
86
|
+
### Rails Integration
|
|
87
|
+
See: [Usage Guide - Rails Integration](USAGE_GUIDE.md#rails-integration)
|
|
88
|
+
|
|
89
|
+
### Sinatra Integration
|
|
90
|
+
See: [Usage Guide - Sinatra Integration](USAGE_GUIDE.md#sinatra-integration)
|
|
91
|
+
|
|
92
|
+
## API Quick Reference
|
|
93
|
+
|
|
94
|
+
### Initialize Client
|
|
95
|
+
|
|
96
|
+
```ruby
|
|
97
|
+
client = Rma::Payment::Gateway::Client.new
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Payment Authorization
|
|
101
|
+
|
|
102
|
+
```ruby
|
|
103
|
+
response = client.authorization.call(order_no, amount, email)
|
|
104
|
+
transaction_id = response["bfs_bfsTxnId"]
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Account Inquiry
|
|
108
|
+
|
|
109
|
+
```ruby
|
|
110
|
+
response = client.account_inquiry.call(transaction_id, bank_id, account_no)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Debit Request
|
|
114
|
+
|
|
115
|
+
```ruby
|
|
116
|
+
response = client.debit_request.call(transaction_id, otp)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
For complete API details, see [API Documentation](API.md).
|
|
120
|
+
|
|
121
|
+
## Supported Banks
|
|
122
|
+
|
|
123
|
+
| Code | Bank Name |
|
|
124
|
+
|------|-----------|
|
|
125
|
+
| 1010 | Bank of Bhutan (BOBL) |
|
|
126
|
+
| 1020 | Bhutan National Bank (BNBL) |
|
|
127
|
+
| 1030 | Druk PNB Bank Limited (DPNBL) |
|
|
128
|
+
| 1040 | Tashi Bank (TBank) |
|
|
129
|
+
| 1050 | Bhutan Development Bank Limited (BDBL) |
|
|
130
|
+
| 1060 | Digital Kidu (DK Bank) |
|
|
131
|
+
|
|
132
|
+
## Error Handling
|
|
133
|
+
|
|
134
|
+
The gem provides specific exception classes:
|
|
135
|
+
|
|
136
|
+
- `ConfigurationError` - Configuration issues
|
|
137
|
+
- `InvalidParameterError` - Invalid input parameters
|
|
138
|
+
- `AuthenticationError` - Authentication failures
|
|
139
|
+
- `NetworkError` - Network connectivity issues
|
|
140
|
+
- `APIError` - API-level errors
|
|
141
|
+
- `SignatureError` - Signature validation errors
|
|
142
|
+
- `TransactionError` - Transaction-specific errors
|
|
143
|
+
|
|
144
|
+
See [Code Examples - Error Handling](EXAMPLES.md#error-handling-examples) for usage.
|
|
145
|
+
|
|
146
|
+
## Security Best Practices
|
|
147
|
+
|
|
148
|
+
1. **Never commit RSA private keys** to version control
|
|
149
|
+
2. **Use environment variables** for sensitive configuration
|
|
150
|
+
3. **Validate all inputs** before sending to API
|
|
151
|
+
4. **Mask sensitive data** in logs
|
|
152
|
+
5. **Use HTTPS** for all communications
|
|
153
|
+
6. **Implement rate limiting** to prevent abuse
|
|
154
|
+
7. **Store transaction IDs** securely
|
|
155
|
+
|
|
156
|
+
For complete security guidelines, see [Security Guide](SECURITY.md).
|
|
157
|
+
|
|
158
|
+
## Testing
|
|
159
|
+
|
|
160
|
+
The gem includes comprehensive test coverage. For testing your integration:
|
|
161
|
+
|
|
162
|
+
```ruby
|
|
163
|
+
# RSpec example
|
|
164
|
+
RSpec.describe PaymentService do
|
|
165
|
+
let(:client) { instance_double(Rma::Payment::Gateway::Client) }
|
|
166
|
+
|
|
167
|
+
before do
|
|
168
|
+
allow(Rma::Payment::Gateway::Client).to receive(:new).and_return(client)
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# Your tests here
|
|
172
|
+
end
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
See [Code Examples - Testing](EXAMPLES.md#testing-examples) for more examples.
|
|
176
|
+
|
|
177
|
+
## Troubleshooting
|
|
178
|
+
|
|
179
|
+
### Common Issues
|
|
180
|
+
|
|
181
|
+
1. **Configuration Error**
|
|
182
|
+
- Check environment variables
|
|
183
|
+
- Verify RSA key path
|
|
184
|
+
- See: [Usage Guide - Troubleshooting](USAGE_GUIDE.md#troubleshooting)
|
|
185
|
+
|
|
186
|
+
2. **Network Timeout**
|
|
187
|
+
- Increase timeout settings
|
|
188
|
+
- Check network connectivity
|
|
189
|
+
- See: [API Documentation - Best Practices](API.md#best-practices)
|
|
190
|
+
|
|
191
|
+
3. **Invalid OTP**
|
|
192
|
+
- Verify OTP is correct
|
|
193
|
+
- Check if OTP expired
|
|
194
|
+
- Restart payment flow if needed
|
|
195
|
+
|
|
196
|
+
4. **Transaction Not Found**
|
|
197
|
+
- Verify transaction ID
|
|
198
|
+
- Check if transaction expired
|
|
199
|
+
- Ensure consistent transaction ID across steps
|
|
200
|
+
|
|
201
|
+
## Contributing
|
|
202
|
+
|
|
203
|
+
We welcome contributions! Please see:
|
|
204
|
+
|
|
205
|
+
- [Main README - Contributing](../README.md#contributing)
|
|
206
|
+
- [Code of Conduct](../CODE_OF_CONDUCT.md)
|
|
207
|
+
|
|
208
|
+
## Support
|
|
209
|
+
|
|
210
|
+
### Documentation Issues
|
|
211
|
+
|
|
212
|
+
If you find issues with the documentation:
|
|
213
|
+
- Open an issue: https://github.com/dcplbt/rma-payment-gateway/issues
|
|
214
|
+
- Submit a PR with improvements
|
|
215
|
+
|
|
216
|
+
### Integration Help
|
|
217
|
+
|
|
218
|
+
For help with integration:
|
|
219
|
+
- Check the [Usage Guide](USAGE_GUIDE.md)
|
|
220
|
+
- Review [Code Examples](EXAMPLES.md)
|
|
221
|
+
- Open an issue on GitHub
|
|
222
|
+
|
|
223
|
+
### Security Concerns
|
|
224
|
+
|
|
225
|
+
For security-related issues:
|
|
226
|
+
- Email: tashii.dendupp@gmail.com
|
|
227
|
+
- Use GitHub Security Advisories for vulnerabilities
|
|
228
|
+
|
|
229
|
+
## Version Information
|
|
230
|
+
|
|
231
|
+
Current Version: **1.0.0**
|
|
232
|
+
|
|
233
|
+
See [CHANGELOG](../CHANGELOG.md) for version history.
|
|
234
|
+
|
|
235
|
+
## License
|
|
236
|
+
|
|
237
|
+
This gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Document Index
|
|
242
|
+
|
|
243
|
+
| Document | Description | Audience |
|
|
244
|
+
|----------|-------------|----------|
|
|
245
|
+
| [Main README](../README.md) | Installation, configuration, basic usage | Everyone |
|
|
246
|
+
| [Quick Reference](QUICK_REFERENCE.md) | Cheat sheet and quick lookup | Developers |
|
|
247
|
+
| [Usage Guide](USAGE_GUIDE.md) | Integration examples and patterns | Developers |
|
|
248
|
+
| [API Documentation](API.md) | Complete API reference | Developers |
|
|
249
|
+
| [Code Examples](EXAMPLES.md) | Practical code examples | Developers |
|
|
250
|
+
| [Security Guide](SECURITY.md) | Security best practices | Security Teams, DevOps |
|
|
251
|
+
| [CHANGELOG](../CHANGELOG.md) | Version history | Everyone |
|
|
252
|
+
| [Code of Conduct](../CODE_OF_CONDUCT.md) | Community guidelines | Contributors |
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
**Last Updated:** 2025-11-03
|
|
257
|
+
**Gem Version:** 1.0.0
|
|
258
|
+
**Maintained By:** Tashi Dendup (tashii.dendupp@gmail.com)
|
|
259
|
+
|