Exemplo n.º 1
0
 /**
  * Builds the resource url with the given parameters
  *
  * @param string $resource
  * @param string $env
  * @param string $query_string
  * @return string
  */
 public static function getUrl($resource, $env, $query_string = null)
 {
     $url = null;
     if (Configuration::isSandbox($env)) {
         $base_url = Configuration::ENV_TEST_BASE_URL;
     } else {
         $base_url = Configuration::ENV_LIVE_BASE_URL;
     }
     if ($base_url && $resource) {
         $url = $base_url . ltrim($resource, '/');
     }
     return $url;
 }
Exemplo n.º 2
0
 public function setUp()
 {
     $config = (require "Config.php");
     if (empty($config["merchant_id"])) {
         throw new \Exception("Merchant Id is required");
     }
     if (empty($config["merchant_key"])) {
         throw new \Exception("Merchant Key is required");
     }
     Configuration::$merchant_id = $config["merchant_id"];
     Configuration::$merchant_key = $config["merchant_key"];
     Configuration::$environment = $config["environment"] ? $config["environment"] : "test";
     if (isset($config["webhook_endpoint"])) {
         $this->webhook_endpoint = $config["webhook_endpoint"];
     }
     if (isset($config["express_endpoint"])) {
         $this->express_endpoint = $config["express_endpoint"];
     }
     $this->_current_order_id = rand(10000, 9999999);
 }
Exemplo n.º 3
0
<?php

error_reporting(E_ALL);
ini_set("display_errors", 1);
use zipMoney\Request;
use zipMoney\Exception;
use zipMoney\Configuration;
use zipMoney\Webhook\Webhook;
require_once '../vendor/autoload.php';
$config = (require_once "Config.php");
if (empty($config["merchant_id"])) {
    throw new \Exception("Merchant Id is required");
}
if (empty($config["merchant_key"])) {
    throw new \Exception("Merchant Key is required");
}
Configuration::$merchant_id = $config["merchant_id"];
Configuration::$merchant_key = $config["merchant_key"];
Configuration::$environment = $config["environment"] ? $config["environment"] : "test";
class ZipMoneyWebHook extends Webhook
{
}
try {
    $webhookTest = new ZipMoneyWebHook();
    $webhookTest->listen();
} catch (Exception $e) {
    echo $e->getMessage();
}