コード例 #1
0
ファイル: icepay_api_basic.php プロジェクト: vazahat/dudex
 /**
  * Create an instance
  * @since version 1.0.0
  * @access public
  * @return instance of self
  */
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #2
0
 /**
  * Load a paymentmethod class for Basic
  * @since version 2.1.0
  * @access protected
  */
 protected function loadBasicPaymentMethodClass()
 {
     if (!class_exists("Icepay_Api_Basic")) {
         return $this;
     }
     $this->pm_class = Icepay_Api_Basic::getInstance()->readFolder()->getClassByPaymentMethodCode($this->data->ic_paymentmethod);
     if (count($this->pm_class->getSupportedIssuers()) == 1) {
         $this->setIssuer(current($this->pm_class->getSupportedIssuers()));
     }
     return $this;
 }
コード例 #3
0
ファイル: sample_ideal.php プロジェクト: pionect/icepay
 *  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', "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
//<--- Change this into your own merchant ID
// Include the API into your project
require_once '../src/icepay_api_basic.php';
/* Apply logging rules */
$logger = Icepay_Api_Logger::getInstance();
$logger->enableLogging()->setLoggingLevel(Icepay_Api_Logger::LEVEL_ALL)->logToFile()->setLoggingDirectory(realpath("../logs"))->setLoggingFile("idealsample.txt")->logToScreen();
// Read paymentmethods from folder and ensures the classes are included
$api = Icepay_Api_Basic::getInstance()->readFolder(realpath('../src/paymentmethods'));
// Store all paymentmethods in an array, as an example for loading programmatically
$paymentmethods = $api->getArray();
// Start a new paymentmethod class
$ideal = new $paymentmethods["ideal"]();
//The same as: $ideal = new Icepay_Paymentmethod_Ideal();
// Retrieve the paymentmethod issuers for this example
$issuers = $ideal->getSupportedIssuers();
try {
    /* Set the payment */
    $paymentObj = new Icepay_PaymentObject();
    $paymentObj->setPaymentMethod($ideal->getCode())->setAmount(1000)->setCountry("NL")->setLanguage("NL")->setReference("My Sample Website")->setDescription("My Sample Payment")->setCurrency("EUR")->setIssuer($issuers[0])->setOrderID(1);
    // Merchant Settings
    $basicmode = Icepay_Basicmode::getInstance();
    $basicmode->setMerchantID(MERCHANTID)->setSecretCode(SECRETCODE)->setProtocol('http')->validatePayment($paymentObj);
    // <--- Required!
コード例 #4
0
ファイル: sample_filter.php プロジェクト: pionect/icepay
 *  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 '../src/icepay_api_basic.php';
/* Apply logging rules */
$logger = Icepay_Api_Logger::getInstance();
$logger->enableLogging()->setLoggingLevel(Icepay_Api_Logger::LEVEL_ALL)->logToFile()->setLoggingDirectory(realpath("../logs"))->setLoggingFile("filter.txt")->logToScreen();
// Read paymentmethods from folder, load the classes and filter the data
$api = Icepay_Api_Basic::getInstance()->readFolder(realpath('../src/paymentmethods'))->prepareFiltering()->filterByCurrency("EUR")->filterByCountry("NL")->filterByAmount(1000)->filterByLanguage("EN");
// Store the filtered data in an array;
$paymentmethods = $api->getArray();
// Checking if the user selected a paymentmethod
if (isset($_POST["paymentmethod"]) && $_POST["paymentmethod"] != "") {
    $postData = $_POST["paymentmethod"];
    //load the paymentmethod class
    $paymentmethod = new $postData();
    //Store the issuers for this paymentmethod into an array
    $issuers = $paymentmethod->getSupportedIssuers();
}
if (isset($_POST["issuer"]) && $_POST["issuer"] != "") {
    try {
        /* Set the paymentObject */
        $paymentObj = new Icepay_PaymentObject();
        $paymentObj->useBasicPaymentmethodClass($paymentmethod)->setAmount(1000)->setCountry("NL")->setLanguage("NL")->setReference("My Sample Website")->setDescription("My Sample Payment")->setCurrency("EUR")->setIssuer($_POST["issuer"])->setOrderID();
コード例 #5
0
ファイル: IcepayApi.php プロジェクト: winnie80/uc_icepay
 /**
  * Grab Icepay payment method complete setup based on provided name
  *
  * @param string $payment_method
  * @return object
  */
 public function getIcepayPaymentMethodClass($payment_pluginId)
 {
     $paymentMethod = paymentPluginToIcepayPaymentMethod($payment_pluginId);
     return \Icepay_Api_Basic::getInstance()->readFolder()->getClassByPaymentmethodCode($paymentMethod);
 }
コード例 #6
0
 private function writeToMethodFile($postdata, $className, $file)
 {
     $api = Icepay_Api_Basic::getInstance()->readFolder(realpath('api/paymentmethods'))->prepareFiltering();
     $class = new $className();
     $string = '<?php' . "\n";
     $string .= 'class ' . $className . ' extends Icepay_Basicmode {' . "\n";
     if (!isset($postdata['_status'])) {
         $postdata['_status'] = $class->getSupportedStatus();
         if ($postdata['_status'] == '') {
             $postdata['_status'] = '0';
         }
     }
     foreach ($postdata as $key => $data) {
         $string .= "\t" . 'public' . "\t\t" . '$' . $key . "\t\t" . '= ';
         if (is_array($data)) {
             $string .= 'array(' . "\n";
             foreach ($data as $name => $value) {
                 if (is_array($value)) {
                     $string .= "\t\t\t\t\t\t\t\t\t\t" . '"' . $name . '" => array(' . "\n";
                     foreach ($value as $kvalue => $vvalue) {
                         $string .= "\t\t\t\t\t\t\t\t\t\t\t\t" . '"' . $kvalue . '" => "' . $vvalue . '",' . "\n";
                     }
                     $string .= "\t\t\t\t\t\t\t\t\t\t" . '),' . "\n";
                 } else {
                     $string .= "\t\t\t\t\t\t\t\t\t\t" . '"' . $name . '" => "' . $value . '",' . "\n";
                 }
             }
             $string .= "\t\t\t\t\t\t\t\t\t" . ');' . "\n";
         } else {
             $string .= '"' . $data . '";' . "\n";
         }
     }
     $string .= '}' . "\n";
     $string .= '?>';
     $file = dirname(__FILE__) . '/api/paymentmethods/' . $file . '.php';
     $handle = fopen($file, 'w');
     fwrite($handle, $string);
 }