Skip to content

Commit

Permalink
DTSERWTHRE-750 Tag/1.0.0 beta12 (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
vwagh-hw authored Aug 10, 2021
1 parent 5dbafff commit 35126da
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

[1.0.0-beta12](https://github.com/hyperwallet/hyperwallet-android-ui-sdk/releases/tag/1.0.0-beta12)
-------------------
* Bug fix

[1.0.0-beta11](https://github.com/hyperwallet/hyperwallet-android-ui-sdk/releases/tag/1.0.0-beta11)
-------------------
* Fixed currency formatting issues
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Note that this SDK is geared towards those who need both backend data and UI fea
To install Hyperwallet UI SDK, you just need to add the dependencies into your build.gradle file in Android Studio (or Gradle). For example:

```bash
api 'com.hyperwallet.android.ui:transfermethodui:1.0.0-beta11'
api 'com.hyperwallet.android.ui:receiptui:1.0.0-beta11'
api 'com.hyperwallet.android.ui:transferui:1.0.0-beta11'
api 'com.hyperwallet.android.ui:transfermethodui:1.0.0-beta12'
api 'com.hyperwallet.android.ui:receiptui:1.0.0-beta12'
api 'com.hyperwallet.android.ui:transferui:1.0.0-beta12'
```

### Proguard
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ allprojects {

}

project.version = "1.0.0-beta11"
project.version = "1.0.0-beta12"

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@

public class SelectTransferMethodPresenter implements SelectTransferMethodContract.Presenter {

private static final String DEFAULT_COUNTRY_CODE = "US";

private final TransferMethodConfigurationRepository mTransferMethodConfigurationRepository;
private final UserRepository mUserRepository;
private final SelectTransferMethodContract.View mView;
Expand Down Expand Up @@ -82,7 +80,7 @@ public void onKeysLoaded(@Nullable final HyperwalletTransferMethodConfigurationK
: key.getCountry(countryCode);

if (country == null) { // param and user country is null
country = key.getCountry(DEFAULT_COUNTRY_CODE);
country = key.getCountries().iterator().next();
}

String currencyCodeString = currencyCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.hyperwallet.android.ui.user.repository.UserRepositoryImpl;

import org.hamcrest.Matchers;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Before;
import org.junit.Rule;
Expand Down Expand Up @@ -1073,4 +1074,58 @@ public Object answer(InvocationOnMock invocation) {
selectTransferMethodPresenter.loadTransferMethodTypes(false, "CA", "CAD");
verify(view).showErrorLoadTransferMethodTypes(ArgumentMatchers.<Error>anyList());
}

@Test
public void loadTransferMethodConfigurationKeys_userWithCountryNotPresentInProgramCountries() throws JSONException {
// User's country is Albania which is not present in mResult successful_tmc_keys_response.json
String userResponseBody = externalResourceManager.getResourceContent("user_al_response.json");
final JSONObject userJsonObject = new JSONObject(userResponseBody);
final User user = new User(userJsonObject);

when(view.isActive()).thenReturn(true);
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) {
TransferMethodConfigurationRepository.LoadKeysCallback callback =
(TransferMethodConfigurationRepository.LoadKeysCallback) invocation.getArguments()[0];
callback.onKeysLoaded(mResult);
return callback;
}
}).when(mTransferMethodConfigurationRepository).getKeys(any(
TransferMethodConfigurationRepository.LoadKeysCallback.class));
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) {
TransferMethodConfigurationRepository.LoadKeysCallback callback =
(TransferMethodConfigurationRepository.LoadKeysCallback) invocation.getArguments()[2];
callback.onKeysLoaded(mFeeAndProcessingTimeResult);
return callback;
}
}).when(mTransferMethodConfigurationRepository).getTransferMethodTypesFeeAndProcessingTime(anyString(), anyString(), any(
TransferMethodConfigurationRepository.LoadKeysCallback.class));
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) {
UserRepository.LoadUserCallback userCallback =
(UserRepository.LoadUserCallback) invocation.getArguments()[0];
userCallback.onUserLoaded(user);
return userCallback;
}
}).when(mUserRepository).loadUser(any(
UserRepository.LoadUserCallback.class));

selectTransferMethodPresenter.loadTransferMethodConfigurationKeys(true, null, null);

// Canada is first country in successful_tmc_keys_response.json
verify(view).showTransferMethodCountry("CA");
verify(view).showTransferMethodCurrency("CAD");
verify(view).showTransferMethodTypes(ArgumentMatchers.<TransferMethodSelectionItem>anyList());
verify(view, never()).showErrorLoadTransferMethodConfigurationKeys(
ArgumentMatchers.<Error>anyList());
verify(view, never()).showErrorLoadCurrency(ArgumentMatchers.<Error>anyList());
verify(view, never()).showErrorLoadTransferMethodTypes(ArgumentMatchers.<Error>anyList());
verify(view, never()).showErrorLoadCountrySelection(ArgumentMatchers.<Error>anyList());
verify(view, never()).showErrorLoadCurrencySelection(ArgumentMatchers.<Error>anyList());
verify(view, never()).showAddTransferMethod(anyString(), anyString(), anyString(), anyString());
}
}
26 changes: 26 additions & 0 deletions transfermethodui/src/test/resources/user_al_response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"token": "usr-token-5",
"status": "PRE_ACTIVATED",
"createdOn": "2017-10-30T22:15:45",
"clientUserId": "123456",
"profileType": "INDIVIDUAL",
"firstName": "Person",
"lastName": "FromAlbania",
"dateOfBirth": "1991-01-01",
"email": "user+5satF1xV@hyperwallet.com",
"addressLine1": "950 Granville",
"city": "Gjirokaster",
"stateProvince": "Gjirokaster",
"country": "AL",
"postalCode": "443001",
"language": "en",
"programToken": "prg-token-2",
"links": [
{
"params": {
"rel": "self"
},
"href": "https://localhost/rest/v3/users/usr-token-5"
}
]
}

0 comments on commit 35126da

Please sign in to comment.