Ejemplo n.º 1
0
 public function handle($data)
 {
     PayqrConfig::setConfig();
     if (isset($data["invoice_action"])) {
         $order_id = $data["order_id"];
         $action = $data["invoice_action"];
         $invoice_id = $data["invoice_id"];
         if ($this->validate($data)) {
             $invAction = new PayqrInvoiceAction();
             switch ($action) {
                 case "invoice_cancel":
                     $invAction->invoice_cancel($invoice_id);
                     $order = new PayqrOrder();
                     $order->cancelOrder();
                     break;
                 case "invoice_revert":
                     $revert_amount = $data["invoice_revert_amount"];
                     $invAction->invoice_revert($invoice_id, $revert_amount);
                     break;
                 case "invoice_confirm":
                     $invAction->invoice_confirm($invoice_id);
                     break;
                 case "invoice_execution_confirm":
                     $invAction->invoice_execution_confirm($invoice_id);
                     break;
                 case "invoice_message":
                     $text = $data["invoice_message_text"];
                     $image_url = $data["invoice_message_image_url"];
                     $click_url = $data["invoice_message_click_url"];
                     $invAction->invoice_message($invoice_id, $text, $image_url, $click_url);
                     break;
                 case "invoice_sync_data":
                     $order = new PayqrOrder();
                     $order->syncOrder();
                     break;
             }
         }
     }
 }
Ejemplo n.º 2
0
$html .= "<div class='row'><label>URL сообщения</label><input type='text' name='message_url'/></div>";
$html .= "<div class='row'><input type='submit'/></div>";
$html .= "</form>";
echo $html;
$method = isset($_POST["method"]) ? $_POST["method"] : "";
$id = isset($_POST["id"]) ? $_POST["id"] : "";
if (!empty($id)) {
    $Payqr_invoice = new PayqrInvoiceAction();
    $Payqr_revert = new PayqrRevertAction();
    $result = "";
    switch ($method) {
        case "get_invoice":
            $result = $Payqr_invoice->get_invoice($id);
            break;
        case "invoice_cancel":
            $result = $Payqr_invoice->invoice_cancel($id);
            break;
        case "invoice_revert":
            $result = $Payqr_invoice->invoice_revert($id, $amount);
            break;
        case "invoice_confirm":
            $result = $Payqr_invoice->invoice_confirm($id);
            break;
        case "invoice_message":
            $result = $Payqr_invoice->invoice_message($id, $_POST["message_text"], $_POST["message_image_url"], $_POST["message_url"]);
            break;
        case "get_revert":
            $result = $Payqr_revert->get_revert($revertId);
            break;
    }
    var_dump($result);