Hi All,
after more research and reading, i was able to get this up and running, but i still have a few questions, hope you guys can help me out.
first, i wasn't able to resolve the 2.6.0-GA dependency
Code: Select all
<dependency>
<groupId>org.broadleafcommerce</groupId>
<artifactId>broadleaf-paypal</artifactId>
<version>2.6.0-GA</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
dependency, so i have to use version 2.6.0-SNAPSHOT instead.
Code: Select all
<dependency>
<groupId>org.broadleafcommerce</groupId>
<artifactId>broadleaf-paypal</artifactId>
<version>2.6.0-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
second, when i use express checkout on paypal-hosted site, the lineItems are emptied .. however, i like to list out all items on paypal express checkout page. i follow this url
https://github.com/BroadleafCommerce/blc-paypalthe instructions says
You must override the OrderToPaymentRequestDTOService implementation to construct the LineItemDTO's on the PaymentRequestDTO in your application, so that it conforms to the API restrictions of this gateway. The NVP API validates that the amounts of the line item DTO's that you pass in equal the Subtotal amount that you passed in.
Your algorithm might look something like this:
Code: Select all
Money amountItemSubtotal = new Money(0);
List<OrderItem> orderItems = order.getOrderItems();
for (OrderItem orderItem : orderItems) {
requestDTO.lineItem()
.shortDescription(orderItem.getName())
.systemId(orderItem.getId().toString())
.amount(orderItem.getTotalPrice().toString())
.quantity(orderItem.getQuantity() + "")
.done();
amountItemSubtotal = amountItemSubtotal.add(orderItem.getPrice().multiply(orderItem.getQuantity()));
}
Money additionalFees = new Money(0);
for (FulfillmentGroup fg : order.getFulfillmentGroups()){
for (FulfillmentGroupFee fee : fg.getFulfillmentGroupFees()){
additionalFees = additionalFees.add(fee.getAmount());
}
}
if (additionalFees.greaterThan(new Money(0))) {
requestDTO.lineItem()
.shortDescription("Additional Fees")
.amount(additionalFees.getAmount())
.quantity(1L)
.done();
amountItemSubtotal = amountItemSubtotal.add(additionalFees);
}
if (order.getTotalAdjustmentsValue() != null &&
order.getTotalAdjustmentsValue().greaterThan(new Money(0))){
requestDTO.lineItem()
.shortDescription("Promotion Code")
.amount(order.getTotalAdjustmentsValue().getAmount().negate())
.quantity(1L)
.done();
amountItemSubtotal = amountItemSubtotal.subtract(order.getTotalAdjustmentsValue());
}
// add additional payment methods like customer credit or gift cards etc...
requestDTO.subTotal(amountItemSubtotal.toString());
I am not quite sure how i would override
OrderToPaymentRequestDTOService , do i create a another spring bean, and extend this OrderToPaymentRequestDTOService and override populateDefaultLineItemsAndSubtotal method, so where would this new bean go ?
Thank you for your help.