1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Paxum driver for PHP merchant library |
4
|
|
|
* |
5
|
|
|
* @link https://github.com/hiqdev/omnipay-paxum |
6
|
|
|
* @package omnipay-paxum |
7
|
|
|
* @license MIT |
8
|
|
|
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/) |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Omnipay\Paxum\Message; |
12
|
|
|
|
13
|
|
|
class PurchaseRequest extends AbstractRequest |
14
|
|
|
{ |
15
|
3 |
|
public function getData() |
16
|
|
|
{ |
17
|
3 |
|
$this->validate( |
18
|
3 |
|
'purse', |
19
|
3 |
|
'amount', 'currency', 'description', |
20
|
3 |
|
'returnUrl', 'cancelUrl', 'notifyUrl' |
21
|
3 |
|
); |
22
|
|
|
|
23
|
|
|
$res = [ |
24
|
3 |
|
'business_email' => $this->getPurse(), |
25
|
3 |
|
'amount' => $this->getAmount(), |
26
|
3 |
|
'currency' => $this->getCurrency(), |
27
|
3 |
|
'item_name' => $this->getDescription(), |
28
|
3 |
|
'finish_url' => $this->getReturnUrl(), |
29
|
3 |
|
'cancel_url' => $this->getCancelUrl(), |
30
|
3 |
|
'variables' => 'notify_url=' . $this->getNotifyUrl(), |
31
|
3 |
|
'button_type_id' => 1, /// Pay Now button |
32
|
3 |
|
]; |
33
|
|
|
|
34
|
3 |
|
if ($this->getTransactionId()) { |
35
|
3 |
|
$res['item_id'] = $this->getTransactionId(); |
36
|
3 |
|
} |
37
|
3 |
|
if ($this->getTestMode()) { |
38
|
3 |
|
$res['sandbox'] = 'ON'; |
39
|
3 |
|
$res['return'] = '00'; |
40
|
3 |
|
} |
41
|
|
|
|
42
|
3 |
|
return $res; |
43
|
|
|
} |
44
|
|
|
|
45
|
2 |
|
public function sendData($data) |
46
|
|
|
{ |
47
|
2 |
|
return $this->response = new PurchaseResponse($this, $data); |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|