Skip to content

Commit 35126da

Browse files
authored
DTSERWTHRE-750 Tag/1.0.0 beta12 (#277)
[1.0.0-beta12](https://github.com/hyperwallet/hyperwallet-android-ui-sdk/releases/tag/1.0.0-beta12) ------------------- * Bug fix
1 parent 5dbafff commit 35126da

File tree

6 files changed

+90
-7
lines changed

6 files changed

+90
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Changelog
22
=========
33

4+
[1.0.0-beta12](https://github.com/hyperwallet/hyperwallet-android-ui-sdk/releases/tag/1.0.0-beta12)
5+
-------------------
6+
* Bug fix
7+
48
[1.0.0-beta11](https://github.com/hyperwallet/hyperwallet-android-ui-sdk/releases/tag/1.0.0-beta11)
59
-------------------
610
* Fixed currency formatting issues

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ Note that this SDK is geared towards those who need both backend data and UI fea
1818
To install Hyperwallet UI SDK, you just need to add the dependencies into your build.gradle file in Android Studio (or Gradle). For example:
1919

2020
```bash
21-
api 'com.hyperwallet.android.ui:transfermethodui:1.0.0-beta11'
22-
api 'com.hyperwallet.android.ui:receiptui:1.0.0-beta11'
23-
api 'com.hyperwallet.android.ui:transferui:1.0.0-beta11'
21+
api 'com.hyperwallet.android.ui:transfermethodui:1.0.0-beta12'
22+
api 'com.hyperwallet.android.ui:receiptui:1.0.0-beta12'
23+
api 'com.hyperwallet.android.ui:transferui:1.0.0-beta12'
2424
```
2525

2626
### Proguard

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ allprojects {
2424

2525
}
2626

27-
project.version = "1.0.0-beta11"
27+
project.version = "1.0.0-beta12"
2828

2929
}
3030

transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/SelectTransferMethodPresenter.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343

4444
public class SelectTransferMethodPresenter implements SelectTransferMethodContract.Presenter {
4545

46-
private static final String DEFAULT_COUNTRY_CODE = "US";
47-
4846
private final TransferMethodConfigurationRepository mTransferMethodConfigurationRepository;
4947
private final UserRepository mUserRepository;
5048
private final SelectTransferMethodContract.View mView;
@@ -82,7 +80,7 @@ public void onKeysLoaded(@Nullable final HyperwalletTransferMethodConfigurationK
8280
: key.getCountry(countryCode);
8381

8482
if (country == null) { // param and user country is null
85-
country = key.getCountry(DEFAULT_COUNTRY_CODE);
83+
country = key.getCountries().iterator().next();
8684
}
8785

8886
String currencyCodeString = currencyCode;

transfermethodui/src/test/java/com/hyperwallet/android/ui/transfermethod/SelectTransferMethodPresenterTest.java

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import com.hyperwallet.android.ui.user.repository.UserRepositoryImpl;
3232

3333
import org.hamcrest.Matchers;
34+
import org.json.JSONException;
3435
import org.json.JSONObject;
3536
import org.junit.Before;
3637
import org.junit.Rule;
@@ -1073,4 +1074,58 @@ public Object answer(InvocationOnMock invocation) {
10731074
selectTransferMethodPresenter.loadTransferMethodTypes(false, "CA", "CAD");
10741075
verify(view).showErrorLoadTransferMethodTypes(ArgumentMatchers.<Error>anyList());
10751076
}
1077+
1078+
@Test
1079+
public void loadTransferMethodConfigurationKeys_userWithCountryNotPresentInProgramCountries() throws JSONException {
1080+
// User's country is Albania which is not present in mResult successful_tmc_keys_response.json
1081+
String userResponseBody = externalResourceManager.getResourceContent("user_al_response.json");
1082+
final JSONObject userJsonObject = new JSONObject(userResponseBody);
1083+
final User user = new User(userJsonObject);
1084+
1085+
when(view.isActive()).thenReturn(true);
1086+
doAnswer(new Answer() {
1087+
@Override
1088+
public Object answer(InvocationOnMock invocation) {
1089+
TransferMethodConfigurationRepository.LoadKeysCallback callback =
1090+
(TransferMethodConfigurationRepository.LoadKeysCallback) invocation.getArguments()[0];
1091+
callback.onKeysLoaded(mResult);
1092+
return callback;
1093+
}
1094+
}).when(mTransferMethodConfigurationRepository).getKeys(any(
1095+
TransferMethodConfigurationRepository.LoadKeysCallback.class));
1096+
doAnswer(new Answer() {
1097+
@Override
1098+
public Object answer(InvocationOnMock invocation) {
1099+
TransferMethodConfigurationRepository.LoadKeysCallback callback =
1100+
(TransferMethodConfigurationRepository.LoadKeysCallback) invocation.getArguments()[2];
1101+
callback.onKeysLoaded(mFeeAndProcessingTimeResult);
1102+
return callback;
1103+
}
1104+
}).when(mTransferMethodConfigurationRepository).getTransferMethodTypesFeeAndProcessingTime(anyString(), anyString(), any(
1105+
TransferMethodConfigurationRepository.LoadKeysCallback.class));
1106+
doAnswer(new Answer() {
1107+
@Override
1108+
public Object answer(InvocationOnMock invocation) {
1109+
UserRepository.LoadUserCallback userCallback =
1110+
(UserRepository.LoadUserCallback) invocation.getArguments()[0];
1111+
userCallback.onUserLoaded(user);
1112+
return userCallback;
1113+
}
1114+
}).when(mUserRepository).loadUser(any(
1115+
UserRepository.LoadUserCallback.class));
1116+
1117+
selectTransferMethodPresenter.loadTransferMethodConfigurationKeys(true, null, null);
1118+
1119+
// Canada is first country in successful_tmc_keys_response.json
1120+
verify(view).showTransferMethodCountry("CA");
1121+
verify(view).showTransferMethodCurrency("CAD");
1122+
verify(view).showTransferMethodTypes(ArgumentMatchers.<TransferMethodSelectionItem>anyList());
1123+
verify(view, never()).showErrorLoadTransferMethodConfigurationKeys(
1124+
ArgumentMatchers.<Error>anyList());
1125+
verify(view, never()).showErrorLoadCurrency(ArgumentMatchers.<Error>anyList());
1126+
verify(view, never()).showErrorLoadTransferMethodTypes(ArgumentMatchers.<Error>anyList());
1127+
verify(view, never()).showErrorLoadCountrySelection(ArgumentMatchers.<Error>anyList());
1128+
verify(view, never()).showErrorLoadCurrencySelection(ArgumentMatchers.<Error>anyList());
1129+
verify(view, never()).showAddTransferMethod(anyString(), anyString(), anyString(), anyString());
1130+
}
10761131
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"token": "usr-token-5",
3+
"status": "PRE_ACTIVATED",
4+
"createdOn": "2017-10-30T22:15:45",
5+
"clientUserId": "123456",
6+
"profileType": "INDIVIDUAL",
7+
"firstName": "Person",
8+
"lastName": "FromAlbania",
9+
"dateOfBirth": "1991-01-01",
10+
"email": "[email protected]",
11+
"addressLine1": "950 Granville",
12+
"city": "Gjirokaster",
13+
"stateProvince": "Gjirokaster",
14+
"country": "AL",
15+
"postalCode": "443001",
16+
"language": "en",
17+
"programToken": "prg-token-2",
18+
"links": [
19+
{
20+
"params": {
21+
"rel": "self"
22+
},
23+
"href": "https://localhost/rest/v3/users/usr-token-5"
24+
}
25+
]
26+
}

0 commit comments

Comments
 (0)