Beispiel #1
0
 public function initJs()
 {
     $result1 = $this->generateCountryStateData();
     $result2 = $this->generateMscIdOption();
     $result = array_merge($result1, $result2);
     $config = oseRegistry::call('msc')->getConfig('locale', 'obj');
     $jsonCountry = oseObject::getValue($config, 'default_country_json', false);
     if (!$jsonCountry) {
         $jsonCountry = oseJson::encode(array('code3' => 'USA', 'code2' => 'US'));
     } else {
         $jsonCountry = oseObject::getValue($config, 'default_country_json');
     }
     $js = oseHTML::getInstance('js');
     $js->append('oseMsc.defaultSelectedCountry=Ext.decode(\'' . $jsonCountry . '\');');
     $js->append('oseMsc.mscList = ' . oseJson::encode($result['mscList']) . ';');
     $js->append('oseMsc.mscOptions = ' . oseJson::encode($result['mscOptions']) . ';');
     $js->append('oseMsc.countryData = ' . oseJson::encode($result['country']) . ';');
     $js->append('oseMsc.stateData = ' . oseJson::encode($result['state']) . ';');
     $js->onReady();
     $js->wrap();
     return $js->toString();
 }
Beispiel #2
0
	public function initJs() {
		$result1 = $this->generateCountryStateData();
		$result2 = $this->generateMscIdOption();
		$result = array_merge($result1, $result2);
		$config = oseRegistry::call('msc')->getConfig('locale', 'obj');
		$jsonCountry = oseObject::getValue($config, 'default_country_json', false);
		if (!$jsonCountry) {
			$jsonCountry = oseJson::encode(array('code3' => 'USA', 'code2' => 'US'));
		} else {
			$jsonCountry = oseObject::getValue($config, 'default_country_json');
		}
		$jsonState = oseObject::getValue($config, 'default_state_json', false);
		$regConfig = oseRegistry::call('msc')->getConfig('register', 'obj');
		$payment_method_note = oseObject::getValue($regConfig, 'payment_method_note', null);
		$hide_billinginfo = oseObject::getValue($regConfig, 'hide_billinginfo', false) ? 'true' : 'false';
		$hide_payment = oseObject::getValue($regConfig, 'hide_payment', false) ? 'true' : 'false';
		$model = $this->getModel('register');
		$item = $model->getBillingInfo();
		$bill = array('total' => 1, 'success' => true, 'result' => $item);
		$js = oseHTML::getInstance('js');
		$js->append('oseMsc.defaultSelectedCountry=Ext.decode(\'' . $jsonCountry . '\');');
		if ($jsonState) {
			$js->append('oseMsc.defaultSelectedState=Ext.decode(\'' . $jsonState . '\');');
		}
		$js->append('oseMsc.payment_method_note="' . $payment_method_note . '";');
		$js->append('oseMsc.hide_billinginfo=' . $hide_billinginfo . ';');
		$js->append('oseMsc.hide_payment=' . $hide_payment . ';');
		$js->append('oseMsc.reg.bill_country="";');
		$js->append('oseMsc.reg.bill_state="";');
		$js->append('oseMsc.reg.bill=' . oseJson::encode($bill) . ';');
		$js->append('oseMsc.mscList = ' . oseJson::encode($result['mscList']) . ';');
		$js->append('oseMsc.mscOptions = ' . oseJson::encode($result['mscOptions']) . ';');
		$js->append('oseMsc.currency = ' . oseJson::encode($result['currency']) . ';');
		$js->append('oseMsc.countryData = ' . oseJson::encode($result['country']) . ';');
		$js->append('oseMsc.stateData = ' . oseJson::encode($result['state']) . ';');
		$js->makeItClosure();
		$js->wrap();
		return $js->toString();
	}
Beispiel #3
0
 function PaypalExpPostForm($orderInfo, $params)
 {
     /*$pConfig= oseMscConfig :: getConfig('payment', 'obj');
     		$paypal_email= $pConfig->paypal_email;
     		$html= array();
     		$test_mode= $pConfig->paypal_testmode;
     		if(empty($paypal_email)) {
     			$html['form']= "";
     			$html['url']= "";
     			return $html;
     		}*/
     $form = oseHTML::getInstance('form');
     if ($this->get('test')) {
         $url = "https://www.sandbox.paypal.com/cgi-bin/webscr";
     } else {
         $url = "https://www.paypal.com/cgi-bin/webscr";
     }
     $db = oseDB::instance();
     $member = oseRegistry::call('member');
     $member->instance($orderInfo->user_id);
     $billinginfo = $member->getBillingInfo('obj');
     $amount = oseObject::getValue($orderInfo, 'payment_price');
     $currency = oseObject::getValue($orderInfo, 'payment_currency');
     $order_id = oseObject::getValue($orderInfo, 'order_id');
     $order_number = oseObject::getValue($orderInfo, 'order_number');
     //$billinginfo = OSEPAYMENTS::get_billinginfo($user_id);
     $user = oseUser::init($orderInfo->user_id);
     //oseExit($billinginfo);
     //$node= oseMscTree :: getNode($orderInfo->entry_id, 'obj');
     /*
     		$payment= oseMscAddon :: getExtInfo($orderInfo->entry_id, 'payment', 'obj');
     
     		if(isset($params['msc_option']))
     		{
     			$msc_option = $params['msc_option'];
     			unset($params['msc_option']);
     		}
     
     		$payment = oseObject::getValue($payment,$msc_option);
     		
     
     		$desc = $this->generateDesc($order_id);
     		
     		$vendor_image_url= "";
     		//$app= & JFactory :: getApplication();
     		//$currentSession= JSession :: getInstance('none', array());
     		//$stores= $currentSession->getStores();
     		//$html['form']= '<form action="'.$url.'" method="post" target="_self">';
     		//$html['form'] .= '<input type="hidden" name="phpMyAdmin" value="octl53wDFSC-rSEy-S6gRa-jWtb" />';
     		$html = array();
     		
     		$form->createForm($url,'ose_pgw_form','ose_pgw_form');
     		$form->append($form->image('submit','components/com_osemsc/assets/images/checkout.png',JText :: _('Click to pay with PayPal - it is fast, free and secure!')));
     		
     		$post_variables= array();
     		$post_variables['phpMyAdmin'] = "octl53wDFSC-rSEy-S6gRa-jWtb";
     		$post_variables['cmd'] = "_ext-enter";
     		$post_variables['redirect_cm'] = "_xclick";
     		$post_variables['upload'] = "1";
     		$post_variables['business'] = $paypal_email;
     		$post_variables['item_name'] = JText :: _('Order ID:')." ".$order_id." - ".JText :: _('Payment for Membership Type:')." ".$msc_name;
     		$post_variables['order_id'] = $order_id;
     		$post_variables['invoice'] = $order_number;
     		$post_variables['amount'] = round($amount, 2);
     		$post_variables['shipping'] = '0.00';
     		$post_variables['currency_code'] = $currency;
     		$post_variables['address_override'] = 0;
     		$post_variables['first_name'] = $billinginfo->firstname;
     		$post_variables['last_name'] = $billinginfo->lastname;
     		$post_variables['address1'] = $billinginfo->addr1;
     		$post_variables['address2'] = $billinginfo->addr2;
     		$post_variables['zip'] = $billinginfo->postcode;
     		$post_variables['city'] = $billinginfo->city;
     		$post_variables['state'] = $billinginfo->state;
     		$post_variables['email'] = $user->email;
     		$post_variables['night_phone_b'] = $billinginfo->telephone;
     		$post_variables['cpp_header_image'] = $vendor_image_url;
     		$post_variables['return'] = JURI :: base()."index.php?option=com_osemsc&view=member&result=success&amount={$amount}&ordernumber={$order_number}";
     		$post_variables['notify_url'] = JURI :: base()."components/com_osemsc/ipn/paypal_notify.php";
     		$post_variables['cancel_return'] = JURI :: base()."index.php";
     		$post_variables['undefined_quantity'] = "0";
     		$post_variables['test_ipn'] = "0";
     		$post_variables['pal'] = "NRUBJXESJTY24";
     		$post_variables['no_shipping'] = "1";
     		$post_variables['no_note'] = "1";
     		
     		foreach($post_variables as $name => $value) {
     			$form->append($form->hidden($name,$value));
     		}
     		
     		$html['form'] = $form->output();*/
     /*
     if($orderInfo->payment_mode == 'm') {
     	$post_variables= array("cmd" => "_ext-enter", "redirect_cmd" => "_xclick", "upload" => "1", "business" => $paypal_email, "receiver_email" => $paypal_email, "item_name" => JText :: _('Order ID:')." ".$order_id." - ".JText :: _('Payment for Membership Type:')." ".$msc_name, "order_id" => $order_id, "invoice" => $order_number, "amount" => round($amount, 2), "shipping" => '0.00', "currency_code" => $currency, "address_override" => "0", "first_name" => $billinginfo->firstname, "last_name" => $billinginfo->lastname, "address1" => $billinginfo->addr1, "address2" => $billinginfo->addr2, "zip" => $billinginfo->postcode, "city" => $billinginfo->city, "state" => $billinginfo->state, "email" => $user->email, "night_phone_b" => $billinginfo->telephone, "cpp_header_image" => $vendor_image_url, "return" => JURI :: base()."index.php?option=com_osemsc&view=member&result=success&amount={$amount}&ordernumber={$order_number}", "notify_url" => JURI :: base()."components/com_osemsc/ipn/paypal_notify.php", "cancel_return" => JURI :: base()."index.php", "undefined_quantity" => "0", "test_ipn" => 0, "pal" => "NRUBJXESJTY24", "no_shipping" => "1", "no_note" => "1");
     	//$html['form'] .= '<input type="image" id="paypal_image" name="submit" src="'."components/com_osemsc/assets/images/checkout.png".'" alt="'.JText :: _('Click to pay with PayPal - it is fast, free and secure!').'" />';
     	
     } else {
     	$orderInfoParams= oseJson :: decode($orderInfo->params);
     	if(!$orderInfoParams->has_trial) {
     		$a3= $orderInfoParams->total;
     		$p3= $orderInfoParams->p3;
     		$t3= $orderInfoParams->t3;
     		$t3= str_replace(substr($t3, 0, 1), strtoupper(substr($t3, 0, 1)), $t3);
     		$post_variables= array("business" => $paypal_email, "cmd" => "_xclick-subscriptions", "item_name" => JText :: _('Order ID:')." ".$order_id." - ".JText :: _('Payment for Membership Type:')." ".$msc_name, "order_id" => $order_id, "item_number" => $order_id, "invoice" => $order_number, "address_override" => "0", "first_name" => $billinginfo->firstname, "last_name" => $billinginfo->lastname, "address1" => $billinginfo->addr1, "address2" => $billinginfo->addr2, "zip" => $billinginfo->postcode, "city" => $billinginfo->city, "state" => $billinginfo->state, "email" => $user->email, "night_phone_b" => $billinginfo->telephone, "return" => JURI :: base()."index.php?option=com_osemsc&view=member&result=success&amount={$a3}&ordernumber={$order_number}", "notify_url" => JURI :: base()."components/com_osemsc/ipn/paypal_notify.php", "cancel_return" => JURI :: base()."index.php", "a3" => round($a3, 2), "p3" => $p3, "t3" => $t3, "src" => "1", "sra" => "1", "no_note" => "1", "invoice" => $order_number, "currency_code" => $currency, "cpp_header_image" => $vendor_image_url, "page_style" => "primary");
     		$html['form'] .= '<input type="image" id="paypal_image" name="submit" src="'."components/com_osemsc/assets/images/checkout.png".'" alt="'.JText :: _('Click to pay with PayPal - it is fast, free and secure!').'" />';
     	} else {
     		$a1= $orderInfoParams->total;
     		$p1= $orderInfoParams->p1;
     		$t1= $orderInfoParams->t1;
     
     		$a3= $orderInfoParams->next_total;
     		$p3= $orderInfoParams->p3;
     		$t3= $orderInfoParams->t3;
     
     		$t1= str_replace(substr($t1, 0, 1), strtoupper(substr($t1, 0, 1)), $t1);
     		$t3= str_replace(substr($t3, 0, 1), strtoupper(substr($t3, 0, 1)), $t3);
     
     		$post_variables= array("business" => $paypal_email, "cmd" => "_xclick-subscriptions", "item_name" => JText :: _('Order ID: ').$order_id." - ".JText :: _('Payment for Membership Type: ').$msc_name, "order_id" => $order_id, "item_number" => $order_id, "invoice" => $order_number, "address_override" => "0", "first_name" => $billinginfo->firstname, "last_name" => $billinginfo->lastname, "address1" => $billinginfo->addr1, "address2" => $billinginfo->addr2, "zip" => $billinginfo->postcode, "city" => $billinginfo->city, "state" => $billinginfo->state, "email" => $user->email, "night_phone_b" => $billinginfo->telephone, "return" => JURI :: base()."index.php?option=com_osemsc&view=member&result=success&amount={$a1}&ordernumber={$order_number}", "notify_url" => JURI :: base()."components/com_osemsc/ipn/paypal_notify.php", "cancel_return" => JURI :: base()."index.php", "a1" => $a1, "p1" => $p1, "t1" => $t1, "a3" => $a3, "p3" => $p3, "t3" => $t3, "src" => "1", "sra" => "1", "no_note" => "1", "invoice" => $order_number, "currency_code" => $currency, "cpp_header_image" => $vendor_image_url, "page_style" => "primary");
     		$html['form'] .= '<input type="image" id="paypal_image" name="submit" src="'."components/com_osemsc/assets/images/checkout.png".'" alt="'.JText :: _('Click to pay with PayPal - it is fast, free and secure!').'" />';
     	}
     }
     // Process payment variables;
     $html['url']= $url."?";
     foreach($post_variables as $name => $value) {
     	$html['form'] .= '<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'" />';
     	$html['url'] .= $name."=".urlencode($value)."&";
     }
     $html['form'] .= '</form>';
     */
     return $html;
 }
Beispiel #4
0
	private function drawMscListCart($msc_id, $osePaymentCurrency) {
		$buildList = oseRegistry::call('payment')->getInstance('MscList');
		$buildList->set('currency', $osePaymentCurrency);
		$tree = oseMscTree::retrieveTree($msc_id, 'obj');
		$first = $tree[0];
		unset($tree[0]);
		if (count($tree) > 0) {
			$firstNode = $buildList->drawParent($first);
			$firstNode = $buildList->drawFirst($firstNode);
			$subTree = $buildList->drawTree($first->id);
			$subTree = $buildList->drawSecond($subTree);
			$row = $this->drawRow(array($firstNode, $subTree));
		} else {
			$firstNode = $buildList->drawLeaf($first);
			$msc = oseRegistry::call('msc');
			$paymentInfos = $msc->getExtInfo($msc_id, 'payment');
			$options = oseMscPublic::generatePriceOption($first, $paymentInfos, $osePaymentCurrency);
			if (!empty($options)) {
				$option = array();
				foreach ($options as $obj) {
					$oAttr = array();
					$oAttr['option.value'] = 'value';
					$oAttr['option.attr'] = 'attr';
					$attrStr = 'title="%s" trial_price="%s" trial_recurrence="%s" standard_price="%s" standard_recurrence="%s" has_trial="%s"';
					$oAttr['attr'] = sprintf($attrStr, $obj['title'], oseObject::getValue($obj, 'trial_price', 0), oseObject::getValue($obj, 'trial_recurrence', 0),
							$obj['standard_price'], $obj['standard_recurrence'], oseObject::getValue($obj, 'has_trial', 0));
					$o = oseHTML::getInstance('Select')->option(oseObject::getValue($obj, 'id'), oseObject::getValue($obj, 'title'), $oAttr);
					$option[] = $o;
				}
				$basic = $options[0];
				$listAttr = array();
				$listAttr['list.attr'] = ' class="msc_options"  size="1" style="width:200px"';
				$listAttr['list.translate'] = false;
				$listAttr['option.key'] = 'value';
				$listAttr['id'] = 'msc_option_' . oseObject::getValue($first, 'id');
				$listAttr['option.text'] = 'text';
				$listAttr['list.select'] = oseObject::getValue($obj, 'id');
				$listAttr['option.attr'] = 'attr';
				$combo = oseHTML::getInstance('Select')->genericlist($option, 'msc_option', $listAttr);
				$firstNode['price'] = "<div class='msc-price-box'><span>" . JText::_('Options') . ":</span>" . $buildList->drawPrice($combo . '<div></div>') . '</div>';
			}
			$hackback = JText::_('Subscribe');
			$needle = JText::_('Add');
			if (isset($firstNode['button'])) {
				$firstNode['button'] = preg_replace("/{$hackback}/", $needle, $firstNode['button'], 1);
			}
			$firstNode = $buildList->drawFirst($firstNode);
			$row = $buildList->drawRow($firstNode);
		}
		$image = $buildList->getImage($first);
		$image = $buildList->drawImage($image);
		return $buildList->drawCard(array($image, $row));
	}