Skip to content

Commit

Permalink
Merge pull request #240 from Mangopay/feature/get-card-validation
Browse files Browse the repository at this point in the history
added endpoint for fetching card validation
  • Loading branch information
iulian03 authored Jan 23, 2024
2 parents b991fd3 + 1db0922 commit 0edc3da
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ruby_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
ruby-version: 2.6.10
- name: Install Rspec
run: |
gem install bundler
gem install bundler -v 2.4.22
bundler install
- name: Test
run: bundle exec rspec
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 0edc3da

Please sign in to comment.