Search in sources :

Example 1 with Region

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);
}
Also used : Region(com.globalcollect.gateway.sdk.client.android.sdk.model.Region)

Example 2 with Region

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);
}
Also used : Region(com.globalcollect.gateway.sdk.client.android.sdk.model.Region)

Example 3 with Region

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));
}
Also used : Spinner(android.widget.Spinner) ArrayList(java.util.ArrayList) CurrencyCode(com.globalcollect.gateway.sdk.client.android.sdk.model.CurrencyCode) EnvironmentType(com.globalcollect.gateway.sdk.client.android.sdk.model.Environment.EnvironmentType) Region(com.globalcollect.gateway.sdk.client.android.sdk.model.Region) CountryCode(com.globalcollect.gateway.sdk.client.android.sdk.model.CountryCode) ArrayAdapter(android.widget.ArrayAdapter)

Aggregations

Region (com.globalcollect.gateway.sdk.client.android.sdk.model.Region)3 ArrayAdapter (android.widget.ArrayAdapter)1 Spinner (android.widget.Spinner)1 CountryCode (com.globalcollect.gateway.sdk.client.android.sdk.model.CountryCode)1 CurrencyCode (com.globalcollect.gateway.sdk.client.android.sdk.model.CurrencyCode)1 EnvironmentType (com.globalcollect.gateway.sdk.client.android.sdk.model.Environment.EnvironmentType)1 ArrayList (java.util.ArrayList)1