-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
660 additions
and
406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ lago: | |
processor: lago | ||
processor_id: gid://dummy/Pay::Customer/772847388 | ||
default: true | ||
data: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require "test_helper" | ||
require "uri" | ||
|
||
class Pay::Lago::PaymentMethodTest < ActiveSupport::TestCase | ||
setup do | ||
@pay_customer = pay_customers(:lago) | ||
end | ||
|
||
test "Lago sync returns Pay::PaymentMethod" do | ||
lago_customer = OpenStruct.new( | ||
external_id: @pay_customer.processor_id, | ||
billing_configuration: OpenStruct.new( | ||
payment_provider: "stripe", | ||
provider_customer_id: "x" | ||
) | ||
) | ||
pay_payment_method = Pay::Lago::PaymentMethod.sync(lago_customer) | ||
assert pay_payment_method.is_a?(Pay::PaymentMethod) | ||
assert pay_payment_method.processor_id == "x" | ||
assert @pay_customer.default_payment_method == pay_payment_method | ||
end | ||
|
||
test "PaymentMethod does not push or pull if not default" do | ||
pay_payment_method = @pay_customer.add_payment_method(:stripe, "test_1234", default: false, sync: false).payment_processor | ||
assert pay_payment_method.push! == false | ||
assert pay_payment_method.pull! == false | ||
end | ||
|
||
test "PaymentMethod can be made default, updating Lago" do | ||
pay_payment_method = @pay_customer.add_payment_method(:stripe, "test_1234_a", sync: true) | ||
lago_customer = Pay::Lago.client.customers.get(@pay_customer.pay_external_id) | ||
assert lago_customer.billing_configuration.provider_customer_id == pay_payment_method.processor_id | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
163 changes: 163 additions & 0 deletions
163
test/vcr_cassettes/test_PaymentMethod_can_be_made_default__updating_Lago.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
14 changes: 7 additions & 7 deletions
14
test/vcr_cassettes/test_can_get_lago_processor_customer.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.