Skip to content

Instantly share code, notes, and snippets.

@philmadden83
Last active September 23, 2016 18:56
Show Gist options
  • Save philmadden83/c4aed9813cd1f2095f13122b7db86513 to your computer and use it in GitHub Desktop.
Save philmadden83/c4aed9813cd1f2095f13122b7db86513 to your computer and use it in GitHub Desktop.
@POST
@Path("/paymentmethods")
public Response (String paymentNonce, String email) throws RequestException {
Account account = userService.getAccount(email);
PaymentAccount paymentAccount = paymentService.verifyPaymentMethod(request);
return Response.ok(paymentAccount.getExternalId()).build;
}
public PaymentAccount storeCreditCard(String paymentNonce, Account account) throws ClientException {
try{
PaymentAccount paymentAccount = paymentProcessingService.storePaymentAccount(request.getPaymentNonce(), account, false, true );
creditCardService.insertOrUpdateLastUsedStickyCreditCard(paymentAccount.getCreditCard());
return paymentAccount;
} catch(PaymentProcessingException ppx){
throw new ClientException((ErrorCode.PAYMENT_ACCOUNT_VALIDATION_PROBLEM, ppx.getErrorMessages()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment