103         $this->
init(
'oxpayments');
 
  113         $this->_blPaymentVatOnTop = $blOnTop;
 
  123         if ($this->_oGroups == null && ($sOxid = $this->
getId())) {
 
  126             $this->_oGroups = 
oxNew(
'oxlist', 
'oxgroups');
 
  130             $sSelect = 
"select {$sViewName}.* from {$sViewName}, oxobject2group 
  131                         where oxobject2group.oxobjectid = '{$sOxid}' 
  132                         and oxobject2group.oxgroupsid={$sViewName}.oxid ";
 
  133             $this->_oGroups->selectString($sSelect);
 
  146         $this->_aDynValues = $aDynValues;
 
  157         $this->_aDynValues[$oKey] = $oVal;
 
  167         if (!$this->_aDynValues) {
 
  168             $sRawDynValue = null;
 
  169             if (is_object($this->oxpayments__oxvaldesc)) {
 
  170                 $sRawDynValue = $this->oxpayments__oxvaldesc->getRawValue();
 
  190         if ($this->oxpayments__oxaddsumtype->value == 
"%") {
 
  191             $dRet = $dBasePrice * $this->oxpayments__oxaddsum->value / 100;
 
  193             $oCur = $this->
getConfig()->getActShopCurrencyObject();
 
  194             $dRet = $this->oxpayments__oxaddsum->value * $oCur->rate;
 
  197         if (($dRet * -1) > $dBasePrice) {
 
  215         $iRules = $this->oxpayments__oxaddsumrules->value;
 
  218         if (!$iRules || ($iRules & self::PAYMENT_ADDSUMRULE_ALLGOODS)) {
 
  219             $dBasketPrice += $oBasket->getProductsPrice()->getSum($oBasket->isCalculationModeNetto());
 
  223         if ((!$iRules || ($iRules & self::PAYMENT_ADDSUMRULE_DISCOUNTS)) &&
 
  224             ($oCosts = $oBasket->getTotalDiscount())
 
  226             $dBasketPrice -= $oCosts->getPrice();
 
  230         if (!$iRules || ($iRules & self::PAYMENT_ADDSUMRULE_VOUCHERS)) {
 
  231             $dBasketPrice -= $oBasket->getVoucherDiscValue();
 
  235         if ((!$iRules || ($iRules & self::PAYMENT_ADDSUMRULE_SHIPCOSTS)) &&
 
  236             ($oCosts = $oBasket->getCosts(
'oxdelivery'))
 
  238             if ($oBasket->isCalculationModeNetto()) {
 
  239                 $dBasketPrice += $oCosts->getNettoPrice();
 
  241                 $dBasketPrice += $oCosts->getBruttoPrice();
 
  247         if (($iRules & self::PAYMENT_ADDSUMRULE_GIFTS) &&
 
  248             ($oCosts = $oBasket->getCosts(
'oxwrapping'))
 
  250             if ($oBasket->isCalculationModeNetto()) {
 
  251                 $dBasketPrice += $oCosts->getNettoPrice();
 
  253                 $dBasketPrice += $oCosts->getBruttoPrice();
 
  258         if (($iRules & self::PAYMENT_ADDSUMRULE_GIFTS) &&
 
  259             ($oCosts = $oBasket->getCosts(
'oxgiftcard'))
 
  262             if ($oBasket->isCalculationModeNetto()) {
 
  263                 $dBasketPrice += $oCosts->getNettoPrice();
 
  265                 $dBasketPrice += $oCosts->getBruttoPrice();
 
  269         return $dBasketPrice;
 
  284             $oPrice = 
oxNew(
'oxPrice');
 
  285             $oPrice->setNettoMode($this->_blPaymentVatOnTop);
 
  287             $oPrice->setPrice($dPrice);
 
  289                 $oPrice->setVat($oBasket->getAdditionalServicesVatPercent());
 
  292             $this->_oPrice = $oPrice;
 
  295             $oPrice = 
oxNew(
'oxPrice');
 
  296             $oPrice->setPrice(0);
 
  297             $this->_oPrice = $oPrice;
 
  361         if ($this->_aCountries === null) {
 
  363             $this->_aCountries = array();
 
  364             $sSelect = 
'select oxobjectid from oxobject2payment where oxpaymentid=' . $oDb->quote($this->
getId()) . 
' and oxtype = "oxcountry" ';
 
  365             $rs = $oDb->getCol($sSelect);
 
  366             $this->_aCountries = $rs;
 
  379     public function delete($sOxId = null)
 
  381         if (parent::delete($sOxId)) {
 
  383             $sOxId = $sOxId ? $sOxId : $this->
getId();
 
  387             $rs = $oDb->execute(
"delete from oxobject2payment where oxpaymentid = " . $oDb->quote($sOxId));
 
  406     public function isValidPayment($aDynValue, $sShopId, $oUser, $dBasketPrice, $sShipSetId)
 
  409         if ($this->oxpayments__oxid->value == 
'oxempty') {
 
  411             if (!$this->oxpayments__oxactive->value || !
$myConfig->getConfigParam(
"blOtherCountryOrder")) {
 
  412                 $this->_iPaymentError = -2;
 
  418                     ->getDeliverySetList(
 
  420                         $oUser->getActiveCountry()
 
  424                 $this->_iPaymentError = -3;
 
  432         $mxValidationResult = 
oxRegistry::get(
"oxInputValidator")->validatePaymentInputData($this->oxpayments__oxid->value, $aDynValue);
 
  434         if (is_integer($mxValidationResult)) {
 
  435             $this->_iPaymentError = $mxValidationResult;
 
  438         } elseif ($mxValidationResult === 
false) {
 
  439             $this->_iPaymentError = 1;
 
  444         $oCur = 
$myConfig->getActShopCurrencyObject();
 
  445         $dBasketPrice = $dBasketPrice / $oCur->rate;
 
  448             $aPaymentList = 
oxRegistry::get(
"oxPaymentList")->getPaymentList($sShipSetId, $dBasketPrice, $oUser);
 
  450             if (!array_key_exists($this->
getId(), $aPaymentList)) {
 
  451                 $this->_iPaymentError = -3;
 
  456             $this->_iPaymentError = -2;