Mercury integration (#723)

* Initial mercury impl

* FIX both mercury and generator class

* Finish mercury integration and provider generator

* Fix schema

* Fix linter and tags

* Update routes.rb

* Avoid schema drift

---------

Signed-off-by: soky srm <sokysrm@gmail.com>
Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
This commit is contained in:
soky srm
2026-01-22 20:37:07 +01:00
committed by GitHub
parent 7842b4a044
commit 179552657c
46 changed files with 3345 additions and 30 deletions

View File

@@ -0,0 +1,29 @@
require "test_helper"
class Provider::MercuryTest < ActiveSupport::TestCase
def setup
@provider = Provider::Mercury.new("test_token", base_url: "https://api-sandbox.mercury.com/api/v1")
end
test "initializes with token and default base_url" do
provider = Provider::Mercury.new("my_token")
assert_equal "my_token", provider.token
assert_equal "https://api.mercury.com/api/v1", provider.base_url
end
test "initializes with custom base_url" do
assert_equal "test_token", @provider.token
assert_equal "https://api-sandbox.mercury.com/api/v1", @provider.base_url
end
test "MercuryError includes error_type" do
error = Provider::Mercury::MercuryError.new("Test error", :unauthorized)
assert_equal "Test error", error.message
assert_equal :unauthorized, error.error_type
end
test "MercuryError defaults error_type to unknown" do
error = Provider::Mercury::MercuryError.new("Test error")
assert_equal :unknown, error.error_type
end
end