AAAAhome/academiac/www/plugins/vmpayment/paypal/paypal/helpers/paypalstd.php 0000604 00000041457 15137407707 0022662 0 ustar 00 _method->sandbox ) { $this->merchant_email = $this->_method->sandbox_merchant_email; } else { $this->merchant_email = $this->_method->paypal_merchant_email; } if (empty($this->merchant_email)) { $sandbox = ""; if ($this->_method->sandbox ) { $sandbox = 'SANDBOX_'; } $text = JText::sprintf('VMPAYMENT_PAYPAL_PARAMETER_REQUIRED', JText::_('VMPAYMENT_PAYPAL_' . $sandbox . 'MERCHANT'), $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id); vmError($text, $text); return FALSE; } } public function ManageCheckout() { return $this->preparePost(); } public function preparePost() { $post_variables = $this->initPostVariables($this->_method->payment_type); $paymentCurrency = CurrencyDisplay::getInstance($this->_method->payment_currency); switch ($this->_method->payment_type) { case '_xclick': case '_donations': $post_variables['item_name'] = JText::_('COM_VIRTUEMART_ORDER_NUMBER') . ': ' . $this->order['details']['BT']->order_number; $post_variables['amount'] = $this->total; break; case '_oe-gift-certificate': $post_variables['item_name'] = JText::_('COM_VIRTUEMART_ORDER_NUMBER') . ': ' . $this->order['details']['BT']->order_number; //$post_variables['amount'] = round ($paymentCurrency->convertCurrencyTo ($this->_method->payment_currency, $this->order['details']['BT']->order_total, FALSE), 2);; $post_variables['fixed_denom'] = vmPSPlugin::getAmountValueInCurrency($this->order['details']['BT']->order_salesPrice, $this->_method->payment_currency); //$post_variables['min_denom'] = $this->total; //$post_variables['max_denom'] = $this->total; $post_variables['shopping_url'] = JURI::root(); $post_variables['buyer_name'] = $this->order['details']['BT']->first_name . ' ' . $this->order['details']['BT']->last_name; if (array_key_exists('ST', $this->order['details'])) { $post_variables['recipient_name'] = $this->order['details']['ST']->first_name . ' ' . $this->order['details']['ST']->last_name; } break; case '_cart': $this->addPrices($post_variables); break; case '_xclick-subscriptions': $post_variables['item_name'] = JText::_('COM_VIRTUEMART_ORDER_NUMBER') . ': ' . $this->order['details']['BT']->order_number; if ($this->_method->subcription_trials) { $post_variables['a1'] = ($this->_method->trial1_price) ? $this->_method->trial1_price : 0; //Trial1 price. $post_variables['p1'] = $this->getDurationValue($this->_method->trial1_duration); $post_variables['t1'] = $this->getDurationUnit($this->_method->trial1_duration); } /*if ($this->_method->subcription_trials == 2) { $post_variables['a2'] = ($this->_method->trial2_price) ? $this->_method->trial2_price : 0; //Trial2 price. $post_variables['p2'] = $this->getDurationValue($this->_method->trial2_duration); $post_variables['t2'] = $this->getDurationUnit($this->_method->trial2_duration); }*/ $post_variables['a3'] = $this->total; //Regular subscription price. $post_variables['p3'] = $this->getDurationValue($this->_method->subscription_duration); $post_variables['t3'] = $this->getDurationUnit($this->_method->subscription_duration); $post_variables['src'] = 1; //Recurring payments. Subscription payments recur unless subscribers cancel their subscriptions before the end of the current billing cycle or you limit the number of times that payments recur with the value that you specify for srt $post_variables['srt'] = $this->_method->subscription_term; //Recurring times. Number of times that subscription payments recur. Specify an integer with a minimum value of 1 and a maximum value of 52. Valid only if you specify src="1" $post_variables['sra'] = 1; //Reattempt on failure. If a recurring payment fails, PayPal attempts to collect the payment two more times before canceling the subscription. $post_variables['modify'] = 0; //Modification behavior. Allowable values are: //0 – allows subscribers only to sign up for new subscriptions, //1 – allows subscribers to sign up for new subscriptions and modify their current subscriptions //2 – allows subscribers to modify only their current subscriptions break; case '_xclick-auto-billing': $post_variables['item_name'] = JText::_('COM_VIRTUEMART_ORDER_NUMBER') . ': ' . $this->order['details']['BT']->order_number; //A description of the automatic billing plan. $post_variables['max_text'] = $this->_method->payment_desc; //Specify whether to let buyers enter maximum billing limits in a text box or choose from a list of maximum billing limits that you specify. //Allowable values are: //max_limit_own – your button displays a text box for buyers to enter their own maximums above a minimum billing limit that you set with the min_amount variable. //max_limit_defined – your button displays a dropdown menu of product options with prices to let buyers choose their maximum billing limits. $post_variables['set_customer_limit'] = 'max_limit_defined'; //The minimum monthly billing limit, if you have one. Valid only if set_customer_limit = max_limit_own. //$post_variables['min_amount'] = 0; $post_variables['min_amount'] = $this->total; switch ($this->_method->billing_max_amount_type) { case 'cust': $post_variables["max_amount"] = vmPSPlugin::getAmountValueInCurrency($this->customerData->getVar('autobilling_max_amount'), $this->_method->payment_currency); break; case 'value': $post_variables["max_amount"] = vmPSPlugin::getAmountValueInCurrency($this->_method->billing_max_amount, $this->_method->payment_currency); break; case 'perc': $percentage = $this->_method->billing_max_amount; $max_amount = ($this->total * floatval($percentage)) / 100 + $this->total; $post_variables['max_amount'] = round($max_amount, 2); break; case 'cart': default: $post_variables['max_amount'] = $this->total; break; } break; case '_xclick-payment-plan': $post_variables['item_name'] = JText::_('COM_VIRTUEMART_ORDER_NUMBER') . ': ' . $this->order['details']['BT']->order_number; $post_variables['disp_tot'] = 'Y'; //Display the total payment amount to buyers during checkout $post_variables['option_index'] = 0; $post_variables['option_select0_type'] = 'E'; //F – pay in full, at checkout, E – pay in equal periods, beginning at checkout or sometime later, V – pay in variable periods, beginning at checkout if ($this->_method->payment_plan_defer) { $post_variables['option_select0_a0'] = '0.00'; $post_variables['option_select0_p0'] = $this->getDurationValue($this->_method->payment_plan_defer_duration); $post_variables['option_select0_t0'] = $this->getDurationUnit($this->_method->payment_plan_defer_duration); $post_variables['option_select0_n0'] = 1; $post_variables['option_select0_a1'] = round($this->total / $this->_method->payment_plan_term, 2); $post_variables['option_select0_p1'] = $this->getDurationValue($this->_method->payment_plan_duration); $post_variables['option_select0_t1'] = $this->getDurationUnit($this->_method->payment_plan_duration); $post_variables['option_select0_n1'] = $this->_method->payment_plan_term; } else { $post_variables['option_select0_a0'] = round($this->total / $this->_method->payment_plan_term, 2); $post_variables['option_select0_p0'] = $this->getDurationValue($this->_method->payment_plan_duration); $post_variables['option_select0_t0'] = $this->getDurationUnit($this->_method->payment_plan_duration); $post_variables['option_select0_n0'] = $this->_method->payment_plan_term; } $post_variables['os0'] = 'pay-in-' . $this->_method->payment_plan_term; $post_variables['option_select0'] = 'pay-in-' . $this->_method->payment_plan_term; $post_variables['option_select0_name'] = $this->_method->payment_name; } $url = $this->_getPayPalUrl(); // add spin image $html = '