BrightSide Workbench Full Report + Source Code
org.turro.financials.cart.www.Checkout Class Reference

Public Member Functions

 Checkout (IConstructor constructor)
 
void renderCheckout ()
 
String getUrlForCheckout ()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 65 of file Checkout.java.

Constructor & Destructor Documentation

◆ Checkout()

org.turro.financials.cart.www.Checkout.Checkout ( IConstructor  constructor)

Definition at line 71 of file Checkout.java.

71  {
72  this.constructor = constructor;
73  contact = Authentication.getIContact();
74  cart = ShoppingCart.getCart(constructor);
75  checkCheckout();
76  }
Here is the call graph for this function:

Member Function Documentation

◆ getUrlForCheckout()

String org.turro.financials.cart.www.Checkout.getUrlForCheckout ( )

Definition at line 142 of file Checkout.java.

142  {
143  IContact c = Authentication.getIContact();
144  if(c == null || !c.isWebUser()) {
145  return ElephantContext.getRootWebPath() + "/user";
146  } else {
147  return ElephantContext.getRootWebPath() + ShopContext.getInstance().getCheckoutPath();
148  }
149  }
Here is the call graph for this function:

◆ renderCheckout()

void org.turro.financials.cart.www.Checkout.renderCheckout ( )

Definition at line 78 of file Checkout.java.

78  {
79  ElephantMarker marker = new ElephantMarker(constructor);
80  marker.put("contact", contact);
81  marker.put("checkout", this);
82  marker.put("cart", cart);
83  switch(cart.getStatus()) {
84  case 0: // nothing
85  marker.process("cart", "none");
86  break;
87  case 1: // cart
88  cart.removeDeliveryItem();
89  marker.process("cart", "confirm");
90  break;
91  case 2: // address, document
92  marker.put("address", getAddress(ShopContext.getInstance().getDelivery()));
93  marker.put("mobile", contact.getConnector(ShopContext.getInstance().getContactPhone()));
94  marker.put("pickup", cart.isPickup());
95  marker.process("cart", "delivery");
96  break;
97  case 3: // billing address, gid
98  marker.put("address", getAddress(ShopContext.getInstance().getFiscal()));
99  marker.process("cart", "billing");
100  break;
101  case 4: // needs delivery
102  if(cart.needsDelivery() && !cart.isPickup()) {
103  cart.removeDeliveryItem();
104  Address delivery = getAddress(ShopContext.getInstance().getDelivery());
105  if(delivery != null && !delivery.isEmpty()) {
106  DeliveryContexts dcs = ShopContext.getInstance().getDeliveryContexts();
107  Product product = dcs.getDeliveryProduct(delivery);
108  if(product != null) {
109  cart.addDeliveryItem(product.getId(), 1, product.getTax(), product.getPrice());
110  } else if(!Strings.isBlank(cart.getDeliveryValue())) {
111  product = dcs.getDeliveryProduct(cart.getDeliveryValue());
112  if(product != null) {
113  cart.addDeliveryItem(product.getId(), 1, product.getTax(), product.getPrice());
114  }
115  }
116  if(product == null) {
117  cart.setStatus(2);
118  marker.process("cart", "outofscope");
119  break;
120  }
121  }
122  marker.put("address", delivery);
123  }
124  marker.put("fiscal", getAddress(ShopContext.getInstance().getFiscal()));
125  marker.put("mobile", contact.getConnector(ShopContext.getInstance().getContactPhone()));
126  if(ShopContext.getInstance().isSelfTestScope()) {
127  cart.getResetOrder();
128  cart.serializeForOrder(contact);
129  marker.put("notificationURL", ElephantContext.getServerUrl("http") + ShopContext.getInstance().getNotificationPath());
130  marker.put("okURL", ElephantContext.getServerUrl("http") + ShopContext.getInstance().getOKPath());
131  marker.put("koURL", ElephantContext.getServerUrl("http") + ShopContext.getInstance().getKOPath());
132  marker.process("cart", "self-test");
133  } else {
134  new RedsysPOS().addParameters(marker, cart.getTotalAmount(), cart.getResetOrder());
135  cart.serializeForOrder(contact);
136  marker.process("cart", "proceed");
137  }
138  break;
139  }
140  }
void setStatus(int status)
Definition: Cart.java:66
boolean addDeliveryItem(long productId, double quantity, double tax, double price)
Definition: Cart.java:117
void serializeForOrder(IContact contact)
Definition: Cart.java:241
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: