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;
             }
         }
     }
 }
Beispiel #2
0
foreach ($actions as $key => $val) {
    $html .= "<option value='{$key}'>{$val}</option>";
}
$html .= "</select></div>";
$html .= "<div class='row'><label>ID инвойса/реверта</label><input type='text' name='id'/></div>";
$html .= "<div class='row'><label>Сумма возврата</label><input type='text' name='amount'/></div>";
$html .= "<div class='row'><label>Текст сообщения</label><input type='text' name='message_text'/></div>";
$html .= "<div class='row'><label>URL картинки сообщения</label><input type='text' name='message_image_url'/></div>";
$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;