<?php
namespace Payment\Common\Ali\Data\Charge; use Payment\Common\PayException; class BarChargeData extends ChargeBaseData { protected function getBizContent() { $content = [ 'out_trade_no' => strval($this->order_no), 'scene' => $this->scene, 'auth_code' => $this->auth_code, 'product_code' => 'FACE_TO_FACE_PAYMENT', 'subject' => strval($this->subject), 'body' => strval($this->body), 'total_amount' => strval($this->amount), 'operator_id' => $this->operator_id, 'store_id' => $this->store_id, 'terminal_id' => $this->terminal_id, ]; $timeExpire = $this->timeout_express; if (! empty($timeExpire)) { $express = floor(($timeExpire - strtotime($this->timestamp)) / 60); ($express > 0) && $content['timeout_express'] = $express . 'm'; } return $content; } protected function checkDataParam() { parent::checkDataParam(); $scene = $this->scene; $authCode = $this->auth_code; if (empty($scene) || ! in_array($scene, ['bar_code', 'wave_code'])) { throw new PayException('支付场景 scene 必须设置 条码支付：bar_code 声波支付：wave_code'); } if (empty($authCode)) { throw new PayException('请提供支付授权码'); } } } 