Class CheckOutHelper
- java.lang.Object
-
- org.apache.ofbiz.order.shoppingcart.CheckOutHelper
-
public class CheckOutHelper extends java.lang.Object
A facade over the ShoppingCart to simplify the relatively complex processing required to create an order in the system.
-
-
Field Summary
Fields Modifier and Type Field Description protected ShoppingCart
cart
protected Delegator
delegator
protected LocalDispatcher
dispatcher
static java.lang.String
module
static java.lang.String
resource_error
static java.math.RoundingMode
rounding
static int
scale
-
Constructor Summary
Constructors Constructor Description CheckOutHelper(LocalDispatcher dispatcher, Delegator delegator, ShoppingCart cart)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
adjustFaceToFacePayment(java.lang.String orderId, java.math.BigDecimal cartTotal, java.util.List<GenericValue> allPaymentPrefs, GenericValue userLogin, Delegator delegator)
java.math.BigDecimal
availableAccountBalance(java.lang.String billingAccountId)
static java.math.BigDecimal
availableAccountBalance(java.lang.String billingAccountId, LocalDispatcher dispatcher)
void
calcAndAddTax()
void
calcAndAddTax(boolean skipEmptyAddresses)
void
calcAndAddTax(GenericValue shipAddress)
void
calcAndAddTax(GenericValue shipAddress, boolean skipEmptyAddresses)
java.util.Map<java.lang.String,java.lang.Object>
checkExternalPayment(java.lang.String orderId)
java.util.Map<java.lang.String,java.lang.Object>
checkGiftCard(java.util.Map<java.lang.String,java.lang.Object> params, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> selectedPaymentMethods)
java.util.Map<java.lang.String,java.lang.Object>
checkOrderBlacklist(GenericValue userLogin)
Deprecated.java.util.Map<java.lang.String,java.lang.Object>
checkOrderBlackList()
java.util.Map<java.lang.String,java.lang.Object>
createOrder(GenericValue userLogin)
java.util.Map<java.lang.String,java.lang.Object>
createOrder(GenericValue userLogin, java.lang.String distributorId, java.lang.String affiliateId, java.util.List<GenericValue> trackingCodeOrders, boolean areOrderItemsExploded, java.lang.String visitId, java.lang.String webSiteId)
java.util.Map<java.lang.String,java.lang.Object>
failedBlacklistCheck(GenericValue userLogin, GenericValue productStore)
java.util.Map<java.lang.String,java.lang.Object>
finalizeOrderEntryOptions(int shipGroupIndex, java.lang.String shippingMethod, java.lang.String shippingInstructions, java.lang.String maySplit, java.lang.String giftMessage, java.lang.String isGift, java.lang.String internalCode, java.lang.String shipBeforeDate, java.lang.String shipAfterDate, java.lang.String orderAdditionalEmails)
Sets the options associated with the order for a given ship groupjava.util.Map<java.lang.String,java.lang.Object>
finalizeOrderEntryOptions(int shipGroupIndex, java.lang.String shippingMethod, java.lang.String shippingInstructions, java.lang.String maySplit, java.lang.String giftMessage, java.lang.String isGift, java.lang.String internalCode, java.lang.String shipBeforeDate, java.lang.String shipAfterDate, java.lang.String internalOrderNotes, java.lang.String shippingNotes)
java.util.Map<java.lang.String,java.lang.Object>
finalizeOrderEntryOptions(int shipGroupIndex, java.lang.String shippingMethod, java.lang.String shippingInstructions, java.lang.String maySplit, java.lang.String giftMessage, java.lang.String isGift, java.lang.String internalCode, java.lang.String shipBeforeDate, java.lang.String shipAfterDate, java.lang.String internalOrderNotes, java.lang.String shippingNotes, java.math.BigDecimal shipEstimate)
java.util.Map<java.lang.String,java.lang.Object>
finalizeOrderEntryPayment(java.lang.String checkOutPaymentId, java.math.BigDecimal amount, boolean singleUse, boolean append)
Sets the payment ID to use during the checkout processjava.util.Map<java.lang.String,java.lang.Object>
finalizeOrderEntryShip(int shipGroupIndex, java.lang.String shippingContactMechId, java.lang.String supplierPartyId, java.lang.String supplierAgreementId)
Sets the shipping contact mechanism for a given ship group on the cartjava.util.Map<java.lang.String,java.math.BigDecimal>
makeBillingAccountMap(java.util.List<GenericValue> paymentPrefs)
static java.util.Map<java.lang.String,java.lang.Object>
processPayment(java.lang.String orderId, java.math.BigDecimal orderTotal, java.lang.String currencyUomId, GenericValue productStore, GenericValue userLogin, boolean faceToFace, boolean manualHold, LocalDispatcher dispatcher, Delegator delegator)
java.util.Map<java.lang.String,java.lang.Object>
processPayment(GenericValue productStore, GenericValue userLogin)
java.util.Map<java.lang.String,java.lang.Object>
processPayment(GenericValue productStore, GenericValue userLogin, boolean faceToFace)
java.util.Map<java.lang.String,java.lang.Object>
processPayment(GenericValue productStore, GenericValue userLogin, boolean faceToFace, boolean manualHold)
java.util.Map<java.lang.String,java.lang.Object>
setCheckOutDates(java.sql.Timestamp shipBefore, java.sql.Timestamp shipAfter)
java.util.Map<java.lang.String,java.lang.Object>
setCheckOutOptions(java.lang.String shippingMethod, java.lang.String shippingContactMechId, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> selectedPaymentMethods, java.util.List<java.lang.String> singleUsePayments, java.lang.String billingAccountId, java.lang.String shippingInstructions, java.lang.String orderAdditionalEmails, java.lang.String maySplit, java.lang.String giftMessage, java.lang.String isGift, java.lang.String internalCode, java.lang.String shipBeforeDate, java.lang.String shipAfterDate)
java.util.Map<java.lang.String,java.lang.Object>
setCheckOutPayment(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> selectedPaymentMethods, java.util.List<java.lang.String> singleUsePayments, java.lang.String billingAccountId)
java.util.List<java.lang.String>
setCheckOutPaymentInternal(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> selectedPaymentMethods, java.util.List<java.lang.String> singleUsePayments, java.lang.String billingAccountId)
java.util.Map<java.lang.String,java.lang.Object>
setCheckOutShippingAddress(java.lang.String shippingContactMechId)
java.util.Map<java.lang.String,java.lang.Object>
setCheckOutShippingOptions(java.lang.String shippingMethod, java.lang.String shippingInstructions, java.lang.String orderAdditionalEmails, java.lang.String maySplit, java.lang.String giftMessage, java.lang.String isGift, java.lang.String internalCode, java.lang.String shipBeforeDate, java.lang.String shipAfterDate)
void
validateGiftCardAmounts()
java.util.Map<java.lang.String,java.lang.Object>
validatePaymentMethods()
-
-
-
Field Detail
-
module
public static final java.lang.String module
-
resource_error
public static final java.lang.String resource_error
- See Also:
- Constant Field Values
-
scale
public static final int scale
-
rounding
public static final java.math.RoundingMode rounding
-
dispatcher
protected LocalDispatcher dispatcher
-
delegator
protected Delegator delegator
-
cart
protected ShoppingCart cart
-
-
Constructor Detail
-
CheckOutHelper
public CheckOutHelper(LocalDispatcher dispatcher, Delegator delegator, ShoppingCart cart)
-
-
Method Detail
-
setCheckOutShippingAddress
public java.util.Map<java.lang.String,java.lang.Object> setCheckOutShippingAddress(java.lang.String shippingContactMechId)
-
setCheckOutShippingOptions
public java.util.Map<java.lang.String,java.lang.Object> setCheckOutShippingOptions(java.lang.String shippingMethod, java.lang.String shippingInstructions, java.lang.String orderAdditionalEmails, java.lang.String maySplit, java.lang.String giftMessage, java.lang.String isGift, java.lang.String internalCode, java.lang.String shipBeforeDate, java.lang.String shipAfterDate)
-
setCheckOutPayment
public java.util.Map<java.lang.String,java.lang.Object> setCheckOutPayment(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> selectedPaymentMethods, java.util.List<java.lang.String> singleUsePayments, java.lang.String billingAccountId)
-
setCheckOutPaymentInternal
public java.util.List<java.lang.String> setCheckOutPaymentInternal(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> selectedPaymentMethods, java.util.List<java.lang.String> singleUsePayments, java.lang.String billingAccountId)
-
setCheckOutDates
public java.util.Map<java.lang.String,java.lang.Object> setCheckOutDates(java.sql.Timestamp shipBefore, java.sql.Timestamp shipAfter)
-
setCheckOutOptions
public java.util.Map<java.lang.String,java.lang.Object> setCheckOutOptions(java.lang.String shippingMethod, java.lang.String shippingContactMechId, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> selectedPaymentMethods, java.util.List<java.lang.String> singleUsePayments, java.lang.String billingAccountId, java.lang.String shippingInstructions, java.lang.String orderAdditionalEmails, java.lang.String maySplit, java.lang.String giftMessage, java.lang.String isGift, java.lang.String internalCode, java.lang.String shipBeforeDate, java.lang.String shipAfterDate)
-
checkGiftCard
public java.util.Map<java.lang.String,java.lang.Object> checkGiftCard(java.util.Map<java.lang.String,java.lang.Object> params, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> selectedPaymentMethods)
-
createOrder
public java.util.Map<java.lang.String,java.lang.Object> createOrder(GenericValue userLogin)
-
createOrder
public java.util.Map<java.lang.String,java.lang.Object> createOrder(GenericValue userLogin, java.lang.String distributorId, java.lang.String affiliateId, java.util.List<GenericValue> trackingCodeOrders, boolean areOrderItemsExploded, java.lang.String visitId, java.lang.String webSiteId)
-
calcAndAddTax
public void calcAndAddTax() throws GeneralException
- Throws:
GeneralException
-
calcAndAddTax
public void calcAndAddTax(boolean skipEmptyAddresses) throws GeneralException
- Throws:
GeneralException
-
calcAndAddTax
public void calcAndAddTax(GenericValue shipAddress) throws GeneralException
- Throws:
GeneralException
-
calcAndAddTax
public void calcAndAddTax(GenericValue shipAddress, boolean skipEmptyAddresses) throws GeneralException
- Throws:
GeneralException
-
processPayment
public java.util.Map<java.lang.String,java.lang.Object> processPayment(GenericValue productStore, GenericValue userLogin) throws GeneralException
- Throws:
GeneralException
-
processPayment
public java.util.Map<java.lang.String,java.lang.Object> processPayment(GenericValue productStore, GenericValue userLogin, boolean faceToFace) throws GeneralException
- Throws:
GeneralException
-
processPayment
public java.util.Map<java.lang.String,java.lang.Object> processPayment(GenericValue productStore, GenericValue userLogin, boolean faceToFace, boolean manualHold) throws GeneralException
- Throws:
GeneralException
-
processPayment
public static java.util.Map<java.lang.String,java.lang.Object> processPayment(java.lang.String orderId, java.math.BigDecimal orderTotal, java.lang.String currencyUomId, GenericValue productStore, GenericValue userLogin, boolean faceToFace, boolean manualHold, LocalDispatcher dispatcher, Delegator delegator) throws GeneralException
- Throws:
GeneralException
-
adjustFaceToFacePayment
public static void adjustFaceToFacePayment(java.lang.String orderId, java.math.BigDecimal cartTotal, java.util.List<GenericValue> allPaymentPrefs, GenericValue userLogin, Delegator delegator) throws GeneralException
- Throws:
GeneralException
-
checkOrderBlackList
public java.util.Map<java.lang.String,java.lang.Object> checkOrderBlackList()
-
checkOrderBlacklist
@Deprecated public java.util.Map<java.lang.String,java.lang.Object> checkOrderBlacklist(GenericValue userLogin)
Deprecated.
-
failedBlacklistCheck
public java.util.Map<java.lang.String,java.lang.Object> failedBlacklistCheck(GenericValue userLogin, GenericValue productStore)
-
checkExternalPayment
public java.util.Map<java.lang.String,java.lang.Object> checkExternalPayment(java.lang.String orderId)
-
finalizeOrderEntryShip
public java.util.Map<java.lang.String,java.lang.Object> finalizeOrderEntryShip(int shipGroupIndex, java.lang.String shippingContactMechId, java.lang.String supplierPartyId, java.lang.String supplierAgreementId)
Sets the shipping contact mechanism for a given ship group on the cart- Parameters:
shipGroupIndex
- The index of the ship group in the cartshippingContactMechId
- The identifier of the contactsupplierPartyId
- The identifier of the supplier to use for the drop shipmentsupplierAgreementId
- The identifier of the agreement with the supplier- Returns:
- A Map conforming to the OFBiz Service conventions containing any error messages
-
finalizeOrderEntryOptions
public java.util.Map<java.lang.String,java.lang.Object> finalizeOrderEntryOptions(int shipGroupIndex, java.lang.String shippingMethod, java.lang.String shippingInstructions, java.lang.String maySplit, java.lang.String giftMessage, java.lang.String isGift, java.lang.String internalCode, java.lang.String shipBeforeDate, java.lang.String shipAfterDate, java.lang.String orderAdditionalEmails)
Sets the options associated with the order for a given ship group- Parameters:
shipGroupIndex
- The index of the ship group in the cartshippingMethod
- The shipping method indicating the carrier and shipment type to useshippingInstructions
- Any additional handling instructionsmaySplit
- "true" or anything else forfalse
giftMessage
- A message to have included for the recipientisGift
- "true" or anything else forfalse
internalCode
- an internal code associated with the order- Returns:
- A Map conforming to the OFBiz Service conventions containing any error messages
-
finalizeOrderEntryOptions
public java.util.Map<java.lang.String,java.lang.Object> finalizeOrderEntryOptions(int shipGroupIndex, java.lang.String shippingMethod, java.lang.String shippingInstructions, java.lang.String maySplit, java.lang.String giftMessage, java.lang.String isGift, java.lang.String internalCode, java.lang.String shipBeforeDate, java.lang.String shipAfterDate, java.lang.String internalOrderNotes, java.lang.String shippingNotes, java.math.BigDecimal shipEstimate)
-
finalizeOrderEntryOptions
public java.util.Map<java.lang.String,java.lang.Object> finalizeOrderEntryOptions(int shipGroupIndex, java.lang.String shippingMethod, java.lang.String shippingInstructions, java.lang.String maySplit, java.lang.String giftMessage, java.lang.String isGift, java.lang.String internalCode, java.lang.String shipBeforeDate, java.lang.String shipAfterDate, java.lang.String internalOrderNotes, java.lang.String shippingNotes)
-
finalizeOrderEntryPayment
public java.util.Map<java.lang.String,java.lang.Object> finalizeOrderEntryPayment(java.lang.String checkOutPaymentId, java.math.BigDecimal amount, boolean singleUse, boolean append)
Sets the payment ID to use during the checkout process- Parameters:
checkOutPaymentId
- The payment ID to be associated with the cart- Returns:
- A Map conforming to the OFBiz Service conventions containing any error messages.
-
availableAccountBalance
public static java.math.BigDecimal availableAccountBalance(java.lang.String billingAccountId, LocalDispatcher dispatcher)
-
availableAccountBalance
public java.math.BigDecimal availableAccountBalance(java.lang.String billingAccountId)
-
makeBillingAccountMap
public java.util.Map<java.lang.String,java.math.BigDecimal> makeBillingAccountMap(java.util.List<GenericValue> paymentPrefs)
-
validatePaymentMethods
public java.util.Map<java.lang.String,java.lang.Object> validatePaymentMethods()
-
validateGiftCardAmounts
public void validateGiftCardAmounts()
-
-