1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ByTIC\Omnipay\PlatiOnline\Message; |
4
|
|
|
|
5
|
|
|
use ByTIC\Omnipay\PlatiOnline\Utils\Urls; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class ServerCompletePurchaseRequest |
9
|
|
|
* @package ByTIC\Omnipay\PlatiOnline\Message |
10
|
|
|
* |
11
|
|
|
* @method ServerCompletePurchaseResponse send() |
12
|
|
|
*/ |
13
|
|
|
class ServerCompletePurchaseRequest extends AbstractRequest |
14
|
|
|
{ |
15
|
|
|
protected $relayMessageKey = 'f_itsn_message'; |
16
|
|
|
protected $cryptMessageKey = 'f_crypt_message'; |
17
|
|
|
|
18
|
|
|
use Traits\RelayRequestTrait; |
|
|
|
|
19
|
|
|
use Traits\HasSoapRequestTrait; |
|
|
|
|
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @return string |
23
|
|
|
*/ |
24
|
|
|
protected function getSoapAction(): string |
25
|
|
|
{ |
26
|
|
|
return 'query'; |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @param \SoapClient $soapClient |
31
|
|
|
* @param array $data |
32
|
|
|
*/ |
33
|
|
|
protected function runTransaction($soapClient, $data) |
34
|
|
|
{ |
35
|
|
|
/** @var \SimpleXMLElement $notification */ |
36
|
|
|
$notification = $data['notification']; |
37
|
|
|
$request['f_website'] = (string)$notification->f_login; |
|
|
|
|
38
|
|
|
$request['f_order_number'] = (string)$notification->f_order_number; |
39
|
|
|
$request['x_trans_id'] = (string)$notification->x_trans_id; |
40
|
|
|
$request['f_action'] = 0; |
41
|
|
|
|
42
|
|
|
$response = $this->runSoapRequest($soapClient, $request, 'po_query'); |
43
|
|
|
return [ |
44
|
|
|
'notification' => [ |
45
|
|
|
'order' => $response->order, |
46
|
|
|
'transaction' => $response->order->tranzaction, |
47
|
|
|
'payment_token' => $response->po_payment_token |
48
|
|
|
] |
49
|
|
|
]; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
protected function getValidationMessageUrl() |
53
|
|
|
{ |
54
|
|
|
return Urls::$itsnXml; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
protected function getSoapRequestValidationUrl(): string |
58
|
|
|
{ |
59
|
|
|
return Urls::$queryXml; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
protected function getSoapResponseValidationUrl() |
63
|
|
|
{ |
64
|
|
|
return Urls::$queryResponseXml; |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|