public ApiResponse braintreeWrapperCardCreate( String userPk, String holdrName, String cardNumber, String cardCvv, String cardExpirationMonth, String cardExpirationYear) { Braintree bt = new Braintree(Office.getBraintreeEncryptionKey()); ApiRequest req = new ApiRequest( Office.getBraintreeWrapperUrl(), TDApplication.getSessionManager().getAccessToken()); req.addGetParam("cmd", "card-create"); req.addGetParam("version", BRAINTREE_WRAPPER_MIN_VERSION); req.addPostParam("customer_pk", userPk); req.addPostParam("card_holder_name", holdrName); req.addPostParam("card_number", bt.encrypt(cardNumber)); req.addPostParam("card_expiration_month", bt.encrypt(String.valueOf(cardExpirationMonth))); req.addPostParam("card_expiration_year", bt.encrypt(String.valueOf(cardExpirationYear))); if (cardCvv != null) { req.addPostParam("card_cvv", bt.encrypt(cardCvv)); } return doPostRequest(req); }
public ApiResponse braintreeWrapperCardList(String userPk) { ApiRequest req = new ApiRequest( Office.getBraintreeWrapperUrl(), TDApplication.getSessionManager().getAccessToken()); req.addGetParam("cmd", "card-list"); req.addGetParam("version", BRAINTREE_WRAPPER_MIN_VERSION); req.addPostParam("customer_pk", userPk); return doPostRequest(req); }
public ApiResponse braintreeWrapperCardDelete(String cardToken) { ApiRequest req = new ApiRequest( Office.getBraintreeWrapperUrl(), TDApplication.getSessionManager().getAccessToken()); req.addGetParam("cmd", "card-delete"); req.addGetParam("version", BRAINTREE_WRAPPER_MIN_VERSION); req.addPostParam("card_token", cardToken); return doPostRequest(req); }
public ApiResponse braintreeWrapperTransactionCreate(BookingData booking, CardData card) { ApiRequest req = new ApiRequest( Office.getBraintreeWrapperUrl(), TDApplication.getSessionManager().getAccessToken()); req.addGetParam("cmd", "transaction-create"); req.addGetParam("version", BRAINTREE_WRAPPER_MIN_VERSION); req.addPostParam("booking_pk", booking.getPk()); req.addPostParam("booking_key", booking.getBookingKey()); req.addPostParam("card_token", card.getToken()); req.addPostParam("amount", booking.getTotalCostValue()); return doPostRequest(req); }