stripe-ruby-mock / stripe-ruby-mock

A mocking library for testing stripe ruby
MIT License
960 stars 722 forks source link

Integration: Test Payment ID Isn't Recognised Server Side #750

Open vladiim opened 4 years ago

vladiim commented 4 years ago

Notes

Steps to recreate

  1. Capybara feature test with JS
  2. stripe.createPaymentMethod client side
  3. Stripe::PaymentMethod.attach with the result.paymentMethod.id returned from step 2

Result [StripeMock req]::attach_payment_method post /v1/payment_methods/pm_1HfEKQIz6J50NfGiUsRw7pAi/attach {:customer=>"test_cus_1"} *** Stripe::InvalidRequestError Exception: No such payment_method: pm_1HfEKQIz6J50NfGiUsRw7pAi

1. Capybara feature test with JS true

      stripe_iframe = all('iframe[name=stripe_checkout_app]').last
      Capybara.within_frame stripe_iframe do
        find(:xpath, "//input[@name='cardnumber']").set('4242 4242 4242 4242')
        find(:xpath, "//input[@name='exp-date']").set('12 / 30')
        find(:xpath, "//input[@name='cvc']").set('130')
        find(:xpath, "//input[@name='postal']").set('10030')
      end
      click_button 'Subscribe'

2. stripe.createPaymentMethod client side stripe.createPaymentMethod({ type: 'card', card: cardElement, })

3. Stripe::PaymentMethod.attach with the result.paymentMethod.id returned from step 2 Stripe::PaymentMethod.attach(payment_id, { customer: user.stripe_id })

CharlieGroves commented 2 months ago

Still an issue, running into the same thing now