use of com.paypal.android.sdk.onetouch.core.exception.ResponseParsingException in project braintree_android by braintree.
the class AuthorizationRequestUnitTest method parseBrowserSwitchResponse_returnsErrorWhenNoEncryptionKeyInPreferences.
@Test
public void parseBrowserSwitchResponse_returnsErrorWhenNoEncryptionKeyInPreferences() {
Uri uri = Uri.parse("com.braintreepayments.demo.braintree://onetouch/v1/success?payload=eyJtc2dfR1VJRCI6Im1zZ19HVUlEIn0=&payloadEnc=encrypteddata");
when(mContextInspector.getStringPreference("com.paypal.otc.msg_guid")).thenReturn("msg_GUID");
when(mContextInspector.getStringPreference("com.paypal.otc.key")).thenReturn("");
Result result = mRequest.parseBrowserResponse(mContextInspector, uri);
assertEquals(ResultType.Error, result.getResultType());
assertTrue(result.getError() instanceof ResponseParsingException);
assertEquals("Response invalid", result.getError().getMessage());
}
use of com.paypal.android.sdk.onetouch.core.exception.ResponseParsingException in project braintree_android by braintree.
the class AuthorizationRequestUnitTest method parseBrowserSwitchResponse_returnsErrorForInvalidJsonPayload.
@Test
public void parseBrowserSwitchResponse_returnsErrorForInvalidJsonPayload() {
Uri uri = Uri.parse("com.braintreepayments.demo.braintree://onetouch/v1/success?payload=amFhZmpmamY=");
Result result = mRequest.parseBrowserResponse(mContextInspector, uri);
assertEquals(ResultType.Error, result.getResultType());
assertTrue(result.getError() instanceof ResponseParsingException);
assertEquals("Response incomplete", result.getError().getMessage());
}
use of com.paypal.android.sdk.onetouch.core.exception.ResponseParsingException in project braintree_android by braintree.
the class AuthorizationRequestUnitTest method parseBrowserSwitchResponse_returnsErrorForMissingPayloadEnc.
@Test
public void parseBrowserSwitchResponse_returnsErrorForMissingPayloadEnc() {
Uri uri = Uri.parse("com.braintreepayments.demo.braintree://onetouch/v1/success?payload=eyJtc2dfR1VJRCI6Im1zZ19HVUlEIn0=");
Result result = mRequest.parseBrowserResponse(mContextInspector, uri);
assertEquals(ResultType.Error, result.getResultType());
assertTrue(result.getError() instanceof ResponseParsingException);
assertEquals("Response invalid", result.getError().getMessage());
}
use of com.paypal.android.sdk.onetouch.core.exception.ResponseParsingException in project braintree_android by braintree.
the class AuthorizationRequestUnitTest method parseBrowserSwitchResponse_returnsErrorForInvalidBase64PayloadInSuccessResponse.
@Test
public void parseBrowserSwitchResponse_returnsErrorForInvalidBase64PayloadInSuccessResponse() {
Uri uri = Uri.parse("com.braintreepayments.demo.braintree://onetouch/v1/success?payload=afjfi");
Result result = mRequest.parseBrowserResponse(mContextInspector, uri);
assertEquals(ResultType.Error, result.getResultType());
assertTrue(result.getError() instanceof ResponseParsingException);
assertEquals("Response incomplete", result.getError().getMessage());
}
use of com.paypal.android.sdk.onetouch.core.exception.ResponseParsingException in project braintree_android by braintree.
the class AuthorizationRequestUnitTest method parseBrowserSwitchResponse_returnsErrorWhenNoMsgGUIDInPreferences.
@Test
public void parseBrowserSwitchResponse_returnsErrorWhenNoMsgGUIDInPreferences() {
Uri uri = Uri.parse("com.braintreepayments.demo.braintree://onetouch/v1/success?payload=eyJtc2dfR1VJRCI6Im1zZ19HVUlEIn0=&payloadEnc=encrypteddata");
when(mContextInspector.getStringPreference("com.paypal.otc.msg_guid")).thenReturn("");
when(mContextInspector.getStringPreference("com.paypal.otc.key")).thenReturn("key");
Result result = mRequest.parseBrowserResponse(mContextInspector, uri);
assertEquals(ResultType.Error, result.getResultType());
assertTrue(result.getError() instanceof ResponseParsingException);
assertEquals("Response invalid", result.getError().getMessage());
}
Aggregations