Пример #1
0
 /**
  * @param $total
  */
 public function setTotal($total)
 {
     if (!class_exists('CurrencyDisplay')) {
         require JPATH_VM_ADMINISTRATOR . '/helpers/currencydisplay.php';
     }
     $this->total = vmPSPlugin::getAmountValueInCurrency($total, $this->_method->payment_currency);
     $cd = CurrencyDisplay::getInstance($this->cart->pricesCurrency);
 }
Пример #2
0
 /**
  * Après versement d’un acompte immédiat, le solde à payer est divisé en 1, 2, ... 6 fois
  * dont la date anniversaire peut être différente de celle du paiement immédiat.
  * Chaque échéance pour le paiement du solde sera présentée à 1 mois d’intervalle à la date anniversaire définie
  * si elle est différente du paiement initial.
  *
  * Indiquer une valeur pour la variable MONTANT qui sera immédiatement présentée en banque,
  * MONTANT2 le montant du solde.
  * EXTRA, le nombre d’échéances souhaitées.
  *
  *
  * OU
  *     * Paiement d’un acompte immédiat et paiement du solde à une date définie.
  *
  * Indiquer le montant à débiter immédiatement dans la variable MONTANT,
  * le solde à débiter dans MONTANT2 et
  * indiquer la date pour le paiement du solde dans la variable DATE2.
  *
  * @param $totalInPaymentCurrency
  */
 function getRecurringDeposit()
 {
     $totalInPaymentCurrency = $this->getTotal();
     if (preg_match('/%$/', $this->_method->recurring_deposit)) {
         $deposit = substr($this->_method->recurring_deposit, 0, -1);
         $recurring_deposit = $totalInPaymentCurrency * $deposit * 0.01;
     } else {
         $recurring_deposit = $this->_method->recurring_deposit;
         if (!class_exists('CurrencyDisplay')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
         }
         $recurring_deposit = vmPSPlugin::getAmountValueInCurrency($recurring_deposit, $this->_method->payment_currency);
         $cd = CurrencyDisplay::getInstance($this->cart->pricesCurrency);
     }
     $montant_currency = vmPSPlugin::getAmountInCurrency($recurring_deposit, $this->_method->payment_currency);
     $montant2_currency = vmPSPlugin::getAmountInCurrency($totalInPaymentCurrency - $recurring_deposit, $this->_method->payment_currency);
     $cd = CurrencyDisplay::getInstance($this->cart->pricesCurrency);
     $recurring["MONTANT"] = number_format($recurring_deposit, 2, '.', '');
     $recurring["MONTANT2"] = $montant2_currency['value'];
     if ($this->_method->recurring_number > 2) {
         $recurring["EXTRA"] = $this->_method->recurring_number - 1 . "FOIS";
     }
     if ($this->_method->recurring_date) {
         $recurring["DATE2"] = $this->getNextTermDate();
     }
     $recurring["info"] = vmText::sprintf('VMPAYMENT_KLIKANDPAY_COMMENT_RECURRING_DEPOSIT', $this->_method->recurring_number, $montant_currency['display']);
     return $recurring;
 }
Пример #3
0
 function addPrices(&$post_variables)
 {
     $paymentCurrency = CurrencyDisplay::getInstance($this->_method->payment_currency);
     $i = 1;
     // Product prices
     if ($this->cart->products) {
         foreach ($this->cart->products as $key => $product) {
             $post_variables["item_name_" . $i] = $this->getItemName($product->product_name);
             if ($product->product_sku) {
                 $post_variables["item_number_" . $i] = $product->product_sku;
             }
             $post_variables["amount_" . $i] = $this->getProductAmount($this->cart->cartPrices[$key]);
             $post_variables["quantity_" . $i] = $product->quantity;
             $i++;
         }
     }
     $post_variables["handling_cart"] = $this->getHandlingAmount();
     $post_variables["handling_cart"] += vmPSPlugin::getAmountValueInCurrency($this->cart->cartPrices['salesPriceShipment'], $this->_method->payment_currency);
     $post_variables['currency_code'] = $this->currency_code_3;
     if (!empty($this->cart->cartPrices['salesPriceCoupon'])) {
         $post_variables['discount_amount_cart'] = abs(vmPSPlugin::getAmountValueInCurrency($this->cart->cartPrices['salesPriceCoupon'], $this->_method->payment_currency));
     }
     $pricesCurrency = CurrencyDisplay::getInstance($this->cart->pricesCurrency);
 }
Пример #4
0
 /**
  * https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/
  * @param $post_variables
  */
 function addPrices(&$post_variables)
 {
     $paymentCurrency = CurrencyDisplay::getInstance($this->_method->payment_currency);
     $i = 0;
     $taxAmount = 0;
     $total = 0;
     // Product prices
     if ($this->cart->products) {
         foreach ($this->cart->products as $key => $product) {
             $post_variables["L_PAYMENTREQUEST_0_NAME" . $i] = $this->getItemName($product->product_name);
             if ($product->product_sku) {
                 $post_variables["L_PAYMENTREQUEST_0_NUMBER" . $i] = $product->product_sku;
             }
             $post_variables["L_PAYMENTREQUEST_0_AMT" . $i] = $this->getProductAmount($this->cart->pricesUnformatted[$key]);
             $post_variables["L_PAYMENTREQUEST_0_QTY" . $i] = $product->quantity;
             $total += $post_variables["L_PAYMENTREQUEST_0_AMT" . $i] * $post_variables["L_PAYMENTREQUEST_0_QTY" . $i];
             $i++;
         }
     }
     // Handling Coupon (handling must be positive value, add then coupon as a product with negative value
     if (!empty($this->cart->pricesUnformatted['salesPriceCoupon'])) {
         $post_variables["L_PAYMENTREQUEST_0_NAME" . $i] = vmText::_('COM_VIRTUEMART_COUPON_DISCOUNT') . ': ' . $this->cart->couponCode;
         $post_variables["L_PAYMENTREQUEST_0_AMT" . $i] = vmPSPlugin::getAmountValueInCurrency($this->cart->pricesUnformatted['salesPriceCoupon'], $this->_method->payment_currency);
         $post_variables["L_PAYMENTREQUEST_0_QTY" . $i] = 1;
         $total += $post_variables["L_PAYMENTREQUEST_0_AMT" . $i] * $post_variables["L_PAYMENTREQUEST_0_QTY" . $i];
     }
     $post_variables["PAYMENTREQUEST_0_ITEMAMT"] = $total;
     $salesPriceShipment = vmPSPlugin::getAmountValueInCurrency($this->cart->pricesUnformatted['salesPriceShipment'], $this->_method->payment_currency);
     if ($salesPriceShipment >= 0) {
         $post_variables["PAYMENTREQUEST_0_SHIPPINGAMT"] = $salesPriceShipment;
     } else {
         $post_variables["PAYMENTREQUEST_0_SHIPDISCAMT"] = $salesPriceShipment;
     }
     $total += $salesPriceShipment;
     $handling = $this->getHandlingAmount();
     $post_variables["PAYMENTREQUEST_0_HANDLINGAMT"] = $handling;
     $total += $handling;
     $post_variables['PAYMENTREQUEST_0_AMT'] = $total;
     $post_variables['PAYMENTREQUEST_0_CURRENCYCODE'] = $this->currency_code_3;
     $pricesCurrency = CurrencyDisplay::getInstance($this->cart->pricesCurrency);
 }
Пример #5
0
	/**
	 * @param $client
	 * @param $total
	 * @param $backToPricesCurrency
	 * @return array
	 */
	private function getTotalInPaymentCurrency ($client, $total, $backToPricesCurrency) {
		if (!class_exists('CurrencyDisplay')) {
			require(JPATH_VM_ADMINISTRATOR . '/helpers/currencydisplay.php');
		}
		$virtuemart_currency_id = $this->getCurrencyId($client);
		$totalInPaymentCurrency = vmPSPlugin::getAmountValueInCurrency($total, $virtuemart_currency_id);
		//$this->debugLog($totalInPaymentCurrency, __FUNCTION__, 'debug');

		$cd = CurrencyDisplay::getInstance($backToPricesCurrency);

		return $totalInPaymentCurrency;
	}
Пример #6
0
 /**
  * @param $post_variables
  */
 function addPrices(&$post_variables)
 {
     $paymentCurrency = CurrencyDisplay::getInstance($this->_method->payment_currency);
     $i = 1;
     $taxAmount = 0;
     $ITEMAMT = 0;
     $TAXAMT = 0;
     $lastId = 0;
     // Product prices
     if ($this->cart->products) {
         foreach ($this->cart->products as $key => $product) {
             $post_variables["L_NAME" . $i] = $this->getItemName($product->product_name);
             if ($product->product_sku) {
                 $post_variables["L_NUMBER" . $i] = $product->product_sku;
             }
             $post_variables["L_AMT" . $i] = $this->getProductAmountWithoutTax($this->cart->cartPrices[$key]);
             $post_variables["L_QTY" . $i] = $product->quantity;
             $post_variables["L_TAXAMT" . $i] = $this->getProductTaxAmount($this->cart->cartPrices[$key]);
             // Item sales tax
             $taxAmount += $post_variables["L_TAXAMT" . $i];
             $ITEMAMT += $post_variables["L_AMT" . $i] * $post_variables["L_QTY" . $i];
             $TAXAMT += $post_variables["L_TAXAMT" . $i];
             $lastId = $i;
             $i++;
         }
     }
     // Handling Coupon (handling must be positive value, add then coupon as a product with negative value
     if (!empty($this->cart->cartPrices['salesPriceCoupon'])) {
         $post_variables["L_NAME" . $i] = tsmText::_('COM_VIRTUEMART_COUPON_DISCOUNT') . ': ' . $this->cart->couponCode;
         $post_variables["L_AMT" . $i] = vmPSPlugin::getAmountValueInCurrency($this->cart->cartPrices['salesPriceCoupon'], $this->_method->payment_currency);
         $post_variables["L_QTY" . $i] = 1;
         $ITEMAMT += $post_variables["L_AMT" . $i] * $post_variables["L_QTY" . $i];
         //$TAXAMT +=$post_variables["L_TAXAMT" . $i];
     }
     if ($this->cart->cartPrices['paymentValue']) {
         $paymentValue = vmPSPlugin::getAmountValueInCurrency($this->cart->cartPrices['paymentValue'], $this->_method->payment_currency);
         $post_variables["L_NAME" . $i] = tsmText::_('COM_VIRTUEMART_PAYMENT');
         $post_variables["L_AMT" . $i] = $paymentValue;
         $post_variables["L_TAXAMT" . $i] = vmPSPlugin::getAmountValueInCurrency($this->cart->cartPrices['paymentTax'], $this->_method->payment_currency);
         // Item sales tax
         $post_variables["L_QTY" . $i] = 1;
         $ITEMAMT += $post_variables["L_AMT" . $i] * $post_variables["L_QTY" . $i];
         $TAXAMT += $post_variables["L_TAXAMT" . $i];
         $lastId = $i;
     }
     // shipment value must include tax
     $shipmentValue = vmPSPlugin::getAmountValueInCurrency($this->cart->cartPrices['salesPriceShipment'], $this->_method->payment_currency);
     if ($shipmentValue >= 0) {
         $post_variables["SHIPPINGAMT"] = $shipmentValue;
         // Total shipping costs for this order.
     } else {
         $post_variables["SHIPDISCAMT"] = $shipmentValue;
         // Shipping discount for this order, specified as a negative number.
     }
     $handling = $this->getHandlingAmount();
     $post_variables["HANDLINGAMT"] = $handling;
     $post_variables['CURRENCYCODE'] = $this->currency_code_3;
     $post_variables['AMT'] = $this->total;
     $post_variables['TAXAMT'] = $TAXAMT;
     // Sum of tax for all items in this order.
     //$post_variables['ITEMAMT'] = vmPSPlugin::getAmountValueInCurrency($this->cart->cartPrices['priceWithoutTax'], $this->_method->payment_currency);
     $post_variables['ITEMAMT'] = $ITEMAMT;
     $pricesCurrency = CurrencyDisplay::getInstance($this->cart->pricesCurrency);
 }
Пример #7
0
	/**
	 * https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/
	 * @param $post_variables
	 */
	function addPrices(&$post_variables) {

		$paymentCurrency = CurrencyDisplay::getInstance($this->_method->payment_currency);
		$i = 0;
		$taxAmount = 0;
		// Product prices
		if ($this->cart->products) {
			foreach ($this->cart->products as $key => $product) {
				$post_variables["L_PAYMENTREQUEST_0_NAME" . $i] = $this->getItemName($product->product_name);
				if ($product->product_sku) {
					$post_variables["L_PAYMENTREQUEST_0_NUMBER" . $i] = $product->product_sku;
				}
				$post_variables["L_PAYMENTREQUEST_0_AMT" . $i] = $this->getProductAmount($this->cart->pricesUnformatted[$key]);
				$post_variables["L_PAYMENTREQUEST_0_QTY" . $i] = $product->quantity;
				$i++;
			}
		}

		$post_variables["PAYMENTREQUEST_0_ITEMAMT"] = vmPSPlugin::getAmountValueInCurrency($this->cart->pricesUnformatted['salesPrice'], $this->_method->payment_currency);
		$salesPriceShipment = vmPSPlugin::getAmountValueInCurrency($this->cart->pricesUnformatted['salesPriceShipment'], $this->_method->payment_currency);
		if ($salesPriceShipment >= 0) {
			$post_variables["PAYMENTREQUEST_0_SHIPPINGAMT"] = $salesPriceShipment;
		} else {
			$post_variables["PAYMENTREQUEST_0_SHIPDISCAMT"] = $salesPriceShipment;
		}

		$handling = $this->getHandlingAmount();
		if (!empty($this->cart->pricesUnformatted['salesPriceCoupon'])) {
			$handling += vmPSPlugin::getAmountValueInCurrency($this->cart->pricesUnformatted['salesPriceCoupon'], $this->_method->payment_currency);
		}
		$post_variables["PAYMENTREQUEST_0_HANDLINGAMT"] = $handling;
		$post_variables['PAYMENTREQUEST_0_AMT'] = $this->total;
		$post_variables['PAYMENTREQUEST_0_CURRENCYCODE'] = $this->currency_code_3;

		$pricesCurrency = CurrencyDisplay::getInstance($this->cart->pricesCurrency);
	}
Пример #8
0
 public function setTotalInPaymentCurrency($total)
 {
     if (!class_exists('CurrencyDisplay')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
     }
     $this->total = vmPSPlugin::getAmountValueInCurrency($total, $this->_method->payment_currency) * 100;
     $cd = CurrencyDisplay::getInstance($this->cart->pricesCurrency);
 }