### Question:
PaypalService { public PaypalResponse completePayment(PaperightCreditTransaction transaction, String token, String payerId) { Profile user = new BaseProfile.Builder(apiUser, apiPassword).signature(apiSignature).build(); Environment environment; if (sandbox) { environment = Environment.SANDBOX; } else { environment = Environment.LIVE; } PayPal payPal = new PayPal(user, environment); PaymentItem item = new PaymentItem(); item.setAmount("" + paperightCreditService.paperightCreditsInBaseCurrency(transaction.getNumberOfCredits())); item.setDescription(transaction.getNumberOfCredits().setScale(0) + " Paperight Credits"); PaymentItem[] items = {item}; Payment payment = new Payment(items); payment.setCurrency(Currency.USD); DoExpressCheckoutPayment doExpressCheckoutPayment = new DoExpressCheckoutPayment(payment, token, PaymentAction.SALE, payerId); payPal.setResponse(doExpressCheckoutPayment); PaypalResponse paypalResponse = new PaypalResponse(); paypalResponse.setRequest(doExpressCheckoutPayment); paypalResponse.setPayPal(payPal); paypalResponse.setResponse(doExpressCheckoutPayment.getNVPResponse()); return paypalResponse; }  PaypalResponse initiatePayment(PaperightCreditTransaction transaction, String returnUrl, String cancelUrl); PaypalResponse completePayment(PaperightCreditTransaction transaction, String token, String payerId);  }### Answer:
@Test public final void testCompletePayment() { PaperightCreditTransaction transaction = new PaperightCreditTransaction(); transaction.setNumberOfCredits(new BigDecimal(123).setScale(0)); PaypalResponse response = paypalService.completePayment(transaction, "EC-786270384N085350D", "ZHTTV47G8KZ8Y"); if (response.isSuccessful()) { System.out.println("Token: " + response.getToken()); System.out.println("Redirect Url: " + response.getRedirectUrl()); System.out.println("Response Map: " + response.getResponse()); } Assert.assertTrue(response.isSuccessful()); }