nowpayments 0.2.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 97ac8b5b89917ed020bf1fc5c887cc02ab236a65778433696826adbcf55298ab
4
+ data.tar.gz: 1faa8a8ef8abdb85c17e33c6f5ddfe7eb17f434a062784095c32627b924eac94
5
+ SHA512:
6
+ metadata.gz: 41100692b84c8888da5c11292d1759c0b17c48027ab72fa15b4b755675402ad39fb36c441cd13cb12a526eb969126700e3c636e3df01de54f3d8e8e5bbe8e85b
7
+ data.tar.gz: 3e66866c39e02084cbfa8156d6b79160eeb962955cbafa1900d298321cb99759da60c43728dc1336b359c32bfbd69ef5f8827e40bbe67d96038268b6373eb2f7
data/.env.example ADDED
@@ -0,0 +1,4 @@
1
+ # NOWPayments Sandbox API credentials for testing
2
+ # Get these from: https://account-sandbox.nowpayments.io/
3
+ NOWPAYMENTS_SANDBOX_API_KEY=your_sandbox_api_key_here
4
+ NOWPAYMENTS_SANDBOX_IPN_SECRET=your_sandbox_ipn_secret_here
data/CHANGELOG.md ADDED
@@ -0,0 +1,122 @@
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
+ ## [Unreleased]
9
+
10
+ ## [0.2.0] - 2025-11-01
11
+
12
+ ### Added - 100% API Coverage Achievement! 🎉
13
+ - **JWT Authentication Module (5 methods)**: Complete token lifecycle management
14
+ - `authenticate(email:, password:)` - Get JWT token with 5-minute expiration
15
+ - `jwt_token(email:, password:)` - Get token with optional auto-refresh
16
+ - `jwt_expired?` - Check token validity
17
+ - `clear_jwt_token` - Manual token clearing
18
+ - `jwt_time_remaining` - Seconds until token expires
19
+ - Automatic Bearer token injection in Authorization header
20
+ - Connection reset mechanism on token change
21
+ - **Fiat Payouts Module (8 methods)**: Beta - Crypto to fiat withdrawals
22
+ - `fiat_payout_payment_methods` - Get available payment methods
23
+ - `create_fiat_payout_account` - Create payout account
24
+ - `fiat_payout_accounts` - List payout accounts
25
+ - `update_fiat_payout_account` - Update account details
26
+ - `create_fiat_payout` - Create fiat payout
27
+ - `fiat_payout_status` - Get payout status
28
+ - `fiat_payouts` - List all payouts with 13 filter options
29
+ - `fiat_payout_rates` - Get conversion rates
30
+ - **Invoice Status Method**: `invoice(invoice_id)` - Get invoice details and status
31
+ - **Mass Payouts (8 methods)**: Batch withdrawals with 2FA verification
32
+ - `balance` - Get account balance
33
+ - `create_payout` - Create batch payout (JWT required)
34
+ - `verify_payout` - 2FA verification (JWT required)
35
+ - `payout_status` - Get payout status
36
+ - `list_payouts` - List all payouts (JWT required)
37
+ - `validate_payout_address` - Validate withdrawal address
38
+ - `min_payout_amount` - Get minimum payout amount
39
+ - `payout_fee` - Calculate payout fee
40
+ - **Conversions Module (3 methods)**: Currency conversions (JWT required)
41
+ - `create_conversion` - Convert between cryptocurrencies
42
+ - `conversion_status` - Check conversion status
43
+ - `list_conversions` - List all conversions
44
+ - **Custody/Sub-accounts Module (11 methods)**: User wallet management for marketplaces
45
+ - `create_sub_account` - Create user account
46
+ - `sub_account_balance` - Get user balance
47
+ - `sub_account_balances` - Get all balances
48
+ - `list_sub_accounts` - List all sub-accounts
49
+ - `transfer_between_sub_accounts` - Transfer between users (JWT required)
50
+ - `create_sub_account_deposit` - Generate deposit address
51
+ - `create_sub_account_payment_deposit` - Payment to sub-account
52
+ - `transfer_to_sub_account` - Deposit to user
53
+ - `withdraw_from_sub_account` - Withdraw from user (JWT required)
54
+ - `sub_account_transfer` - Get transfer details
55
+ - `sub_account_transfers` - List all transfers
56
+ - **Subscriptions/Recurring Payments Module (9 methods)**: Complete subscription management
57
+ - `subscription_plans` - List all plans
58
+ - `create_subscription_plan` - Create new plan
59
+ - `update_subscription_plan` - Update plan
60
+ - `subscription_plan` - Get plan details
61
+ - `create_subscription` - Create subscription
62
+ - `list_recurring_payments` - List with filters
63
+ - `recurring_payment` - Get subscription details
64
+ - `delete_recurring_payment` - Cancel subscription (JWT required)
65
+ - `subscription_payments` - List subscription payments
66
+
67
+ ### Changed
68
+ - **Complete API Coverage**: Now 57 methods across 11 modules (was 44 methods across 9 modules)
69
+ - **Modular Architecture**: Split monolithic client (674 lines) into focused API modules (76-line client + 11 modules)
70
+ - **Documentation**: Updated README to 578 lines with complete method list, usage examples, and guides
71
+ - Version bump from 0.1.0 to 0.2.0 (minor version for new features)
72
+
73
+ ### Documentation
74
+ - Added comprehensive API reference (docs/API.md - 950+ lines)
75
+ - Added JWT authentication examples (examples/jwt_authentication_example.rb - 10 usage patterns)
76
+ - Updated README with collapsible method lists and detailed usage guides
77
+ - Added currency conversions examples
78
+ - Added fiat payouts usage guide
79
+ - Added internal documentation for gap analysis and sprint reports
80
+
81
+ ### Security
82
+ - JWT Bearer token support for protected endpoints
83
+ - Automatic token expiration management (5-minute lifetime)
84
+ - Secure token storage and injection
85
+ - All existing webhook security features maintained
86
+
87
+ ### Breaking Changes
88
+ - None - All changes are additive and backward compatible
89
+
90
+ ## [0.1.0] - 2025-01-XX
91
+
92
+ ### Added
93
+ - Complete API client implementation with all NOWPayments v1 endpoints
94
+ - Payment API: create, retrieve, list with filters, update estimate
95
+ - Invoice API: create hosted payment pages with success/cancel URLs
96
+ - Subscription API: plans, create plan, get plan, create subscription, list payments
97
+ - Payout API: mass withdrawals support
98
+ - Estimation API: minimum amounts and price estimates
99
+ - Status & utility endpoints: API status, currencies, full currency info, merchant coins
100
+ - Comprehensive error handling with custom exception hierarchy (8 error types)
101
+ - Secure IPN webhook verification with HMAC-SHA512 and recursive key sorting
102
+ - Rack middleware for Rails/Sinatra webhook integration
103
+ - Faraday ErrorHandler middleware for automatic HTTP error mapping
104
+ - Sandbox environment support for testing
105
+ - VCR cassette support for reliable integration testing
106
+ - Complete RSpec test suite with WebMock integration
107
+ - Example scripts: simple demo and webhook server (Sinatra)
108
+ - Comprehensive API documentation (docs/API.md)
109
+ - Professional README with usage examples
110
+
111
+ ### Changed
112
+ - Upgraded to Faraday 2.x with built-in JSON support (no faraday-json dependency)
113
+ - All API methods return raw Hash responses (no data models per design decision)
114
+
115
+ ### Security
116
+ - Implemented constant-time signature comparison to prevent timing attacks
117
+ - Recursive key sorting for consistent HMAC signature generation
118
+ - Webhook signature verification with SecurityError on failure
119
+
120
+ [Unreleased]: https://github.com/Sentia/nowpayments/compare/v0.1.0...HEAD
121
+ [0.1.0]: https://github.com/Sentia/nowpayments/releases/tag/v0.1.0
122
+
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Chayut Orapinpatipat
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.