solidgate-ruby-sdk 0.1.13 → 0.1.14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c09e01ee5693446c15395118e8cfbdaa984a116958ea3ca0b40571edfc792dc
4
- data.tar.gz: 350e5a68b64c761e858dfe43b1be5543737cd439e9a3e7c008a42bd1ccceee05
3
+ metadata.gz: d423d0cbeef1718913f59ff786575342486d81d6eb73cfb3f5da06c475221f4a
4
+ data.tar.gz: c3768b1d3340a88db3c6496a25c5f37a7736fc6dd22ffbc57bf0f661c2b529a7
5
5
  SHA512:
6
- metadata.gz: de3b3b8769772bd367f27bea5be25afa57c4e469e3ee267ca02d3dc930e47d34dff03f0f133e25b7ea48083c1efc4c5134aa617a8a60a36738188dfe5377216b
7
- data.tar.gz: 9170f1bca57c7dc5b9a0a5f73cb5b05a0c9668b1bb564c59f9dfcc576d647fa7e81169cdf7016e6a8f69b89a90d9fe1170f576e9bb2d982886e84e2ee645b742
6
+ metadata.gz: ca06ec82f66d554752912b12b30125dfcdf8fab9ee83260adc3ab2149c5b135ec8c0a0ae03e8f7f1e7285a67ea66e63fd1fb9f7b42ca4577d32483d98e9c050d
7
+ data.tar.gz: 84852a85d4426c447fa50c8aeb33c4aa7afc1b3e31b6419d67c806d0d64fc522417e18bb2dab1963e894200906ab5d90f75f36a9999c2df15d76a0d4be220d62
data/AGENTS.md ADDED
@@ -0,0 +1,148 @@
1
+ # Solidgate Ruby SDK - Agent Documentation
2
+ # This file provides context for AI coding assistants about the codebase structure and conventions
3
+
4
+ ## Overview
5
+ Solidgate Ruby SDK is an unofficial Ruby library for integrating with the Solidgate payment gateway API.
6
+ It provides a clean, object-oriented interface for payment processing, subscription management, and webhook handling.
7
+
8
+ ## Project Structure
9
+
10
+ ### Core Components
11
+
12
+ #### `lib/solidgate-ruby-sdk.rb`
13
+ - Main entry point for the SDK
14
+ - Defines the `Solidgate` module with global configuration
15
+ - Provides `Solidgate.configure` and `Solidgate.configuration` methods
16
+ - Loads all core components
17
+
18
+ #### `lib/solidgate/configuration.rb`
19
+ - `Solidgate::Configuration` class for managing API credentials and settings
20
+ - Key attributes:
21
+ - `public_key` / `private_key` - API authentication credentials
22
+ - `sandbox` - Boolean for environment switching
23
+ - `api_url` - Custom API endpoint (defaults to sandbox/production based on sandbox setting)
24
+ - `timeout` / `open_timeout` - HTTP connection settings
25
+ - `user_agent` - Custom user agent string
26
+ - `webhook_public_key` / `webhook_private_key` - Webhook authentication
27
+ - Production URL: `https://subscriptions.solidgate.com`
28
+ - Sandbox URL: `https://subscriptions.solidgate.com`
29
+
30
+ #### `lib/solidgate/client.rb`
31
+ - `Solidgate::Client` class - Low-level HTTP client for API interactions
32
+ - Handles authentication via HMAC-SHA512 signatures
33
+ - Provides methods for all Solidgate API endpoints:
34
+ - Payment operations: `create_payment`, `get_payment`, `capture_payment`, `void_payment`, `refund_payment`, `settle_payment`
35
+ - Subscription operations: `create_subscription`, `subscription_status`, `switch_subscription_product`, `update_subscription_pause`, `create_subscription_pause`, `delete_subscription_pause`, `cancel_subscription`, `restore_subscription`
36
+ - Product operations: `create_product`, `create_price`, `products`, `product_prices`, `update_product_price`
37
+ - Utility methods: `generate_intent`, `generate_signature`, `refund`, `order_status`
38
+ - Private methods for HTTP operations: `get`, `post`, `patch`, `delete`, `request`
39
+ - Encryption: `encrypt_payload` for payment intent generation (AES-256-CBC)
40
+
41
+ #### `lib/solidgate/payment.rb`
42
+ - `Solidgate::Payment` class - High-level payment resource wrapper
43
+ - Provides a more Ruby-idiomatic interface around `Solidgate::Client`
44
+ - Includes validation for payment parameters
45
+ - Methods: `create`, `get`, `capture`, `void`, `refund`
46
+
47
+ #### `lib/solidgate/webhook.rb`
48
+ - `Solidgate::Webhook` class - Webhook signature validation
49
+ - Validates incoming webhook requests using configured webhook keys
50
+ - Method: `validate_signature(payload, signature)`
51
+
52
+ #### `lib/solidgate/errors.rb`
53
+ - Custom error hierarchy:
54
+ - `Solidgate::Error` - Base error class
55
+ - `Solidgate::ConfigurationError` - Missing/invalid configuration
56
+ - `Solidgate::APIError` - General API errors (includes http_status)
57
+ - `Solidgate::AuthenticationError` - 401 responses
58
+ - `Solidgate::InvalidRequestError` - 400 responses
59
+ - `Solidgate::ConnectionError` - Network failures
60
+ - `Solidgate::TimeoutError` - Request timeouts
61
+ - `Solidgate::RateLimitError` - 429 responses
62
+ - `Solidgate::ValidationError` - Parameter validation (includes errors hash)
63
+
64
+ #### `lib/solidgate/version.rb`
65
+ - Version constant: `Solidgate::VERSION = "0.1.13"`
66
+
67
+ ### Test Structure
68
+
69
+ #### `spec/spec_helper.rb`
70
+ - RSpec configuration with WebMock and VCR
71
+ - Disables real HTTP connections
72
+ - Filters sensitive data (keys, signatures) from test recordings
73
+ - Provides `:configured` metadata for tests requiring configuration
74
+
75
+ #### `spec/solidgate/`
76
+ - `client_spec.rb` - Client HTTP method tests
77
+ - `configuration_spec.rb` - Configuration validation tests
78
+ - `payment_spec.rb` - Payment resource tests
79
+
80
+ ### Utilities
81
+
82
+ #### `bin/console`
83
+ - Interactive Ruby console with SDK preloaded
84
+ - Uses environment variables for credentials if available
85
+
86
+ #### `bin/setup`
87
+ - Automated setup script (runs bundle install)
88
+
89
+ #### `Rakefile`
90
+ - Default task runs specs
91
+ - Uses bundler/gem_tasks for gem-related tasks
92
+
93
+ #### `examples/basic_usage.rb`
94
+ - Example demonstrating common SDK usage patterns
95
+ - Shows error handling for different error types
96
+
97
+ ## Key Conventions
98
+
99
+ ### Authentication
100
+ - All API requests require HMAC-SHA512 signature
101
+ - Signature format: `Base64(HMAC_SHA516(private_key, public_key + json + public_key))`
102
+ - Headers: `Merchant` (public key) and `Signature`
103
+
104
+ ### Error Handling
105
+ - Use specific error classes for different failure scenarios
106
+ - API errors include `code`, `details`, and `http_status`
107
+ - Validation errors include detailed `errors` hash
108
+
109
+ ### API URL Selection
110
+ - Uses `sandbox?` flag to choose between sandbox/production
111
+ - Can override with custom `api_url` for testing
112
+
113
+ ### Payment Amounts
114
+ - All amounts in minor units (cents for USD)
115
+ - Currency codes are 3-letter ISO 4217
116
+
117
+ ### Webhook Security
118
+ - Validate signatures using `webhook_public_key` and `webhook_private_key`
119
+ - Never trust webhook data without validation
120
+
121
+ ## Development Notes
122
+
123
+ ### Adding New API Endpoints
124
+ 1. Add method to `Solidgate::Client` with proper documentation
125
+ 2. Follow existing naming conventions (snake_case for Ruby, kebab-case for API paths)
126
+ 3. Add corresponding tests in `spec/solidgate/client_spec.rb`
127
+ 4. Update README.md with usage examples
128
+
129
+ ### Code Style
130
+ - Frozen string literals: `# frozen_string_literal: true`
131
+ - 2-space indentation
132
+ - YARD documentation for public methods
133
+ - Follow Ruby conventions (snake_case for methods/variables)
134
+
135
+ ### Versioning
136
+ - Follows Semantic Versioning (semver.org)
137
+ - Version defined in `lib/solidgate/version.rb`
138
+ - Update CHANGELOG.md for each release
139
+
140
+ ## Environment Variables
141
+ - `SOLIDGATE_PUBLIC_KEY` - Public API key
142
+ - `SOLIDGATE_PRIVATE_KEY` - Private API key
143
+ - `SOLIDGATE_WEBHOOK_PUBLIC_KEY` - Webhook public key
144
+ - `SOLIDGATE_WEBHOOK_PRIVATE_KEY` - Webhook private key
145
+
146
+ ## Dependencies
147
+ - Runtime: `faraday`, `faraday-multipart`
148
+ - Development: `rspec`, `webmock`, `vcr`, `rubocop`, `pry`
data/CHANGELOG.md CHANGED
@@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.13] - 2026-02-13
11
+ ### Added
12
+ - `order_status` endpoint to check order/payment status on `pay.solidgate.com` (`Solidgate::Client#order_status`).
13
+ - README: expanded examples and documentation (order status, payment/refund examples).
14
+
15
+ ### Changed
16
+ - Documentation and minor client docstring improvements.
17
+
18
+ ## [0.1.12] - 2026-02-13
19
+ ### Added
20
+ - `update_product_price` endpoint (`Solidgate::Client#update_product_price`) to modify product price attributes.
21
+
22
+ ### Changed
23
+ - Bumped packaged version to `0.1.12` and updated `Gemfile.lock`.
24
+ - Tests updated for product/price management.
25
+
26
+ ## [0.1.11] - 2026-02-06
27
+ ### Added
28
+ - `update_subscription_payment_method` endpoint to update a subscription's stored payment token.
29
+ - README examples and RSpec coverage for subscription payment-method updates.
30
+
10
31
  ## [0.1.10] - 2026-02-03
11
32
  - Added refund method example to README
12
33
 
@@ -43,5 +64,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
43
64
  - Thread-safe configuration
44
65
  - Comprehensive documentation and examples
45
66
 
46
- [Unreleased]: https://github.com/carrfane/solidgate-ruby-sdk/compare/v0.1.0...HEAD
67
+ [Unreleased]: https://github.com/carrfane/solidgate-ruby-sdk/compare/v0.1.13...HEAD
68
+ [0.1.13]: https://github.com/carrfane/solidgate-ruby-sdk/releases/tag/v0.1.13
69
+ [0.1.12]: https://github.com/carrfane/solidgate-ruby-sdk/releases/tag/v0.1.12
70
+ [0.1.11]: https://github.com/carrfane/solidgate-ruby-sdk/releases/tag/v0.1.11
71
+ [0.1.10]: https://github.com/carrfane/solidgate-ruby-sdk/releases/tag/v0.1.10
47
72
  [0.1.0]: https://github.com/carrfane/solidgate-ruby-sdk/releases/tag/v0.1.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- solidgate-ruby-sdk (0.1.13)
4
+ solidgate-ruby-sdk (0.1.14)
5
5
  faraday
6
6
  faraday-multipart
7
7
 
data/README.md CHANGED
@@ -103,6 +103,12 @@ client.capture_payment('payment_id_123', amount: 500)
103
103
  # Void an authorized payment (before settlement)
104
104
  client.void_payment('payment_id_123')
105
105
 
106
+ # Refund a captured payment by payment ID
107
+ client.refund_payment('payment_id_123')
108
+
109
+ # Partial refund by payment ID
110
+ client.refund_payment('payment_id_123', amount: 500, reason: 'Customer requested')
111
+
106
112
  # Refund by order ID (pay.solidgate.com)
107
113
  client.refund(order_id: 'order_123', amount: 1000)
108
114
 
@@ -173,6 +179,17 @@ client.update_subscription_pause('subscription_id_123',
173
179
  client.delete_subscription_pause('subscription_id_123')
174
180
  ```
175
181
 
182
+ ### Payment Settlement
183
+
184
+ Settle a payment for final processing:
185
+
186
+ ```ruby
187
+ client = Solidgate::Client.new
188
+
189
+ # Settle a payment (note: current implementation may have issues)
190
+ client.settle_payment
191
+ ```
192
+
176
193
  ### Product & Price Management
177
194
 
178
195
  ```ruby
@@ -117,14 +117,14 @@ module Solidgate
117
117
  end
118
118
 
119
119
  # Settles a payment for final processing.
120
- # Note: This method appears to have a bug and returns config.api_url instead of making an API call.
120
+ # Note: This method currently has a bug and returns config.api_url instead of making an API call.
121
121
  #
122
122
  # @param params [Hash] settlement parameters
123
123
  # @return [String] currently returns the API URL (likely unintended behavior)
124
124
  # @todo Fix this method to properly call the settlement endpoint
125
125
  #
126
126
  def settle_payment(params = {})
127
- conifg.api_url
127
+ config.api_url
128
128
  end
129
129
 
130
130
  # Creates a new recurring subscription.
@@ -387,6 +387,10 @@ module Solidgate
387
387
  post('/api/v1/status', body: params, base_url: "https://pay.solidgate.com")
388
388
  end
389
389
 
390
+ def make_card_recurring(params)
391
+ post('/api/v1/recurring', body: params, base_url: "https://pay.solidgate.com")
392
+ end
393
+
390
394
  private
391
395
 
392
396
  # Builds a Configuration object from the provided options.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Solidgate
4
- VERSION = "0.1.13"
4
+ VERSION = "0.1.14"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidgate-ruby-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hector Carrillo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-02-13 00:00:00.000000000 Z
11
+ date: 2026-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -117,6 +117,7 @@ extra_rdoc_files: []
117
117
  files:
118
118
  - ".rspec"
119
119
  - ".ruby-version"
120
+ - AGENTS.md
120
121
  - CHANGELOG.md
121
122
  - Gemfile
122
123
  - Gemfile.lock