public function sendData($data)
 {
     // Initialise the PaymentWall configuration
     $this->setPaymentWallObject();
     // Create the charge object
     $charge = new \Paymentwall_Charge($data['sale_id']);
     $charge->get();
     // Get the response data -- this is returned as a JSON string.
     $charge_data = json_decode($charge->getRawResponseData(), true);
     // Construct the response object
     $this->response = new Response($this, $charge_data);
     return $this->response;
 }
Ejemplo n.º 2
0
function paymentwallbrick_refund($params)
{
    if (!class_exists("Paymentwall_Config")) {
        require_once dirname(__FILE__) . "/paymentwallbrick/lib/paymentwall.php";
    }
    if ($params["test_mode"] == "on") {
        Paymentwall_Config::getInstance()->set(array('api_type' => Paymentwall_Config::API_GOODS, 'public_key' => $params['test_public_key'], 'private_key' => $params['test_private_key']));
    } else {
        Paymentwall_Config::getInstance()->set(array('api_type' => Paymentwall_Config::API_GOODS, 'public_key' => $params['public_key'], 'private_key' => $params['private_key']));
    }
    $charge = new Paymentwall_Charge($params['transid']);
    $charge->get();
    if ($charge->amount != $params["amount"]) {
        return array('status' => 'error', 'rawdata' => "Only full refunds are supported");
    }
    $charge->refund();
    if ($charge->isRefunded()) {
        return array('status' => 'success', 'transid' => $charge->id);
    } else {
        $response = $charge->getPublicData();
        $errors = json_decode($response, true);
        return array('status' => 'error', 'rawdata' => $errors['error']['message']);
    }
}
Ejemplo n.º 3
0
$gatewayParams = getGatewayVariables("paymentwallbrick");
// Die if module is not active.
if (!$gatewayParams['type']) {
    die("Module Not Activated");
}
if (!class_exists("Paymentwall_Config")) {
    require_once dirname(__FILE__) . "/lib/paymentwall.php";
}
if ($gatewayParams["test_mode"] == "on") {
    Paymentwall_Config::getInstance()->set(array('api_type' => Paymentwall_Config::API_GOODS, 'public_key' => $gatewayParams['test_public_key'], 'private_key' => $gatewayParams['test_private_key']));
} else {
    Paymentwall_Config::getInstance()->set(array('api_type' => Paymentwall_Config::API_GOODS, 'public_key' => $gatewayParams['public_key'], 'private_key' => $gatewayParams['private_key']));
}
$charge_id = $_GET["ref"];
$invoice_id = $_GET["goodsid"];
$status = $_GET['type'];
$charge = new Paymentwall_Charge($_GET["ref"]);
logTransaction($gatewayParams["name"], $_GET, "PingBack");
$charge->get();
if ($status == 201 && $charge->isCaptured()) {
    $invoiceId = checkCbInvoiceID($invoice_id, $gatewayParams['name']);
    checkCbTransID($charge_id);
    logTransaction($gatewayParams["name"], var_export($charge, true), "Charge Approved via PingBack");
    addInvoicePayment($invoiceId, $charge_id, null, null, "paymentwallbrick");
} elseif ($status == 202) {
    $invoiceId = checkCbInvoiceID($invoice_id, $gatewayParams['name']);
    checkCbTransID($charge_id);
    logTransaction($gatewayParams["name"], var_export($charge, true), "Charge Declined via PingBack");
    sendMessage("Credit Card Payment Failed", $invoiceId);
}
echo "OK";