| 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; |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 19 | use Traits\HasSoapRequestTrait; |
||
|
0 ignored issues
–
show
|
|||
| 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; |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 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 | $data['notification'] = [ |
||
| 44 | 'order' => $response->order, |
||
| 45 | 'transaction' => $response->order->tranzaction, |
||
| 46 | 'payment_token' => $response->po_payment_token |
||
| 47 | ]; |
||
| 48 | return $data; |
||
| 49 | } |
||
| 50 | |||
| 51 | protected function getValidationMessageUrl() |
||
| 52 | { |
||
| 53 | return Urls::$itsnXml; |
||
| 54 | } |
||
| 55 | |||
| 56 | protected function getSoapRequestValidationUrl(): string |
||
| 57 | { |
||
| 58 | return Urls::$queryXml; |
||
| 59 | } |
||
| 60 | |||
| 61 | protected function getSoapResponseValidationUrl() |
||
| 62 | { |
||
| 63 | return Urls::$queryResponseXml; |
||
| 64 | } |
||
| 65 | } |
||
| 66 |