12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- namespace bank;
- //汇元宝
- class hfb implements IBank
- {
- private $mName;
- private $mNo;
- private $mBank;
- public function __construct()
- {
- $this->clear();
- }
- public function clear()
- {
- $this->mName = '汇元银通(北京)在线支付技术有限公司';
- $this->mNo = '210401354';
- $this->mBank = '汇元银通-备付金账户';
- }
- public function match($line): bool
- {
- $diff = array_diff(self::$format, $line);
- return empty($diff);
- }
- static $format = [
- 0 => '明细记录ID',
- 1 => '批次号',
- 2 => '商户内码',
- 3 => '持卡人',
- 4 => '收款卡号',
- 5 => '银行名称',
- 6 => '开户行名称',
- 7 => '商户流水号',
- 8 => '付款金额',
- 9 => '手续费',
- 10 => '付款状态',
- 11 => '审核状态',
- 12 => '付款创建时间',
- 13 => '备注说明',
- 14 => '处理说明'];
- public function convert($line): array
- {
- $trade_no = $line[0];
- $other_name = $line[3];
- $other_no = $line[4];
- $other_bank = $line[6];
- $out = mb_str_replace(['¥',','], '', $line[8]);
- $money_type = '人民币';
- $in = 0.00;
- $service_charge = mb_str_replace(['¥',','], '', $line[9]);
- if(trim($line[10]) !== '成功') {
- return [];
- }
- $trade_time = strtotime($line[12]);
- $remark = "$line[13]-$line[14]";
- $left = '';
- $subject = '';
- $post_date = '';
- $proof_type = '';
- $proof_no = '';
- $result = [
- 'trade_time' => $trade_time,
- 'out_amount' => $out,
- 'in_amount' => $in,
- 'left_amount' => $left,
- 'money_type' => $money_type,
- 'other_name' => $other_name,
- 'other_no' => $other_no,
- 'other_bank' => $other_bank,
- 'post_date' => $post_date,
- 'rsubject' => $subject,
- 'remark' => $remark,
- 'trade_no' => $trade_no,
- 'proof_type' => $proof_type,
- 'proof_no' => $proof_no,
- 'self_name' => $this->mName,
- 'self_no' => $this->mNo,
- 'self_bank' => $this->mBank,
- 'service_charge' => $service_charge
- ];
- return $result;
- }
- }
|