Examples of Txn


Examples of securepay.jxa.api.Txn

        Payment payment = new Payment();
        payment.setServerURL(serverURL);
        payment.setProcessTimeout(Integer.valueOf(processtimeout));
        payment.setMerchantId(merchantId);
        Txn txn = payment.addTxn(4, (String) orderPaymentPreference.get("orderId"));
        txn.setTxnSource(8);
        txn.setAmount(Integer.toString(amont));
        txn.setTxnId(referenceNum);

        // Send payment to SecurePay for processing
        boolean processed = payment.process(pwd);

        Map<String, Object> result = ServiceUtil.returnSuccess();
        if (UtilValidate.isEmpty(processed)) {
            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                    "AccountingSecurityPayPaymentWasNotSent", locale));
        } else {
            if (payment.getCount() == 1){
                Txn resp = payment.getTxn(0);
                boolean approved = resp.getApproved();
                if (approved == false){
                    result.put("refundResult", false);
                    result.put("refundRefNum", authTransaction.getString("referenceNum"));
                    result.put("refundAmount", BigDecimal.ZERO);
                } else {
                    result.put("refundResult", true);
                    result.put("refundAmount", refundAmount);
                    result.put("refundRefNum", resp.getTxnId());
                }
                result.put("refundCode", resp.getResponseCode());
                result.put("refundMessage", resp.getResponseText());
                result.put("refundFlag", "R");
            }
        }
        return result;
    }
View Full Code Here

Examples of securepay.jxa.api.Txn

        Payment payment = new Payment();
        payment.setServerURL(serverURL);
        payment.setProcessTimeout(Integer.valueOf(processtimeout));
        payment.setMerchantId(merchantId);

        Txn txn = payment.addTxn(0, referenceCode);
        txn.setTxnSource(8);
        txn.setAmount(Integer.toString(amont));
        txn.setCardNumber((String) creditCard.get("cardNumber"));
        String expiryDate = (String) creditCard.get("expireDate");
        txn.setExpiryDate(expiryDate.substring(0, 3) + expiryDate.substring(5));
        if (UtilValidate.isNotEmpty(cardSecurityCode)) {
            txn.setCVV(cardSecurityCode);
        }

        // Send payment to SecurePay for processing
        boolean processed = payment.process(pwd);

        Map<String, Object> result = ServiceUtil.returnSuccess();
        if (UtilValidate.isEmpty(processed)) {
            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                    "AccountingSecurityPayPaymentWasNotSent", locale));
        } else {
            if (payment.getCount() == 1) {
                Txn resp = payment.getTxn(0);
                boolean approved = resp.getApproved();
                if (approved == false){
                    result.put("creditResult", false);
                    result.put("creditRefNum", "N/A");
                    result.put("creditAmount", BigDecimal.ZERO);
                } else {
                    result.put("creditResult", true);
                    result.put("creditAmount", creditAmount);
                    result.put("creditRefNum", resp.getTxnId());
                }
                result.put("creditCode", resp.getResponseCode());
                result.put("creditMessage", resp.getResponseText());
            }
        }
        return result;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.