Skip to content
Draft
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
4 changes: 2 additions & 2 deletions src/main/java/co/omise/Example.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void chargeWithAuthentication(AuthenticationType authenticationType)

logInfo(
"created charge with %s authentication: %s and auth url: %s ",
authenticationType.getWireValue(),
charge.getAuthenticatedBy(),
charge.getId(),
charge.getAuthorizeUri());
}
Expand Down Expand Up @@ -516,7 +516,7 @@ void listLinks() throws IOException, OmiseException, ClientException {

void createSource() throws IOException, OmiseException, ClientException {
Request<Source> request = new Source.CreateRequestBuilder()
.type(SourceType.InternetBankingBay)
.type(SourceType.MobileBankingKbank)
.amount(100000) // 1,000 THB
.currency("thb")
.terminalId("test_term_id")
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/co/omise/models/SourceType.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ public enum SourceType {
InstallmentUob,
@JsonProperty("installment_ttb")
InstallmentTtb,
@JsonProperty("internet_banking_bay")
InternetBankingBay,
@JsonProperty("internet_banking_bbl")
InternetBankingBbl,
@JsonProperty("internet_banking_ktb")
InternetBankingKtb,
@JsonProperty("internet_banking_scb")
InternetBankingScb,
@JsonProperty("mobile_banking_bay")
MobileBankingBay,
@JsonProperty("mobile_banking_bbl")
Expand Down
30 changes: 0 additions & 30 deletions src/test/java/co/omise/live/LiveChargeRequestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,36 +84,6 @@ public void testLiveCreateCharge() throws IOException, OmiseException {
assertEquals(token.getCard().getLastDigits(), charge.getCard().getLastDigits());
}

@Test
@Ignore("only hit the network when we need to.")
public void testLiveChargeWithInternetBanking() throws IOException, OmiseException {
Request<Source> sourceRequest = new Source.CreateRequestBuilder()
.type(SourceType.InternetBankingBay)
.amount(10000)
.currency("thb")
.build();

Source source = client.sendRequest(sourceRequest);

Request<Charge> createChargeRequest =
new Charge.CreateRequestBuilder()
.source(source.getId())
.amount(10000)
.currency("thb")
.returnUri("http://example.com/orders/345678/complete")
.build();

Charge charge = client.sendRequest(createChargeRequest);

System.out.println("created charge: " + charge.getId());

assertNotNull(charge.getId());
assertEquals(10000, charge.getAmount());
assertEquals("THB", charge.getCurrency());
assertEquals(SourceType.InternetBankingBay, charge.getSource().getType());
assertEquals(FlowType.Redirect, charge.getSource().getFlow());
}

@Test
@Ignore("only hit the network when we need to.")
public void testLiveChargeWithBillPaymentTescoLotus() throws IOException, OmiseException {
Expand Down
80 changes: 0 additions & 80 deletions src/test/java/co/omise/live/LiveSourceRequestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,86 +22,6 @@ public void setup() throws Exception {
client = getLiveClient();
}

@Test
@Ignore("only hit the network when we need to.")
public void testLiveSourceInternetBankingBay() throws IOException, OmiseException {
Request<Source> request = new Source.CreateRequestBuilder()
.type(SourceType.InternetBankingBay)
.amount(10000)
.currency("thb")
.build();

Source source = client.sendRequest(request);

System.out.println("created source: " + source.getId());

assertNotNull(source.getId());
assertEquals("internet_banking_bay", source.getType().toString());
assertEquals("redirect", source.getFlow().toString());
assertEquals(10000L, source.getAmount());
assertEquals("THB", source.getCurrency());
}

@Test
@Ignore("only hit the network when we need to.")
public void testLiveSourceInternetBankingKtb() throws IOException, OmiseException {
Request<Source> request = new Source.CreateRequestBuilder()
.type(SourceType.InternetBankingKtb)
.amount(10000)
.currency("thb")
.build();

Source source = client.sendRequest(request);

System.out.println("created source: " + source.getId());

assertNotNull(source.getId());
assertEquals("internet_banking_ktb", source.getType().toString());
assertEquals("redirect", source.getFlow().toString());
assertEquals(10000L, source.getAmount());
assertEquals("THB", source.getCurrency());
}

@Test
@Ignore("only hit the network when we need to.")
public void testLiveSourceInternetBankingScb() throws IOException, OmiseException {
Request<Source> request = new Source.CreateRequestBuilder()
.type(SourceType.InternetBankingScb)
.amount(10000)
.currency("thb")
.build();

Source source = client.sendRequest(request);

System.out.println("created source: " + source.getId());

assertNotNull(source.getId());
assertEquals("internet_banking_scb", source.getType().toString());
assertEquals("redirect", source.getFlow().toString());
assertEquals(10000L, source.getAmount());
assertEquals("THB", source.getCurrency());
}

@Test
@Ignore("only hit the network when we need to.")
public void testLiveSourceInternetBankingBbl() throws IOException, OmiseException {
Request<Source> request = new Source.CreateRequestBuilder()
.type(SourceType.InternetBankingBbl)
.amount(10000)
.currency("thb")
.build();

Source source = client.sendRequest(request);

System.out.println("created source: " + source.getId());

assertNotNull(source.getId());
assertEquals("internet_banking_bbl", source.getType().toString());
assertEquals("redirect", source.getFlow().toString());
assertEquals(10000L, source.getAmount());
assertEquals("THB", source.getCurrency());
}

@Test
@Ignore("only hit the network when we need to.")
public void testLiveSourceBillPayment() throws IOException, OmiseException {
Expand Down
4 changes: 0 additions & 4 deletions src/test/java/co/omise/models/SourceTypeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ public class SourceTypeTest {

@Test
public void checkStringValue() {
assertEquals("internet_banking_bay", SourceType.InternetBankingBay.toString());
assertEquals("internet_banking_ktb", SourceType.InternetBankingKtb.toString());
assertEquals("internet_banking_bbl", SourceType.InternetBankingBbl.toString());
assertEquals("internet_banking_scb", SourceType.InternetBankingScb.toString());
assertEquals("installment_uob", SourceType.InstallmentUob.toString());
assertEquals("installment_ttb", SourceType.InstallmentTtb.toString());
assertEquals("mobile_banking_bay", SourceType.MobileBankingBay.toString());
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/co/omise/requests/ChargeRequestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void testCreateChargeFromSource() throws IOException, OmiseException {

assertEquals(CHARGE_ID, charge.getId());
assertEquals("src_test_5929c3tjts3omoi7ti2", charge.getSource().getId());
assertEquals(SourceType.InternetBankingScb, charge.getSource().getType());
assertEquals(SourceType.MobileBankingScb, charge.getSource().getType());
assertEquals(Barcode.class, charge.getSource().getScannableCode().getClass());
assertEquals(100000L, charge.getAmount());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
"created_at": "2020-03-30T05:01:03Z"
}
},
"type": "internet_banking_scb",
"flow": "redirect",
"type": "mobile_banking_scb",
"flow": "app_redirect",
"amount": 100000,
"currency": "thb"
}
Expand Down
6 changes: 3 additions & 3 deletions src/test/resources/testdata/objects/source_object.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"object": "source",
"id": "src_test_5929c3tjts3omoi7ti2",
"type": "internet_banking_scb",
"flow": "redirect",
"type": "mobile_banking_scb",
"flow": "app_redirect",
"amount": 100000,
"currency": "thb"
}
}