Skip to content

Commit

Permalink
Merge pull request #121 from mollie/fix-mandate-helper
Browse files Browse the repository at this point in the history
Payment: mandate endpoint requires customer id
  • Loading branch information
vernondegoede authored Aug 12, 2019
2 parents 7e8f57f + fa2d548 commit e73be2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/mollie/payment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ def customer(options = {})
end

def mandate(options = {})
return if customer_id.nil?
return if mandate_id.nil?
options = options.merge(customer_id: customer_id)
Customer::Mandate.get(mandate_id, options)
end

Expand Down
3 changes: 2 additions & 1 deletion test/mollie/payment_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,12 @@ def test_get_mandate
{
"resource": "payment",
"id": "tr_WDqYK6vllg",
"customer_id": "cst_4qqhO89gsT",
"mandate_id": "mdt_h3gAaD5zP"
}
), headers: {})

stub_request(:get, 'https://api.mollie.com/v2/mandates/mdt_h3gAaD5zP')
stub_request(:get, 'https://api.mollie.com/v2/customers/cst_4qqhO89gsT/mandates/mdt_h3gAaD5zP')
.to_return(status: 200, body: %(
{
"resource": "mandate",
Expand Down

0 comments on commit e73be2c

Please sign in to comment.