Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# NOWPayments Sandbox API credentials for testing
# Get these from: https://account-sandbox.nowpayments.io/
NOWPAYMENTS_SANDBOX_API_KEY=your_sandbox_api_key_here
NOWPAYMENTS_SANDBOX_IPN_SECRET=your_sandbox_ipn_secret_here
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
/spec/reports/
/tmp/

# Build artifacts
*.gem

# rspec failure tracking
.rspec_status
/docs/internal/*
.github/copilot-instructions.md
40 changes: 40 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,48 @@
AllCops:
TargetRubyVersion: 3.2
NewCops: enable

Style/StringLiterals:
EnforcedStyle: double_quotes

Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes

# Metrics - Relaxed for v0.1.0
Metrics/ClassLength:
Max: 200
Exclude:
- 'spec/**/*'

Metrics/MethodLength:
Max: 15
Exclude:
- 'spec/**/*'

Metrics/BlockLength:
Max: 120
Exclude:
- 'spec/**/*'
- 'examples/**/*'

Metrics/CyclomaticComplexity:
Max: 10

Metrics/ParameterLists:
Max: 10
CountKeywordArgs: false

Metrics/AbcSize:
Max: 20

# Naming
Naming/MethodParameterName:
MinNameLength: 1
AllowedNames: ['a', 'b']

Naming/PredicateMethod:
Enabled: false

# Layout
Layout/LineLength:
Max: 140
41 changes: 39 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.1.0] - 2025-11-01
## [0.1.0] - 2025-01-XX

### Added
- Complete API client implementation with all NOWPayments v1 endpoints
- Payment API: create, retrieve, list with filters, update estimate
- Invoice API: create hosted payment pages with success/cancel URLs
- Subscription API: plans, create plan, get plan, create subscription, list payments
- Payout API: mass withdrawals support
- Estimation API: minimum amounts and price estimates
- Status & utility endpoints: API status, currencies, full currency info, merchant coins
- Comprehensive error handling with custom exception hierarchy (8 error types)
- Secure IPN webhook verification with HMAC-SHA512 and recursive key sorting
- Rack middleware for Rails/Sinatra webhook integration
- Faraday ErrorHandler middleware for automatic HTTP error mapping
- Sandbox environment support for testing
- VCR cassette support for reliable integration testing
- Complete RSpec test suite with WebMock integration
- Example scripts: simple demo and webhook server (Sinatra)
- Comprehensive API documentation (docs/API.md)
- Professional README with usage examples

### Changed
- Upgraded to Faraday 2.x with built-in JSON support (no faraday-json dependency)
- All API methods return raw Hash responses (no data models per design decision)

### Security
- Implemented constant-time signature comparison to prevent timing attacks
- Recursive key sorting for consistent HMAC signature generation
- Webhook signature verification with SecurityError on failure

[Unreleased]: https://github.com/Sentia/nowpayments/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/Sentia/nowpayments/releases/tag/v0.1.0

- Initial release
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ gemspec
gem "irb"
gem "rake", "~> 13.0"

gem "dotenv", "~> 2.8"
gem "pry", "~> 0.14"
gem "rspec", "~> 3.0"
gem "simplecov", "~> 0.22", require: false
gem "vcr", "~> 6.0"
gem "webmock", "~> 3.0"

gem "rubocop", "~> 1.21"
133 changes: 133 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
PATH
remote: .
specs:
nowpayments (0.1.0)
faraday (~> 2.0)

GEM
remote: https://rubygems.org/
specs:
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.3)
base64 (0.3.0)
bigdecimal (3.3.1)
coderay (1.1.3)
crack (1.0.1)
bigdecimal
rexml
date (3.5.0)
diff-lcs (1.6.2)
docile (1.4.1)
dotenv (2.8.1)
erb (5.1.3)
faraday (2.14.0)
faraday-net_http (>= 2.0, < 3.5)
json
logger
faraday-net_http (3.4.1)
net-http (>= 0.5.0)
hashdiff (1.2.1)
io-console (0.8.1)
irb (1.15.2)
pp (>= 0.6.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.15.2)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
logger (1.7.0)
method_source (1.1.0)
net-http (0.7.0)
uri
parallel (1.27.0)
parser (3.3.10.0)
ast (~> 2.4.1)
racc
pp (0.6.3)
prettyprint
prettyprint (0.2.0)
prism (1.6.0)
pry (0.15.2)
coderay (~> 1.1)
method_source (~> 1.0)
psych (5.2.6)
date
stringio
public_suffix (6.0.2)
racc (1.8.1)
rainbow (3.1.1)
rake (13.3.1)
rdoc (6.15.1)
erb
psych (>= 4.0.0)
tsort
regexp_parser (2.11.3)
reline (0.6.2)
io-console (~> 0.5)
rexml (3.4.4)
rspec (3.13.2)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.6)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.7)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.6)
rubocop (1.81.7)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.47.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.47.1)
parser (>= 3.3.7.2)
prism (~> 1.4)
ruby-progressbar (1.13.0)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.13.2)
simplecov_json_formatter (0.1.4)
stringio (3.1.7)
tsort (0.2.0)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.1.0)
uri (1.1.0)
vcr (6.3.1)
base64
webmock (3.26.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)

PLATFORMS
arm64-darwin-23
ruby

DEPENDENCIES
dotenv (~> 2.8)
irb
nowpayments!
pry (~> 0.14)
rake (~> 13.0)
rspec (~> 3.0)
rubocop (~> 1.21)
simplecov (~> 0.22)
vcr (~> 6.0)
webmock (~> 3.0)

BUNDLED WITH
2.7.2
Loading