Closed

OpenBravo POS Credit Card Tip Out added to software

This project involves providing a solution to a software feature that needs to added in order for the tip amount to be calculated and than finalize the transaction.

The issue is the software does not allow for an authorization first, and capture transid.

The receipt is than closed.

If you can understand this please respond.

Ryan

Here is the listed Java for the [url removed, login to view]:

/**

* <p>Title: AIM Java Version 1.4.1_02-b06</p>

* <p>Description: Advanced Integration Method</p>

* <p>Copyright: Copyright (c) 2003</p>

* <p>Company: Authorize.Net</p>

* @author [url removed, login to view]

* @version 3.1

*/

/**

* Based on sample code and snipptes provided by:

* Patrick Phelan,

* Roedy Green, Canadian Mind Products

*/

// Modifications by Adrian Romero & Mikel Irurita

package [url removed, login to view];

import [url removed, login to view];

import java.io.*;

import java.net.*;

import [url removed, login to view];

import [url removed, login to view];

import com.openbravo.pos.forms.*;

import [url removed, login to view];

import [url removed, login to view];

import [url removed, login to view];

import [url removed, login to view];

import [url removed, login to view];

import [url removed, login to view];

import [url removed, login to view];

import [url removed, login to view];

public class PaymentGatewayAuthorizeNet implements PaymentGateway {

private static String ENDPOINTADDRESS;

private static final String OPERATIONVALIDATE = "AUTH_CAPTURE";

private static final String OPERATIONREFUND = "CREDIT";

private static final String APPROVED = "1";

private String m_sCommerceID;

private String m_sCommercePassword;

private boolean m_bTestMode;

/** Creates a new instance of PaymentGatewayAuthorizeNet */

public PaymentGatewayAuthorizeNet(AppProperties props) {

// Grab some configuration variables

m_sCommerceID = [url removed, login to view]("payment.commerceid");

AltEncrypter cypher = new AltEncrypter("cypherkey" + [url removed, login to view]("payment.commerceid"));

this.m_sCommercePassword = [url removed, login to view]([url removed, login to view]("payment.commercepassword").substring(6));

m_bTestMode = [url removed, login to view]([url removed, login to view]("payment.testmode")).booleanValue();

ENDPOINTADDRESS = (m_bTestMode)

? "https://test.authorize.net/gateway/transact.dll"

: "https://cardpresent.authorize.net/gateway/transact.dll";

}

public PaymentGatewayAuthorizeNet() {

}

@Override

public void execute(PaymentInfoMagcard payinfo) {

StringBuffer sb = new StringBuffer();

try {

//test -> login:44CWBFp7wh9 / pass:43P7s8qb84CVT9Jx

[url removed, login to view]("x_cpversion=1.0");

[url removed, login to view]("&x_market_type=2");

[url removed, login to view]("&x_device_type=1");

[url removed, login to view]("&x_login=");

[url removed, login to view]([url removed, login to view](m_sCommerceID, "UTF-8"));

[url removed, login to view]("&x_tran_key=");

[url removed, login to view]([url removed, login to view](m_sCommercePassword, "UTF-8"));

[url removed, login to view]("&x_amount=");

NumberFormat formatter = new DecimalFormat("0000.00");

String amount = [url removed, login to view]([url removed, login to view]([url removed, login to view]()));

[url removed, login to view]([url removed, login to view]([url removed, login to view](',', '.'), "UTF-8"));

if ([url removed, login to view](true) == null) {

[url removed, login to view]("&x_card_num=");

[url removed, login to view]([url removed, login to view]([url removed, login to view](), "UTF-8"));

[url removed, login to view]("&x_exp_date=");

String tmp = [url removed, login to view]();

[url removed, login to view]([url removed, login to view](tmp, "UTF-8"));

String[] cc_name = [url removed, login to view]().split(" ");

[url removed, login to view]("&x_first_name=");

if ([url removed, login to view] > 0) {

[url removed, login to view]([url removed, login to view](cc_name[0], "UTF-8"));

}

[url removed, login to view]("&x_last_name=");

if ([url removed, login to view] > 1) {

[url removed, login to view]([url removed, login to view](cc_name[1], "UTF-8"));

}

} else {

// Example Track1

// %B4111111111111111^PADILLA VISDOMINE/LUIS^0905123000000000000002212322222?5

//[url removed, login to view]("&x_track1=");

//[url removed, login to view]([url removed, login to view](false));

[url removed, login to view]("&x_track2=");

[url removed, login to view]([url removed, login to view](false));

}

[url removed, login to view]("&x_method=CC");

[url removed, login to view]("&x_version=3.1");

[url removed, login to view]("&x_delim_data=TRUE");

[url removed, login to view]("&x_delim_char=|");

[url removed, login to view]("&x_relay_response=FALSE");

[url removed, login to view]("&x_test_request=");

[url removed, login to view](m_bTestMode);

//PAYMENT

if ([url removed, login to view]() >= 0.0) {

[url removed, login to view]("&x_type=");

[url removed, login to view](OPERATIONVALIDATE);

//[url removed, login to view]("&x_card_code=340"); //CCV

}

//REFUND

else {

[url removed, login to view]("&x_type=");

[url removed, login to view](OPERATIONREFUND);

[url removed, login to view]("&x_trans_id=");

[url removed, login to view]([url removed, login to view]());

}

// open secure connection

URL url = new URL(ENDPOINTADDRESS);

URLConnection connection = [url removed, login to view]();

[url removed, login to view](true);

[url removed, login to view](false);

// not necessarily required but fixes a bug with some servers

[url removed, login to view]("Content-Type","application/x-www-form-urlencoded");

// POST the data in the string buffer

DataOutputStream out = new DataOutputStream([url removed, login to view]());

[url removed, login to view]([url removed, login to view]().getBytes());

[url removed, login to view]();

[url removed, login to view]();

// process and read the gateway response

BufferedReader in = new BufferedReader(new InputStreamReader([url removed, login to view]()));

String returned = [url removed, login to view]();

[url removed, login to view](); // fin

AuthorizeNetParser anp = new AuthorizeNetParser(returned);

Map props = [url removed, login to view]();

if ([url removed, login to view]().equals([url removed, login to view]("button.ok"))) {

if ([url removed, login to view]([url removed, login to view]("ResponseCode"))) {

//Transaction approved

[url removed, login to view]((String) [url removed, login to view]("AuthCode"), (String) [url removed, login to view]("TransID"), returned);

} else {

StringBuilder errorLine = new StringBuilder();

//Transaction declined

if ([url removed, login to view]()>0) {

for (int i=1; i<=[url removed, login to view](); i++) {

[url removed, login to view]([url removed, login to view]("ErrorCode"+[url removed, login to view](i)));

[url removed, login to view](": ");

[url removed, login to view]([url removed, login to view]("ErrorText"+[url removed, login to view](i)));

[url removed, login to view]("\n");

}

}

[url removed, login to view]([url removed, login to view]("message.paymenterror"), [url removed, login to view]());

}

}

else {

[url removed, login to view]([url removed, login to view](), "");

}

} catch (UnsupportedEncodingException eUE) {

[url removed, login to view]([url removed, login to view]("message.paymentexceptionservice"), [url removed, login to view]());

} catch (MalformedURLException eMURL) {

[url removed, login to view]([url removed, login to view]("message.paymentexceptionservice"), [url removed, login to view]());

} catch(IOException e){

[url removed, login to view]([url removed, login to view]("message.paymenterror"), [url removed, login to view]());

}

}

private class AuthorizeNetParser extends DefaultHandler {

private SAXParser m_sp = null;

private Map props = new HashMap();

private String text;

private InputStream is;

private String result;

private int numMessages = 0;

private int numErrors = 0;

public AuthorizeNetParser(String input) {

is = new ByteArrayInputStream([url removed, login to view]());

}

public Map splitXML(){

try {

if (m_sp == null) {

SAXParserFactory spf = [url removed, login to view]();

m_sp = [url removed, login to view]();

}

[url removed, login to view](is, this);

} catch (ParserConfigurationException ePC) {

result = [url removed, login to view]("exception.parserconfig");

} catch (SAXException eSAX) {

result = [url removed, login to view]("exception.xmlfile");

} catch (IOException eIO) {

result = [url removed, login to view]("exception.iofile");

}

result = [url removed, login to view]("button.ok");

return props;

}

@Override

public void endElement(String uri, String localName, String qName) throws SAXException {

try {

if ([url removed, login to view]("ResponseCode")) {

[url removed, login to view]("ResponseCode", [url removed, login to view](text, "UTF-8"));

text="";

} else if ([url removed, login to view]("ErrorCode")){

numErrors++;

[url removed, login to view]("ErrorCode"+[url removed, login to view](numErrors), [url removed, login to view](text, "UTF-8"));

text = "";

} else if ([url removed, login to view]("ErrorText")) {

[url removed, login to view]("ErrorText"+[url removed, login to view](numErrors), [url removed, login to view](text, "UTF-8"));

text="";

} else if ([url removed, login to view]("Code")) {

numMessages++;

[url removed, login to view]("Code"+[url removed, login to view](numMessages), [url removed, login to view](text, "UTF-8"));

text = "";

} else if ([url removed, login to view]("Description")) {

[url removed, login to view]("Description"+[url removed, login to view](numMessages), [url removed, login to view](text, "UTF-8"));

text="";

} else if ([url removed, login to view]("AuthCode")) {

[url removed, login to view]("AuthCode", [url removed, login to view](text, "UTF-8"));

text="";

} else if ([url removed, login to view]("AVSResultCode")) {

[url removed, login to view]("AVSResultCode", [url removed, login to view](text, "UTF-8"));

text="";

} else if ([url removed, login to view]("CVVResultCode")) {

[url removed, login to view]("CVVResultCode", [url removed, login to view](text, "UTF-8"));

text="";

} else if ([url removed, login to view]("TransID")) {

[url removed, login to view]("TransID", [url removed, login to view](text, "UTF-8"));

text="";

} else if ([url removed, login to view]("RefTransID")) {

[url removed, login to view]("RefTransID", [url removed, login to view](text, "UTF-8"));

text="";

} else if ([url removed, login to view]("TransHash")) {

[url removed, login to view]("TransHash", [url removed, login to view](text, "UTF-8"));

text="";

} else if ([url removed, login to view]("TestMode")) {

[url removed, login to view]("TestMode", [url removed, login to view](text, "UTF-8"));

text="";

} else if ([url removed, login to view]("UserRef")) {

[url removed, login to view]("UserRef", [url removed, login to view](text, "UTF-8"));

text="";

}

}

catch(UnsupportedEncodingException eUE){

result = [url removed, login to view]();

}

}

@Override

public void startDocument() throws SAXException {

text = new String();

}

@Override

public void endDocument() throws SAXException {

}

@Override

public void characters(char[] ch, int start, int length) throws SAXException {

if (text!=null) {

text = new String(ch, start, length);

}

}

public String getResult(){

return [url removed, login to view];

}

public int getNumErrors(){

return numErrors;

}

public int getNumMessages(){

return numMessages;

}

}

}

Skills: Java, Software Testing, Twitter, User Interface / IA

See more: openbravo pos tip, openbravo pos credit card, openbravo pos receipt, approved equals, openbravo pos card, java pos, avsresultcode, mikel irurita, true green, to p, text string, substring c, pending credit, n equals, map string int, map string, java new feature, int map, int i, import io, get substring, get math org, get length string, c substring, string substring

About the Employer:
( 0 reviews ) Waukesha, United States

Project ID: #532680

2 freelancers are bidding on average $750 for this job

A2Design

We can help you. See our skills at: [url removed, login to view]

$750 USD in 16 days
(1 Review)
5.0
rinkuphp

please check your pm

$750 USD in 30 days
(0 Reviews)
0.0