Current section
Files
Jump to
Current section
Files
lib/elixir_test.ex
defmodule ElixirTest do
@moduledoc false
def test_cards do
# test add card
IO.inspect "testing create cards"
options = Juspay.Cards.create(["merchant_id": "vasu2795", customer_id: "user_108", name_on_card: "Sindbad", card_exp_year: 2015, card_exp_month: 7, customer_email: "customer@mail.com",nickname: "Visa card", card_number: "4123567890123456"])
IO.inspect options
reference = options["card_reference"]
fingerprint = options["card_fingerprint"]
token = options["card_token"]
# nil reference fingerprint take action
IO.inspect "testing second create cards"
options =Juspay.Cards.create([merchant_id: "vasu2795", "customer_id": "user_108", name_on_card: "Sindbad", card_exp_year: 2015, card_exp_month: 7, customer_email: "customer@mail.com",nickname: "Visa card", card_number: "4123567970123456"])
IO.inspect options
#
# Test Cards list
IO.inspect "testing cards list"
cards_list = Juspay.Cards.list( %{"customer_id": "guest_user"})
IO.inspect cards_list
# Test delete card
IO.inspect "testing delete card"
options = Juspay.Cards.create( [merchant_id: "vasu2795", customer_id: "user_108", name_on_card: "Sindbad", card_exp_year: 2015, card_exp_month: 7, customer_email: "customer@mail.com",nickname: "Visa card", card_number: "4123567970123456"])
deleted_card = Juspay.Cards.delete( [card_token: token])
IO.inspect deleted_card
if(deleted_card["deleted"] == true) do
IO.inspect "Deleted true"
else
IO.inspect "not deleted"
end
# Test for create order
IO.inspect "testing create Orders"
order = Juspay.Orders.create( [order_id: "142315694476",
amount: "90.30",
currency: "INR",
customer_id: "guest",
customer_email: "custome32@mail.com",
customer_phone: "9985115522",
product_id: "prod9-14ef1833",
return_url: "http://shop.merchant.com/payments/handleResponse",
description: "Sample description",
billing_address_first_name: "firrsstname",
billing_address_last_name: "laseestname",
billing_address_line1: "Linse1",
billing_address_line2: "Line2",
billing_address_line3: "Linee3",
billing_address_city: "Chennasi",
billing_address_state: "TamilNsadu",
billing_address_country: "India",
billing_address_postal_code: "600020",
billing_address_phone: "9988775566",
billing_address_country_code_iso: "IND",
shipping_address_first_name: "firstname",
shipping_address_last_name: "lastname",
shipping_address_line1: "Line1",
shipping_address_line2: "Line2",
shipping_address_line3: "Line3",
shipping_address_city: "Chennai",
shipping_address_state: "TamilNadu",
shipping_address_postal_code: "600020",
shipping_address_phone: "9962881912",
shipping_address_country_code_iso: "IND",
shipping_address_country: "Ind"])
IO.inspect order
# Test for Order update
IO.inspect "testing update order"
order = Juspay.Orders.update( [order_id: "142315694476",
amount: "100.30"])
IO.inspect order
# Test for Order list
IO.inspect "testing orders list"
order = Juspay.Orders.list()
IO.inspect order
# Test for Order refund
# IO.inspect "testing orders refund"
# order = Juspay.Orders.refund( [order_id: "142315694476",amount: 10])
# IO.inspect order
#Test for order status
IO.inspect "testing orders status"
order = Juspay.Orders.status([order_id: "142315694476"])
IO.inspect order
#Test for Wallets list
IO.inspect "testing wallets list"
wallets_list = Juspay.Wallets.list([customer_id: "guest_user"])
IO.inspect wallets_list
#Test for Wallets
1
end
end