Sha256: 26f36c009f805815561882d719f65ee04d710b52f01ee7c74c674b97e13f706e

Contents?: true

Size: 1.62 KB

Versions: 2

Compression:

Stored size: 1.62 KB

Contents

# coding: utf-8

require_relative 'spec_helper'

RSpec.describe 'Iyzipay' do
  before :all do
    @options = Iyzipay::Options.new
    @options.api_key = 'your api key'
    @options.secret_key = 'your secret key'
    @options.base_url = 'https://api.iyzipay.com'
  end

  it 'should pay with card' do
    payment_card = {
        cardHolderName: 'John Doe',
        cardNumber: '5528790000000008',
        expireYear: '2030',
        expireMonth: '12',
        cvc: '123',
        registerCard: 0
    }
    request = {
        locale: 'tr',
        conversationId: '123456789',
        buyerEmail: 'john@doe.com',
        buyerId: 'B2323',
        buyerIp: '85.34.78.112',
        connectorName: 'isbank',
        installment: 1,
        paidPrice: '1',
        price: '1',
        paymentCard: payment_card
    }
    payment = Iyzipay::Model::BasicPaymentPreAuth.new.create(request, @options)
    begin
      $stderr.puts payment.inspect
    rescue
      $stderr.puts 'oops'
      raise
    end
  end

  it 'should pay with card token' do
    payment_card = {
        cardToken: 'card token',
        cardUserKey: 'card user key'
    }
    request = {
        locale: 'tr',
        conversationId: '123456789',
        buyerEmail: 'john@doe.com',
        buyerId: 'B2323',
        buyerIp: '85.34.78.112',
        connectorName: 'isbank',
        installment: 1,
        paidPrice: '1',
        price: '1',
        paymentCard: payment_card
    }
    payment = Iyzipay::Model::BasicPaymentPreAuth.new.create(request, @options)
    begin
      $stderr.puts payment.inspect
    rescue
      $stderr.puts 'oops'
      raise
    end
  end

  after :each do
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
iyzipay-1.0.31 spec/basic_payment_pre_auth_spec.rb
iyzipay-1.0.29 spec/basic_payment_pre_auth_spec.rb