コード例 #1
0
ファイル: dwauth.php プロジェクト: carriercomm/atikit
 public function main($content)
 {
     $permissions = ["Send", "Transactions", "Balance", "AccountInfoFull", "Funding"];
     if (isset($content['myid'])) {
         $myid = $content['myid'];
     } else {
         $myid = $this->company->id;
     }
     if (!$this->isProvidingCompany()) {
         $myid = $this->company->id;
     }
     $Dwolla = new DwollaRestClient($this->getSetting('dwolla_app_key'), $this->getSetting('dwolla_app_secret'), $this->getSetting('atikit_url') . "/dwauth/{$myid}/", $permissions);
     if (!isset($content['code'])) {
         $durl = $Dwolla->getAuthUrl();
         header("Location: {$durl}");
     }
     if (isset($content['error'])) {
         $this->notifyCompany($myid, "Dwolla Error", $content['error_description'], null);
         $this->reloadTarget();
     } else {
         if (isset($content['code'])) {
             $code = $content['code'];
             $token = $Dwolla->requestToken($code);
             if (!$token) {
                 print $Dwolla->getError();
                 // Check for errors
                 die("Unable to Obtain token");
             } else {
                 $this->query("UPDATE companies SET company_dwollatoken='{$token}' WHERE id='{$myid}'");
                 $this->notifyCompany($myid, "Dwolla Authorized!", "You can now begin using Dwolla with aTikit.", null);
                 if (!$this->isProvidingCompany()) {
                     $this->reloadTarget('billing/checking/');
                 } else {
                     $this->reloadTarget();
                 }
             }
             // Print the access token
         }
     }
 }
コード例 #2
0
ファイル: core.inc.php プロジェクト: carriercomm/atikit
 public function dwolla_getFundingSources($cid)
 {
     $token = $this->returnFieldFromTable("company_dwollatoken", "companies", "id='{$cid}'");
     if (!$token) {
         return null;
     }
     $Dwolla = new DwollaRestClient();
     $Dwolla->setToken($token);
     return $Dwolla->fundingSources();
 }
コード例 #3
0
ファイル: client.php プロジェクト: manishkhanchandani/mkgxy
 /**
  * Constructor. Takes no arguments.
  */
 public function __construct()
 {
     self::$settings = new Settings();
     self::$settings->host = self::$settings->sandbox ? self::$settings->sandbox_host : self::$settings->production_host;
     $this->settings = self::$settings;
     $p = ['defaults' => ['headers' => ['Content-Type' => 'application/json'], 'timeout' => self::$settings->rest_timeout]];
     if (self::$settings->proxy) {
         $p['proxy'] = self::$settings->proxy;
     }
     $this->client = new Client($p);
 }
コード例 #4
0
ファイル: send.php プロジェクト: matt-t-hall/Dwolla
<?php

// Include the Dwolla REST Client
require 'lib/dwolla.php';
// Include any required keys
require '_keys.php';
// Instantiate a new Dwolla REST Client
$Dwolla = new DwollaRestClient($apiKey, $apiSecret);
//Testing
/*
$Dwolla->setDebug(true);
echo "<p>User ID=".$_POST["userID"]."</p>";//testing
echo "<p>Amount=".$_POST["amount"]."</p>";//testing
*/
$user = $Dwolla->getUser($_POST["userID"]);
$amount = $_POST["amount"];
if ($amount < 0 || $amount > 1) {
    echo "Error: Invalid dollar amount!";
} elseif (!$user) {
    echo "Error: {$Dwolla->getError()} \n";
} else {
    //Hard coded in _keys.php $token="2Dn+YkMrJNG43UR7VMQXyir6ocDAtB6vBasBUtcKM7A3iV/Bga";
    $Dwolla->setToken($token);
    //Make the transaction
    $transactionId = $Dwolla->send($pin, $user['Id'], $amount);
    if (!$transactionId) {
        //Check for errors
        echo "Error: {$Dwolla->getError()} \n";
    } else {
        // Print Transaction ID
        echo "Transaction successful (Transaction ID: {$transactionId}) \n";
コード例 #5
0
ファイル: billing.php プロジェクト: carriercomm/atikit
 public function addBankAccount($content)
 {
     if (!$content['routing'] || !$content['account'] || !$content['type'] || !$content['nickname']) {
         $this->failJson("Unable to Add", "Some fields are blank, Please try again.");
     }
     $myid = $this->company->id;
     $Dwolla = new DwollaRestClient($this->getSetting('dwolla_app_key'), $this->getSetting('dwolla_app_secret'), $this->getSetting('atikit_url') . "dwauth/{$myid}/");
     $Dwolla->setToken($this->company->company_dwollatoken);
     $newFundingSource = $Dwolla->addFundingSource($content['account'], $content['routing'], $content['type'], $content['nickname']);
     if (!$newFundingSource) {
         $this->failJson("Unable to Add", $Dwolla->getError());
     }
     $json = [];
     $json['action'] = 'reload';
     $json['url'] = "/billing/checking/";
     $this->jsone('success', $json);
 }