| Conditions | 4 |
| Paths | 4 |
| Total Lines | 40 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 31 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | 18 | public function getData() |
|
| 16 | { |
||
| 17 | 18 | $this->validate( |
|
| 18 | 18 | 'transactionReference', |
|
| 19 | 18 | 'amount', |
|
| 20 | 18 | 'paymentMethod', |
|
| 21 | 18 | 'currency', |
|
| 22 | 18 | 'returnUrl', |
|
| 23 | 18 | 'notifyUrl', |
|
| 24 | 18 | 'description', |
|
| 25 | 18 | 'items' |
|
| 26 | ); |
||
| 27 | |||
| 28 | 18 | $data = $this->getBaseData(); |
|
| 29 | 18 | $data['transType'] = 'PURC'; |
|
| 30 | 18 | $data['orderNum'] = $this->getTransactionReference(); |
|
| 31 | 18 | $data['orderAmount'] = $this->getAmount(); |
|
| 32 | 18 | $data['paymentSchema'] = $this->getPaymentMethod(); |
|
| 33 | 18 | $data['orderCurrency'] = $this->getCurrency(); |
|
| 34 | 18 | $data['frontURL'] = $this->getReturnUrl(); |
|
| 35 | 18 | $data['backURL'] = $this->getNotifyUrl(); |
|
| 36 | 18 | $data['goodsInfo'] = $this->getDescription(); |
|
| 37 | 18 | $data['detailInfo'] = base64_encode(json_encode($this->getItems())); |
|
| 38 | |||
| 39 | // Payment specific stuff |
||
| 40 | |||
| 41 | 18 | switch ($data['paymentSchema']) { |
|
| 42 | 18 | case 'WX': |
|
| 43 | 18 | $data['tradeFrom'] = 'QUICK'; |
|
| 44 | 18 | break; |
|
| 45 | 3 | case 'AP': |
|
| 46 | 3 | $data['tradeFrom'] = 'WEB'; |
|
| 47 | 3 | break; |
|
| 48 | 3 | case 'UP': |
|
| 49 | 3 | $data['tradeFrom'] = 'H5'; |
|
| 50 | 3 | break; |
|
| 51 | } |
||
| 52 | |||
| 53 | 18 | return $data; |
|
| 54 | } |
||
| 55 | |||
| 61 |