/** * Checks if the country code is allowed for the service provider. * * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object * @return boolean True if payment provider can be used, false if not */ public function isAvailable(\Aimeos\MShop\Order\Item\Base\Iface $basket) { $addresses = $basket->getAddresses(); $paymentType = \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT; $deliveryType = \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY; if (isset($addresses[$deliveryType])) { $code = strtoupper($addresses[$deliveryType]->getCountryId()); if ($this->checkCountryCode($code, 'country.delivery-include') === false || $this->checkCountryCode($code, 'country.delivery-exclude') === true) { return false; } } else { if (isset($addresses[$paymentType])) { $code = strtoupper($addresses[$paymentType]->getCountryId()); if ($this->checkCountryCode($code, 'country.delivery-include') === false || $this->checkCountryCode($code, 'country.delivery-exclude') === true) { return false; } } } if (isset($addresses[$paymentType])) { $code = strtoupper($addresses[$paymentType]->getCountryId()); if ($this->checkCountryCode($code, 'country.billing-include') === false || $this->checkCountryCode($code, 'country.billing-exclude') === true) { return false; } } return $this->getProvider()->isAvailable($basket); }
/** * Checks if payment provider can be used based on the basket content. * Checks for country, currency, address, scoring, etc. should be implemented in separate decorators * * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object * @return boolean True if payment provider can be used, false if not */ public function isAvailable(\Aimeos\MShop\Order\Item\Base\Iface $basket) { if ($basket->getLocale()->getLanguageId() === 'en') { return $this->getProvider()->isAvailable($basket); } return false; }
/** * Returns the configuration attribute definitions of the provider to generate a list of available fields and * rules for the value of each field in the frontend. * * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object * @return array List of attribute definitions implementing \Aimeos\MW\Common\Critera\Attribute\Iface */ public function getConfigFE(\Aimeos\MShop\Order\Item\Base\Iface $basket) { $list = array(); $feconfig = $this->feConfig; try { $attrs = $basket->getService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT)->getAttributes(); foreach ($attrs as $item) { if (isset($feconfig[$item->getCode()])) { $feconfig[$item->getCode()]['default'] = $item->getValue(); } } } catch (\Aimeos\MShop\Order\Exception $e) { } // If payment isn't available yet try { $address = $basket->getAddress(); if ($feconfig['novalnetsepa.holder']['default'] == '' && ($fn = $address->getFirstname()) !== '' && ($ln = $address->getLastname()) !== '') { $feconfig['novalnetsepa.holder']['default'] = $fn . ' ' . $ln; } } catch (\Aimeos\MShop\Order\Exception $e) { } // If address isn't available foreach ($feconfig as $key => $config) { $list[$key] = new \Aimeos\MW\Criteria\Attribute\Standard($config); } return $list; }
/** * Checks if the the basket weight is ok for the service provider. * * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object * @return boolean True if payment provider can be used, false if not */ public function isAvailable(\Aimeos\MShop\Order\Item\Base\Iface $basket) { $context = $this->getContext(); $prodMap = array(); $basketWeight = 0; foreach ($basket->getProducts() as $basketItem) { $prodId = $basketItem->getProductId(); // basket can contain a product several times in different basket items if (!isset($prodMap[$prodId])) { $prodMap[$prodId] = 0.0; } $prodMap[$prodId] += $basketItem->getQuantity(); } $propertyManager = \Aimeos\MShop\Factory::createManager($context, 'product/property'); $search = $propertyManager->createSearch(true); $expr = array($search->compare('==', 'product.property.parentid', array_keys($prodMap)), $search->compare('==', 'product.property.type.code', 'package-weight'), $search->getConditions()); $search->setConditions($search->combine('&&', $expr)); $search->setSlice(0, 0x7fffffff); // if more than 100 products are in the basket foreach ($propertyManager->searchItems($search) as $property) { $basketWeight += (double) $property->getValue() * $prodMap[$property->getParentId()]; } if ($this->checkWeightScale($basketWeight) === false) { return false; } return $this->getProvider()->isAvailable($basket); }
/** * Checks if the country code is allowed for the service provider. * * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object * @return boolean True if payment provider can be used, false if not */ public function isAvailable(\Aimeos\MShop\Order\Item\Base\Iface $basket) { $code = strtoupper($basket->getPrice()->getCurrencyId()); if ($this->checkCurrencyCode($code, 'currency.include') === false || $this->checkCurrencyCode($code, 'currency.exclude') === true) { return false; } return $this->getProvider()->isAvailable($basket); }
/** * Checks if the service provider should be available. * * Tests products in basket if they have a download attribute. The method * returns true if "download.all" is "1" and all products contain the * attribute resp. if "download.all" is "0" and at least one product * contains no download attribute. * * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object * @return boolean True if payment provider can be used, false if not */ public function isAvailable(\Aimeos\MShop\Order\Item\Base\Iface $basket) { $val = (bool) $this->getConfigValue(array('download.all')); foreach ($basket->getProducts() as $product) { if ((bool) count($product->getAttributes('download')) !== $val) { return !$val; } } return $this->getProvider()->isAvailable($basket); }
/** * Returns the price when using the provider. * Usually, this is the lowest price that is available in the service item but can also be a calculated based on * the basket content, e.g. 2% of the value as transaction cost. * * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object * @return \Aimeos\MShop\Price\Item\Iface Price item containing the price, shipping, rebate */ public function calcPrice(\Aimeos\MShop\Order\Item\Base\Iface $basket) { $config = $this->getServiceItem()->getConfig(); if (!isset($config['costs.percent'])) { throw new \Aimeos\MShop\Service\Provider\Exception(sprintf('Missing configuration "%1$s"', 'costs.percent')); } $value = $basket->getPrice()->getValue() * $config['costs.percent'] / 100; $price = $this->getProvider()->calcPrice($basket); $price->setCosts($price->getCosts() + $value); return $price; }
/** * Checks for requirements. * * @param \Aimeos\MShop\Order\Item\Base\Iface $base Basic order of the customer * @return boolean True if the requirements are met, false if not */ public function isAvailable(\Aimeos\MShop\Order\Item\Base\Iface $base) { if (($prodcode = $this->getConfigValue('required.productcode')) !== null) { foreach ($base->getProducts() as $product) { if ($product->getProductCode() == $prodcode) { return parent::isAvailable($base); } } return false; } return true; }
/** * Checks for the min/max order value. * * @param \Aimeos\MShop\Order\Item\Base\Iface $base Basic order of the customer * @return boolean True if the basket matches the constraints, false if not */ public function isAvailable(\Aimeos\MShop\Order\Item\Base\Iface $base) { $price = $base->getPrice(); $currency = $price->getCurrencyId(); $value = $price->getValue() + $price->getRebate(); $minvalue = $this->getConfigValue('basketvalues.total-value-min', array()); if (isset($minvalue[$currency]) && $minvalue[$currency] > $value) { return false; } $maxvalue = $this->getConfigValue('basketvalues.total-value-max', array()); if (isset($maxvalue[$currency]) && $maxvalue[$currency] < $value) { return false; } return parent::isAvailable($base); }
/** * Returns the configuration attribute definitions of the provider to generate a list of available fields and * rules for the value of each field in the frontend. * * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object * @return array List of attribute definitions implementing \Aimeos\MW\Common\Critera\Attribute\Iface */ public function getConfigFE(\Aimeos\MShop\Order\Item\Base\Iface $basket) { $list = array(); $feconfig = $this->feConfig; try { $address = $basket->getAddress(); if (($fn = $address->getFirstname()) !== '' && ($ln = $address->getLastname()) !== '') { $feconfig['directdebit.accountowner']['default'] = $fn . ' ' . $ln; } } catch (\Aimeos\MShop\Order\Exception $e) { } // If address isn't available foreach ($feconfig as $key => $config) { $list[$key] = new \Aimeos\MW\Criteria\Attribute\Standard($config); } return $list; }
/** * Tests if the shipping threshold is reached and updates the price accordingly * * @param \Aimeos\MShop\Order\Item\Base\Iface $order Basket object * @param \Aimeos\MShop\Price\Item\Iface $price Delivery price item * @param array $threshold Associative list of currency/threshold pairs */ protected function checkThreshold(\Aimeos\MShop\Order\Item\Base\Iface $order, \Aimeos\MShop\Price\Item\Iface $price, array $threshold) { $currency = $price->getCurrencyId(); if (!isset($threshold[$currency])) { return; } $sum = \Aimeos\MShop\Factory::createManager($this->getContext(), 'price')->createItem(); foreach ($order->getProducts() as $product) { $sum->addItem($product->getPrice(), $product->getQuantity()); } if ($sum->getValue() + $sum->getRebate() >= $threshold[$currency] && $price->getCosts() > '0.00') { $price->setRebate($price->getCosts()); $price->setCosts('0.00'); } else { if ($sum->getValue() + $sum->getRebate() < $threshold[$currency] && $price->getRebate() > '0.00') { $price->setCosts($price->getRebate()); $price->setRebate('0.00'); } } }
/** * Checks if the the basket weight is ok for the service provider. * * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object * @return boolean True if payment provider can be used, false if not */ public function isAvailable(\Aimeos\MShop\Order\Item\Base\Iface $basket) { $prodMap = array(); // basket can contain a product several times in different basket items // product IDs are only those of articles, selections and bundles, not of the variants and bundled products foreach ($basket->getProducts() as $basketItem) { $qty = $basketItem->getQuantity(); $code = $basketItem->getProductCode(); $prodMap[$code] = isset($prodMap[$code]) ? $prodMap[$code] + $qty : $qty; foreach ($basketItem->getProducts() as $prodItem) { $qty = $prodItem->getQuantity(); $code = $prodItem->getProductCode(); $prodMap[$code] = isset($prodMap[$code]) ? $prodMap[$code] + $qty : $qty; } } if ($this->checkWeightScale($this->getWeight($prodMap)) === false) { return false; } return $this->getProvider()->isAvailable($basket); }
/** * Returns a list of tax rates and values for the given basket. * * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket containing the products, services, etc. * @return array Associative list of tax rates as key and corresponding amounts as value */ protected function getTaxRates(\Aimeos\MShop\Order\Item\Base\Iface $basket) { $taxrates = array(); foreach ($basket->getProducts() as $product) { $price = $product->getSumPrice(); $taxrate = $price->getTaxrate(); if (isset($taxrates[$taxrate])) { $taxrates[$taxrate]->addItem($price); } else { $taxrates[$taxrate] = $price->setQuantity(1); // sum is already calculated } } try { $price = clone $basket->getService('delivery')->getPrice(); $taxrate = $price->getTaxrate(); if (isset($taxrates[$taxrate])) { $taxrates[$taxrate]->addItem($price, $price->getQuantity()); } else { $taxrates[$taxrate] = $price->setQuantity(1); // only single price } } catch (\Exception $e) { } // if delivery service isn't available try { $price = clone $basket->getService('payment')->getPrice(); $taxrate = $price->getTaxrate(); if (isset($taxrates[$taxrate])) { $taxrates[$taxrate]->addItem($price, $price->getQuantity()); } else { $taxrates[$taxrate] = $price->setQuantity(1); // only single price } } catch (\Exception $e) { } // if payment service isn't available return $taxrates; }
/** * Returns a list of tax rates and values for the given basket. * * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket containing the products, services, etc. * @return array Associative list of tax rates as key and corresponding amounts as value */ protected function getTaxRates(\Aimeos\MShop\Order\Item\Base\Iface $basket) { $taxrates = array(); foreach ($basket->getProducts() as $product) { $price = $product->getPrice(); $taxrate = $price->getTaxrate(); if (isset($taxrates[$taxrate])) { $taxrates[$taxrate] += ($price->getValue() + $price->getCosts()) * $product->getQuantity(); } else { $taxrates[$taxrate] = ($price->getValue() + $price->getCosts()) * $product->getQuantity(); } } try { $price = $basket->getService('delivery')->getPrice(); $taxrate = $price->getTaxrate(); if (isset($taxrates[$taxrate])) { $taxrates[$taxrate] += $price->getValue() + $price->getCosts(); } else { $taxrates[$taxrate] = $price->getValue() + $price->getCosts(); } } catch (\Exception $e) { } // if delivery service isn't available try { $price = $basket->getService('payment')->getPrice(); $taxrate = $price->getTaxrate(); if (isset($taxrates[$taxrate])) { $taxrates[$taxrate] += $price->getValue() + $price->getCosts(); } else { $taxrates[$taxrate] = $price->getValue() + $price->getCosts(); } } catch (\Exception $e) { } // if payment service isn't available return $taxrates; }
/** * Checks for the product limits when the configuration contains limits per currency. * * @param \Aimeos\MShop\Order\Item\Base\Iface $order Basket object * @param \Aimeos\MShop\Order\Item\Base\Product\Iface $value Order product item * @throws \Aimeos\MShop\Plugin\Provider\Exception If one limit is exceeded */ protected function checkWithCurrency(\Aimeos\MShop\Order\Item\Base\Iface $order, \Aimeos\MShop\Order\Item\Base\Product\Iface $value) { $config = $this->getItemBase()->getConfig(); $currencyId = $value->getPrice()->getCurrencyId(); if (isset($config['single-value-max'][$currencyId]) && $value->getPrice()->getValue() * $value->getQuantity() > (double) $config['single-value-max'][$currencyId]) { $msg = $this->getContext()->getI18n()->dt('mshop', 'The maximum product value is %1$s'); throw new \Aimeos\MShop\Plugin\Provider\Exception(sprintf($msg, $config['single-value-max'][$currencyId])); } if (isset($config['total-value-max'][$currencyId])) { $price = clone $value->getPrice(); $price->setValue($price->getValue() * $value->getQuantity()); foreach ($order->getProducts() as $product) { $price->addItem($product->getPrice(), $product->getQuantity()); } if ((double) $price->getValue() > (double) $config['total-value-max'][$currencyId]) { $msg = $this->getContext()->getI18n()->dt('mshop', 'The maximum value of all products is %1$s'); throw new \Aimeos\MShop\Plugin\Provider\Exception(sprintf($msg, $config['total-value-max'][$currencyId])); } } }
/** * Saves the services of the order to the storage. * * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket containing service items */ protected function storeServices(\Aimeos\MShop\Order\Item\Base\Iface $basket) { $manager = $this->getSubManager('service'); $attrManager = $manager->getSubManager('attribute'); foreach ($basket->getServices() as $type => $item) { $item->setBaseId($basket->getId()); $item->setType($type); $manager->saveItem($item); foreach ($item->getAttributes() as $attribute) { $attribute->setServiceId($item->getId()); $attrManager->saveItem($attribute); } } }
/** * Adds the "additional" section to the XML object * * @param \Aimeos\MShop\Order\Item\Base\Iface $base Order base object * @param \DOMDocument $dom DOM document object with contains the XML structure * @param \DOMElement $orderitem DOM element which will be the parent of the new child * @throws DOMException If an error occures */ protected function buildXMLAdditional(\Aimeos\MShop\Order\Item\Base\Iface $base, \DOMDocument $dom, \DOMElement $orderitem) { $additional = $dom->createElement('additional'); $this->appendChildCDATA('comment', '', $dom, $additional); $couponItem = $dom->createElement('discount'); foreach ($base->getCoupons() as $code => $products) { $this->appendChildCDATA('code', $code, $dom, $couponItem); } $additional->appendChild($couponItem); $orderitem->appendChild($additional); }
/** * Adds the default services to the basket if they are not available. * * @param \Aimeos\MShop\Order\Item\Base\Iface $order Basket object */ protected function setServicesDefault(\Aimeos\MShop\Order\Item\Base\Iface $order) { $services = $order->getServices(); $type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY; if (!isset($services[$type]) && (bool) $this->getConfigValue('autofill.delivery', false) === true && (($item = $this->getServiceItem($order, $type, $this->getConfigValue('autofill.deliverycode'))) !== null || ($item = $this->getServiceItem($order, $type)) !== null)) { $order->setService($item, $type); } $type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT; if (!isset($services[$type]) && (bool) $this->getConfigValue('autofill.payment', false) === true && (($item = $this->getServiceItem($order, $type, $this->getConfigValue('autofill.paymentcode'))) !== null || ($item = $this->getServiceItem($order, $type)) !== null)) { $order->setService($item, $type); } }
/** * Migrates the services from the old basket to the current one. * * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object * @param array $errors Associative list of previous errors * @return array Associative list of errors occured */ protected function copyServices(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors) { foreach ($basket->getServices() as $type => $item) { try { $attributes = array(); foreach ($item->getAttributes() as $attrItem) { $attributes[$attrItem->getCode()] = $attrItem->getValue(); } $this->setService($type, $item->getServiceId(), $attributes); $basket->deleteService($type); } catch (\Exception $e) { } // Don't notify the user as appropriate services can be added automatically } return $errors; }
/** * Returns an list of order data required by PayPal. * * @param \Aimeos\MShop\Order\Item\Base\Iface $orderBase Order base item * @return array Associative list of key/value pairs with order data required by PayPal */ protected function getOrderDetails(\Aimeos\MShop\Order\Item\Base\Iface $orderBase) { $deliveryCosts = $paymentCosts = '0.00'; $values = $this->getAuthParameter(); try { $orderAddressDelivery = $orderBase->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY); /* setting up the shipping address details (ReviewOrder) */ $values['ADDROVERRIDE'] = 1; $values['PAYMENTREQUEST_0_SHIPTONAME'] = $orderAddressDelivery->getFirstName() . ' ' . $orderAddressDelivery->getLastName(); $values['PAYMENTREQUEST_0_SHIPTOSTREET'] = $orderAddressDelivery->getAddress1() . ' ' . $orderAddressDelivery->getAddress2() . ' ' . $orderAddressDelivery->getAddress3(); $values['PAYMENTREQUEST_0_SHIPTOCITY'] = $orderAddressDelivery->getCity(); $values['PAYMENTREQUEST_0_SHIPTOSTATE'] = $orderAddressDelivery->getState(); $values['PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE'] = $orderAddressDelivery->getCountryId(); $values['PAYMENTREQUEST_0_SHIPTOZIP'] = $orderAddressDelivery->getPostal(); } catch (\Exception $e) { } // If no address is available $lastPos = 0; foreach ($orderBase->getProducts() as $product) { $price = $product->getPrice(); $lastPos = $product->getPosition() - 1; $values['L_PAYMENTREQUEST_0_NUMBER' . $lastPos] = $product->getId(); $values['L_PAYMENTREQUEST_0_NAME' . $lastPos] = $product->getName(); $values['L_PAYMENTREQUEST_0_QTY' . $lastPos] = $product->getQuantity(); $values['L_PAYMENTREQUEST_0_AMT' . $lastPos] = $this->getAmount($price); } $price = $orderBase->getService('payment')->getPrice(); if (($paymentCosts = $this->getAmount($price)) > '0.00') { $lastPos++; $values['L_PAYMENTREQUEST_0_NAME' . $lastPos] = $this->getContext()->getI18n()->dt('mshop', 'Payment costs'); $values['L_PAYMENTREQUEST_0_QTY' . $lastPos] = '1'; $values['L_PAYMENTREQUEST_0_AMT' . $lastPos] = $paymentCosts; } try { $orderServiceDeliveryItem = $orderBase->getService('delivery'); $deliveryCosts = $this->getAmount($orderServiceDeliveryItem->getPrice()); $values['L_SHIPPINGOPTIONAMOUNT0'] = (string) $deliveryCosts; $values['L_SHIPPINGOPTIONLABEL0'] = $orderServiceDeliveryItem->getName(); $values['L_SHIPPINGOPTIONNAME0'] = $orderServiceDeliveryItem->getCode(); $values['L_SHIPPINGOPTIONISDEFAULT0'] = 'true'; } catch (\Exception $e) { } // If no delivery service is available $price = $orderBase->getPrice(); $amount = $this->getAmount($price); $values['MAXAMT'] = $amount + 0.01; // @todo rounding error? $values['PAYMENTREQUEST_0_AMT'] = $amount; $values['PAYMENTREQUEST_0_ITEMAMT'] = number_format($price->getValue() + $paymentCosts, 2, '.', ''); $values['PAYMENTREQUEST_0_SHIPPINGAMT'] = number_format($price->getCosts() - $paymentCosts, 2, '.', ''); $values['PAYMENTREQUEST_0_INSURANCEAMT'] = '0.00'; $values['PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED'] = 'false'; $values['PAYMENTREQUEST_0_SHIPDISCAMT'] = '0.00'; $values['PAYMENTREQUEST_0_TAXAMT'] = $price->getTaxValue(); $values['PAYMENTREQUEST_0_CURRENCYCODE'] = $orderBase->getPrice()->getCurrencyId(); $values['PAYMENTREQUEST_0_PAYMENTACTION'] = $this->getConfigValue(array('paypalexpress.PaymentAction'), 'sale'); return $values; }
/** * Addes the transation reference to the order service attributes. * * @param \Aimeos\MShop\Order\Item\Base\Iface $baseItem Order base object with service items attached * @param string $ref Transaction reference from the payment gateway */ protected function saveTransationRef(\Aimeos\MShop\Order\Item\Base\Iface $baseItem, $ref) { $serviceItem = $baseItem->getService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT); $attr = array('TRANSACTIONID' => $ref); $this->setAttributes($serviceItem, $attr, 'payment/omnipay'); $this->saveOrderBase($baseItem); }
/** * Returns a list of tax rates and their price items for the given basket. * * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket containing the products, services, etc. * @return array Associative list of tax rates as key and corresponding price items as value */ protected function getPriceByTaxRate(\Aimeos\MShop\Order\Item\Base\Iface $basket) { $taxrates = array(); $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'price'); foreach ($basket->getProducts() as $product) { $price = $product->getPrice(); $taxrate = $price->getTaxRate(); if (!isset($taxrates[$taxrate])) { $taxrates[$taxrate] = $manager->createItem(); } $taxrates[$taxrate]->addItem($price, $product->getQuantity()); } try { $price = $basket->getService('delivery')->getPrice(); $taxrate = $price->getTaxRate(); if (!isset($taxrates[$taxrate])) { $taxrates[$taxrate] = $manager->createItem(); } $taxrates[$taxrate]->addItem($price); } catch (\Exception $e) { } // if delivery service isn't available try { $price = $basket->getService('payment')->getPrice(); $taxrate = $price->getTaxRate(); if (!isset($taxrates[$taxrate])) { $taxrates[$taxrate] = $manager->createItem(); } $taxrates[$taxrate]->addItem($price); } catch (\Exception $e) { } // if payment service isn't available return $taxrates; }
/** * Returns the IDs of the products in the current basket. * * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object * @return string[] List of product IDs */ protected function getProductIdsFromBasket(\Aimeos\MShop\Order\Item\Base\Iface $basket) { $list = array(); foreach ($basket->getProducts() as $orderProduct) { $list[$orderProduct->getProductId()] = true; foreach ($orderProduct->getProducts() as $subProduct) { $list[$subProduct->getProductId()] = true; } } return array_keys($list); }
/** * Returns an Omnipay credit card object * * @param \Aimeos\MShop\Order\Item\Base\Iface $base Order base object with addresses and services * @param array $params POST parameters passed to the provider * @return \Omnipay\Common\CreditCard Credit card object */ protected function getCardDetails(\Aimeos\MShop\Order\Item\Base\Iface $base, array $params) { if ($this->getValue('address')) { $addr = $base->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT); $params['billingName'] = $addr->getFirstname() . ' ' . $addr->getLastname(); $params['billingFirstName'] = $addr->getFirstname(); $params['billingLastName'] = $addr->getLastname(); $params['billingCompany'] = $addr->getCompany(); $params['billingAddress1'] = $addr->getAddress1(); $params['billingAddress2'] = $addr->getAddress2(); $params['billingCity'] = $addr->getCity(); $params['billingPostcode'] = $addr->getPostal(); $params['billingState'] = $addr->getState(); $params['billingCountry'] = $addr->getCountryId(); $params['billingPhone'] = $addr->getTelephone(); $params['billingFax'] = $addr->getTelefax(); $params['email'] = $addr->getEmail(); } $params['holder'] = isset($params['novalnetcredit.holder']) ? $params['novalnetcredit.holder'] : ''; $params['number'] = isset($params['novalnetcredit.number']) ? $params['novalnetcredit.number'] : ''; $params['expiryYear'] = isset($params['novalnetcredit.year']) ? $params['novalnetcredit.year'] : ''; $params['expiryMonth'] = isset($params['novalnetcredit.month']) ? $params['novalnetcredit.month'] : ''; $params['cvv'] = isset($params['novalnetcredit.cvv']) ? $params['novalnetcredit.cvv'] : ''; return new \Omnipay\Common\CreditCard($params); }