1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ByTIC\Payments\Gateways\Providers\Librapay\Message\Traits; |
4
|
|
|
|
5
|
|
|
use ByTIC\Payments\Gateways\Providers\AbstractGateway\Message\Traits\HasGatewayRequestTrait; |
6
|
|
|
use ByTIC\Payments\Gateways\Providers\AbstractGateway\Message\Traits\HasModelRequest; |
7
|
|
|
use ByTIC\Payments\Gateways\Providers\Librapay\Gateway; |
8
|
|
|
use ByTIC\Payments\Gateways\Providers\Librapay\Helper; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Trait CompletePurchaseTrait |
12
|
|
|
*/ |
13
|
|
|
trait CompletePurchaseTrait |
14
|
|
|
{ |
15
|
|
|
use HasModelRequest; |
16
|
|
|
use HasGatewayRequestTrait; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @inheritdoc |
20
|
|
|
*/ |
21
|
|
|
public function getData() |
22
|
|
|
{ |
23
|
|
|
$return = parent::getData(); |
24
|
|
|
// Add model only if has data |
25
|
|
|
if (count($return)) { |
26
|
|
|
$return['model'] = $this->getModel(); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
return $return; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @return string |
34
|
|
|
*/ |
35
|
|
|
public function getModelIdFromRequest() |
36
|
|
|
{ |
37
|
|
|
$modelId = $this->getHttpRequestBag()->get('ORDER'); |
|
|
|
|
38
|
|
|
$modelId = Helper::decodeOrderId($modelId); |
39
|
|
|
|
40
|
|
|
return $modelId; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @inheritdoc |
45
|
|
|
*/ |
46
|
|
|
protected function parseNotification() |
47
|
|
|
{ |
48
|
|
|
if ($this->validateModel()) { |
49
|
|
|
$model = $this->getModel(); |
50
|
|
|
$this->updateParametersFromPurchase($model); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
return parent::parseNotification(); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @param Gateway $gateway |
58
|
|
|
*/ |
59
|
|
|
protected function updateParametersFromGateway($gateway) |
60
|
|
|
{ |
61
|
|
|
$this->setMerchant($gateway->getMerchant()); |
|
|
|
|
62
|
|
|
$this->setTerminal($gateway->getTerminal()); |
|
|
|
|
63
|
|
|
$this->setKey($gateway->getKey()); |
|
|
|
|
64
|
|
|
$this->setMerchantName($gateway->getMerchantName()); |
|
|
|
|
65
|
|
|
$this->setMerchantEmail($gateway->getMerchantEmail()); |
|
|
|
|
66
|
|
|
$this->setMerchantUrl($gateway->getMerchantUrl()); |
|
|
|
|
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.