wp-pay-gateways /
ideal-advanced-v3
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Transaction request message. |
||
| 4 | * |
||
| 5 | * @author Pronamic <[email protected]> |
||
| 6 | * @copyright 2005-2021 Pronamic |
||
| 7 | * @license GPL-3.0-or-later |
||
| 8 | * @package Pronamic\WordPress\Pay |
||
| 9 | */ |
||
| 10 | |||
| 11 | namespace Pronamic\WordPress\Pay\Gateways\IDealAdvancedV3\XML; |
||
| 12 | |||
| 13 | use DOMDocument; |
||
| 14 | use Pronamic\WordPress\Pay\Gateways\IDealAdvancedV3\IDeal; |
||
|
0 ignored issues
–
show
|
|||
| 15 | use Pronamic\WordPress\Pay\Gateways\IDealAdvancedV3\Issuer; |
||
| 16 | use Pronamic\WordPress\Pay\Gateways\IDealAdvancedV3\Transaction; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Title: iDEAL transaction request XML message |
||
| 20 | * Description: |
||
| 21 | * Copyright: 2005-2021 Pronamic |
||
| 22 | * Company: Pronamic |
||
| 23 | * |
||
| 24 | * @author Remco Tolsma |
||
| 25 | * @version 2.0.1 |
||
| 26 | */ |
||
| 27 | class TransactionRequestMessage extends RequestMessage { |
||
| 28 | /** |
||
| 29 | * The document element name |
||
| 30 | * |
||
| 31 | * @var string |
||
| 32 | */ |
||
| 33 | const NAME = 'AcquirerTrxReq'; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Issuer |
||
| 37 | * |
||
| 38 | * @var Issuer |
||
| 39 | */ |
||
| 40 | public $issuer; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Transaction |
||
| 44 | * |
||
| 45 | * @var Transaction |
||
| 46 | */ |
||
| 47 | public $transaction; |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Constructs and initializes an transaction request message |
||
| 51 | */ |
||
| 52 | public function __construct() { |
||
| 53 | parent::__construct( self::NAME ); |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Get document |
||
| 58 | * |
||
| 59 | * @see RequestMessage::get_document() |
||
| 60 | * @return DOMDocument |
||
| 61 | * @throws \Exception Throws exception if no transaction amount has been set. |
||
| 62 | */ |
||
| 63 | public function get_document() { |
||
| 64 | $document = parent::get_document(); |
||
| 65 | |||
| 66 | $document_element = $document->documentElement; |
||
| 67 | |||
| 68 | if ( null !== $document_element ) { |
||
| 69 | // Issuer. |
||
| 70 | $issuer = $this->issuer; |
||
| 71 | |||
| 72 | $element = self::add_element( $document, $document_element, 'Issuer' ); |
||
| 73 | |||
| 74 | self::add_elements( |
||
| 75 | $document, |
||
| 76 | $element, |
||
| 77 | array( |
||
| 78 | 'issuerID' => $issuer->get_id(), |
||
| 79 | ) |
||
| 80 | ); |
||
| 81 | |||
| 82 | // Merchant. |
||
| 83 | $merchant = $this->get_merchant(); |
||
| 84 | |||
| 85 | $element = self::add_element( $document, $document_element, 'Merchant' ); |
||
| 86 | |||
| 87 | self::add_elements( |
||
| 88 | $document, |
||
| 89 | $element, |
||
| 90 | array( |
||
| 91 | 'merchantID' => $merchant->get_id(), |
||
| 92 | 'subID' => $merchant->get_sub_id(), |
||
| 93 | 'merchantReturnURL' => $merchant->get_return_url(), |
||
| 94 | ) |
||
| 95 | ); |
||
| 96 | |||
| 97 | // Transaction. |
||
| 98 | $transaction = $this->transaction; |
||
| 99 | |||
| 100 | $element = self::add_element( $document, $document_element, 'Transaction' ); |
||
| 101 | |||
| 102 | $amount = $transaction->get_amount(); |
||
| 103 | |||
| 104 | if ( null === $amount ) { |
||
| 105 | throw new \Exception( 'Required iDEAL transaction amount has not been set.' ); |
||
| 106 | } |
||
| 107 | |||
| 108 | self::add_elements( |
||
| 109 | $document, |
||
| 110 | $element, |
||
| 111 | array( |
||
| 112 | 'purchaseID' => $transaction->get_purchase_id(), |
||
| 113 | 'amount' => $amount, |
||
| 114 | 'currency' => $transaction->get_currency(), |
||
| 115 | 'expirationPeriod' => $transaction->get_expiration_period(), |
||
| 116 | 'language' => $transaction->get_language(), |
||
| 117 | 'description' => $transaction->get_description(), |
||
| 118 | 'entranceCode' => $transaction->get_entrance_code(), |
||
| 119 | ) |
||
| 120 | ); |
||
| 121 | } |
||
| 122 | |||
| 123 | // Return. |
||
| 124 | return $document; |
||
| 125 | } |
||
| 126 | } |
||
| 127 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths