JavaDeveloper Tutorial - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

JavaDeveloper Tutorial

Description:

Log Transaction Info for Later Processing Message Customer that they will ... Java Doc. Sample Code in test directory. Partner Extranet Message Board ... – PowerPoint PPT presentation

Number of Views:45
Avg rating:3.0/5.0
Slides: 17
Provided by: cybers7
Category:

less

Transcript and Presenter's Notes

Title: JavaDeveloper Tutorial


1
Java Developer Tutorial
2
CyberSource Component for JAVA
  • Access all CyberSource Services
  • 100 Pure Java
  • Supports Multi Threaded Applications
  • Available for Java 1.1.7 and Java 1.2.x
  • Packaged for Unix and NT

3
Getting Started
  • Register - www.cybersource.com/register
  • Download Java CDK ICS2 Developers Guide -
    www.cybersource.com/support
  • Extract zip or jar file
  • Run Ecert - java Ecert ltmerchant IDgt
  • Edit Test Program
  • Compile and Run Test

4
Simple Web Order Form Requirements
  • Collect Customer Payment Info
  • Format CyberSource Request
  • Transmit Request
  • Process Response
  • Message Customer
  • Record Response

5
Transaction Flow Diagram
Customer Browser
Merchant Server
Payment Processor
Cybersource
Billing Info
ics_auth
Auth Req
auth_rflag
Customer Message
Auth
6
Application Diagram
Display Payment Info Form to Customer
Customer Approves Transaction
Card Declined. Ask Customer for another Credit
Card
rcode 0
Transaction Declined?
rcode 1, -1
rcode -1
Processing Error?
Log Transaction Info for Later Processing Message
Customer that they will Receive Final
Conformation via Email
rcode 1
Continue Processing Order
7
Customer Order Form
8
Create Connection Object
public void createICSClient() // create ICS
client object try client
new ICSClient("ICS2Test",certDir
"ICS2Test.pvt", certDir
"ICS2Test.crt","CyberSource_SJC_US",
certDir "CyberSource_SJC_US.crt", new
URL("http//ics2test.ic3.com"))
catch(Exception e)
System.out.println("ICS connect Error " e)

9
Create Order Offer Object
offer new ICSClientOffer() // create offer
object //add Line Item public void
addLineItem(String ProductName,String
ProductCode, String ProductSKU,double
Amount,int Quantity,String PackerCode)
offer.setProductName(ProductName)
offer.setProductCode(ProductCode)
offer.setMerchantProductSKU(ProductSKU)
offer.setAmount(Amount) offer.setQuantity(Q
uantity) offer.setPackerCode(PackerCode)

10
Create Request Object
private ICSClientRequest icsRequest
icsRequest.addApplication(ICSServiceName) //
request a service(s) icsRequest.setMerchantR
efNo(merchantRefNo) icsRequest.setMerchantI
D(merchantID) icsRequest.setCustomerFirstNa
me(firstName) icsRequest.setCustomerLastNam
e(lastName) icsRequest.setCustomerEmailAddr
ess(email) icsRequest.setCustomerPhone(phon
e) icsRequest.setBillAddress1(shipAddr1)
icsRequest.setBillCity(city)
icsRequest.setBillState(state)
icsRequest.setBillZip(zip)
icsRequest.setBillCountry(country)
icsRequest.setCustomerCreditCardNumber(cardNum)
icsRequest.setCustomerCreditCardExpirationMon
th(cardExpMonth) icsRequest.setCustomerCred
itCardExpirationYear(cardExpYear)
icsRequest.setCurrency(currency)
11
Send Request and Receive Response
public int processICSTrans(ICSClientRequest
icsRequest) returnCode 0
try reply
client.send(icsRequest) returnCode
reply.getReplyCode()
catch(Exception e) System.out.println(e
) return returnCode
12
Process Record Response
returnCode processICSTrans(icsReques
t) // proccess ICS request
if(returnCode 1 ) // check if request
accepted // Accepted
writeAcceptedMessage(response)
writeLogFile(logDir "accepted.log",
reply.toString()) // write reply to log
else ...

13
Handle Decline and Error Messages
else
if(returnCode 0 ) // check if request
declined
// Declined
writeDeclinedMessage(response)
writeLogFile(logDir "declined.log",
reply.toString()) // write reply to log
else // rcode -1
// A Processing
Error Occured - Log for Later Attempt
writeAcceptedMessage(response)
writeLogFile(logDir "proc_error.log",
reply.toString()) // write reply to log

14
Additional Application Considerations
  • Add a Shopping Cart
  • Calling Fraud, Tax, DAV if needed
  • Semi Real-Time Authorization option
  • Error Handling - Alerts, Logs
  • Database Integration

15
Cybersource Java API - Tips
  • ICSClentRequest Class convenience methods i.e.
    getReplyCode()
  • ICSMessage Class methods
  • ICSMessage.setField(String, String)
  • ICSMessage.getField(String)

16
Cybersource Java API - more info
  • ICS Dev Guide - Appendix J
  • Java Doc
  • Sample Code in test directory
  • Partner Extranet Message Board
Write a Comment
User Comments (0)
About PowerShow.com