Beispiel #1
0
 public function testFetchInvoice()
 {
     $this->expectException("IuguException");
     $new_invoice = Iugu_Invoice::fetch("NO VALID INVOICE");
     $fetched_invoice = Iugu_Invoice::fetch($this->invoice->id);
     $this->assertNotNull($fetched_invoice);
     $this->assertNotNull($fetched_invoice["id"]);
 }
Beispiel #2
0
 public function invoice()
 {
     if (!isset($this->invoice_id)) {
         return false;
     }
     if (!$this->invoice_id) {
         return false;
     }
     return Iugu_Invoice::fetch($this->invoice_id);
 }
Beispiel #3
0
<?php

if ($_POST['event'] == "invoice.status_changed") {
    include "../../../dbconnect.php";
    include "../../../includes/functions.php";
    include "../../../includes/gatewayfunctions.php";
    include "../../../includes/invoicefunctions.php";
    require_once "../iugu/Iugu.php";
    $gatewaymodule = "iugu";
    $GATEWAY = getGatewayVariables($gatewaymodule);
    if (!$GATEWAY["type"]) {
        die("Module Not Activated");
    }
    $post_iugu = array("event" => $_POST['event'], "id" => $_POST["data"]["id"], "status" => $_POST["data"]["status"]);
    Iugu::setApiKey($GATEWAY["api_token"]);
    $consultar = Iugu_Invoice::fetch($_POST["data"]["id"]);
    $valor = explode("R\$ ", $consultar->paid);
    $taxa = explode("R\$ ", $consultar->taxes_paid);
    $status = $consultar->status;
    $amount = str_replace(",", ".", $valor[1]);
    $fee = str_replace(",", ".", $taxa[1]);
    foreach ($consultar->variables as $variavel) {
        if ($variavel->variable == "payment_data.transaction_number") {
            $transid = $variavel->value;
        }
    }
    foreach ($consultar->custom_variables as $variavel) {
        if ($variavel->name == "invoice_id") {
            $invoiceid = $variavel->value;
        }
    }