function setup_checkout(ET_Order $order) { $order = clone $order; $order = $order->generate_data_to_pay(); $setting = $this->_settings; $payment = new ET_GoogleCheckout(); $currencyCodeType = isset($order['currencyCodeType']) ? $order['currencyCodeType'] : ''; $pro = isset($order['products']) ? $order['products'] : array(); $products = ""; $itemamt = 0.0; $i = 0; if (isset($order['total_before_discount']) && $order['total_before_discount'] > $order['total']) { $pro[] = array('NAME' => __("Discount", ET_DOMAIN), 'L_DESC' => __("You have use a coupon code to get discount", ET_DOMAIN), 'AMT' => $order['total'] - $order['total_before_discount'], 'QTY' => 1); } // set digital url $key = $payment->get_digital_key($order['ID']); $url = $setting['return']; $returnURL = $url . '&token=' . $key; // general product string add to paypal url if (!empty($pro)) { $xml_data = new gc_XmlBuilder(); $xml_data->Push('checkout-shopping-cart', array('xmlns' => GOOGLE_SCHEMA_URL)); $xml_data->Push('shopping-cart'); $xml_data->Push('items'); foreach ($pro as $key => $value) { $xml_data->Push('item'); $xml_data->Element('item-name', $value['NAME']); $xml_data->Element('item-description', $value['L_DESC']); $xml_data->Element('unit-price', $value['AMT'], array('currency' => $order['currencyCodeType'])); $xml_data->Element('quantity', $value['QTY']); $xml_data->Push('digital-content'); // digital url $xml_data->Element('url', $returnURL); // description when order success $xml_data->element('description', substr('You have completed order!', 0, 40)); $xml_data->Pop('digital-content'); $xml_data->Pop('item'); } $xml_data->Pop('items'); } $xml_data->Pop('shopping-cart'); $xml_data->Push('checkout-flow-support'); $xml_data->Push('merchant-checkout-flow-support'); $xml_data->Element('continue-shopping-url', $setting['continue_shop']); $xml_data->Pop('merchant-checkout-flow-support'); $xml_data->Pop('checkout-flow-support'); $xml_data->Pop('checkout-shopping-cart'); $nvpstr = $xml_data->GetXML(); $data = $payment->set_checkout($nvpstr); return array('ACK' => true, 'url' => $data['url'], 'extend' => $data); }