use of com.braintreepayments.api.models.Configuration in project braintree_android by braintree.
the class PayPalRequestUnitTest method getBillingAgreementRequest_buildsWithOfflineStageUrl.
@Test
public void getBillingAgreementRequest_buildsWithOfflineStageUrl() throws JSONException {
Configuration configuration = Configuration.fromJson(stringFromFixture("configuration/with_offline_paypal.json"));
BraintreeFragment fragment = mMockFragmentBuilder.configuration(configuration).build();
Request request = PayPal.getBillingAgreementRequest(fragment, null);
assertEquals(EnvironmentManager.MOCK, request.getEnvironment());
}
use of com.braintreepayments.api.models.Configuration in project braintree_android by braintree.
the class PayPalRequestUnitTest method getCheckoutRequest_containsCorrectValues.
@Test
public void getCheckoutRequest_containsCorrectValues() throws JSONException {
Configuration configuration = Configuration.fromJson(stringFromFixture("configuration/with_offline_paypal.json"));
BraintreeFragment fragment = mMockFragmentBuilder.configuration(configuration).build();
CheckoutRequest request = PayPal.getCheckoutRequest(fragment, "https://paypal.com/?token=pairingId");
assertEquals(EnvironmentManager.MOCK, request.getEnvironment());
assertEquals("com.braintreepayments.api.braintree://onetouch/v1/cancel", request.getCancelUrl());
assertEquals("com.braintreepayments.api.braintree://onetouch/v1/success", request.getSuccessUrl());
assertEquals("paypal_client_id", request.getClientId());
assertEquals("pairingId", request.getPairingId());
}
use of com.braintreepayments.api.models.Configuration in project braintree_android by braintree.
the class PayPalRequestUnitTest method getAuthorizationRequest_buildsWithCustomStageUrl.
@Test
public void getAuthorizationRequest_buildsWithCustomStageUrl() throws JSONException, InvalidArgumentException {
Configuration configuration = Configuration.fromJson(stringFromFixture("configuration/with_custom_paypal.json"));
BraintreeFragment fragment = mMockFragmentBuilder.authorization(Authorization.fromString(TOKENIZATION_KEY)).configuration(configuration).build();
Request request = PayPal.getAuthorizationRequest(fragment);
assertEquals("custom", request.getEnvironment());
}
use of com.braintreepayments.api.models.Configuration in project braintree_android by braintree.
the class PayPalRequestUnitTest method getBillingAgreement_containsCorrectValues.
@Test
public void getBillingAgreement_containsCorrectValues() throws JSONException {
Configuration configuration = Configuration.fromJson(stringFromFixture("configuration/with_offline_paypal.json"));
BraintreeFragment fragment = mMockFragmentBuilder.configuration(configuration).build();
BillingAgreementRequest request = PayPal.getBillingAgreementRequest(fragment, "https://paypal.com/?ba_token=pairingId");
assertEquals(EnvironmentManager.MOCK, request.getEnvironment());
assertEquals("com.braintreepayments.api.braintree://onetouch/v1/cancel", request.getCancelUrl());
assertEquals("com.braintreepayments.api.braintree://onetouch/v1/success", request.getSuccessUrl());
assertEquals("paypal_client_id", request.getClientId());
assertEquals("pairingId", request.getPairingId());
}
use of com.braintreepayments.api.models.Configuration in project braintree_android by braintree.
the class VenmoUnitTest method performAppSwitch_persistsIfVaultTrue.
@Test
public void performAppSwitch_persistsIfVaultTrue() throws InvalidArgumentException {
Configuration configuration = getConfigurationFromFixture();
Authorization clientToken = Authorization.fromString(stringFromFixture("base_64_client_token.txt"));
disableSignatureVerification();
BraintreeFragment fragment = new MockFragmentBuilder().context(VenmoInstalledContextFactory.venmoInstalledContext(true, RuntimeEnvironment.application)).configuration(configuration).authorization(clientToken).build();
Venmo.authorizeAccount(fragment, true);
SharedPreferences prefs = SharedPreferencesHelper.getSharedPreferences(fragment.getApplicationContext());
assertTrue(prefs.getBoolean("com.braintreepayments.api.Venmo.VAULT_VENMO_KEY", false));
}
Aggregations