Jump to content

quey

Members
  • Posts

    1
  • Joined

  • Last visited

quey's Achievements

  1. Hello everyone, I’ve built a custom non‐merchant gateway (QueyePay) for Blesta, but after the customer completes payment on the QueyePay site, they always end up back at my Blesta homepage and the invoice remains unpaid. My callback() or validate() methods never run, and I can’t figure out why. Below is a brief overview: 1. buildProcess() In my gateway’s buildProcess(), I create a “return URL” like this: $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; $host = $_SERVER['HTTP_HOST']; $returnRoute = '/blesta-dev/index.php' . '?controller=gateways' . '&action=success' . '&gateway=queye_pay' . '&invoice_id=' . $invoiceId . '&client_id=' . $clientId; $returnUrl = $protocol . '://' . $host . $returnRoute; // Send this as "x-return" header to QueyePay $headers = [ "x-key: {$vendorKey}", "x-secret: {$vendorSecret}", "x-name: {$productName}", "x-currency: {$currency}", "x-price: {$price}", "x-return: {$returnUrl}" ]; After QueyePay processing, QueyePay redirects the user back to that returnUrl. However, nothing happens in Blesta—no logs, no invoice update. 2. success() & validate() I have a success() method that simply calls my validate(): public function success(array $get, array $post = null) { file_put_contents('/path/to/success_debug.log', print_r($get, true), FILE_APPEND); return $this->validate($get, $post); } public function validate(array $get, array $post = null) { file_put_contents('/path/to/validate_debug.log', print_r($get, true), FILE_APPEND); if (empty($get['invoice_id']) || empty($get['tr_id'])) { $this->Input->setErrors(['tr_id' => ['required' => 'Missing tr_id']]); return; } // Call QueyePay status API, then: return [ 'client_id' => $get['client_id'], 'amount' => $transactionAmount, 'currency' => $transactionCurrency, 'invoices' => [['id' => $invoiceId, 'amount' => $transactionAmount]], 'status' => 'approved', 'transaction_id' => $trId ]; } 2. success() & validate() I have a success() method that simply calls my validate(): public function success(array $get, array $post = null) { file_put_contents('/path/to/success_debug.log', print_r($get, true), FILE_APPEND); return $this->validate($get, $post); } public function validate(array $get, array $post = null) { file_put_contents('/path/to/validate_debug.log', print_r($get, true), FILE_APPEND); if (empty($get['invoice_id']) || empty($get['tr_id'])) { $this->Input->setErrors(['tr_id' => ['required' => 'Missing tr_id']]); return; } // Call QueyePay status API, then: return [ 'client_id' => $get['client_id'], 'amount' => $transactionAmount, 'currency' => $transactionCurrency, 'invoices' => [['id' => $invoiceId, 'amount' => $transactionAmount]], 'status' => 'approved', 'transaction_id' => $trId ]; } Neither success_debug.log nor validate_debug.log ever receive any data, which means Blesta isn’t hitting these methods. Should the return URL always use action=callback (not action=success)? If so, is my URL format wrong? Are there any sample .htaccess rules to force HTTPS but still allow Blesta’s controller=gateways&action=callback to pass through intact? Any other ideas why Blesta never hits callback() or validate(), and always redirects to the homepage?
×
×
  • Create New...