Created
March 20, 2012 18:34
-
-
Save VantivSDK/2139404 to your computer and use it in GitHub Desktop.
Java SDK - Litle Payment full lifecycle example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.litle.sdk.*; | |
import com.litle.sdk.generate.*; | |
//Full Lifecycle | |
public class FullLifecycleExample { | |
public static void main(String[] args) { | |
LitleOnline litle = new LitleOnline(); | |
Authorization auth = new Authorization(); | |
auth.setOrderId("1"); | |
auth.amount(10010L); | |
auth.setOrderSource(OrderSourceType.ECOMMERCE); | |
Contact billToAddress = new Contact(); | |
billToAddress.setName("John Smith"); | |
billToAddress.setAddressLine1("1 Main St."); | |
billToAddress.setCity("Burlington"); | |
billToAddress.setState("MA"); | |
billToAddress.setCountry(CountryTypeEnum.US); | |
billToAddress.setZip("01803-3747"); | |
auth.setBillToAddress(billToAddress); | |
CardType card = new CardType(); | |
card.setNumber("375001010000003"); | |
card.setExpDate("0112"); | |
card.setCardValidationNum("349"); | |
card.setType(MethodOfPaymentTypeEnum.AX); | |
auth.setCard(card); | |
AuthorizationResponse authResponse = litle.authorize(authorization); | |
System.out.println("Response: " + authResponse.getResponse()); | |
System.out.println("Message: " + authResponse.getMessage()); | |
System.out.println("Litle Transaction ID: " + authResponse.getLitleTxnId()); | |
Capture capture = new Capture(); | |
capture.setLitleTxnId(authResponse.getLitleTxnId()); | |
CaptureResponse captureResponse = litle.capture(capture); //Capture the Auth | |
System.out.println("Response: " + captureResponse.getResponse()); | |
System.out.println("Message: " + captureResponse.getMessage()); | |
System.out.println("Litle Transaction ID: " + captureResponse.getLitleTxnId()); | |
Credit credit = new Credit(); | |
capture.setLitleTxnId(captureResponse.getLitleTxnId()); | |
CreditResponse creditResponse = litle.credit(credit); //Refund the capture | |
System.out.println("Response: " + creditResponse.getResponse()); | |
System.out.println("Message: " + creditResponse.getMessage()); | |
System.out.println("Litle Transaction ID: " + creditResponse.getLitleTxnId()); | |
//TODO - Fix the void here | |
Void credit = new Credit(); | |
capture.setLitleTxnId(captureResponse.getLitleTxnId()); | |
CreditResponse creditResponse = litle.credit(credit); //Refund the capture | |
System.out.println("Response: " + creditResponse.getResponse()); | |
System.out.println("Message: " + creditResponse.getMessage()); | |
System.out.println("Litle Transaction ID: " + creditResponse.getLitleTxnId()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment