Fix paypal one-time donation handling.

This commit is contained in:
Alex Hart
2023-10-20 11:48:05 -03:00
committed by Cody Henthorne
parent 8c7556427a
commit 6295041341

View File

@@ -1154,7 +1154,6 @@ public class PushServiceSocket {
public PayPalConfirmPaymentIntentResponse confirmPayPalOneTimePaymentIntent(String currency, String amount, long level, String payerId, String paymentId, String paymentToken) throws IOException {
String payload = JsonUtil.toJson(new PayPalConfirmOneTimePaymentIntentPayload(amount, currency, level, payerId, paymentId, paymentToken));
Log.d(TAG, payload);
String result = makeServiceRequestWithoutAuthentication(CONFIRM_PAYPAL_ONE_TIME_PAYMENT_INTENT, "POST", payload, NO_HEADERS, new DonationResponseHandler());
return JsonUtil.fromJsonResponse(result, PayPalConfirmPaymentIntentResponse.class);
}
@@ -2664,6 +2663,10 @@ public class PushServiceSocket {
private static class DonationResponseHandler implements ResponseCodeHandler {
@Override
public void handle(int responseCode, ResponseBody body) throws NonSuccessfulResponseCodeException, PushNetworkException {
if (responseCode < 400) {
return;
}
if (responseCode == 440) {
try {
throw JsonUtil.fromJson(body.string(), DonationProcessorError.class);