Sha256: c848efc9f09eff24c96431d3616051466c31a7932e0593d2b03498ac720c89a6

Contents?: true

Size: 1.59 KB

Versions: 23

Compression:

Stored size: 1.59 KB

Contents

describe MangoPay::PayIn::PayPal::Web, type: :feature do
  include_context 'payins'

  def check_type_and_status(payin)
    expect(payin['Type']).to eq('PAYIN')
    expect(payin['Nature']).to eq('REGULAR')
    expect(payin['PaymentType']).to eq('PAYPAL')
    expect(payin['ExecutionType']).to eq('WEB')

    # not SUCCEEDED yet: waiting for processing
    expect(payin['Status']).to eq('CREATED')
    expect(payin['ResultCode']).to be_nil
    expect(payin['ResultMessage']).to be_nil
    expect(payin['ExecutionDate']).to be_nil
  end

  describe 'CREATE' do
    it 'creates a paypal web payin' do
      created = new_payin_paypal_web
      expect(created['Id']).not_to be_nil
      check_type_and_status(created)
    end
  end

  describe "FETCH" do
    it 'FETCHES a payIn with PayPal account email' do
      payin_id = "54088959"
      buyer_account_email = "paypal-buyer-user@mangopay.com"
      payin = MangoPay::PayIn.fetch(id = payin_id)

      expect(payin).not_to be_nil
      expect(payin["PaypalBuyerAccountEmail"]).not_to be_nil
      expect(payin["PaypalBuyerAccountEmail"]).to eq(buyer_account_email)
    end
  end

  describe 'FETCH' do
    it 'fetches a payin' do
      created = new_payin_paypal_web
      fetched = MangoPay::PayIn.fetch(created['Id'])
      expect(fetched['Id']).to eq(created['Id'])
      expect(fetched['CreationDate']).to eq(created['CreationDate'])
      expect(fetched['CreditedFunds']).to eq(created['CreditedFunds'])
      expect(fetched['CreditedWalletId']).to eq(created['CreditedWalletId'])
      check_type_and_status(created)
      check_type_and_status(fetched)
    end
  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
mangopay-3.15.0 spec/mangopay/payin_paypal_web_spec.rb
mangopay-3.14.0 spec/mangopay/payin_paypal_web_spec.rb
mangopay-3.13.2 spec/mangopay/payin_paypal_web_spec.rb
mangopay-3.12.0 spec/mangopay/payin_paypal_web_spec.rb
mangopay-3.11.1 spec/mangopay/payin_paypal_web_spec.rb
mangopay-3.11.0 spec/mangopay/payin_paypal_web_spec.rb
mangopay-3.10.0 spec/mangopay/payin_paypal_web_spec.rb
mangopay-3.9.0 spec/mangopay/payin_paypal_web_spec.rb
mangopay-3.8.0 spec/mangopay/payin_paypal_web_spec.rb
mangopay-3.7.0 spec/mangopay/payin_paypal_web_spec.rb
mangopay-3.6.0 spec/mangopay/payin_paypal_web_spec.rb
mangopay-3.5.0 spec/mangopay/payin_paypal_web_spec.rb
mangopay-3.4.0 spec/mangopay/payin_paypal_web_spec.rb
mangopay-3.3.0 spec/mangopay/payin_paypal_web_spec.rb
mangopay-3.2.0 spec/mangopay/payin_paypal_web_spec.rb
mangopay-3.1.0 spec/mangopay/payin_paypal_web_spec.rb
mangopay-3.0.38 spec/mangopay/payin_paypal_web_spec.rb
mangopay-3.0.37 spec/mangopay/payin_paypal_web_spec.rb
mangopay-3.0.36 spec/mangopay/payin_paypal_web_spec.rb
mangopay-3.0.35 spec/mangopay/payin_paypal_web_spec.rb