Esempio n. 1
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. 2
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. 3
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();
 }