× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello,



I have a java credit card valiation program that I wish to convert to rpg.
I've seen several posts on calling java methods and such, but can it be done
with the following code. If so, can someone provide some examples. I guess
the most confusing part is the "import" section.



Thanks.



import java.util.*;

import com.cybersource.ws.client.*;



public class CCAuthorization {



public static void main( String[] args ) {

Properties props = new Properties();

props.setProperty("merchantID","v2348705");


props.setProperty("keysDirectory","/QIBM/UserData/Java400/ext/keys");

props.setProperty("targetAPIVersion","1.2");

props.setProperty("sendToProduction","TRUE");

props.setProperty("enableLog","TRUE");

props.setProperty("logDirectory","/QIBM/UserData/Java400/ext/logs");

props.setProperty("logMaximumSize","100");



String requestID = runAuth( props, args );

}



public static String runAuth( Properties props, String[] args ) {



String requestID = null;

try {



HashMap request = new HashMap();



request.put( "ccAuthService_run", "true" );

request.put( "merchantReferenceCode", args[13] );

request.put( "billTo_firstName", args[0]);

request.put( "billTo_lastName", args[1]);

request.put( "billTo_street1", args[2]);

request.put( "billTo_city", args[3]);

request.put( "billTo_state", args[4]);

request.put( "billTo_postalCode", args[5]);

request.put( "billTo_country", args[6] );

request.put( "billTo_email", args[8] );

request.put( "billTo_phoneNumber", args[9] );

request.put( "card_accountNumber", args[10] );

request.put( "card_expirationMonth", args[11] );

request.put( "card_expirationYear", args[12] );

request.put( "purchaseTotals_currency","USD");

request.put( "item_0_unitPrice", args[14]);

request.put( "comments", args[15]);





HashMap reply = Client.runTransaction( request, props );



args[24] = (String) reply.get( "decision" );

args[25] = (String) reply.get( "reasonCode" );

args[26] = (String) reply.get( "requestID" );



if ("ACCEPT".equalsIgnoreCase( args[24]
))

{



args[28] = (String)
reply.get( "ccAuthReply_amount" );

args[29] = (String) reply.get( "ccAuthReply_authorizationCode");



requestID = (String)
reply.get( "requestID" );



request = new HashMap();



request.put(
"ccCaptureService_run", "true" );

request.put(
"merchantReferenceCode", args[13] );

request.put(
"ccCaptureService_authRequestID", requestID);

request.put(
"purchaseTotals_currency", "USD" );

request.put(
"item_0_unitPrice", args[14]);



reply =
Client.runTransaction( request, props );





} else {



args[28] = (String)
reply.get("ccAuthReply_avsCode" );

args[29] = (String)
reply.get("ccAuthReply_authFactorCode");



}



} catch (ClientException e) {

System.out.println( e.getMessage() );

} catch (FaultException e) {

System.out.println( e.getMessage() );

}





return( requestID );

}

}


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.