Skip to content

Commit

Permalink
Rename callback
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahkoop committed Dec 14, 2023
1 parent b1ee900 commit b60d775
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ public void createPaymentAuthRequest(@NonNull final SEPADirectDebitRequest sepaD
try {
SEPADirectDebitPaymentAuthRequestParams params =
new SEPADirectDebitPaymentAuthRequestParams(buildBrowserSwitchOptions(result));
callback.onResult(new SEPADirectDebitPaymentAuthRequest.ReadyToLaunch(params));
callback.onSEPADirectDebitPaymentAuthRequest(new SEPADirectDebitPaymentAuthRequest.ReadyToLaunch(params));
} catch (JSONException exception) {
braintreeClient.sendAnalyticsEvent(
"sepa-direct-debit.browser-switch.failure");
callback.onResult(new SEPADirectDebitPaymentAuthRequest.Failure(exception));
callback.onSEPADirectDebitPaymentAuthRequest(new SEPADirectDebitPaymentAuthRequest.Failure(exception));
}
} else if (result.getApprovalUrl().equals("null")) {
braintreeClient.sendAnalyticsEvent(
Expand All @@ -87,22 +87,22 @@ public void createPaymentAuthRequest(@NonNull final SEPADirectDebitRequest sepaD
if (sepaDirectDebitNonce != null) {
braintreeClient.sendAnalyticsEvent(
"sepa-direct-debit.tokenize.success");
callback.onResult(new SEPADirectDebitPaymentAuthRequest.LaunchNotRequired(sepaDirectDebitNonce));
callback.onSEPADirectDebitPaymentAuthRequest(new SEPADirectDebitPaymentAuthRequest.LaunchNotRequired(sepaDirectDebitNonce));
} else if (tokenizeError != null) {
braintreeClient.sendAnalyticsEvent(
"sepa-direct-debit.tokenize.failure");
callback.onResult(new SEPADirectDebitPaymentAuthRequest.Failure(tokenizeError));
callback.onSEPADirectDebitPaymentAuthRequest(new SEPADirectDebitPaymentAuthRequest.Failure(tokenizeError));
}
});
} else {
braintreeClient.sendAnalyticsEvent(
"sepa-direct-debit.create-mandate.failure");
callback.onResult(new SEPADirectDebitPaymentAuthRequest.Failure(new BraintreeException("An unexpected error occurred.")));
callback.onSEPADirectDebitPaymentAuthRequest(new SEPADirectDebitPaymentAuthRequest.Failure(new BraintreeException("An unexpected error occurred.")));
}
} else if (createMandateError != null) {
braintreeClient.sendAnalyticsEvent(
"sepa-direct-debit.create-mandate.failure");
callback.onResult(new SEPADirectDebitPaymentAuthRequest.Failure(createMandateError));
callback.onSEPADirectDebitPaymentAuthRequest(new SEPADirectDebitPaymentAuthRequest.Failure(createMandateError));
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ fun interface SEPADirectDebitPaymentAuthRequestCallback {
* must trigger the web-based mandate flow via
* [SEPADirectDebitLauncher.launch]
*/
fun onResult(paymentAuthRequest: SEPADirectDebitPaymentAuthRequest)
fun onSEPADirectDebitPaymentAuthRequest(paymentAuthRequest: SEPADirectDebitPaymentAuthRequest)
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void tokenize_onCreateMandateRequestSuccess_callsBackSEPAResponse_andSend

ArgumentCaptor<SEPADirectDebitPaymentAuthRequest> captor =
ArgumentCaptor.forClass(SEPADirectDebitPaymentAuthRequest.class);
verify(paymentAuthRequestCallback).onResult(captor.capture());
verify(paymentAuthRequestCallback).onSEPADirectDebitPaymentAuthRequest(captor.capture());

SEPADirectDebitPaymentAuthRequest paymentAuthRequest = captor.getValue();
assertTrue(paymentAuthRequest instanceof SEPADirectDebitPaymentAuthRequest.ReadyToLaunch);
Expand Down Expand Up @@ -114,7 +114,7 @@ public void tokenize_onCreateMandateRequestSuccess_whenMandateAlreadyApproved_on

ArgumentCaptor<SEPADirectDebitPaymentAuthRequest> captor = ArgumentCaptor.forClass(
SEPADirectDebitPaymentAuthRequest.class);
verify(paymentAuthRequestCallback).onResult(captor.capture());
verify(paymentAuthRequestCallback).onSEPADirectDebitPaymentAuthRequest(captor.capture());

SEPADirectDebitPaymentAuthRequest paymentAuthRequest = captor.getValue();
assertTrue(paymentAuthRequest instanceof SEPADirectDebitPaymentAuthRequest.LaunchNotRequired);
Expand Down Expand Up @@ -142,7 +142,7 @@ public void createPaymentAuthRequest_onCreateMandateRequestSuccess_whenApprovalU
sut.createPaymentAuthRequest(sepaDirectDebitRequest, paymentAuthRequestCallback);

ArgumentCaptor<SEPADirectDebitPaymentAuthRequest> captor = ArgumentCaptor.forClass(SEPADirectDebitPaymentAuthRequest.class);
verify(paymentAuthRequestCallback).onResult(captor.capture());
verify(paymentAuthRequestCallback).onSEPADirectDebitPaymentAuthRequest(captor.capture());

SEPADirectDebitPaymentAuthRequest paymentAuthRequest = captor.getValue();
assertTrue(paymentAuthRequest instanceof SEPADirectDebitPaymentAuthRequest.Failure);
Expand Down Expand Up @@ -192,7 +192,7 @@ public void tokenize_onCreateMandateError_returnsErrorToListener_andSendsAnalyti

sut.createPaymentAuthRequest(sepaDirectDebitRequest, paymentAuthRequestCallback);
ArgumentCaptor<SEPADirectDebitPaymentAuthRequest> captor = ArgumentCaptor.forClass(SEPADirectDebitPaymentAuthRequest.class);
verify(paymentAuthRequestCallback).onResult(captor.capture());
verify(paymentAuthRequestCallback).onSEPADirectDebitPaymentAuthRequest(captor.capture());

SEPADirectDebitPaymentAuthRequest paymentAuthRequest = captor.getValue();
assertTrue(paymentAuthRequest instanceof SEPADirectDebitPaymentAuthRequest.Failure);
Expand Down

0 comments on commit b60d775

Please sign in to comment.