List of usage examples for org.apache.commons.lang SerializationUtils clone
public static Object clone(Serializable object)
Deep clone an Object
using serialization.
This is many times slower than writing clone methods by hand on all objects in your object graph.
From source file:org.yes.cart.payment.impl.AuthorizeNetSimPaymentGatewayImpl.java
/** * {@inheritDoc}// w ww . ja va 2 s .co m */ public Payment authorize(final Payment paymentIn) { final Payment payment = (Payment) SerializationUtils.clone(paymentIn); payment.setTransactionOperation(AUTH); payment.setTransactionReferenceId(UUID.randomUUID().toString()); payment.setTransactionAuthorizationCode(UUID.randomUUID().toString()); payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_MANUAL_PROCESSING_REQUIRED); payment.setPaymentProcessorBatchSettlement(false); return payment; }
From source file:org.yes.cart.payment.impl.AuthorizeNetSimPaymentGatewayImpl.java
/** * {@inheritDoc}//from w ww . j a v a 2 s .c om */ public Payment reverseAuthorization(final Payment paymentIn) { final Payment payment = (Payment) SerializationUtils.clone(paymentIn); payment.setTransactionOperation(REVERSE_AUTH); payment.setTransactionReferenceId(UUID.randomUUID().toString()); payment.setTransactionAuthorizationCode(UUID.randomUUID().toString()); payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_MANUAL_PROCESSING_REQUIRED); payment.setPaymentProcessorBatchSettlement(false); return payment; }
From source file:org.yes.cart.payment.impl.AuthorizeNetSimPaymentGatewayImpl.java
/** * {@inheritDoc}//from ww w .ja v a 2 s . c o m */ public Payment capture(final Payment paymentIn) { final Payment payment = (Payment) SerializationUtils.clone(paymentIn); payment.setTransactionOperation(CAPTURE); payment.setTransactionReferenceId(UUID.randomUUID().toString()); payment.setTransactionAuthorizationCode(UUID.randomUUID().toString()); payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_MANUAL_PROCESSING_REQUIRED); payment.setPaymentProcessorBatchSettlement(false); return payment; }
From source file:org.yes.cart.payment.impl.AuthorizeNetSimPaymentGatewayImpl.java
/** * {@inheritDoc}//from w w w . ja v a2 s .c o m */ public Payment voidCapture(final Payment paymentIn) { final Payment payment = (Payment) SerializationUtils.clone(paymentIn); payment.setTransactionOperation(VOID_CAPTURE); payment.setTransactionReferenceId(UUID.randomUUID().toString()); payment.setTransactionAuthorizationCode(UUID.randomUUID().toString()); payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_MANUAL_PROCESSING_REQUIRED); payment.setPaymentProcessorBatchSettlement(false); return payment; }
From source file:org.yes.cart.payment.impl.AuthorizeNetSimPaymentGatewayImpl.java
/** * {@inheritDoc}// w w w .j a va 2 s .com */ public Payment refund(final Payment paymentIn) { final Payment payment = (Payment) SerializationUtils.clone(paymentIn); payment.setTransactionOperation(REFUND); payment.setTransactionReferenceId(UUID.randomUUID().toString()); payment.setTransactionAuthorizationCode(UUID.randomUUID().toString()); payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_MANUAL_PROCESSING_REQUIRED); payment.setPaymentProcessorBatchSettlement(false); return payment; }
From source file:org.yes.cart.payment.impl.CyberSourcePaymentGatewayImpl.java
/** * Perform cybersource call./*from ww w . j a v a2 s. co m*/ * * @param request request. * @param paymentIn input payment * @param operation op name * @return updated payment */ Payment runTransaction(final Map<String, String> request, final Payment paymentIn, final String operation) { final Payment payment = (Payment) SerializationUtils.clone(paymentIn); payment.setTransactionOperation(operation); final Logger log = ShopCodeContext.getLog(this); try { if (log.isDebugEnabled()) { log.debug(HttpParamsUtils.stringify("Cybersource request:", request)); } HashMap<String, String> reply = Client.runTransaction(request, getProperties()); if (log.isDebugEnabled()) { log.debug(HttpParamsUtils.stringify("Cybersource response:", reply)); } /* See http://apps.cybersource.com/library/documentation/sbc/SB_API_SP_UG/html/api.htm#API_8156_59537 ACCEPT: The request succeeded ERROR: There was a system error REJECT: The request was rejected */ if ("ACCEPT".equalsIgnoreCase(reply.get("decision"))) { payment.setTransactionAuthorizationCode(reply.get("requestID")); payment.setTransactionRequestToken(reply.get("requestToken")); payment.setTransactionReferenceId(reply.get("requestID")); payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_OK); payment.setPaymentProcessorBatchSettlement( CAPTURE.equals(operation) || AUTH_CAPTURE.equals(operation)); } else { payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_FAILED); payment.setPaymentProcessorBatchSettlement(false); } payment.setTransactionOperationResultCode(reply.get("reasonCode")); payment.setTransactionOperationResultMessage(ERROR_CODE_DESC_MAP.get(reply.get("reasonCode"))); } catch (ClientException e) { ShopCodeContext.getLog(this).error("Can not execute transaction. Client exception : " + payment, e); payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_FAILED); payment.setPaymentProcessorBatchSettlement(false); payment.setTransactionOperationResultMessage(e.getMessage()); } catch (FaultException e) { ShopCodeContext.getLog(this).error("Can not execute transaction. Fault exception : " + payment, e); payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_FAILED); payment.setTransactionOperationResultMessage(e.getMessage()); } return payment; }
From source file:org.yes.cart.payment.impl.InvoicePaymentGatewayImpl.java
/** * {@inheritDoc}/*ww w.j a v a 2 s .co m*/ */ public Payment authorize(Payment paymentIn) { final Payment payment = (Payment) SerializationUtils.clone(paymentIn); payment.setTransactionOperation(AUTH); payment.setTransactionReferenceId(UUID.randomUUID().toString()); payment.setTransactionAuthorizationCode(UUID.randomUUID().toString()); payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_MANUAL_PROCESSING_REQUIRED); payment.setPaymentProcessorBatchSettlement(false); return payment; }
From source file:org.yes.cart.payment.impl.InvoicePaymentGatewayImpl.java
/** * {@inheritDoc}//from w w w . j a v a 2s. c o m */ public Payment reverseAuthorization(Payment paymentIn) { final Payment payment = (Payment) SerializationUtils.clone(paymentIn); payment.setTransactionOperation(REVERSE_AUTH); payment.setTransactionReferenceId(UUID.randomUUID().toString()); payment.setTransactionAuthorizationCode(UUID.randomUUID().toString()); payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_MANUAL_PROCESSING_REQUIRED); payment.setPaymentProcessorBatchSettlement(false); return payment; }
From source file:org.yes.cart.payment.impl.InvoicePaymentGatewayImpl.java
/** * {@inheritDoc}/*from ww w .j av a 2 s. c o m*/ */ public Payment capture(Payment paymentIn) { final Payment payment = (Payment) SerializationUtils.clone(paymentIn); payment.setTransactionOperation(CAPTURE); payment.setTransactionReferenceId(UUID.randomUUID().toString()); payment.setTransactionAuthorizationCode(UUID.randomUUID().toString()); payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_MANUAL_PROCESSING_REQUIRED); payment.setPaymentProcessorBatchSettlement(false); return payment; }
From source file:org.yes.cart.payment.impl.InvoicePaymentGatewayImpl.java
/** * {@inheritDoc}//from ww w . j a v a 2 s . com */ public Payment authorizeCapture(Payment paymentIn) { final Payment payment = (Payment) SerializationUtils.clone(paymentIn); payment.setTransactionOperation(AUTH_CAPTURE); payment.setTransactionReferenceId(UUID.randomUUID().toString()); payment.setTransactionAuthorizationCode(UUID.randomUUID().toString()); payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_OK); payment.setPaymentProcessorBatchSettlement(true); return payment; }