/** * @param Order $order * @param float $callbackAmount * @param int $errorCode * @return bool */ public function verifyCallbackAmount($order, $callbackAmount, $errorCode = CallbackException::INVALID_AMOUNT) { $amount = 1 * $order->getAmount(); if (round($amount - $callbackAmount, 2) != 0) { $this->throwCallbackException(__('Invalid callback amount [%callbackAmount%], should be [%amount%]', ['amount' => $amount, 'callbackAmount' => $callbackAmount]), $errorCode); } }
protected function getRequestData(Order $order) { return ['service' => $this->service, 'partner' => $this->config['partner'], '_input_charset' => $this->config['charset'], 'sign_type' => $this->config['sign_type'], 'notify_url' => url($this->config['notify_url'], null, true), 'return_url' => url($this->config['return_url'], null, true), 'out_trade_no' => $order->getOrderId(), 'subject' => $order->getProductName(), 'total_fee' => $order->getAmount(), 'seller_id' => $this->config['seller_id'], 'payment_type' => 1]; }