public function startTransaction(Order $order, UrlInterface $url)
 {
     $config = new Config($this->_scopeConfig);
     $config->configureSDK();
     $total = $order->getGrandTotal();
     $items = $order->getAllVisibleItems();
     $orderId = $order->getIncrementId();
     $quoteId = $order->getQuoteId();
     $currency = $order->getOrderCurrencyCode();
     $returnUrl = $url->getUrl('paynl/checkout/finish/');
     $exchangeUrl = $url->getUrl('paynl/checkout/exchange/');
     $paymentOptionId = $this->getPaymentOptionId();
     $arrBillingAddress = $order->getBillingAddress()->toArray();
     $arrShippingAddress = $order->getShippingAddress()->toArray();
     $enduser = array('initials' => substr($arrBillingAddress['firstname'], 0, 1), 'lastName' => $arrBillingAddress['lastname'], 'phoneNumber' => $arrBillingAddress['telephone'], 'emailAddress' => $arrBillingAddress['email']);
     $address = array();
     $arrAddress = \Paynl\Helper::splitAddress($arrBillingAddress['street']);
     $address['streetName'] = $arrAddress[0];
     $address['houseNumber'] = $arrAddress[1];
     $address['zipCode'] = $arrBillingAddress['postcode'];
     $address['city'] = $arrBillingAddress['city'];
     $address['country'] = $arrBillingAddress['country_id'];
     $shippingAddress = array();
     $arrAddress2 = \Paynl\Helper::splitAddress($arrShippingAddress['street']);
     $shippingAddress['streetName'] = $arrAddress2[0];
     $shippingAddress['houseNumber'] = $arrAddress2[1];
     $shippingAddress['zipCode'] = $arrShippingAddress['postcode'];
     $shippingAddress['city'] = $arrShippingAddress['city'];
     $shippingAddress['country'] = $arrShippingAddress['country_id'];
     $data = array('amount' => $total, 'returnUrl' => $returnUrl, 'paymentMethod' => $paymentOptionId, 'description' => $orderId, 'extra1' => $orderId, 'extra2' => $quoteId, 'exchangeUrl' => $exchangeUrl, 'currency' => $currency);
     $data['address'] = $address;
     $data['shippingAddress'] = $shippingAddress;
     $data['enduser'] = $enduser;
     $arrProducts = array();
     foreach ($items as $item) {
         $arrItem = $item->toArray();
         if ($arrItem['price_incl_tax'] != null) {
             $product = array('id' => $arrItem['product_id'], 'name' => $arrItem['name'], 'price' => $arrItem['price_incl_tax'], 'qty' => $arrItem['qty_ordered'], 'tax' => $arrItem['tax_amount']);
         }
         $arrProducts[] = $product;
     }
     //shipping
     $shippingCost = $order->getShippingAddress()->getShippingInclTax();
     $shippingTax = $order->getShippingAddress()->getShippingTaxAmount();
     $shippingDescription = $order->getShippingAddress()->getShippingDescription();
     $arrProducts[] = array('id' => 'shipping', 'name' => $shippingDescription, 'price' => $shippingCost, 'qty' => 1, 'tax' => $shippingTax);
     // kortingen
     $discount = $order->getSubtotal() - $order->getSubtotalWithDiscount();
     if ($discount > 0) {
         $arrProducts[] = array('id' => 'discount', 'name' => __('Discount'), 'price' => $discount * -1, 'qty' => 1, 'tax' => 0);
     }
     $data['products'] = $arrProducts;
     if ($config->isTestMode()) {
         $data['testmode'] = 1;
     }
     $data['ipaddress'] = $order->getRemoteIp();
     $transaction = \Paynl\Transaction::start($data);
     return $transaction->getRedirectUrl();
 }
Esempio n. 2
0
 public static function start($options = array())
 {
     $api = new Api\Start();
     if (isset($options['amount'])) {
         $api->setAmount(round($options['amount'] * 100));
     }
     if (isset($options['returnUrl'])) {
         $api->setFinishUrl($options['returnUrl']);
     }
     if (isset($options['exchangeUrl'])) {
         $api->setExchangeUrl($options['exchangeUrl']);
     }
     if (isset($options['paymentMethod']) && !empty($options['paymentMethod'])) {
         $api->setPaymentOptionId($options['paymentMethod']);
     }
     if (isset($options['bank']) && !empty($options['bank'])) {
         $api->setPaymentOptionSubId($options['bank']);
     }
     if (isset($options['description']) && !empty($options['description'])) {
         $api->setDescription($options['description']);
     }
     if (isset($options['testmode']) && $options['testmode'] == 1) {
         $api->setTestMode(true);
     }
     if (isset($options['extra1'])) {
         $api->setExtra1($options['extra1']);
     }
     if (isset($options['extra2'])) {
         $api->setExtra2($options['extra2']);
     }
     if (isset($options['extra3'])) {
         $api->setExtra3($options['extra3']);
     }
     if (isset($options['products'])) {
         foreach ($options['products'] as $product) {
             $taxClass = Helper::calculateTaxClass($product['price'], $product['tax']);
             $api->addProduct($product['id'], $product['name'], round($product['price'] * 100), $product['qty'], $taxClass);
         }
     }
     $enduser = array();
     if (isset($options['enduser'])) {
         $enduser = $options['enduser'];
     }
     if (isset($options['language'])) {
         $enduser['language'] = $options['language'];
     }
     if (isset($options['address'])) {
         $address = array('streetName' => $options['address']['streetName'], 'streetNumber' => $options['address']['houseNumber'], 'zipCode' => $options['address']['zipCode'], 'city' => $options['address']['city'], 'countryCode' => $options['address']['country']);
         $enduser['address'] = $address;
     }
     if (isset($options['invoiceAddress'])) {
         $invoiceAddress = array('initials' => $options['invoiceAddress']['initials'], 'lastName' => $options['invoiceAddress']['lastName'], 'streetName' => $options['invoiceAddress']['streetName'], 'streetNumber' => $options['invoiceAddress']['houseNumber'], 'zipCode' => $options['invoiceAddress']['zipCode'], 'city' => $options['invoiceAddress']['city'], 'countryCode' => $options['invoiceAddress']['country']);
         $enduser['invoiceAddress'] = $invoiceAddress;
     }
     if (!empty($enduser)) {
         $api->setEnduser($enduser);
     }
     $result = $api->doRequest();
     return new Result\Start($result);
 }
Esempio n. 3
0
 protected function processResult($result)
 {
     $output = Helper::objectToArray($result);
     if (isset($output['status']) && $output['status'] == 'FALSE') {
         throw new Error\Api($output['error']);
     }
     return parent::processResult($result);
 }
Esempio n. 4
0
 protected function processResult($result)
 {
     $output = Helper::objectToArray($result);
     if ($output['request']['result'] != 1 && $output['request']['result'] != 'TRUE') {
         throw new Error\Api($output['request']['errorId'] . ' - ' . $output['request']['errorMessage']);
     }
     return $output;
 }
Esempio n. 5
0
 protected function processResult($result)
 {
     $output = Helper::objectToArray($result);
     if (!is_array($output)) {
         throw new Error\Api($output);
     }
     return $output;
 }
Esempio n. 6
0
 protected function processResult($result)
 {
     $output = Helper::objectToArray($result);
     // errors are returned different in this api
     if (isset($output['result']) && $output['result'] == 0) {
         throw new ApiError($output['errorId'] . ' - ' . $output['errorMessage']);
     }
     return $output;
 }
Esempio n. 7
0
 protected function processResult($result)
 {
     $output = Helper::objectToArray($result);
     if (!is_array($output)) {
         throw new ApiError($output);
     }
     if (isset($output['request']['result']) && $output['request']['result'] == 0) {
         throw new ApiError($output['request']['errorMessage']);
     }
     return $output;
 }
Esempio n. 8
0
 /**
  * Do the request
  *
  * @param null $endpoint
  * @param null $version
  * @return array The result
  */
 public function doRequest($endpoint = null, $version = null)
 {
     if (isset(self::$cache[Config::getServiceId()])) {
         Helper::requireApiToken();
         Helper::requireServiceId();
         return self::$cache[Config::getServiceId()];
     } else {
         $result = parent::doRequest('transaction/getService');
         self::$cache[Config::getServiceId()] = $result;
         return $result;
     }
 }
Esempio n. 9
0
 protected function processResult($result)
 {
     $output = Helper::objectToArray($result);
     if ($result == '') {
         throw new ApiError('Empty result');
     }
     if (!is_array($output)) {
         throw new ApiError($output);
     }
     // errors are returned different in this api
     if ($output['success'] != 1) {
         throw new ApiError($output['error_field'] . ' - ' . $output['error_message']);
     }
     return $output;
 }
Esempio n. 10
0
 protected function getData()
 {
     Helper::requireServiceId();
     $this->data['serviceId'] = Config::getServiceId();
     return parent::getData();
 }
Esempio n. 11
0
 public function testObjectToArray()
 {
     $object = (object) array('a' => '1', 'b' => '2', 'c' => '3', 'd' => '4');
     $array = \Paynl\Helper::objectToArray($object);
     $this->assertInternalType('array', $array);
 }
Esempio n. 12
0
 public function execute()
 {
     try {
         /** @var \Magento\Checkout\Model\Type\Onepage $onepage */
         $onepage = $this->_objectManager->get('Magento\\Checkout\\Model\\Type\\Onepage');
         /** @var \Magento\Quote\Model\Quote $quote */
         $quote = $onepage->getQuote();
         $quote->collectTotals();
         $quote->reserveOrderId();
         $orderId = $quote->getReservedOrderId();
         $payment = $quote->getPayment()->getMethodInstance();
         $total = $quote->getGrandTotal();
         $items = $quote->getAllVisibleItems();
         $currency = $quote->getQuoteCurrencyCode();
         $returnUrl = $this->_url->getUrl('paynl/finish/');
         $exchangeUrl = $this->_url->getUrl('paynl/exchange/');
         $paymentOptionId = $payment->getPaymentOptionId();
         $arrBillingAddress = $quote->getBillingAddress()->toArray();
         $arrShippingAddress = $quote->getShippingAddress()->toArray();
         $enduser = array('initials' => substr($arrBillingAddress['firstname'], 0, 1), 'lastName' => $arrBillingAddress['lastname'], 'phoneNumber' => $arrBillingAddress['telephone'], 'emailAddress' => $arrBillingAddress['email']);
         $address = array();
         $arrAddress = \Paynl\Helper::splitAddress($arrBillingAddress['street']);
         $address['streetName'] = $arrAddress[0];
         $address['houseNumber'] = $arrAddress[1];
         $address['zipCode'] = $arrBillingAddress['postcode'];
         $address['city'] = $arrBillingAddress['city'];
         $address['country'] = $arrBillingAddress['country_id'];
         $shippingAddress = array();
         $arrAddress2 = \Paynl\Helper::splitAddress($arrShippingAddress['street']);
         $shippingAddress['streetName'] = $arrAddress2[0];
         $shippingAddress['houseNumber'] = $arrAddress2[1];
         $shippingAddress['zipCode'] = $arrShippingAddress['postcode'];
         $shippingAddress['city'] = $arrShippingAddress['city'];
         $shippingAddress['country'] = $arrShippingAddress['country_id'];
         $data = array('amount' => $total, 'returnUrl' => $returnUrl, 'paymentMethod' => $paymentOptionId, 'description' => $orderId, 'extra1' => $orderId, 'extra1' => $quote->getId(), 'exchangeUrl' => $exchangeUrl, 'currency' => $currency);
         $data['address'] = $address;
         $data['shippingAddress'] = $shippingAddress;
         $data['enduser'] = $enduser;
         $arrProducts = array();
         foreach ($items as $item) {
             $arrItem = $item->toArray();
             if ($arrItem['price_incl_tax'] != null) {
                 $product = array('id' => $arrItem['product_id'], 'name' => $arrItem['name'], 'price' => $arrItem['price_incl_tax'], 'qty' => $arrItem['qty'], 'tax' => $arrItem['tax_amount']);
             }
             $arrProducts[] = $product;
         }
         //shipping
         $shippingCost = $quote->getShippingAddress()->getShippingInclTax();
         $shippingTax = $quote->getShippingAddress()->getShippingTaxAmount();
         $shippingDescription = $quote->getShippingAddress()->getShippingDescription();
         $arrProducts[] = array('id' => 'shipping', 'name' => $shippingDescription, 'price' => $shippingCost, 'qty' => 1, 'tax' => $shippingTax);
         // kortingen
         $discount = $quote->getSubtotal() - $quote->getSubtotalWithDiscount();
         if ($discount > 0) {
             $arrProducts[] = array('id' => 'discount', 'name' => __('Discount'), 'price' => $discount * -1, 'qty' => 1, 'tax' => 0);
         }
         $data['products'] = $arrProducts;
         if ($this->_config->isTestMode()) {
             $data['testmode'] = 1;
         }
         $data['ipaddress'] = $quote->getRemoteIp();
         \Paynl\Config::setApiToken($this->_config->getApiToken());
         \Paynl\Config::setServiceId($this->_config->getServiceId());
         $transaction = \Paynl\Transaction::start($data);
         $onepage->saveOrder();
         $this->_redirect($transaction->getRedirectUrl());
     } catch (\Exception $e) {
         $this->messageManager->addException($e, __('Something went wrong, please try again later'));
         $this->_redirect('checkout/cart');
     }
 }
Esempio n. 13
0
File: start.php Progetto: ivodvb/sdk
<?php

/*
 * Copyright (C) 2015 Andy Pieters <*****@*****.**>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
require_once '../../vendor/autoload.php';
require_once '../config.php';
try {
    $result = \Paynl\Transaction::start(array('amount' => 10, 'returnUrl' => dirname(Paynl\Helper::getBaseUrl()) . '/return.php', 'exchangeUrl' => dirname(Paynl\Helper::getBaseUrl()) . '/exchange.php', 'paymentMethod' => 10, 'currency' => 'EUR', 'expireDate' => new DateTime('2016-04-01'), 'description' => '123456', 'testmode' => 0, 'extra1' => 'ext1', 'extra2' => 'ext2', 'extra3' => 'ext3', 'ipaddress' => \Paynl\Helper::getIp(), 'invoiceDate' => new DateTime('now'), 'deliveryDate' => new DateTime('2016-06-06'), 'products' => array(array('id' => 1, 'name' => 'een product', 'price' => 5, 'tax' => 0.87, 'qty' => 1), array('id' => 2, 'name' => 'ander product', 'price' => 5, 'tax' => 0.87, 'qty' => 1)), 'language' => 'EN', 'enduser' => array('initials' => 'T', 'lastName' => 'Test', 'gender' => 'M', 'birthDate' => '14-05-1999', 'phoneNumber' => '0612345678', 'emailAddress' => '*****@*****.**'), 'address' => array('streetName' => 'Test', 'houseNumber' => '10', 'zipCode' => '1234AB', 'city' => 'Test', 'country' => 'NL'), 'invoiceAddress' => array('initials' => 'IT', 'lastName' => 'ITEST', 'streetName' => 'Istreet', 'houseNumber' => '70', 'zipCode' => '5678CD', 'city' => 'ITest', 'country' => 'NL')));
    // Save this transactionid and link it to your order
    $transactionId = $result->getTransactionId();
    echo '<a href="' . $result->getRedirectUrl() . '">' . $result->getRedirectUrl() . '</a>';
    echo "<br />" . $transactionId;
} catch (\Paynl\Error\Error $e) {
    echo "Fout: " . $e->getMessage();
}
Esempio n. 14
0
File: Add.php Progetto: ivodvb/sdk
 /**
  * Get data to send to the api
  *
  * @return array
  * @throws ErrorRequired
  */
 protected function getData()
 {
     Helper::requireServiceId();
     $this->data['serviceId'] = Config::getServiceId();
     if (empty($this->_amount)) {
         throw new ErrorRequired('Amount is not set', 1);
     }
     $this->data['amount'] = $this->_amount;
     if (empty($this->_bankAccountHolder)) {
         throw new ErrorRequired('bankAccountHolder is not set', 1);
     }
     $this->data['bankAccountHolder'] = $this->_bankAccountHolder;
     if (empty($this->_bankAccountNumber)) {
         throw new ErrorRequired('bankAccountNumber is not set', 1);
     }
     $this->data['bankAccountNumber'] = $this->_bankAccountNumber;
     if (!empty($this->_bankAccountBic)) {
         $this->data['bankAccountBic'] = $this->_bankAccountBic;
     }
     if (!empty($this->_description)) {
         $this->data['description'] = $this->_description;
     }
     if (!empty($this->_promotorId)) {
         $this->data['promotorId'] = $this->_promotorId;
     }
     if (!empty($this->_info)) {
         $this->data['info'] = $this->_info;
     }
     if (!empty($this->_tool)) {
         $this->data['tool'] = $this->_tool;
     }
     if (!empty($this->_object)) {
         $this->data['object'] = $this->_object;
     }
     if (!empty($this->_extra1)) {
         $this->data['extra1'] = $this->_extra1;
     }
     if (!empty($this->_extra2)) {
         $this->data['extra2'] = $this->_extra2;
     }
     if (!empty($this->_extra3)) {
         $this->data['extra3'] = $this->_extra3;
     }
     if (isset($this->_orderId)) {
         $this->data['orderId'] = $this->_orderId;
     }
     if (isset($this->_currency)) {
         $this->data['currency'] = $this->_currency;
     }
     if (!empty($this->_processDate)) {
         $this->data['processDate'] = $this->_processDate->format('d-m-Y');
     }
     return parent::getData();
 }
Esempio n. 15
0
 /**
  * Start a new transaction
  *
  * @param array|null $options
  * @return Result\Start
  * @throws Error\Error
  */
 public static function start($options = array())
 {
     $api = new Api\Start();
     if (isset($options['amount'])) {
         $api->setAmount(round($options['amount'] * 100));
     }
     if (isset($options['currency'])) {
         $api->setCurrency($options['currency']);
     }
     if (isset($options['expireDate'])) {
         if (is_string($options['expireDate'])) {
             $options['expireDate'] = new \DateTime($options['expireDate']);
         }
         $api->setExpireDate($options['expireDate']);
     }
     if (isset($options['returnUrl'])) {
         $api->setFinishUrl($options['returnUrl']);
     }
     if (isset($options['exchangeUrl'])) {
         $api->setExchangeUrl($options['exchangeUrl']);
     }
     if (isset($options['paymentMethod']) && !empty($options['paymentMethod'])) {
         $api->setPaymentOptionId($options['paymentMethod']);
     }
     if (isset($options['bank']) && !empty($options['bank'])) {
         $api->setPaymentOptionSubId($options['bank']);
     }
     if (isset($options['description']) && !empty($options['description'])) {
         $api->setDescription($options['description']);
     }
     if (isset($options['testmode']) && $options['testmode'] == 1) {
         $api->setTestMode(true);
     }
     if (isset($options['extra1'])) {
         $api->setExtra1($options['extra1']);
     }
     if (isset($options['extra2'])) {
         $api->setExtra2($options['extra2']);
     }
     if (isset($options['extra3'])) {
         $api->setExtra3($options['extra3']);
     }
     if (isset($options['ipaddress'])) {
         $api->setIpAddress($options['ipaddress']);
     }
     if (isset($options['invoiceDate'])) {
         if (is_string($options['invoiceDate'])) {
             $options['invoiceDate'] = new \DateTime($options['invoiceDate']);
         }
         $api->setInvoiceDate($options['invoiceDate']);
     }
     if (isset($options['deliveryDate'])) {
         if (is_string($options['deliveryDate'])) {
             $options['deliveryDate'] = new \DateTime($options['deliveryDate']);
         }
         $api->setDeliveryDate($options['deliveryDate']);
     }
     if (isset($options['products'])) {
         foreach ($options['products'] as $product) {
             $taxClass = Helper::calculateTaxClass($product['price'], $product['tax']);
             $taxPercentage = null;
             if (isset($product['vatPercentage']) && is_numeric($product['vatPercentage'])) {
                 $taxPercentage = round($product['vatPercentage'], 2);
                 $taxClass = Helper::calculateTaxClass(100 + $taxPercentage, $taxPercentage);
             } else {
                 $taxPercentage = round(Helper::calculateTaxPercentage($product['price'], $product['tax']));
             }
             if (!isset($product['type'])) {
                 $product['type'] = self::PRODUCT_TYPE_ARTICLE;
             }
             $api->addProduct($product['id'], $product['name'], $product['type'], round($product['price'] * 100), $product['qty'], $taxClass, $taxPercentage);
         }
     }
     $enduser = array();
     if (isset($options['enduser'])) {
         if (isset($options['enduser']['birthDate'])) {
             $options['enduser']['birthDate'] = new \DateTime($options['enduser']['birthDate']);
         }
         $enduser = $options['enduser'];
     }
     if (isset($options['language'])) {
         $enduser['language'] = $options['language'];
     }
     if (isset($options['address'])) {
         $address = array();
         if (isset($options['address']['streetName'])) {
             $address['streetName'] = $options['address']['streetName'];
         }
         if (isset($options['address']['houseNumber'])) {
             $address['streetNumber'] = $options['address']['houseNumber'];
         }
         if (isset($options['address']['houseNumberExtension'])) {
             $address['streetNumberExtension'] = $options['address']['houseNumberExtension'];
         }
         if (isset($options['address']['zipCode'])) {
             $address['zipCode'] = $options['address']['zipCode'];
         }
         if (isset($options['address']['city'])) {
             $address['city'] = $options['address']['city'];
         }
         if (isset($options['address']['country'])) {
             $address['countryCode'] = $options['address']['country'];
         }
         $enduser['address'] = $address;
     }
     if (isset($options['invoiceAddress'])) {
         $invoiceAddress = array();
         if (isset($options['invoiceAddress']['initials'])) {
             $invoiceAddress['initials'] = $options['invoiceAddress']['initials'];
         }
         if (isset($options['invoiceAddress']['lastName'])) {
             $invoiceAddress['lastName'] = $options['invoiceAddress']['lastName'];
         }
         if (isset($options['invoiceAddress']['streetName'])) {
             $invoiceAddress['streetName'] = $options['invoiceAddress']['streetName'];
         }
         if (isset($options['invoiceAddress']['houseNumber'])) {
             $invoiceAddress['streetNumber'] = $options['invoiceAddress']['houseNumber'];
         }
         if (isset($options['invoiceAddress']['houseNumberExtension'])) {
             $invoiceAddress['streetNumberExtension'] = $options['invoiceAddress']['houseNumberExtension'];
         }
         if (isset($options['invoiceAddress']['zipCode'])) {
             $invoiceAddress['zipCode'] = $options['invoiceAddress']['zipCode'];
         }
         if (isset($options['invoiceAddress']['city'])) {
             $invoiceAddress['city'] = $options['invoiceAddress']['city'];
         }
         if (isset($options['invoiceAddress']['country'])) {
             $invoiceAddress['countryCode'] = $options['invoiceAddress']['country'];
         }
         if (isset($options['invoiceAddress']['gender'])) {
             $invoiceAddress['gender'] = $options['invoiceAddress']['gender'];
         }
         $enduser['invoiceAddress'] = $invoiceAddress;
     }
     if (!empty($enduser)) {
         $api->setEnduser($enduser);
     }
     if (isset($options['transferType'])) {
         $api->setTransferType($options['transferType']);
     }
     if (isset($options['transferValue'])) {
         $api->setTransferValue($options['transferValue']);
     }
     $result = $api->doRequest();
     return new Result\Start($result);
 }
Esempio n. 16
0
 protected function getData()
 {
     // Checken of alle verplichte velden geset zijn
     Helper::requireServiceId();
     $data['serviceId'] = Config::getServiceId();
     if ($this->_testMode === true) {
         $data['testMode'] = '1';
     } else {
         $data['testMode'] = '0';
     }
     if (empty($this->_amount)) {
         throw new \ErrorRequired('Amount is niet geset', 1);
     } else {
         $data['amount'] = $this->_amount;
     }
     if (!empty($this->_paymentOptionId)) {
         $data['paymentOptionId'] = $this->_paymentOptionId;
     }
     if (empty($this->_finishUrl)) {
         throw new ErrorRequired('FinishUrl is niet geset', 1);
     } else {
         $data['finishUrl'] = $this->_finishUrl;
     }
     if (!empty($this->_exchangeUrl)) {
         $data['transaction']['orderExchangeUrl'] = $this->_exchangeUrl;
     }
     if (!empty($this->_description)) {
         $data['transaction']['description'] = $this->_description;
     }
     if (!empty($this->_paymentOptionSubId)) {
         $data['paymentOptionSubId'] = $this->_paymentOptionSubId;
     }
     //ip en browserdata setten browserdata set ik met dummydata
     $data['ipAddress'] = Helper::getIp();
     if (!empty($this->_products)) {
         //            $data['saleData']['invoiceDate'] = date('d-m-Y');
         //            $data['saleData']['deliveryDate'] = date('d-m-Y', strtotime('+1 day'));
         $data['saleData']['orderData'] = $this->_products;
     }
     if (!empty($this->_enduser)) {
         $data['enduser'] = $this->_enduser;
     }
     if (!empty($this->_extra1)) {
         $data['statsData']['extra1'] = $this->_extra1;
     }
     if (!empty($this->_extra2)) {
         $data['statsData']['extra2'] = $this->_extra2;
     }
     if (!empty($this->_extra3)) {
         $data['statsData']['extra3'] = $this->_extra3;
     }
     if (!empty($this->_promotorId)) {
         $data['statsData']['promotorId'] = $this->_promotorId;
     }
     if (!empty($this->_info)) {
         $data['statsData']['info'] = $this->_info;
     }
     if (!empty($this->_tool)) {
         $data['statsData']['tool'] = $this->_tool;
     }
     if (!empty($this->_object)) {
         $data['statsData']['object'] = $this->_object;
     }
     if (!empty($this->_domainId)) {
         $data['statsData']['domain_id'] = $this->_domainId;
     }
     if (!empty($this->_transferData)) {
         $data['statsData']['transferData'] = $this->_transferData;
     }
     $this->data = array_merge($data, $this->data);
     return parent::getData();
 }
Esempio n. 17
0
File: Start.php Progetto: paynl/sdk
 protected function getData()
 {
     // Checken of alle verplichte velden geset zijn
     Helper::requireServiceId();
     $data['serviceId'] = Config::getServiceId();
     if ($this->_testMode === true) {
         $data['testMode'] = '1';
     } else {
         $data['testMode'] = '0';
     }
     if (empty($this->_amount)) {
         throw new ErrorRequired('Amount is niet geset', 1);
     } else {
         $data['amount'] = $this->_amount;
     }
     if (!empty($this->_paymentOptionId)) {
         $data['paymentOptionId'] = $this->_paymentOptionId;
     }
     if (empty($this->_finishUrl)) {
         throw new ErrorRequired('FinishUrl is niet geset', 1);
     } else {
         $data['finishUrl'] = $this->_finishUrl;
     }
     if (!empty($this->_exchangeUrl)) {
         $data['transaction']['orderExchangeUrl'] = $this->_exchangeUrl;
     }
     if (!empty($this->_description)) {
         $data['transaction']['description'] = $this->_description;
     }
     if (isset($this->_currency)) {
         $data['transaction']['currency'] = $this->_currency;
     }
     if (isset($this->_expireDate)) {
         $data['transaction']['expireDate'] = $this->_expireDate->format('d-m-Y H:i:s');
     }
     if (!empty($this->_paymentOptionSubId)) {
         $data['paymentOptionSubId'] = $this->_paymentOptionSubId;
     }
     if (isset($this->_ipaddress)) {
         $data['ipAddress'] = $this->_ipaddress;
     } else {
         $data['ipAddress'] = Helper::getIp();
     }
     if (!empty($this->_products)) {
         $data['saleData']['orderData'] = $this->_products;
     }
     if (!empty($this->_deliveryDate)) {
         $data['saleData']['deliveryDate'] = $this->_deliveryDate->format('d-m-Y');
     }
     if (!empty($this->_invoiceDate)) {
         $data['saleData']['invoiceDate'] = $this->_invoiceDate->format('d-m-Y');
     }
     if (!empty($this->_enduser)) {
         $data['enduser'] = $this->_enduser;
     }
     if (!empty($this->_extra1)) {
         $data['statsData']['extra1'] = $this->_extra1;
     }
     if (!empty($this->_extra2)) {
         $data['statsData']['extra2'] = $this->_extra2;
     }
     if (!empty($this->_extra3)) {
         $data['statsData']['extra3'] = $this->_extra3;
     }
     if (!empty($this->_promotorId)) {
         $data['statsData']['promotorId'] = $this->_promotorId;
     }
     if (!empty($this->_info)) {
         $data['statsData']['info'] = $this->_info;
     }
     if (!empty($this->_tool)) {
         $data['statsData']['tool'] = $this->_tool;
     }
     if (!empty($this->_object)) {
         $data['statsData']['object'] = $this->_object;
     }
     if (!empty($this->_domainId)) {
         $data['statsData']['domain_id'] = $this->_domainId;
     }
     if (!empty($this->_transferData)) {
         $data['statsData']['transferData'] = $this->_transferData;
     }
     if (!empty($this->_transferType)) {
         $data['transferType'] = $this->_transferType;
     }
     if (!empty($this->_transferValue)) {
         $data['transferValue'] = $this->_transferValue;
     }
     $this->data = array_merge($data, $this->data);
     return parent::getData();
 }