@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * $ Dollar |
| 62 | 62 | */ |
| 63 | 63 | public static function get_pattern() { |
| 64 | - if ( null === self::$pattern ) { |
|
| 64 | + if (null === self::$pattern) { |
|
| 65 | 65 | $characters = array( |
| 66 | 66 | 'A-Z', |
| 67 | 67 | 'a-z', |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * We use a # as a regex delimiter instead of a / so we don't have to escape the slash. |
| 91 | 91 | * @see http://stackoverflow.com/q/12239424 |
| 92 | 92 | */ |
| 93 | - self::$pattern = '#[^' . implode( $characters ) . ']#'; |
|
| 93 | + self::$pattern = '#[^' . implode($characters) . ']#'; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | return self::$pattern; |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * @param string $string String to filter. |
| 103 | 103 | * @return mixed |
| 104 | 104 | */ |
| 105 | - public static function filter( $string ) { |
|
| 106 | - return preg_replace( self::get_pattern(), '', $string ); |
|
| 105 | + public static function filter($string) { |
|
| 106 | + return preg_replace(self::get_pattern(), '', $string); |
|
| 107 | 107 | } |
| 108 | 108 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | * @param string $code Code. |
| 42 | 42 | * @param string $message Message. |
| 43 | 43 | */ |
| 44 | - public function __construct( $code, $message ) { |
|
| 44 | + public function __construct($code, $message) { |
|
| 45 | 45 | $this->code = $code; |
| 46 | 46 | $this->message = $message; |
| 47 | 47 | } |
@@ -192,13 +192,13 @@ |
||
| 192 | 192 | * @param string|null $default Value to return if method could not be transformed. |
| 193 | 193 | * @return string|null |
| 194 | 194 | */ |
| 195 | - public static function transform( $payment_method, $default = null ) { |
|
| 196 | - if ( ! is_scalar( $payment_method ) ) { |
|
| 195 | + public static function transform($payment_method, $default = null) { |
|
| 196 | + if ( ! is_scalar($payment_method)) { |
|
| 197 | 197 | return null; |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - if ( isset( self::$map[ $payment_method ] ) ) { |
|
| 201 | - return self::$map[ $payment_method ]; |
|
| 200 | + if (isset(self::$map[$payment_method])) { |
|
| 201 | + return self::$map[$payment_method]; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | return $default; |
@@ -28,5 +28,5 @@ |
||
| 28 | 28 | * |
| 29 | 29 | * @param SimpleXMLElement $xml XML element to parse. |
| 30 | 30 | */ |
| 31 | - public static function parse( SimpleXMLElement $xml ); |
|
| 31 | + public static function parse(SimpleXMLElement $xml); |
|
| 32 | 32 | } |
@@ -33,57 +33,57 @@ |
||
| 33 | 33 | * @param SimpleXMLElement $xml XML element to parse. |
| 34 | 34 | * @return Transaction |
| 35 | 35 | */ |
| 36 | - public static function parse( SimpleXMLElement $xml ) { |
|
| 36 | + public static function parse(SimpleXMLElement $xml) { |
|
| 37 | 37 | $transaction = new Transaction(); |
| 38 | 38 | |
| 39 | 39 | // Transaction request. |
| 40 | - if ( isset( $xml->trxid ) ) { |
|
| 41 | - $transaction->id = Security::filter( $xml->trxid ); |
|
| 40 | + if (isset($xml->trxid)) { |
|
| 41 | + $transaction->id = Security::filter($xml->trxid); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if ( isset( $xml->issuerurl ) ) { |
|
| 45 | - $transaction->issuer_url = urldecode( Security::filter( $xml->issuerurl ) ); |
|
| 44 | + if (isset($xml->issuerurl)) { |
|
| 45 | + $transaction->issuer_url = urldecode(Security::filter($xml->issuerurl)); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | // Status response. |
| 49 | - if ( isset( $xml->status ) ) { |
|
| 50 | - $transaction->status = Security::filter( $xml->status ); |
|
| 49 | + if (isset($xml->status)) { |
|
| 50 | + $transaction->status = Security::filter($xml->status); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - if ( isset( $xml->amount ) ) { |
|
| 54 | - $transaction->amount = Pay_Util::cents_to_amount( Security::filter( $xml->amount ) ); |
|
| 53 | + if (isset($xml->amount)) { |
|
| 54 | + $transaction->amount = Pay_Util::cents_to_amount(Security::filter($xml->amount)); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - if ( isset( $xml->purchaseid ) ) { |
|
| 58 | - $transaction->purchase_id = Security::filter( $xml->purchaseid ); |
|
| 57 | + if (isset($xml->purchaseid)) { |
|
| 58 | + $transaction->purchase_id = Security::filter($xml->purchaseid); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - if ( isset( $xml->description ) ) { |
|
| 62 | - $transaction->description = Security::filter( $xml->description ); |
|
| 61 | + if (isset($xml->description)) { |
|
| 62 | + $transaction->description = Security::filter($xml->description); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - if ( isset( $xml->entrancecode ) ) { |
|
| 66 | - $transaction->entrance_code = Security::filter( $xml->entrancecode ); |
|
| 65 | + if (isset($xml->entrancecode)) { |
|
| 66 | + $transaction->entrance_code = Security::filter($xml->entrancecode); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if ( isset( $xml->issuerid ) ) { |
|
| 70 | - $transaction->issuer_id = Security::filter( $xml->issuerid ); |
|
| 69 | + if (isset($xml->issuerid)) { |
|
| 70 | + $transaction->issuer_id = Security::filter($xml->issuerid); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if ( isset( $xml->timestamp ) ) { |
|
| 74 | - $transaction->timestamp = new DateTime( Security::filter( $xml->timestamp ) ); |
|
| 73 | + if (isset($xml->timestamp)) { |
|
| 74 | + $transaction->timestamp = new DateTime(Security::filter($xml->timestamp)); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - if ( isset( $xml->consumername ) ) { |
|
| 78 | - $transaction->consumer_name = Security::filter( $xml->consumername ); |
|
| 77 | + if (isset($xml->consumername)) { |
|
| 78 | + $transaction->consumer_name = Security::filter($xml->consumername); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if ( isset( $xml->consumeraccount ) ) { |
|
| 82 | - $transaction->consumer_account = Security::filter( $xml->consumeraccount ); |
|
| 81 | + if (isset($xml->consumeraccount)) { |
|
| 82 | + $transaction->consumer_account = Security::filter($xml->consumeraccount); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - if ( isset( $xml->consumercity ) ) { |
|
| 86 | - $transaction->consumer_city = Security::filter( $xml->consumercity ); |
|
| 85 | + if (isset($xml->consumercity)) { |
|
| 86 | + $transaction->consumer_city = Security::filter($xml->consumercity); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | return $transaction; |
@@ -30,10 +30,10 @@ |
||
| 30 | 30 | * |
| 31 | 31 | * @param SimpleXMLElement $xml XML element to parse. |
| 32 | 32 | */ |
| 33 | - public static function parse( SimpleXMLElement $xml ) { |
|
| 33 | + public static function parse(SimpleXMLElement $xml) { |
|
| 34 | 34 | $error = new Sisow_Error( |
| 35 | - Security::filter( $xml->errorcode ), |
|
| 36 | - Security::filter( $xml->errormessage ) |
|
| 35 | + Security::filter($xml->errorcode), |
|
| 36 | + Security::filter($xml->errormessage) |
|
| 37 | 37 | ); |
| 38 | 38 | |
| 39 | 39 | return $error; |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | * Construct settings. |
| 28 | 28 | */ |
| 29 | 29 | public function __construct() { |
| 30 | - add_filter( 'pronamic_pay_gateway_sections', array( $this, 'sections' ) ); |
|
| 31 | - add_filter( 'pronamic_pay_gateway_fields', array( $this, 'fields' ) ); |
|
| 30 | + add_filter('pronamic_pay_gateway_sections', array($this, 'sections')); |
|
| 31 | + add_filter('pronamic_pay_gateway_fields', array($this, 'fields')); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -37,15 +37,15 @@ discard block |
||
| 37 | 37 | * @param array $sections Sections. |
| 38 | 38 | * @return array |
| 39 | 39 | */ |
| 40 | - public function sections( array $sections ) { |
|
| 40 | + public function sections(array $sections) { |
|
| 41 | 41 | // Sisow. |
| 42 | 42 | $sections['sisow'] = array( |
| 43 | - 'title' => __( 'Sisow', 'pronamic_ideal' ), |
|
| 44 | - 'methods' => array( 'sisow' ), |
|
| 43 | + 'title' => __('Sisow', 'pronamic_ideal'), |
|
| 44 | + 'methods' => array('sisow'), |
|
| 45 | 45 | 'description' => sprintf( |
| 46 | 46 | /* translators: %s: Sisow */ |
| 47 | - __( 'Account details are provided by %1$s after registration. These settings need to match with the %1$s dashboard.', 'pronamic_ideal' ), |
|
| 48 | - __( 'Sisow', 'pronamic_ideal' ) |
|
| 47 | + __('Account details are provided by %1$s after registration. These settings need to match with the %1$s dashboard.', 'pronamic_ideal'), |
|
| 48 | + __('Sisow', 'pronamic_ideal') |
|
| 49 | 49 | ), |
| 50 | 50 | ); |
| 51 | 51 | |
@@ -58,55 +58,55 @@ discard block |
||
| 58 | 58 | * @param array $fields Fields. |
| 59 | 59 | * @return array |
| 60 | 60 | */ |
| 61 | - public function fields( array $fields ) { |
|
| 61 | + public function fields(array $fields) { |
|
| 62 | 62 | // Merchant ID. |
| 63 | 63 | $fields[] = array( |
| 64 | 64 | 'filter' => FILTER_SANITIZE_STRING, |
| 65 | 65 | 'section' => 'sisow', |
| 66 | - 'methods' => array( 'sisow' ), |
|
| 66 | + 'methods' => array('sisow'), |
|
| 67 | 67 | 'meta_key' => '_pronamic_gateway_sisow_merchant_id', |
| 68 | - 'title' => _x( 'Merchant ID', 'sisow', 'pronamic_ideal' ), |
|
| 68 | + 'title' => _x('Merchant ID', 'sisow', 'pronamic_ideal'), |
|
| 69 | 69 | 'type' => 'text', |
| 70 | - 'classes' => array( 'code' ), |
|
| 71 | - 'tooltip' => __( 'Merchant ID as mentioned at <strong>My Profile</strong> in the Sisow dashboard.', 'pronamic_ideal' ), |
|
| 70 | + 'classes' => array('code'), |
|
| 71 | + 'tooltip' => __('Merchant ID as mentioned at <strong>My Profile</strong> in the Sisow dashboard.', 'pronamic_ideal'), |
|
| 72 | 72 | ); |
| 73 | 73 | |
| 74 | 74 | // Merchant Key. |
| 75 | 75 | $fields[] = array( |
| 76 | 76 | 'filter' => FILTER_SANITIZE_STRING, |
| 77 | 77 | 'section' => 'sisow', |
| 78 | - 'methods' => array( 'sisow' ), |
|
| 78 | + 'methods' => array('sisow'), |
|
| 79 | 79 | 'meta_key' => '_pronamic_gateway_sisow_merchant_key', |
| 80 | - 'title' => _x( 'Merchant Key', 'sisow', 'pronamic_ideal' ), |
|
| 80 | + 'title' => _x('Merchant Key', 'sisow', 'pronamic_ideal'), |
|
| 81 | 81 | 'type' => 'text', |
| 82 | - 'classes' => array( 'regular-text', 'code' ), |
|
| 83 | - 'tooltip' => __( 'Merchant Key as mentioned at <strong>My Profile</strong> in the Sisow dashboard.', 'pronamic_ideal' ), |
|
| 82 | + 'classes' => array('regular-text', 'code'), |
|
| 83 | + 'tooltip' => __('Merchant Key as mentioned at <strong>My Profile</strong> in the Sisow dashboard.', 'pronamic_ideal'), |
|
| 84 | 84 | ); |
| 85 | 85 | |
| 86 | 86 | // Shop ID. |
| 87 | 87 | $fields[] = array( |
| 88 | 88 | 'filter' => FILTER_SANITIZE_STRING, |
| 89 | 89 | 'section' => 'sisow', |
| 90 | - 'methods' => array( 'sisow' ), |
|
| 90 | + 'methods' => array('sisow'), |
|
| 91 | 91 | 'meta_key' => '_pronamic_gateway_sisow_shop_id', |
| 92 | - 'title' => _x( 'Shop ID', 'sisow', 'pronamic_ideal' ), |
|
| 92 | + 'title' => _x('Shop ID', 'sisow', 'pronamic_ideal'), |
|
| 93 | 93 | 'type' => 'text', |
| 94 | - 'classes' => array( 'regular-text', 'code' ), |
|
| 95 | - 'tooltip' => __( 'Shop ID as mentioned at <strong>My Profile</strong> in the Sisow dashboard.', 'pronamic_ideal' ), |
|
| 94 | + 'classes' => array('regular-text', 'code'), |
|
| 95 | + 'tooltip' => __('Shop ID as mentioned at <strong>My Profile</strong> in the Sisow dashboard.', 'pronamic_ideal'), |
|
| 96 | 96 | /* translators: %s: 0 */ |
| 97 | - 'description' => sprintf( __( 'Default: <code>%s</code>', 'pronamic_ideal' ), 0 ), |
|
| 97 | + 'description' => sprintf(__('Default: <code>%s</code>', 'pronamic_ideal'), 0), |
|
| 98 | 98 | 'default' => 0, |
| 99 | 99 | ); |
| 100 | 100 | |
| 101 | 101 | // Transaction feedback. |
| 102 | 102 | $fields[] = array( |
| 103 | 103 | 'section' => 'sisow', |
| 104 | - 'methods' => array( 'sisow' ), |
|
| 105 | - 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
|
| 104 | + 'methods' => array('sisow'), |
|
| 105 | + 'title' => __('Transaction feedback', 'pronamic_ideal'), |
|
| 106 | 106 | 'type' => 'description', |
| 107 | 107 | 'html' => sprintf( |
| 108 | 108 | '<span class="dashicons dashicons-yes"></span> %s', |
| 109 | - __( 'Payment status updates will be processed without any additional configuration.', 'pronamic_ideal' ) |
|
| 109 | + __('Payment status updates will be processed without any additional configuration.', 'pronamic_ideal') |
|
| 110 | 110 | ), |
| 111 | 111 | ); |
| 112 | 112 | |
@@ -29,13 +29,13 @@ |
||
| 29 | 29 | * @param int $post_id Post ID. |
| 30 | 30 | * @return Config |
| 31 | 31 | */ |
| 32 | - public function get_config( $post_id ) { |
|
| 32 | + public function get_config($post_id) { |
|
| 33 | 33 | $config = new Config(); |
| 34 | 34 | |
| 35 | - $config->merchant_id = $this->get_meta( $post_id, 'sisow_merchant_id' ); |
|
| 36 | - $config->merchant_key = $this->get_meta( $post_id, 'sisow_merchant_key' ); |
|
| 37 | - $config->shop_id = $this->get_meta( $post_id, 'sisow_shop_id' ); |
|
| 38 | - $config->mode = $this->get_meta( $post_id, 'mode' ); |
|
| 35 | + $config->merchant_id = $this->get_meta($post_id, 'sisow_merchant_id'); |
|
| 36 | + $config->merchant_key = $this->get_meta($post_id, 'sisow_merchant_key'); |
|
| 37 | + $config->shop_id = $this->get_meta($post_id, 'sisow_shop_id'); |
|
| 38 | + $config->mode = $this->get_meta($post_id, 'mode'); |
|
| 39 | 39 | |
| 40 | 40 | return $config; |
| 41 | 41 | } |
@@ -37,17 +37,17 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @param Config $config Config. |
| 39 | 39 | */ |
| 40 | - public function __construct( Config $config ) { |
|
| 41 | - parent::__construct( $config ); |
|
| 40 | + public function __construct(Config $config) { |
|
| 41 | + parent::__construct($config); |
|
| 42 | 42 | |
| 43 | 43 | $this->supports = array( |
| 44 | 44 | 'payment_status_request', |
| 45 | 45 | ); |
| 46 | 46 | |
| 47 | - $this->set_method( self::METHOD_HTTP_REDIRECT ); |
|
| 47 | + $this->set_method(self::METHOD_HTTP_REDIRECT); |
|
| 48 | 48 | |
| 49 | - $this->client = new Client( $config->merchant_id, $config->merchant_key ); |
|
| 50 | - $this->client->set_test_mode( self::MODE_TEST === $config->mode ); |
|
| 49 | + $this->client = new Client($config->merchant_id, $config->merchant_key); |
|
| 50 | + $this->client->set_test_mode(self::MODE_TEST === $config->mode); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $result = $this->client->get_directory(); |
| 62 | 62 | |
| 63 | - if ( $result ) { |
|
| 63 | + if ($result) { |
|
| 64 | 64 | $groups[] = array( |
| 65 | 65 | 'options' => $result, |
| 66 | 66 | ); |
@@ -111,14 +111,14 @@ discard block |
||
| 111 | 111 | * |
| 112 | 112 | * @param Payment $payment Payment. |
| 113 | 113 | */ |
| 114 | - public function start( Payment $payment ) { |
|
| 114 | + public function start(Payment $payment) { |
|
| 115 | 115 | // Order and purchase ID. |
| 116 | 116 | $order_id = $payment->get_order_id(); |
| 117 | - $purchase_id = strval( empty( $order_id ) ? $payment->get_id() : $order_id ); |
|
| 117 | + $purchase_id = strval(empty($order_id) ? $payment->get_id() : $order_id); |
|
| 118 | 118 | |
| 119 | 119 | // Maximum length for purchase ID is 16 characters, otherwise an error will occur: |
| 120 | 120 | // ideal_sisow_error - purchaseid too long (16). |
| 121 | - $purchase_id = substr( $purchase_id, 0, 16 ); |
|
| 121 | + $purchase_id = substr($purchase_id, 0, 16); |
|
| 122 | 122 | |
| 123 | 123 | // New transaction request. |
| 124 | 124 | $request = new TransactionRequest( |
@@ -128,12 +128,12 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | $request->merge_parameters( |
| 130 | 130 | array( |
| 131 | - 'payment' => Methods::transform( $payment->get_method(), $payment->get_method() ), |
|
| 132 | - 'purchaseid' => substr( $purchase_id, 0, 16 ), |
|
| 131 | + 'payment' => Methods::transform($payment->get_method(), $payment->get_method()), |
|
| 132 | + 'purchaseid' => substr($purchase_id, 0, 16), |
|
| 133 | 133 | 'entrancecode' => $payment->get_entrance_code(), |
| 134 | 134 | 'amount' => $payment->get_amount()->get_cents(), |
| 135 | - 'description' => substr( $payment->get_description(), 0, 32 ), |
|
| 136 | - 'testmode' => ( self::MODE_TEST === $this->config->mode ) ? 'true' : 'false', |
|
| 135 | + 'description' => substr($payment->get_description(), 0, 32), |
|
| 136 | + 'testmode' => (self::MODE_TEST === $this->config->mode) ? 'true' : 'false', |
|
| 137 | 137 | 'returnurl' => $payment->get_return_url(), |
| 138 | 138 | 'cancelurl' => $payment->get_return_url(), |
| 139 | 139 | 'notifyurl' => $payment->get_return_url(), |
@@ -145,15 +145,15 @@ discard block |
||
| 145 | 145 | ); |
| 146 | 146 | |
| 147 | 147 | // Payment method. |
| 148 | - $this->set_payment_method( null === $payment->get_method() ? PaymentMethods::IDEAL : $payment->get_method() ); |
|
| 148 | + $this->set_payment_method(null === $payment->get_method() ? PaymentMethods::IDEAL : $payment->get_method()); |
|
| 149 | 149 | |
| 150 | 150 | // Additional parameters for payment method. |
| 151 | - if ( PaymentMethods::IDEALQR === $payment->get_method() ) { |
|
| 152 | - $request->set_parameter( 'qrcode', 'true' ); |
|
| 151 | + if (PaymentMethods::IDEALQR === $payment->get_method()) { |
|
| 152 | + $request->set_parameter('qrcode', 'true'); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | // Customer. |
| 156 | - if ( null !== $payment->get_customer() ) { |
|
| 156 | + if (null !== $payment->get_customer()) { |
|
| 157 | 157 | $customer = $payment->get_customer(); |
| 158 | 158 | |
| 159 | 159 | $request->merge_parameters( |
@@ -164,16 +164,16 @@ discard block |
||
| 164 | 164 | ) |
| 165 | 165 | ); |
| 166 | 166 | |
| 167 | - if ( null !== $customer->get_birth_date() ) { |
|
| 168 | - $request->set_parameter( 'birth_date', $customer->get_birth_date()->format( 'ddmmYYYY' ) ); |
|
| 167 | + if (null !== $customer->get_birth_date()) { |
|
| 168 | + $request->set_parameter('birth_date', $customer->get_birth_date()->format('ddmmYYYY')); |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | // Billing address. |
| 173 | - if ( null !== $payment->get_billing_address() ) { |
|
| 173 | + if (null !== $payment->get_billing_address()) { |
|
| 174 | 174 | $address = $payment->get_billing_address(); |
| 175 | 175 | |
| 176 | - if ( null !== $address->get_name() ) { |
|
| 176 | + if (null !== $address->get_name()) { |
|
| 177 | 177 | $name = $address->get_name(); |
| 178 | 178 | |
| 179 | 179 | $request->merge_parameters( |
@@ -201,10 +201,10 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | // Shipping address. |
| 204 | - if ( null !== $payment->get_shipping_address() ) { |
|
| 204 | + if (null !== $payment->get_shipping_address()) { |
|
| 205 | 205 | $address = $payment->get_shipping_address(); |
| 206 | 206 | |
| 207 | - if ( null !== $address->get_name() ) { |
|
| 207 | + if (null !== $address->get_name()) { |
|
| 208 | 208 | $name = $address->get_name(); |
| 209 | 209 | |
| 210 | 210 | $request->merge_parameters( |
@@ -231,16 +231,16 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | // Lines. |
| 234 | - if ( null !== $payment->get_lines() ) { |
|
| 234 | + if (null !== $payment->get_lines()) { |
|
| 235 | 235 | $lines = $payment->get_lines(); |
| 236 | 236 | |
| 237 | 237 | $x = 1; |
| 238 | 238 | |
| 239 | - foreach ( $lines as $line ) { |
|
| 240 | - $net_price = ( null === $line->get_unit_price() ) ? null : $line->get_unit_price()->get_cents(); |
|
| 241 | - $total = ( null === $line->get_total_amount() ) ? null : $line->get_total_amount()->get_cents(); |
|
| 242 | - $tax = ( null === $line->get_tax_amount() ) ? null : $line->get_tax_amount()->get_cents(); |
|
| 243 | - $net_total = ( $total - $tax ); |
|
| 239 | + foreach ($lines as $line) { |
|
| 240 | + $net_price = (null === $line->get_unit_price()) ? null : $line->get_unit_price()->get_cents(); |
|
| 241 | + $total = (null === $line->get_total_amount()) ? null : $line->get_total_amount()->get_cents(); |
|
| 242 | + $tax = (null === $line->get_tax_amount()) ? null : $line->get_tax_amount()->get_cents(); |
|
| 243 | + $net_total = ($total - $tax); |
|
| 244 | 244 | |
| 245 | 245 | $request->merge_parameters( |
| 246 | 246 | array( |
@@ -260,11 +260,11 @@ discard block |
||
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | // Create transaction. |
| 263 | - $result = $this->client->create_transaction( $request ); |
|
| 263 | + $result = $this->client->create_transaction($request); |
|
| 264 | 264 | |
| 265 | - if ( false !== $result ) { |
|
| 266 | - $payment->set_transaction_id( $result->id ); |
|
| 267 | - $payment->set_action_url( $result->issuer_url ); |
|
| 265 | + if (false !== $result) { |
|
| 266 | + $payment->set_transaction_id($result->id); |
|
| 267 | + $payment->set_action_url($result->issuer_url); |
|
| 268 | 268 | } else { |
| 269 | 269 | $this->error = $this->client->get_error(); |
| 270 | 270 | } |
@@ -275,34 +275,34 @@ discard block |
||
| 275 | 275 | * |
| 276 | 276 | * @param Payment $payment Payment. |
| 277 | 277 | */ |
| 278 | - public function update_status( Payment $payment ) { |
|
| 278 | + public function update_status(Payment $payment) { |
|
| 279 | 279 | $request = new StatusRequest( |
| 280 | 280 | $payment->get_transaction_id(), |
| 281 | 281 | $this->config->merchant_id, |
| 282 | 282 | $this->config->shop_id |
| 283 | 283 | ); |
| 284 | 284 | |
| 285 | - $result = $this->client->get_status( $request ); |
|
| 285 | + $result = $this->client->get_status($request); |
|
| 286 | 286 | |
| 287 | - if ( $result instanceof Error ) { |
|
| 287 | + if ($result instanceof Error) { |
|
| 288 | 288 | $this->error = $this->client->get_error(); |
| 289 | 289 | |
| 290 | 290 | return; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - if ( false === $result ) { |
|
| 293 | + if (false === $result) { |
|
| 294 | 294 | $this->error = $this->client->get_error(); |
| 295 | 295 | |
| 296 | 296 | return; |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - if ( $result instanceof Transaction ) { |
|
| 299 | + if ($result instanceof Transaction) { |
|
| 300 | 300 | $transaction = $result; |
| 301 | 301 | |
| 302 | - $payment->set_status( $transaction->status ); |
|
| 303 | - $payment->set_consumer_name( $transaction->consumer_name ); |
|
| 304 | - $payment->set_consumer_account_number( $transaction->consumer_account ); |
|
| 305 | - $payment->set_consumer_city( $transaction->consumer_city ); |
|
| 302 | + $payment->set_status($transaction->status); |
|
| 303 | + $payment->set_consumer_name($transaction->consumer_name); |
|
| 304 | + $payment->set_consumer_account_number($transaction->consumer_account); |
|
| 305 | + $payment->set_consumer_city($transaction->consumer_city); |
|
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | 308 | } |