Skip to content

Commit

Permalink
[EM-2197] Add mobile banking source types (#141)
Browse files Browse the repository at this point in the history
* added

* fix test

* fix

* fix test

* added changelog

* bump version
  • Loading branch information
kan98 authored Aug 8, 2022
1 parent 37ce6fd commit df451d4
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGE LOG

## v4.1.0

* **NEW** Added `Mobile Banking Bay`, `Mobile Banking BBL`, `Mobile Banking KBank` and `Mobile Banking OCBC PAO` source types (#141)

## v4.0.8

* **FIXED** Fix passing null if email not specified in request (#139)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.github.ben-manes.versions'

group 'co.omise'
version '4.0.8'
version '4.1.0'

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/co/omise/models/PlatformType.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public enum PlatformType {
Unknown,
@JsonProperty("WEB")
Web,
@JsonProperty("iOS")
@JsonProperty("IOS")
iOS,
@JsonProperty("ANDROID")
Android;
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/co/omise/models/SourceType.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ public enum SourceType {
InternetBankingKtb,
@JsonProperty("internet_banking_scb")
InternetBankingScb,
@JsonProperty("mobile_banking_bay")
MobileBankingBay,
@JsonProperty("mobile_banking_bbl")
MobileBankingBbl,
@JsonProperty("mobile_banking_kbank")
MobileBankingKbank,
@JsonProperty("mobile_banking_ocbc_pao")
MobileBankingOcbcPao,
@JsonProperty("mobile_banking_scb")
MobileBankingScb,
@JsonProperty("paynow")
Expand Down
89 changes: 89 additions & 0 deletions src/test/java/co/omise/live/LiveSourceRequestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import co.omise.models.OmiseException;
import co.omise.models.Source;
import co.omise.models.SourceType;
import co.omise.models.PlatformType;
import co.omise.requests.Request;
import org.junit.Before;
import org.junit.Ignore;
Expand Down Expand Up @@ -214,6 +215,94 @@ public void testLiveSourceZeroInterestInstallments() throws IOException, OmiseEx
assertTrue(source.isZeroInterestInstallments());
}

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

Source source = client.sendRequest(request);

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

assertNotNull(source.getId());
assertEquals("mobile_banking_bay", source.getType().toString());
assertEquals("app_redirect", source.getFlow().toString());
assertEquals(10000L, source.getAmount());
assertEquals("THB", source.getCurrency());
assertEquals("IOS", source.getPlatformType().toString());
}

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

Source source = client.sendRequest(request);

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

assertNotNull(source.getId());
assertEquals("mobile_banking_bbl", source.getType().toString());
assertEquals("app_redirect", source.getFlow().toString());
assertEquals(25000L, source.getAmount());
assertEquals("THB", source.getCurrency());
assertEquals("ANDROID", source.getPlatformType().toString());
}

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

Source source = client.sendRequest(request);

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

assertNotNull(source.getId());
assertEquals("mobile_banking_kbank", source.getType().toString());
assertEquals("app_redirect", source.getFlow().toString());
assertEquals(25000L, source.getAmount());
assertEquals("THB", source.getCurrency());
assertEquals("ANDROID", source.getPlatformType().toString());
}

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

Source source = client.sendRequest(request);

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

assertNotNull(source.getId());
assertEquals("mobile_banking_ocbc_pao", source.getType().toString());
assertEquals("app_redirect", source.getFlow().toString());
assertEquals(25000L, source.getAmount());
assertEquals("THB", source.getCurrency());
assertEquals("IOS", source.getPlatformType().toString());
}

@Test
@Ignore("only hit the network when we need to.")
public void testLiveSourceMobileBankingScb() throws IOException, OmiseException {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/co/omise/models/PlatformTypeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class PlatformTypeTest {
@Test
public void checkStringValue() {
assertEquals("WEB", PlatformType.Web.toString());
assertEquals("iOS", PlatformType.iOS.toString());
assertEquals("IOS", PlatformType.iOS.toString());
assertEquals("ANDROID", PlatformType.Android.toString());
}
}
4 changes: 4 additions & 0 deletions src/test/java/co/omise/models/SourceTypeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ public void checkStringValue() {
assertEquals("internet_banking_ktb", SourceType.InternetBankingKtb.toString());
assertEquals("internet_banking_bbl", SourceType.InternetBankingBbl.toString());
assertEquals("internet_banking_scb", SourceType.InternetBankingScb.toString());
assertEquals("mobile_banking_bay", SourceType.MobileBankingBay.toString());
assertEquals("mobile_banking_bbl", SourceType.MobileBankingBbl.toString());
assertEquals("mobile_banking_kbank", SourceType.MobileBankingKbank.toString());
assertEquals("mobile_banking_ocbc_pao", SourceType.MobileBankingOcbcPao.toString());
assertEquals("mobile_banking_scb", SourceType.MobileBankingScb.toString());
assertEquals("bill_payment_tesco_lotus", SourceType.BillPaymentTescoLotus.toString());
assertEquals("alipay", SourceType.Alipay.toString());
Expand Down

0 comments on commit df451d4

Please sign in to comment.