Skip to content

Commit

Permalink
added endpoint for fetching card validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Iulian Masar committed Jan 23, 2024
1 parent b991fd3 commit ad0c208
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/mangopay/card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ def validate(card_id, params)
url = "#{MangoPay.api_path}/cards/#{card_id}/validation"
MangoPay.request(:post, url, params)
end

def get_card_validation(card_id, validation_id)
url = "#{MangoPay.api_path}/cards/#{card_id}/validation/#{validation_id}"
MangoPay.request(:get, url)
end
end
end
end
8 changes: 8 additions & 0 deletions spec/mangopay/card_registration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,13 @@

expect(validated).to_not be_nil
end

it "fetches card validation" do
created = new_card_registration_completed
card_validation = create_card_validation(created['UserId'], created['CardId'])
fetched_card_validation = MangoPay::Card.get_card_validation(created['CardId'], card_validation['Id'])

expect(card_validation['Id']).equal? fetched_card_validation['Id']
end
end
end

0 comments on commit ad0c208

Please sign in to comment.