-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathOpenPayUWrapper.php
52 lines (42 loc) · 1.46 KB
/
OpenPayUWrapper.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
namespace Accesto\Component\Payum\PayU;
/**
* Class OpenPayUWrapper
* @package Accesto\Component\Payum\PayU
*/
class OpenPayUWrapper
{
const RECURRING_FIRST = 'FIRST';
const RECURRING_STANDARD = 'STANDARD';
protected $oauthClientId;
protected $oauthSecret;
public function __construct($environment, $signatureKey, $posId, $oauthClientId = null, $oauthSecret = null)
{
\OpenPayU_Configuration::setEnvironment($environment);
\OpenPayU_Configuration::setMerchantPosId($posId);
\OpenPayU_Configuration::setSignatureKey($signatureKey);
$this->oauthClientId = $oauthClientId;
$this->oauthSecret = $oauthSecret;
}
public function create($order)
{
return \OpenPayU_Order::create($order);
}
public function refund($id, $description = 'Refund')
{
return \OpenPayU_Refund::create($id, $description);
}
public function retrieve($id)
{
return \OpenPayU_Order::retrieve($id);
}
public function retrievePayMethods($userId, $userEmail)
{
\OpenPayU_Configuration::setOauthClientId($this->oauthClientId);
\OpenPayU_Configuration::setOauthClientSecret($this->oauthSecret);
\OpenPayU_Configuration::setOauthGrantType(\OauthGrantType::TRUSTED_MERCHANT);
\OpenPayU_Configuration::setOauthEmail($userEmail);
\OpenPayU_Configuration::setOauthExtCustomerId($userId);
return \OpenPayU_Retrieve::payMethods();
}
}