Skip to content

Commit

Permalink
Merge pull request #24 from htdc/update-to-latest-pin-hostname
Browse files Browse the repository at this point in the history
Update to latest pin domain
  • Loading branch information
FairfullB authored Nov 18, 2024
2 parents f788b24 + ed6f4cf commit 8c97f45
Show file tree
Hide file tree
Showing 59 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions lib/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ defmodule PINXS.Client do
Default URL for communicating with Pin Payments
"""
def default_url do
"https://api.pin.net.au/1"
"https://api.pinpayments.com/1"
end

@doc """
Test URL for communicating with Pin Payments
"""
def test_url do
"https://test-api.pin.net.au/1"
"https://test-api.pinpayments.com/1"
end
end
8 changes: 4 additions & 4 deletions lib/pinxs.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@ defmodule PINXS do
Default usage is to just provide the api key
iex> PINXS.config("ABC123")
%PINXS{api_key: "ABC123", url: "https://api.pin.net.au/1"}
%PINXS{api_key: "ABC123", url: "https://api.pinpayments.com/1"}
"""

def config(api_key) do
%PINXS{api_key: api_key, url: "https://api.pin.net.au/1"}
%PINXS{api_key: api_key, url: "https://api.pinpayments.com/1"}
end

@doc """
If you want to use test mode
iex> PINXS.config("ABC123", :test)
%PINXS{api_key: "ABC123", url: "https://test-api.pin.net.au/1"}
%PINXS{api_key: "ABC123", url: "https://test-api.pinpayments.com/1"}
Or you can have an arbitrary URL
iex> PINXS.config("ABC123", "https://my-fake-pin")
%PINXS{api_key: "ABC123", url: "https://my-fake-pin"}
"""
def config(api_key, :test) do
%PINXS{api_key: api_key, url: "https://test-api.pin.net.au/1"}
%PINXS{api_key: api_key, url: "https://test-api.pinpayments.com/1"}
end

def config(api_key, url) do
Expand Down
2 changes: 1 addition & 1 deletion test/bank_accounts/bank_account_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule PINXS.BankAccounts.BankAccountTest do
{:ok, created_account} = BankAccount.create(bank_account, client)

assert created_account.number == "XXX456"
assert created_account.token == "ba_sik8FwkHtPMi7rjtSY0ibg"
assert created_account.token == "ba_oszuw2X_GXzSdrsGPa4MlQ"
end
end
end
4 changes: 2 additions & 2 deletions test/cards/card_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defmodule PINXS.Cards.CardTest do
card = %Card{
number: "5520000000000000",
expiry_month: "12",
expiry_year: "20",
expiry_year: "30",
name: "Rubius Hagrid",
address_line1: "The Game Keepers Cottage",
address_city: "Hogwarts",
Expand All @@ -22,7 +22,7 @@ defmodule PINXS.Cards.CardTest do
with_proxy("cards.fixture") do
{:ok, response} = Card.create(card, client)

assert response.expiry_year == 2020
assert response.expiry_year == 2030
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/charges/charge_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defmodule PINXS.Charges.ChargeTest do
{:ok, charge} = Charge.create(charge, client)
assert charge.amount == 50_000
assert charge.email == "[email protected]"
assert charge.card.token == "card_u2vD9fa5icjORwtWm8t6dw"
assert charge.card.token == "card_pJ1BLE6sCmjHnCPooMA_tA"
assert charge.captured == true
end
end
Expand Down
22 changes: 11 additions & 11 deletions test/customers/customer_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule PINXS.Customers.CustomerTest do
card = %Card{
number: "5520000000000000",
expiry_month: "12",
expiry_year: "20",
expiry_year: "30",
name: "Rubius Hagrid",
address_line1: "The Game Keepers Cottage",
address_city: "Hogwarts",
Expand All @@ -30,7 +30,7 @@ defmodule PINXS.Customers.CustomerTest do
with_proxy("create_customer.fixture") do
{:ok, customer} = Customer.create(customer, client)

assert customer.token == "cus_--WoYjMhIsbglISJqdNHMA"
assert customer.token == "cus_DGrwx9DKOevzPZ1e9dwnxg"
end
end

Expand All @@ -46,7 +46,7 @@ defmodule PINXS.Customers.CustomerTest do
with_proxy("get_all_customers.fixture") do
{:ok, customers} = Customer.get_all(client)

assert length(customers.items) == 2
assert length(customers.items) == 16
end
end

Expand All @@ -61,7 +61,7 @@ defmodule PINXS.Customers.CustomerTest do

test "Get single customer" do
with_proxy("get_customer.fixture") do
{:ok, customer} = Customer.get("cus_--WoYjMhIsbglISJqdNHMA", client)
{:ok, customer} = Customer.get("cus_xTHNEXjR1A2-8KtOKEpeyQ", client)

assert customer.email == "[email protected]"
end
Expand All @@ -77,7 +77,7 @@ defmodule PINXS.Customers.CustomerTest do

test "Update a customer" do
with_proxy("update_customer.fixture") do
{:ok, customer} = Customer.get("cus_--WoYjMhIsbglISJqdNHMA", client)
{:ok, customer} = Customer.get("cus_01VO6LV4uIyOrwS_fcQ3Ww", client)
to_update = %{email: "[email protected]"}
{:ok, updated} = Customer.update(customer, to_update, client)

Expand Down Expand Up @@ -121,7 +121,7 @@ defmodule PINXS.Customers.CustomerTest do

{:ok, %{items: [card | _]}} = Customer.get_cards(created_customer, client)

assert card.expiry_year == 2020
assert card.expiry_year == 2030
end
end

Expand All @@ -132,23 +132,23 @@ defmodule PINXS.Customers.CustomerTest do
{:ok, created_card} =
Customer.add_card(
created_customer,
%{card | expiry_year: 2020},
%{card | expiry_year: 2029},
client
)

assert created_card.expiry_year == 2020
assert created_card.expiry_year == 2029
end
end

test "Add card to customer with token", %{customer: customer, card: card} do
with_proxy("add_card_token_to_customer.fixture") do
{:ok, created_customer} = Customer.create(customer, client)

{:ok, created_card} = Card.create(%{card | expiry_year: 2021}, client)
{:ok, created_card} = Card.create(%{card | expiry_year: 2029}, client)

{:ok, added_card} = Customer.add_card(created_customer, created_card.token, client)

assert added_card.expiry_year == 2021
assert added_card.expiry_year == 2029
end
end

Expand All @@ -159,7 +159,7 @@ defmodule PINXS.Customers.CustomerTest do
{:ok, created_card} =
Customer.add_card(
created_customer,
%{card | expiry_year: 2021},
%{card | expiry_year: 2030},
client
)

Expand Down
Binary file modified test/fixtures/add_card_to_customer.fixture
Binary file not shown.
Binary file modified test/fixtures/add_card_token_to_customer.fixture
Binary file not shown.
Binary file modified test/fixtures/balance.fixture
Binary file not shown.
Binary file modified test/fixtures/bank_accounts_create.fixture
Binary file not shown.
Binary file modified test/fixtures/capture_full_charge.fixture
Binary file not shown.
Binary file modified test/fixtures/capture_partial_charge.fixture
Binary file not shown.
Binary file modified test/fixtures/card_with_missing_field.fixture
Binary file not shown.
Binary file modified test/fixtures/cards.fixture
Binary file not shown.
Binary file modified test/fixtures/charge_with_card_token.fixture
Binary file not shown.
Binary file modified test/fixtures/charge_with_customer_token.fixture
Binary file not shown.
Binary file modified test/fixtures/create_charge.fixture
Binary file not shown.
Binary file modified test/fixtures/create_customer.fixture
Binary file not shown.
Binary file modified test/fixtures/create_customer_with_missing_fields.fixture
Binary file not shown.
Binary file modified test/fixtures/delete_customer.fixture
Binary file not shown.
Binary file modified test/fixtures/delete_customer_card.fixture
Binary file not shown.
Binary file modified test/fixtures/get_all_charges.fixture
Binary file not shown.
Binary file modified test/fixtures/get_all_customers.fixture
Binary file not shown.
Binary file modified test/fixtures/get_charge.fixture
Binary file not shown.
Binary file modified test/fixtures/get_customer.fixture
Binary file not shown.
Binary file modified test/fixtures/get_customer_cards.fixture
Binary file not shown.
Binary file modified test/fixtures/get_customer_charges.fixture
Binary file not shown.
Binary file modified test/fixtures/get_nil_charge.fixture
Binary file not shown.
Binary file modified test/fixtures/get_non_existing_customer.fixture
Binary file not shown.
Binary file modified test/fixtures/get_paged_customers.fixture
Binary file not shown.
Binary file modified test/fixtures/recipients/create.fixture
Binary file not shown.
Binary file modified test/fixtures/recipients/create_from_token.fixture
Binary file not shown.
Binary file modified test/fixtures/recipients/get.fixture
Binary file not shown.
Binary file modified test/fixtures/recipients/get_all.fixture
Binary file not shown.
Binary file modified test/fixtures/recipients/update.fixture
Binary file not shown.
Binary file modified test/fixtures/refunds/create.fixture
Binary file not shown.
Binary file modified test/fixtures/refunds/get_all.fixture
Binary file not shown.
Binary file modified test/fixtures/refunds/get_one.fixture
Binary file not shown.
Binary file modified test/fixtures/refunds/get_refunds_for_charge.fixture
Binary file not shown.
Binary file modified test/fixtures/search_charges.fixture
Binary file not shown.
Binary file modified test/fixtures/transfers/create.fixture
Binary file not shown.
Binary file modified test/fixtures/transfers/create_with_missing_currency.fixture
Binary file not shown.
Binary file modified test/fixtures/transfers/get_all.fixture
Binary file not shown.
Binary file modified test/fixtures/transfers/get_all_by_page.fixture
Binary file not shown.
Binary file modified test/fixtures/transfers/get_line_items.fixture
Binary file not shown.
Binary file modified test/fixtures/transfers/get_line_items_per_page.fixture
Binary file not shown.
Binary file modified test/fixtures/transfers/get_specific_transfer.fixture
Binary file not shown.
Binary file modified test/fixtures/transfers/search.fixture
Binary file not shown.
Binary file modified test/fixtures/update_customer.fixture
Binary file not shown.
Binary file modified test/fixtures/void-auth.fixture
Binary file not shown.
Binary file modified test/fixtures/webhooks/create.fixture
Binary file not shown.
Binary file modified test/fixtures/webhooks/delete.fixture
Binary file not shown.
Binary file modified test/fixtures/webhooks/events/get.fixture
Binary file not shown.
Binary file modified test/fixtures/webhooks/events/get_all.fixture
Binary file not shown.
Binary file modified test/fixtures/webhooks/get.fixture
Binary file not shown.
Binary file modified test/fixtures/webhooks/get_all.fixture
Binary file not shown.
4 changes: 2 additions & 2 deletions test/refunds/refund_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule PINXS.Refunds.RefundTest do
card = %Card{
number: "5520000000000000",
expiry_month: "12",
expiry_year: "20",
expiry_year: "30",
name: "Rubius Hagrid",
address_line1: "The Game Keepers Cottage",
address_city: "Hogwarts",
Expand Down Expand Up @@ -46,7 +46,7 @@ defmodule PINXS.Refunds.RefundTest do
with_proxy("refunds/get_all.fixture") do
{:ok, refunds} = Refund.get_all(client)

assert length(refunds.items) == 25
assert length(refunds.items) == 20
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/transfers/transfer_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ defmodule PINXS.Transfers.TransferTest do
with_proxy("transfers/search.fixture") do
{:ok, retrieved_transfers} = Transfer.search(%{query: "[email protected]"}, client)

assert retrieved_transfers.count == 5
assert retrieved_transfers.count == 17
assert retrieved_transfers.items != []
end
end
Expand Down
6 changes: 3 additions & 3 deletions test/webhooks/webhook_events_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ defmodule PINXS.Webhooks.WebhookEventTest do
with_proxy("webhooks/events/get_all.fixture") do
{:ok, events} = Event.get_all(client)

assert length(events) == 8
assert length(events) == 75
end
end

test "Gets webhook event" do
with_proxy("webhooks/events/get.fixture") do
{:ok, event} = Event.get("evt_JV_7Ri698ge902K6AQyuCg", client)
{:ok, event} = Event.get("evt_4t2D3ges-DNWyaxfg0zQ8Q", client)


assert event.token == "evt_JV_7Ri698ge902K6AQyuCg"
assert event.token == "evt_4t2D3ges-DNWyaxfg0zQ8Q"
assert event.type == "transfer.created"
end
end
Expand Down

0 comments on commit 8c97f45

Please sign in to comment.