|
@@ -6,10 +6,10 @@ class TestParatika < Minitest::Test
|
|
|
|
|
|
|
|
def setup
|
|
def setup
|
|
|
Paratika.configure do |config|
|
|
Paratika.configure do |config|
|
|
|
- config.merchant_id = '10000000'
|
|
|
|
|
- config.merchant_user = 'apiuser@testmerchant.com'
|
|
|
|
|
- config.merchant_password = 'Pluto321`'
|
|
|
|
|
- config.url = 'https://test.paratika.com.tr'
|
|
|
|
|
|
|
+ config.merchant_id = '10002036'
|
|
|
|
|
+ config.merchant_user = 'paytentest@akillibulut.net'
|
|
|
|
|
+ config.merchant_password = 'D2w4KV[$~b'
|
|
|
|
|
+ config.url = 'https://entegrasyon.paratika.com.tr'
|
|
|
end
|
|
end
|
|
|
@@customer = { id: 'c1', name: 'John Doe', email: 'test@example.com', phone: '905531781020', ip: '7.11.7.11' }
|
|
@@customer = { id: 'c1', name: 'John Doe', email: 'test@example.com', phone: '905531781020', ip: '7.11.7.11' }
|
|
|
@@card = { name: 'John Doe', number: '4355084355084358', expiry: '12/2030', ccv: '000', save: 'yes' }
|
|
@@card = { name: 'John Doe', number: '4355084355084358', expiry: '12/2030', ccv: '000', save: 'yes' }
|
|
@@ -24,46 +24,55 @@ class TestParatika < Minitest::Test
|
|
|
|
|
|
|
|
def test_currency_exchange
|
|
def test_currency_exchange
|
|
|
result = Paratika::CurrencyExchange.new('USD', 'TRY', BigDecimal('1.00')).send
|
|
result = Paratika::CurrencyExchange.new('USD', 'TRY', BigDecimal('1.00')).send
|
|
|
|
|
+ puts result.to_json + __method__.to_s
|
|
|
assert result.data[:success]
|
|
assert result.data[:success]
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def test_sale_with_new_card
|
|
def test_sale_with_new_card
|
|
|
result = Paratika::Sale.new(@@payment, @@customer, @@card).send
|
|
result = Paratika::Sale.new(@@payment, @@customer, @@card).send
|
|
|
|
|
+ puts result.to_json + __method__.to_s
|
|
|
assert result.data[:success]
|
|
assert result.data[:success]
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def test_pre_auth_with_new_card
|
|
def test_pre_auth_with_new_card
|
|
|
result = Paratika::PreAuth.new(@@payment, @@customer, @@card).send
|
|
result = Paratika::PreAuth.new(@@payment, @@customer, @@card).send
|
|
|
|
|
+ puts result.to_json + __method__.to_s
|
|
|
assert result.data[:success]
|
|
assert result.data[:success]
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def test_sale_with_saved_card
|
|
def test_sale_with_saved_card
|
|
|
result = Paratika::Sale.new(@@payment, @@customer, { token: @@token }).send
|
|
result = Paratika::Sale.new(@@payment, @@customer, { token: @@token }).send
|
|
|
|
|
+ puts result.to_json + __method__.to_s
|
|
|
assert result.data[:success]
|
|
assert result.data[:success]
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def test_pre_auth_with_saved_card
|
|
def test_pre_auth_with_saved_card
|
|
|
result = Paratika::PreAuth.new(@@payment, @@customer, { token: @@token }).send
|
|
result = Paratika::PreAuth.new(@@payment, @@customer, { token: @@token }).send
|
|
|
|
|
+ puts result.to_json + __method__.to_s
|
|
|
assert result.data[:success]
|
|
assert result.data[:success]
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def test_cancel_transaction
|
|
def test_cancel_transaction
|
|
|
result = Paratika::Void.new(@@refundable).send
|
|
result = Paratika::Void.new(@@refundable).send
|
|
|
|
|
+ puts result.to_json + __method__.to_s
|
|
|
assert result.data[:success]
|
|
assert result.data[:success]
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def test_refund_money
|
|
def test_refund_money
|
|
|
result = Paratika::Refund.new(@@refundable).send
|
|
result = Paratika::Refund.new(@@refundable).send
|
|
|
|
|
+ puts result.to_json + __method__.to_s
|
|
|
assert result.data[:success]
|
|
assert result.data[:success]
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def test_query_saved_cards
|
|
def test_query_saved_cards
|
|
|
result = Paratika::QueryCard.new(@@customer[:id]).send
|
|
result = Paratika::QueryCard.new(@@customer[:id]).send
|
|
|
|
|
+ puts result.to_json + __method__.to_s
|
|
|
assert result.data[:success]
|
|
assert result.data[:success]
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def test_delete_card
|
|
def test_delete_card
|
|
|
result = Paratika::EWalletDeleteCard.new(@@token).send
|
|
result = Paratika::EWalletDeleteCard.new(@@token).send
|
|
|
|
|
+ puts result.to_json + __method__.to_s
|
|
|
assert result.data[:success]
|
|
assert result.data[:success]
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|