Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support omise api 2019 #92

Merged
merged 12 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Omise.Examples/Example.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public async Task<PaymentSource> RetrieveSourceTrueMoney()
Amount = 2000,
Currency = "thb",
Type = OffsiteTypes.TrueMoney,
PhoneNumber = "0812345678"
MobileNumber = "0812345678"
});
}

Expand Down
2 changes: 1 addition & 1 deletion Omise.Examples/Examples/Balances.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class Balances : Example
public async Task Retrieve__Retrieve()
{
var balance = await Client.Balance.Get();
Console.WriteLine($"available balance: {balance.Available}");
Console.WriteLine($"available balance: {balance.Transferable}");
Console.WriteLine($"total balance: {balance.Total}");
}
}
Expand Down
8 changes: 0 additions & 8 deletions Omise.Examples/Examples/Charges.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,6 @@ public async Task Create__Create_With_Source_InternetBanking()
{
Amount = 2000,
Currency = "thb",
Offsite = OffsiteTypes.InternetBankingBAY,
Flow = FlowTypes.Redirect,
Source = source,
ReturnUri = "https://www.omise.co/",
Metadata = new Dictionary<string, object>
Expand Down Expand Up @@ -262,8 +260,6 @@ public async Task Create__Create_With_Source_BillPayment()
{
Amount = 2000,
Currency = "thb",
Offsite = OffsiteTypes.BillPaymentTescoLotus,
Flow = FlowTypes.Offline,
Source = source
});

Expand All @@ -280,8 +276,6 @@ public async Task Create__Create_With_Source_RabbitLinepay()
{
Amount = 2000,
Currency = "thb",
Offsite = OffsiteTypes.RabbitLinepay,
Flow = FlowTypes.Redirect,
Source = source
});

Expand All @@ -297,8 +291,6 @@ public async Task Create__Create_With_Source_WeChatPay()
{
Amount = 2000,
Currency = "thb",
Offsite = OffsiteTypes.WeChatPay,
Flow = FlowTypes.Redirect,
Source = source
});

Expand Down
2 changes: 1 addition & 1 deletion Omise.Examples/Examples/PaymentSources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public async Task Create__Create_TrueMoney()
Amount = 2000,
Currency = "thb",
Type = OffsiteTypes.TrueMoney,
PhoneNumber = "0812345678"
MobileNumber = "0812345678"
});

Console.WriteLine($"created source: {source.Id}");
Expand Down
23 changes: 0 additions & 23 deletions Omise.Examples/Examples/Transfers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,29 +56,6 @@ public async Task Retrieve__Retrieve()
Console.WriteLine($"transfer amount: {transfer.Amount}");
}

public async Task Update__Update()
{
var transferId = ExampleInfo.TRANSFER_ID; // "trsf_test_560ph0660cgiag1xjeh";
var transfer = await Client.Transfers.Update(transferId, new UpdateTransferRequest
{
Amount = 733137
});

Console.WriteLine($"updated transfer: {transfer.Id}");
}

public async Task Update__Update_With_Metadata()
{
var transferId = ExampleInfo.TRANSFER_ID; // "trsf_test_560ph0660cgiag1xjeh";
var transfer = await Client.Transfers.Update(transferId, new UpdateTransferRequest
{
Amount = 733137,
Metadata = new Dictionary<string, object> { { "color", "red" } }
});

Console.WriteLine($"updated transfer: {transfer.Id}");
}

public async Task Destroy__Destroy()
{
var transfer = RetrieveTransfer();
Expand Down
39 changes: 19 additions & 20 deletions Omise.Tests/ClientTest.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using System;
using NUnit.Framework;

namespace Omise.Tests
namespace Omise.Tests
{
[TestFixture]
public class ClientTest : OmiseTest
public class ClientTest : OmiseTest
{
[Test]
public void TestCtor()
public void TestCtor()
{
var pkey = "pkey_test_123";
var skey = "skey_test_123";
Expand All @@ -23,44 +23,43 @@ public void TestCtor()
}

[Test]
public void TestAPIVersion()
public void TestAPIVersion()
{
var client = new Client("pkey_test_123", "skey_test_123");
client.APIVersion = "new-shiny-version";
Assert.AreEqual("new-shiny-version", client.APIVersion);
Assert.AreEqual("new-shiny-version", ((Requester)client.Requester).APIVersion);
Assert.AreEqual("2019-05-29", client.APIVersion);
Assert.AreEqual("2019-05-29", ((Requester)client.Requester).APIVersion);
}

[Test]
public void TestResources()
public void TestResources()
{
var client = new Client(DummyCredentials);
var resources = new object[]
{
client.Account,
client.Balance,
client.Capability,
client.Charge("chrg_test_4yq7duw15p9hdrjp8oq"),
client.Balance,
client.Capability,
client.Charge("chrg_test_4yq7duw15p9hdrjp8oq"),
client.Charges,
client.Customer("cust_test_4yq6txdpfadhbaqnwp3"),
client.Customers,
client.Customer("cust_test_4yq6txdpfadhbaqnwp3"),
client.Customers,
client.Disputes,
client.Events,
client.Occurrences,
client.Recipient("recp_test_57po4c5obpi7rrxhtyl"),
client.Recipients,
client.Refunds,
client.Schedule("schd_test_57ze0f4rbugx2jjlg4y"),
client.Schedules,
client.Recipient("recp_test_57po4c5obpi7rrxhtyl"),
client.Recipients,
client.Refunds,
client.Schedule("schd_test_57ze0f4rbugx2jjlg4y"),
client.Schedules,
client.Tokens,
client.Transactions,
client.Transfers,
};

foreach (var resource in resources)
foreach (var resource in resources)
{
Assert.IsNotNull(resource);
}
}
}
}
}
Expand Down
Loading
Loading