braintree / braintree_java

Braintree Java library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
158 stars 99 forks source link

Get CVV from object CreditCard #12

Closed prayagupa closed 11 years ago

prayagupa commented 11 years ago

After CreditCardRequest is processed successfully for a customerId with CVV, cardHolderName, number etc, I want CreditCard to provide CVV, number later. How can I achieve that, so that I can make a TransactionRequest with already added CreditCard?

Snippet of my code is :

def defaultCreditCard =  getDefaultCreditCard(merchant)
TransactionRequest encourageTransaction = new TransactionRequest()
                                                   .amount(invoiceToEncourage.subtotal)
                                                   .creditCard()
                                                   .number("4111111111111111") //get it from default CreditCard
                                                   .cvv("111") //get it from default CreditCard
                                                   .expirationMonth(defaultCreditCard.getExpirationMonth())
                                                   .expirationYear(defaultCreditCard.getExpirationYear())
                                                   .done()
         Result<Transaction> result = gateway.transaction().sale(encourageTransaction);
prayagupa commented 11 years ago

Well, Creating Transactions from the Vault has the answer for my question.

          TransactionRequest encourageTransaction = new TransactionRequest()
                                                   .customerId(defaultCreditCard.customerId)
                                                   .amount(invoiceToEncourage.subtotal)