private function _generPaypalParam($orderEntity) { $nvp = array(); $nvp["returnURL"] = $this->_getReturnUrl($orderEntity['id']); $nvp["cancelURL"] = $this->_getCancelUrl(); $nvp["actionType"] = "PAY"; $nvp['currencyCode'] = "AUD"; $nvp["clientDeviceId"] = "mydevice"; $nvp["clientIp"] = WeFlex_Util::GetIp(); $nvp["memo"] = "Thanks!"; $nvp["feesPayer"] = "EACHRECEIVER"; $nvp['receiverEmail'] = array(); $nvp['receiverAmount'] = array(); $nvp['primaryReceiver'] = array(); $products = $orderEntity["cart_info"][TCVM_Cart_Imple::STEP_PRODUCT]["products"]; foreach ($products as $id => $product) { if ($product["paypal"] == "us") { $nvp['receiverEmail']["us"] = TCVM::GetInstance()->config->payment->paypal->receiver->us; $nvp['receiverAmount']["us"] = $nvp['receiverAmount']["us"] + $product["price"]; $nvp['primaryReceiver']["us"] = "false"; } else { $nvp['receiverEmail']["au"] = TCVM::GetInstance()->config->payment->paypal->receiver->au; $nvp['receiverAmount']["au"] = $nvp['receiverAmount']["au"] + $product["price"]; $nvp['primaryReceiver']["au"] = "false"; } } //application fee if ($orderEntity["cart_info"][TCVM_Cart_Imple::STEP_PRODUCT]["new"]) { $nvp['receiverEmail']["us"] = TCVM::GetInstance()->config->payment->paypal->receiver->us; $nvp['receiverAmount']["us"] = $nvp['receiverAmount']["us"] + $orderEntity["cart_info"][TCVM_Cart_Imple::STEP_PRODUCT]["new"]; $nvp['primaryReceiver']["us"] = "false"; } return $nvp; }
private function _generPaypalParam($orderId, $params) { $order = TCVM_Order_Factory::Factory(); $orderEntity = $order->getOrder($orderId); $params['PAYMENTACTION'] = 'Sale'; $params['CURRENCYCODE'] = 'AUD'; $params['IPADDRESS'] = WeFlex_Util::GetIp(); $params['AMT'] = $orderEntity['total_price']; return $params; }
public function getGeoLocation($host = null) { if ($host) { $ip = @gethostbyname($host); } else { $ip = WeFlex_Util::GetIp(); } if (preg_match('/^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:[.](?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$/', $ip)) { $xml = @file_get_contents('http://' . $this->service . '/' . $this->version . '/' . 'ip_query.php?key=' . $this->apiKey . '&ip=' . $ip); try { $response = @new SimpleXMLElement($xml); foreach ($response as $field => $value) { $result[(string) $field] = (string) $value; } return $result; } catch (Exception $e) { $this->errors[] = $e->getMessage(); return; } } $this->errors[] = '"' . $host . '" is not a valid IP address or hostname.'; return; }
public function indexAction() { dump(WeFlex_Util::GetIp()); die; }