use of com.globalcollect.gateway.sdk.client.android.sdk.model.Region in project connect-sdk-client-android by Ingenico-ePayments.
the class BaseAsyncTaskTest method createMockConfiguration.
private void createMockConfiguration(SessionResponse response) {
String clientSessionId = response.getClientSessionId();
String customerId = response.getCustomerId();
Region region = Region.valueOf(response.getRegion());
String baseUrl = clientBaseUrl != null ? clientBaseUrl : GcUtil.getC2SBaseUrlByRegion(region, environmentType);
when(mockConfiguration.getClientSessionId()).thenReturn(clientSessionId);
when(mockConfiguration.getCustomerId()).thenReturn(customerId);
when(mockConfiguration.getRegion()).thenReturn(region);
when(mockConfiguration.getBaseUrl()).thenReturn(baseUrl);
when(mockConfiguration.getMetadata(mockContext)).thenReturn(null);
}
use of com.globalcollect.gateway.sdk.client.android.sdk.model.Region in project connect-sdk-client-android by Ingenico-ePayments.
the class BaseAsyncTaskTest method createInvalidMockConfiguration.
/**
* Create an invalid Uri that will return an http response code other than 200.
*/
private void createInvalidMockConfiguration() {
Region region = Region.EU;
String baseUrl = clientBaseUrl != null ? clientBaseUrl : GcUtil.getC2SBaseUrlByRegion(region, environmentType);
when(mockConfiguration.getClientSessionId()).thenReturn("Invalid");
when(mockConfiguration.getCustomerId()).thenReturn("Invalid");
when(mockConfiguration.getRegion()).thenReturn(region);
when(mockConfiguration.getBaseUrl()).thenReturn(baseUrl);
when(mockConfiguration.getMetadata(mockContext)).thenReturn(null);
}
use of com.globalcollect.gateway.sdk.client.android.sdk.model.Region in project connect-sdk-client-android by Ingenico-ePayments.
the class StartPageActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_startpage);
// Get all values for Region spinner
List<Region> spinnerArrayRegion = new ArrayList<Region>(EnumSet.allOf(Region.class));
// Make adapters of list and put it inside spinner
ArrayAdapter<Region> adapterRegion = new ArrayAdapter<Region>(this, android.R.layout.simple_spinner_item, spinnerArrayRegion);
adapterRegion.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Spinner spinnerRegion = (Spinner) findViewById(R.id.region);
spinnerRegion.setAdapter(adapterRegion);
// Get all values for Environment spinner
List<EnvironmentType> spinnerArrayEnvironment = new ArrayList<EnvironmentType>(EnumSet.allOf(EnvironmentType.class));
// Make adapters of list and put it inside spinner
ArrayAdapter<EnvironmentType> adapterEnvironment = new ArrayAdapter<EnvironmentType>(this, android.R.layout.simple_spinner_item, spinnerArrayEnvironment);
// adapterRegion.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Spinner spinnerEnvironment = (Spinner) findViewById(R.id.environment);
spinnerEnvironment.setAdapter(adapterEnvironment);
// Get all values for CountryCode spinner
List<CountryCode> spinnerArrayCountry = new ArrayList<CountryCode>(EnumSet.allOf(CountryCode.class));
Collections.sort(spinnerArrayCountry);
// Make adapters of list and put it inside spinner
ArrayAdapter<CountryCode> adapterCountry = new ArrayAdapter<CountryCode>(this, android.R.layout.simple_spinner_item, spinnerArrayCountry);
adapterCountry.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Spinner spinnerCountry = (Spinner) findViewById(R.id.country_code);
spinnerCountry.setAdapter(adapterCountry);
spinnerCountry.setSelection(adapterCountry.getPosition(CountryCode.US));
// Get all values for CurrencyCode spinner
List<CurrencyCode> spinnerArrayCurrency = new ArrayList<CurrencyCode>(EnumSet.allOf(CurrencyCode.class));
Collections.sort(spinnerArrayCurrency);
// Make adapters of list and put it inside spinner
ArrayAdapter<CurrencyCode> adapterCurrency = new ArrayAdapter<CurrencyCode>(this, android.R.layout.simple_spinner_item, spinnerArrayCurrency);
adapterCurrency.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Spinner spinnerCurrency = (Spinner) findViewById(R.id.currency_code);
spinnerCurrency.setAdapter(adapterCurrency);
spinnerCurrency.setSelection(adapterCurrency.getPosition(CurrencyCode.EUR));
}
Aggregations