Ejemplo n.º 1
0
 /**
  * Create an instance
  * 
  * @since 2.1.0
  * @access public
  * @return instance of self
  */
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Ejemplo n.º 2
0
 /**
  * Get issuers
  *
  * @see Pronamic_WP_Pay_Gateway::get_issuers()
  */
 public function get_issuers()
 {
     $groups = array();
     $methods = Icepay_Api_Webservice::getInstance()->paymentmethodService()->setMerchantID($this->config->merchant_id)->setSecretCode($this->config->secret_code)->retrieveAllPaymentmethods()->asArray();
     $issuers = Icepay_Api_Webservice::getInstance()->singleMethod()->loadFromArray($methods)->selectPaymentMethodByCode('IDEAL')->getIssuers();
     if ($issuers) {
         $options = array();
         foreach ($issuers as $issuer) {
             $options[$issuer['IssuerKeyword']] = $issuer['Description'];
         }
         $groups[] = array('options' => $options);
     }
     return $groups;
 }
Ejemplo n.º 3
0
 protected function processWebservice(\Icepay_PaymentObject_Interface_Abstract $paymentObject)
 {
     try {
         /** @var \Icepay_Webservice_Pay $service */
         $service = \Icepay_Api_Webservice::getInstance()->paymentService();
         $service->setMerchantID((string) $this->merchantId)->setSecretCode((string) $this->secretCode)->setSuccessURL($this->successUrl)->setErrorURL($this->errorUrl);
         /** @var \Icepay_TransactionObject $transactionObj */
         $transactionObj = $service->checkOut($paymentObject);
         $this->url = $transactionObj->getPaymentScreenURL();
         $this->icepayTransactionId = $transactionObj->getPaymentID();
         $this->providerTransactionId = $transactionObj->getProviderTransactionID();
         $this->testMode = $transactionObj->getTestMode();
     } catch (\Exception $e) {
         throw new ApiException('There was a problem procesing the Webservice payment', 0, $e);
     }
 }
Ejemplo n.º 4
0
 public function getPaymentMethods($amount = null, $country = null, $currency = null)
 {
     /** @var \Icepay_Api_Webservice $api */
     $api = \Icepay_Api_Webservice::getInstance();
     $methods = $api->paymentMethodService()->setMerchantID((string) $this->merchantId)->setSecretCode((string) $this->secretCode)->retrieveAllPaymentmethods()->asArray();
     /** @var \Icepay_Webservice_Filtering $filtering */
     $filtering = $api->filtering();
     $filtering->loadFromArray($methods);
     if ($amount) {
         $filtering->filterByAmount($amount);
     }
     if ($country) {
         $filtering->filterByCountry($country);
     }
     if ($currency) {
         $filtering->filterByCurrency($currency);
     }
     return $filtering->getFilteredPaymentmethods();
 }
 *  authors or copyright holders be liable for any claim, damages or
 *  other liability, whether in an action of contract, tort or otherwise,
 *  arising from, out of or in connection with the software or the use
 *  of other dealings in the software.
 *
 */
/*  Define your ICEPAY Merchant ID and Secret code. The values below are sample values and will not work, Change them to your own merchant settings. */
define('MERCHANTID', 12345);
//<--- Change this into your own merchant ID
define('SECRETCODE', "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
//<--- Change this into your own merchant ID
define('PAYMENTID', 1234567);
// <--- Change this into the payment ID
// Include the API into your project
require_once '../api/icepay_api_webservice.php';
$payment = Icepay_Api_Webservice::getInstance()->paymentService();
$logger = Icepay_Api_Logger::getInstance();
try {
    // Merchant Settings
    $payment->setMerchantID(MERCHANTID)->setSecretCode(SECRETCODE);
    /* Apply logging rules */
    $logger->enableLogging()->setLoggingLevel(Icepay_Api_Logger::LEVEL_ALL)->logToFile()->setLoggingDirectory(realpath("../logs"))->setLoggingFile("getpayment.txt")->logToScreen()->log('Sample log entry for sample_webservice_getpayment.php', Icepay_Api_Logger::NOTICE);
} catch (Exception $e) {
    echo $e->getMessage();
}
?>

<pre>
<?php 
try {
    var_dump($payment->getPayment(PAYMENTID));
Ejemplo n.º 6
0
 *  a particular purpose and non-infringement. In no event shall the
 *  authors or copyright holders be liable for any claim, damages or
 *  other liability, whether in an action of contract, tort or otherwise,
 *  arising from, out of or in connection with the software or the use
 *  of other dealings in the software.
 *
 */
/*  Define your ICEPAY Merchant ID and Secret code. The values below are sample values and will not work, Change them to your own merchant settings. */
define('MERCHANTID', 12345);
//<--- Change this into your own merchant ID
define('SECRETCODE', "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
//<--- Change this into your own merchant ID
// Include the API into your project
require_once '../api/icepay_api_webservice.php';
// Initiate the Refund instance
$refund = Icepay_Api_Webservice::getInstance()->refundService();
$refund->setMerchantID(MERCHANTID)->setSecretCode(SECRETCODE);
?>
<!doctype html>
<html>
<head>
    <title>Icepay - Webservice Samples</title>
    <style>
    div#container {    width: 1000px;    min-height: 600px;    height: auto;    border: 1px solid #000;    margin: 50px auto;    padding: 10px;}
    div#sample {    margin: 10px 0;}
    fieldset {    margin-top: 30px;    display: block;}
    legend {    font-weight: bold;}
    p {    margin-top: 0;}
    p.note {    font-size: 13px;    margin-top: 10px;}
    th {    text-align: left;    padding-right: 30px;}
    h1 img {    float: left;    margin-right: 130px;}
 *  a particular purpose and non-infringement. In no event shall the
 *  authors or copyright holders be liable for any claim, damages or
 *  other liability, whether in an action of contract, tort or otherwise,
 *  arising from, out of or in connection with the software or the use
 *  of other dealings in the software.
 *
 */
/*  Define your ICEPAY Merchant ID and Secret code. The values below are sample values and will not work, Change them to your own merchant settings. */
define('MERCHANTID', 12345);
//<--- Change this into your own merchant ID
define('SECRETCODE', "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
//<--- Change this into your own merchant ID
// Include the API into your project
require_once '../api/icepay_api_webservice.php';
// Set the service
$service = Icepay_Api_Webservice::getInstance()->paymentMethodService();
// Configure the service
$service->setMerchantID(MERCHANTID)->setSecretCode(SECRETCODE)->retrieveAllPaymentmethods()->saveToFile("data", realpath("../wsdata"));
/* Saves the Paymentmethod array to a file. */
/* Alternatively you can also fetch the paymentmethods object and/or array. */
$paymentMethods = $service->retrieveAllPaymentMethods()->asArray();
?>
<html>
<body>
Paymentmethods succesfully retrieved from webservice...<BR/>
Use the sample_webservice_filtering.php for an example how to use the stored date and filter it.<BR/>
<pre>
<?php 
var_dump($paymentMethods);
?>
</pre>
 *  other liability, whether in an action of contract, tort or otherwise,
 *  arising from, out of or in connection with the software or the use
 *  of other dealings in the software.
 *
 */
// Define your merchant ID, Pintcode, User and Useragent
// Note: The values below are sample values and will not work, Change them to your own merchant settings.
define('MERCHANTID', 12345);
define('REPORTINGPINCODE', 123456);
// <--- The pincode needs to be requested via ICEPAY seperatly. Support -> New case "Request pincode"
define('REPORTINGUSER', "xxxxxxx");
define('REPORTINGUSERAGENT', "xxxxxxxxxxxxxxxxxxx");
// Include the API into your project
require_once '../api/icepay_api_webservice.php';
// Initiate the Refund instance
$reporting = Icepay_Api_Webservice::getInstance()->reportingService();
$reporting->setUserName(REPORTINGUSER)->setPinCode(REPORTINGPINCODE)->setUserAgent(REPORTINGUSERAGENT)->setMerchantID(MERCHANTID)->useCookie()->usePHPSession()->initSession();
/* creates session if not loaded from cookie or PHP session */
// To kill your session simply call the killSession() function
//
//$reporting->killSession();
//exit;
?>
<!doctype html>
<html>
<head>
    <title>Icepay - Webservice Samples</title>

    <style>
    div#container {    width: 1000px;    min-height: 600px;    height: auto;    border: 1px solid #000;    margin: 50px auto;    padding: 10px;}
    div#sample {    margin: 10px 0;}
        <select name="paymentmethod">
            <option value="">Please select...</option>
            <?php 
foreach ($filter->getFilteredPaymentmethods() as $value) {
    echo "<option value=\"{$value["PaymentMethodCode"]}\" " . (isset($_POST["paymentmethod"]) && $_POST["paymentmethod"] == $value["PaymentMethodCode"] ? "selected" : "") . ">{$value["Description"]}</option>";
}
?>
        </select>
    </p>
    
    <?php 
if (isset($_POST["paymentmethod"]) && $_POST["paymentmethod"] != "") {
    ?>
    
    <?php 
    $method = Icepay_Api_Webservice::getInstance()->singleMethod()->importFromString($filter->exportAsString());
    $method->selectPaymentMethodByCode($_POST["paymentmethod"])->selectCountry($_POST["country"]);
    ?>
    <p> Select issuer (<?php 
    echo count($method->getIssuers());
    ?>
 available):
        <select name="issuer">
            <option value="">Please select...</option>
            <?php 
    foreach ($method->getIssuers() as $value) {
        echo "<option value=\"{$value["IssuerKeyword"]}\" " . (isset($_POST["issuer"]) && $_POST["issuer"] == $value["IssuerKeyword"] ? "selected" : "") . ">{$value["Description"]}</option>";
    }
    ?>
        </select>
    </p>
Ejemplo n.º 10
0
 /**
  * Post the fields and return the URL generated by ICEPAY
  * @since version 1.0.0
  * @access public
  * @return string URL or Error message
  */
 public function getURL()
 {
     if ($this->_generatedURL != "") {
         return $this->_generatedURL;
     }
     if (!isset($this->_merchantID)) {
         throw new Exception('Merchant ID not set, use the setMerchantID() method');
     }
     if (!isset($this->_secretCode)) {
         throw new Exception('Secretcode ID not set, use the setSecretCode() method');
     }
     if (!isset($this->data->ic_country)) {
         if (count($this->_country) == 1) {
             $this->data->ic_country = current($this->_country);
         } else {
             $this->data->ic_country = $this->_defaultCountryCode;
         }
     }
     if (!isset($this->data->ic_issuer) && isset($this->data->ic_paymentmethod)) {
         if (count($this->_issuer) == 1) {
             $this->data->ic_issuer = current($this->_issuer);
         } else {
             throw new Exception('Issuer not set, use the setIssuer() method');
         }
     }
     if (!isset($this->data->ic_language)) {
         if (count($this->_language) == 1) {
             $this->data->ic_language = current($this->_language);
         } else {
             throw new Exception('Language not set, use the setLanguage() method');
         }
     }
     if (!isset($this->data->ic_currency)) {
         if (count($this->_currency) == 1) {
             $this->data->ic_currency = current($this->_currency);
         } else {
             throw new Exception('Currency not set, use the setCurrency() method');
         }
     }
     if (!isset($this->data->ic_amount)) {
         throw new Exception('Amount not set, use the setAmount() method');
     }
     if (!isset($this->data->ic_orderid)) {
         throw new Exception('OrderID not set, use the setOrderID() method');
     }
     if (!isset($this->data->ic_reference)) {
         $this->data->ic_reference = "";
     }
     if (!isset($this->data->ic_description)) {
         $this->data->ic_description = "";
     }
     /*
      * Dynamic URLs
      * @since 1.0.1
      */
     if (!isset($this->data->ic_urlcompleted)) {
         $this->data->ic_urlcompleted = "";
     }
     if (!isset($this->data->ic_urlerror)) {
         $this->data->ic_urlerror = "";
     }
     $this->data->ic_version = $this->_checkout_version;
     $this->data->ic_merchantid = $this->_merchantID;
     $this->data->chk = $this->generateCheckSumDynamic();
     /* @since version 1.0.2 */
     if ($this->_webservice) {
         require_once DIR . DS . "icepay_api_webservice.php";
         if (!isset($this->data->ic_issuer) || $this->data->ic_issuer == "") {
             throw new Exception("Issuer not set");
         }
         //$ws = Icepay_Api_Webservice::getInstance()->paymentService();
         $ws = Icepay_Api_Webservice::getInstance()->paymentService();
         $ws->setMerchantID($this->_merchantID)->setSecretCode($this->_secretCode)->setSuccessURL($this->data->ic_urlcompleted)->setErrorURL($this->data->ic_urlerror);
         try {
             $this->_generatedURL = $ws->checkOut($this->paymentObj, true);
         } catch (Exception $e) {
             throw new Exception($e->getMessage());
         }
         return $this->_generatedURL;
     }
     if (isset($this->data->ic_paymentmethod)) {
         $this->_generatedURL = $this->postRequest($this->basicMode(), $this->prepareParameters());
     } else {
         $this->_generatedURL = sprintf("%s&%s", $this->basicMode(), $this->prepareParameters());
     }
     return $this->_generatedURL;
 }