use of com.braintreepayments.api.models.Configuration in project braintree_android by braintree.
the class IdealUnitTest method fetchIssuingBanks_postsConfigurationExceptionWhenBraintreeApiNotEnabled.
@Test
public void fetchIssuingBanks_postsConfigurationExceptionWhenBraintreeApiNotEnabled() throws InvalidArgumentException, InterruptedException {
Configuration configuration = new TestConfigurationBuilder().ideal(new TestIdealConfigurationBuilder().routeId("some-route-id")).buildConfiguration();
BraintreeFragment fragment = getMockFragment(stringFromFixture("client_token.json"), configuration);
Ideal.fetchIssuingBanks(fragment, new BraintreeResponseListener<List<IdealBank>>() {
@Override
public void onResponse(List<IdealBank> idealBanks) {
fail("Success listener called");
}
});
ArgumentCaptor<Exception> captor = ArgumentCaptor.forClass(Exception.class);
verify(fragment).postCallback(captor.capture());
Exception e = captor.getValue();
assertEquals("Your access is restricted and cannot use this part of the Braintree API.", e.getMessage());
}
use of com.braintreepayments.api.models.Configuration in project braintree_android by braintree.
the class PayPalRequestUnitTest method getAuthorizationRequest_buildsWithLiveStageUrl.
@Test
public void getAuthorizationRequest_buildsWithLiveStageUrl() throws JSONException, InvalidArgumentException {
Configuration configuration = Configuration.fromJson(stringFromFixture("configuration/with_live_paypal.json"));
BraintreeFragment fragment = mMockFragmentBuilder.authorization(Authorization.fromString(TOKENIZATION_KEY)).configuration(configuration).build();
Request request = PayPal.getAuthorizationRequest(fragment);
assertEquals(EnvironmentManager.LIVE, request.getEnvironment());
}
use of com.braintreepayments.api.models.Configuration in project braintree_android by braintree.
the class PayPalRequestUnitTest method getBillingAgreementRequest_buildsWithCustomStageUrl.
@Test
public void getBillingAgreementRequest_buildsWithCustomStageUrl() throws JSONException {
Configuration configuration = Configuration.fromJson(stringFromFixture("configuration/with_custom_paypal.json"));
BraintreeFragment fragment = mMockFragmentBuilder.configuration(configuration).build();
Request request = PayPal.getBillingAgreementRequest(fragment, null);
assertEquals("custom", request.getEnvironment());
}
use of com.braintreepayments.api.models.Configuration in project braintree_android by braintree.
the class PayPalRequestUnitTest method getCheckoutRequest_buildsWithLiveStageUrl.
@Test
public void getCheckoutRequest_buildsWithLiveStageUrl() throws JSONException {
Configuration configuration = Configuration.fromJson(stringFromFixture("configuration/with_live_paypal.json"));
BraintreeFragment fragment = mMockFragmentBuilder.configuration(configuration).build();
Request request = PayPal.getCheckoutRequest(fragment, null);
assertEquals(EnvironmentManager.LIVE, request.getEnvironment());
}
use of com.braintreepayments.api.models.Configuration in project braintree_android by braintree.
the class PayPalRequestUnitTest method getCheckoutRequest_buildsWithOfflineStageUrl.
@Test
public void getCheckoutRequest_buildsWithOfflineStageUrl() throws JSONException {
Configuration configuration = Configuration.fromJson(stringFromFixture("configuration/with_offline_paypal.json"));
BraintreeFragment fragment = mMockFragmentBuilder.configuration(configuration).build();
Request request = PayPal.getCheckoutRequest(fragment, null);
assertEquals(EnvironmentManager.MOCK, request.getEnvironment());
}
Aggregations