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
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
zai_payment (2.8.4)
zai_payment (2.8.5)
base64 (~> 0.3.0)
faraday (~> 2.0)
openssl (~> 3.3)
Expand Down
12 changes: 12 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
## [Released]

## [2.8.5] - 2025-12-12

### Fixed
- **Webhook Environment-Based Base URL**: Fixed webhook base URL to dynamically switch based on environment 🔧
- Added `Config#webhook_base_endpoint` method to determine correct endpoint per environment
- Production environment: webhooks use `core_base` (`https://au-0000.api.assemblypay.com`)
- Prelive environment: webhooks use `va_base` (`https://sandbox.au-0000.api.assemblypay.com`)
- Webhook client now automatically uses correct base URL when switching environments
- Improves on v2.8.4 which hardcoded to `core_base` for all environments

**Full Changelog**: https://github.com/Sentia/zai-payment/compare/v2.8.4...v2.8.5

## [2.8.4] - 2025-12-12

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion lib/zai_payment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def token_type = auth.token_type
# --- Resource accessors ---
# @return [ZaiPayment::Resources::Webhook] webhook resource instance
def webhooks
@webhooks ||= Resources::Webhook.new(client: Client.new(base_endpoint: :core_base))
@webhooks ||= Resources::Webhook.new(client: Client.new(base_endpoint: config.webhook_base_endpoint))
end

# @return [ZaiPayment::Resources::User] user resource instance
Expand Down
2 changes: 1 addition & 1 deletion lib/zai_payment/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def set_timeout_option(faraday, option, value)
def base_url
# Use specified base_endpoint or default to va_base
# Users API uses core_base endpoint
# Webhooks API uses va_base endpoint
# Webhooks API uses core_base (production) or va_base (prelive)
if base_endpoint
config.endpoints[base_endpoint]
else
Expand Down
13 changes: 13 additions & 0 deletions lib/zai_payment/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,18 @@ def endpoints
raise "Unknown environment: #{environment}"
end
end

# Returns the appropriate webhook base endpoint based on environment
# Production uses core_base, prelive uses va_base
def webhook_base_endpoint
case environment.to_sym
when :production
:core_base
when :prelive
:va_base
else
raise "Unknown environment: #{environment}"
end
end
end
end
2 changes: 1 addition & 1 deletion lib/zai_payment/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module ZaiPayment
VERSION = '2.8.4'
VERSION = '2.8.5'
end