@@ -44,7 +44,7 @@ |
||
| 44 | 44 | /** |
| 45 | 45 | * Constructs and initialize a iDEAL basic item |
| 46 | 46 | */ |
| 47 | - public function __construct( $number, $description, $quantity, $price ) { |
|
| 47 | + public function __construct($number, $description, $quantity, $price) { |
|
| 48 | 48 | $this->number = $number; |
| 49 | 49 | $this->description = $description; |
| 50 | 50 | $this->quantity = $quantity; |
@@ -20,19 +20,19 @@ |
||
| 20 | 20 | * Get parsed notification. |
| 21 | 21 | */ |
| 22 | 22 | public static function get_notification() { |
| 23 | - if ( ! filter_has_var( INPUT_GET, 'xml_notification' ) && ! filter_has_var( INPUT_GET, 'xml_notifaction' ) ) { |
|
| 23 | + if ( ! filter_has_var(INPUT_GET, 'xml_notification') && ! filter_has_var(INPUT_GET, 'xml_notifaction')) { |
|
| 24 | 24 | // Also check for typo 'xml_notifaction', as this has been used in the past. |
| 25 | 25 | return; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - $data = file_get_contents( 'php://input' ); |
|
| 28 | + $data = file_get_contents('php://input'); |
|
| 29 | 29 | |
| 30 | - $xml = Core_Util::simplexml_load_string( $data ); |
|
| 30 | + $xml = Core_Util::simplexml_load_string($data); |
|
| 31 | 31 | |
| 32 | - if ( is_wp_error( $xml ) ) { |
|
| 32 | + if (is_wp_error($xml)) { |
|
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - return NotificationParser::parse( $xml ); |
|
| 36 | + return NotificationParser::parse($xml); |
|
| 37 | 37 | } |
| 38 | 38 | } |
@@ -17,10 +17,10 @@ |
||
| 17 | 17 | abstract class AbstractIntegration extends IDeal_AbstractIntegration { |
| 18 | 18 | public function __construct() { |
| 19 | 19 | // Actions |
| 20 | - $function = array( __NAMESPACE__ . '\Listener', 'listen' ); |
|
| 20 | + $function = array(__NAMESPACE__ . '\Listener', 'listen'); |
|
| 21 | 21 | |
| 22 | - if ( ! has_action( 'wp_loaded', $function ) ) { |
|
| 23 | - add_action( 'wp_loaded', $function ); |
|
| 22 | + if ( ! has_action('wp_loaded', $function)) { |
|
| 23 | + add_action('wp_loaded', $function); |
|
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | |
@@ -16,61 +16,61 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class Settings extends GatewaySettings { |
| 18 | 18 | public function __construct() { |
| 19 | - add_filter( 'pronamic_pay_gateway_sections', array( $this, 'sections' ) ); |
|
| 20 | - add_filter( 'pronamic_pay_gateway_fields', array( $this, 'fields' ) ); |
|
| 19 | + add_filter('pronamic_pay_gateway_sections', array($this, 'sections')); |
|
| 20 | + add_filter('pronamic_pay_gateway_fields', array($this, 'fields')); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function sections( array $sections ) { |
|
| 23 | + public function sections(array $sections) { |
|
| 24 | 24 | // Transaction feedback |
| 25 | 25 | $sections['IDealBasic_feedback'] = array( |
| 26 | - 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
|
| 27 | - 'methods' => array( 'ideal-basic' ), |
|
| 28 | - 'description' => __( 'The URL below needs to be copied to the payment provider dashboard to receive automatic transaction status updates.', 'pronamic_ideal' ), |
|
| 26 | + 'title' => __('Transaction feedback', 'pronamic_ideal'), |
|
| 27 | + 'methods' => array('ideal-basic'), |
|
| 28 | + 'description' => __('The URL below needs to be copied to the payment provider dashboard to receive automatic transaction status updates.', 'pronamic_ideal'), |
|
| 29 | 29 | ); |
| 30 | 30 | |
| 31 | 31 | // Return sections |
| 32 | 32 | return $sections; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function fields( array $fields ) { |
|
| 35 | + public function fields(array $fields) { |
|
| 36 | 36 | // Hash Key |
| 37 | 37 | $fields[] = array( |
| 38 | 38 | 'filter' => FILTER_SANITIZE_STRING, |
| 39 | 39 | 'section' => 'ideal', |
| 40 | 40 | 'meta_key' => '_pronamic_gateway_ideal_hash_key', |
| 41 | - 'title' => __( 'Hash Key', 'pronamic_ideal' ), |
|
| 41 | + 'title' => __('Hash Key', 'pronamic_ideal'), |
|
| 42 | 42 | 'type' => 'text', |
| 43 | - 'classes' => array( 'regular-text', 'code' ), |
|
| 44 | - 'tooltip' => __( 'Hash key (also known as: key or secret key) as mentioned in the payment provider dashboard.', 'pronamic_ideal' ), |
|
| 45 | - 'methods' => array( 'ideal-basic' ), |
|
| 43 | + 'classes' => array('regular-text', 'code'), |
|
| 44 | + 'tooltip' => __('Hash key (also known as: key or secret key) as mentioned in the payment provider dashboard.', 'pronamic_ideal'), |
|
| 45 | + 'methods' => array('ideal-basic'), |
|
| 46 | 46 | ); |
| 47 | 47 | |
| 48 | 48 | // Transaction feedback |
| 49 | 49 | $fields[] = array( |
| 50 | 50 | 'section' => 'ideal', |
| 51 | - 'methods' => array( 'ideal-basic' ), |
|
| 52 | - 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
|
| 51 | + 'methods' => array('ideal-basic'), |
|
| 52 | + 'title' => __('Transaction feedback', 'pronamic_ideal'), |
|
| 53 | 53 | 'type' => 'description', |
| 54 | 54 | 'html' => sprintf( |
| 55 | 55 | '<span class="dashicons dashicons-warning"></span> %s', |
| 56 | - __( 'Receiving payment status updates needs additional configuration, if not yet completed.', 'pronamic_ideal' ) |
|
| 56 | + __('Receiving payment status updates needs additional configuration, if not yet completed.', 'pronamic_ideal') |
|
| 57 | 57 | ), |
| 58 | 58 | ); |
| 59 | 59 | |
| 60 | 60 | // XML Notification URL |
| 61 | 61 | $fields[] = array( |
| 62 | 62 | 'section' => 'IDealBasic_feedback', |
| 63 | - 'title' => __( 'XML Notification URL', 'pronamic_ideal' ), |
|
| 63 | + 'title' => __('XML Notification URL', 'pronamic_ideal'), |
|
| 64 | 64 | 'type' => 'text', |
| 65 | - 'classes' => array( 'regular-text', 'code' ), |
|
| 66 | - 'value' => add_query_arg( array( |
|
| 65 | + 'classes' => array('regular-text', 'code'), |
|
| 66 | + 'value' => add_query_arg(array( |
|
| 67 | 67 | 'gateway' => 'IDealBasic', |
| 68 | 68 | 'xml_notification' => 'true', |
| 69 | - ), site_url( '/' ) ), |
|
| 70 | - 'methods' => array( 'ideal-basic' ), |
|
| 69 | + ), site_url('/')), |
|
| 70 | + 'methods' => array('ideal-basic'), |
|
| 71 | 71 | 'readonly' => true, |
| 72 | 72 | 'size' => 200, |
| 73 | - 'tooltip' => __( 'Copy the XML notification URL to the payment provider dashboard to receive automatic transaction status updates.', 'pronamic_ideal' ), |
|
| 73 | + 'tooltip' => __('Copy the XML notification URL to the payment provider dashboard to receive automatic transaction status updates.', 'pronamic_ideal'), |
|
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | 76 | // Return fields |
@@ -26,25 +26,25 @@ |
||
| 26 | 26 | * |
| 27 | 27 | * @return Notification |
| 28 | 28 | */ |
| 29 | - public static function parse( SimpleXMLElement $xml, $notification = null ) { |
|
| 30 | - if ( null === $notification ) { |
|
| 29 | + public static function parse(SimpleXMLElement $xml, $notification = null) { |
|
| 30 | + if (null === $notification) { |
|
| 31 | 31 | $notification = new Notification(); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if ( $xml->createDateTimeStamp ) { |
|
| 35 | - $notification->set_date( new DateTime( Security::filter( $xml->createDateTimeStamp ) ) ); |
|
| 34 | + if ($xml->createDateTimeStamp) { |
|
| 35 | + $notification->set_date(new DateTime(Security::filter($xml->createDateTimeStamp))); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - if ( $xml->transactionID ) { |
|
| 39 | - $notification->set_transaction_id( Security::filter( $xml->transactionID ) ); |
|
| 38 | + if ($xml->transactionID) { |
|
| 39 | + $notification->set_transaction_id(Security::filter($xml->transactionID)); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if ( $xml->purchaseID ) { |
|
| 43 | - $notification->set_purchase_id( Security::filter( $xml->purchaseID ) ); |
|
| 42 | + if ($xml->purchaseID) { |
|
| 43 | + $notification->set_purchase_id(Security::filter($xml->purchaseID)); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if ( $xml->status ) { |
|
| 47 | - $notification->set_status( Security::filter( $xml->status ) ); |
|
| 46 | + if ($xml->status) { |
|
| 47 | + $notification->set_status(Security::filter($xml->status)); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | return $notification; |
@@ -28,21 +28,21 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @var array |
| 30 | 30 | */ |
| 31 | - private static $characters_an = array( 'A-Z', 'a-z', '0-9', ' ' ); |
|
| 31 | + private static $characters_an = array('A-Z', 'a-z', '0-9', ' '); |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Strictly alphanumerical (letters and numbers only) |
| 35 | 35 | * |
| 36 | 36 | * @var array |
| 37 | 37 | */ |
| 38 | - private static $characters_ans = array( 'A-Z', 'a-z', '0-9' ); |
|
| 38 | + private static $characters_ans = array('A-Z', 'a-z', '0-9'); |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Numerical |
| 42 | 42 | * |
| 43 | 43 | * @var array |
| 44 | 44 | */ |
| 45 | - private static $characters_n = array( '0-9' ); |
|
| 45 | + private static $characters_n = array('0-9'); |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * Filter the specified characters from the string |
@@ -53,13 +53,13 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return string |
| 55 | 55 | */ |
| 56 | - private static function filter( array $characters, $string, $max = null ) { |
|
| 57 | - $pattern = '#[^' . implode( $characters ) . ']#'; |
|
| 56 | + private static function filter(array $characters, $string, $max = null) { |
|
| 57 | + $pattern = '#[^' . implode($characters) . ']#'; |
|
| 58 | 58 | |
| 59 | - $string = preg_replace( $pattern, '', $string ); |
|
| 59 | + $string = preg_replace($pattern, '', $string); |
|
| 60 | 60 | |
| 61 | - if ( isset( $max ) ) { |
|
| 62 | - $string = substr( $string, 0, $max ); |
|
| 61 | + if (isset($max)) { |
|
| 62 | + $string = substr($string, 0, $max); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | return $string; |
@@ -73,16 +73,16 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @return string |
| 75 | 75 | */ |
| 76 | - public static function an( $string, $max = null ) { |
|
| 77 | - return self::filter( self::$characters_an, $string, $max ); |
|
| 76 | + public static function an($string, $max = null) { |
|
| 77 | + return self::filter(self::$characters_an, $string, $max); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public static function an16( $string ) { |
|
| 81 | - return self::an( $string, 16 ); |
|
| 80 | + public static function an16($string) { |
|
| 81 | + return self::an($string, 16); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - public static function an32( $string ) { |
|
| 85 | - return self::an( $string, 32 ); |
|
| 84 | + public static function an32($string) { |
|
| 85 | + return self::an($string, 32); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -93,16 +93,16 @@ discard block |
||
| 93 | 93 | * |
| 94 | 94 | * @return string |
| 95 | 95 | */ |
| 96 | - public static function ans( $string, $max = null ) { |
|
| 97 | - return self::filter( self::$characters_ans, $string, $max ); |
|
| 96 | + public static function ans($string, $max = null) { |
|
| 97 | + return self::filter(self::$characters_ans, $string, $max); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - public static function ans16( $string ) { |
|
| 101 | - return self::ans( $string, 16 ); |
|
| 100 | + public static function ans16($string) { |
|
| 101 | + return self::ans($string, 16); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - public static function ans32( $string ) { |
|
| 105 | - return self::ans( $string, 32 ); |
|
| 104 | + public static function ans32($string) { |
|
| 105 | + return self::ans($string, 32); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @return string |
| 115 | 115 | */ |
| 116 | - public static function n( $string, $max = null ) { |
|
| 117 | - return self::filter( self::$characters_n, $string, $max ); |
|
| 116 | + public static function n($string, $max = null) { |
|
| 117 | + return self::filter(self::$characters_n, $string, $max); |
|
| 118 | 118 | } |
| 119 | 119 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @param DateTime $date |
| 66 | 66 | */ |
| 67 | - public function set_date( DateTime $date ) { |
|
| 67 | + public function set_date(DateTime $date) { |
|
| 68 | 68 | $this->date = $date; |
| 69 | 69 | } |
| 70 | 70 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * |
| 83 | 83 | * @param string $transaction_id |
| 84 | 84 | */ |
| 85 | - public function set_transaction_id( $transaction_id ) { |
|
| 85 | + public function set_transaction_id($transaction_id) { |
|
| 86 | 86 | $this->transaction_id = $transaction_id; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @param string $purchase_id |
| 102 | 102 | */ |
| 103 | - public function set_purchase_id( $purchase_id ) { |
|
| 103 | + public function set_purchase_id($purchase_id) { |
|
| 104 | 104 | $this->purchase_id = $purchase_id; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * |
| 119 | 119 | * @param string $status |
| 120 | 120 | */ |
| 121 | - public function set_status( $status ) { |
|
| 121 | + public function set_status($status) { |
|
| 122 | 122 | $this->status = $status; |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -17,33 +17,33 @@ |
||
| 17 | 17 | class Listener { |
| 18 | 18 | public static function listen() { |
| 19 | 19 | // Also check for typo 'xml_notifaction', as this has been used in the past. |
| 20 | - if ( ! filter_has_var( INPUT_GET, 'xml_notification' ) && ! filter_has_var( INPUT_GET, 'xml_notifaction' ) ) { |
|
| 20 | + if ( ! filter_has_var(INPUT_GET, 'xml_notification') && ! filter_has_var(INPUT_GET, 'xml_notifaction')) { |
|
| 21 | 21 | return; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | $notification = Util::get_notification(); |
| 25 | 25 | |
| 26 | - if ( ! $notification ) { |
|
| 26 | + if ( ! $notification) { |
|
| 27 | 27 | return; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - $payment = get_pronamic_payment_by_purchase_id( $notification->get_purchase_id() ); |
|
| 30 | + $payment = get_pronamic_payment_by_purchase_id($notification->get_purchase_id()); |
|
| 31 | 31 | |
| 32 | - if ( null !== $payment ) { |
|
| 32 | + if (null !== $payment) { |
|
| 33 | 33 | // Add note. |
| 34 | 34 | $note = sprintf( |
| 35 | 35 | /* translators: %s: iDEAL Basic */ |
| 36 | - __( 'Webhook requested by %s.', 'pronamic_ideal' ), |
|
| 37 | - __( 'iDEAL Basic', 'pronamic_ideal' ) |
|
| 36 | + __('Webhook requested by %s.', 'pronamic_ideal'), |
|
| 37 | + __('iDEAL Basic', 'pronamic_ideal') |
|
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | - $payment->add_note( $note ); |
|
| 40 | + $payment->add_note($note); |
|
| 41 | 41 | |
| 42 | - $payment->set_status( $notification->get_status() ); |
|
| 43 | - $payment->set_transaction_id( $notification->get_transaction_id() ); |
|
| 42 | + $payment->set_status($notification->get_status()); |
|
| 43 | + $payment->set_transaction_id($notification->get_transaction_id()); |
|
| 44 | 44 | |
| 45 | 45 | // Update payment. |
| 46 | - Plugin::update_payment( $payment ); |
|
| 46 | + Plugin::update_payment($payment); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | $this->forbidden_characters = array(); |
| 178 | 178 | |
| 179 | - $this->set_payment_type( self::PAYMENT_TYPE_IDEAL ); |
|
| 180 | - $this->set_expire_date_format( self::DATE_EXPIRE_FORMAT ); |
|
| 181 | - $this->set_expire_date_modifier( self::EXPIRE_DATE_MODIFIER ); |
|
| 182 | - $this->set_forbidden_characters( self::FORBIDDEN_CHARACHTERS ); |
|
| 179 | + $this->set_payment_type(self::PAYMENT_TYPE_IDEAL); |
|
| 180 | + $this->set_expire_date_format(self::DATE_EXPIRE_FORMAT); |
|
| 181 | + $this->set_expire_date_modifier(self::EXPIRE_DATE_MODIFIER); |
|
| 182 | + $this->set_forbidden_characters(self::FORBIDDEN_CHARACHTERS); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * |
| 197 | 197 | * @param string $url Payment server URL. |
| 198 | 198 | */ |
| 199 | - public function set_payment_server_url( $url ) { |
|
| 199 | + public function set_payment_server_url($url) { |
|
| 200 | 200 | $this->payment_server_url = $url; |
| 201 | 201 | } |
| 202 | 202 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * |
| 215 | 215 | * @param string $merchant_id Merchant ID. |
| 216 | 216 | */ |
| 217 | - public function set_merchant_id( $merchant_id ) { |
|
| 217 | + public function set_merchant_id($merchant_id) { |
|
| 218 | 218 | $this->merchant_id = $merchant_id; |
| 219 | 219 | } |
| 220 | 220 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * |
| 233 | 233 | * @param string $sub_id Sub ID. |
| 234 | 234 | */ |
| 235 | - public function set_sub_id( $sub_id ) { |
|
| 235 | + public function set_sub_id($sub_id) { |
|
| 236 | 236 | $this->sub_id = $sub_id; |
| 237 | 237 | } |
| 238 | 238 | |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | * |
| 252 | 252 | * @param string $hash_key Hash key. |
| 253 | 253 | */ |
| 254 | - public function set_hash_key( $hash_key ) { |
|
| 254 | + public function set_hash_key($hash_key) { |
|
| 255 | 255 | $this->hash_key = $hash_key; |
| 256 | 256 | } |
| 257 | 257 | |
@@ -270,8 +270,8 @@ discard block |
||
| 270 | 270 | * |
| 271 | 271 | * @param string $purchase_id Purchase ID. |
| 272 | 272 | */ |
| 273 | - public function set_purchase_id( $purchase_id ) { |
|
| 274 | - $this->purchase_id = substr( $purchase_id, 0, 16 ); |
|
| 273 | + public function set_purchase_id($purchase_id) { |
|
| 274 | + $this->purchase_id = substr($purchase_id, 0, 16); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | /** |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | * |
| 289 | 289 | * @param string $language Language. |
| 290 | 290 | */ |
| 291 | - public function set_language( $language ) { |
|
| 291 | + public function set_language($language) { |
|
| 292 | 292 | $this->language = $language; |
| 293 | 293 | } |
| 294 | 294 | |
@@ -307,8 +307,8 @@ discard block |
||
| 307 | 307 | * |
| 308 | 308 | * @param string $description Description. |
| 309 | 309 | */ |
| 310 | - public function set_description( $description ) { |
|
| 311 | - $this->description = DataHelper::an32( $description ); |
|
| 310 | + public function set_description($description) { |
|
| 311 | + $this->description = DataHelper::an32($description); |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | /** |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | * |
| 326 | 326 | * @param string $currency Currency. |
| 327 | 327 | */ |
| 328 | - public function set_currency( $currency ) { |
|
| 328 | + public function set_currency($currency) { |
|
| 329 | 329 | $this->currency = $currency; |
| 330 | 330 | } |
| 331 | 331 | |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | * |
| 345 | 345 | * @param string $payment_type Payment type. |
| 346 | 346 | */ |
| 347 | - public function set_payment_type( $payment_type ) { |
|
| 347 | + public function set_payment_type($payment_type) { |
|
| 348 | 348 | $this->payment_type = $payment_type; |
| 349 | 349 | } |
| 350 | 350 | |
@@ -355,10 +355,10 @@ discard block |
||
| 355 | 355 | * |
| 356 | 356 | * @return DateTime |
| 357 | 357 | */ |
| 358 | - public function get_expire_date( $create_new = false ) { |
|
| 359 | - if ( null === $this->expire_date || $create_new ) { |
|
| 360 | - $this->expire_date = new DateTime( null, new DateTimeZone( Plugin::TIMEZONE ) ); |
|
| 361 | - $this->expire_date->modify( $this->expire_date_modifier ); |
|
| 358 | + public function get_expire_date($create_new = false) { |
|
| 359 | + if (null === $this->expire_date || $create_new) { |
|
| 360 | + $this->expire_date = new DateTime(null, new DateTimeZone(Plugin::TIMEZONE)); |
|
| 361 | + $this->expire_date->modify($this->expire_date_modifier); |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | return $this->expire_date; |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | * |
| 379 | 379 | * @param string $expire_date_format Expire date format. |
| 380 | 380 | */ |
| 381 | - public function set_expire_date_format( $expire_date_format ) { |
|
| 381 | + public function set_expire_date_format($expire_date_format) { |
|
| 382 | 382 | $this->expire_date_format = $expire_date_format; |
| 383 | 383 | } |
| 384 | 384 | |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | * |
| 397 | 397 | * @param string $expire_date_modifier Expire date modifier. |
| 398 | 398 | */ |
| 399 | - public function set_expire_date_modifier( $expire_date_modifier ) { |
|
| 399 | + public function set_expire_date_modifier($expire_date_modifier) { |
|
| 400 | 400 | $this->expire_date_modifier = $expire_date_modifier; |
| 401 | 401 | } |
| 402 | 402 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | * |
| 406 | 406 | * @param DateTime $date Expire date. |
| 407 | 407 | */ |
| 408 | - public function set_expire_date( DateTime $date ) { |
|
| 408 | + public function set_expire_date(DateTime $date) { |
|
| 409 | 409 | $this->expire_date = $date; |
| 410 | 410 | } |
| 411 | 411 | |
@@ -425,13 +425,13 @@ discard block |
||
| 425 | 425 | * |
| 426 | 426 | * @throws InvalidArgumentException Passed characters is not an array or string. |
| 427 | 427 | */ |
| 428 | - public function set_forbidden_characters( $characters ) { |
|
| 429 | - if ( ! is_array( $characters ) && ! is_string( $characters ) ) { |
|
| 430 | - throw new InvalidArgumentException( 'Invalid characters argument.' ); |
|
| 428 | + public function set_forbidden_characters($characters) { |
|
| 429 | + if ( ! is_array($characters) && ! is_string($characters)) { |
|
| 430 | + throw new InvalidArgumentException('Invalid characters argument.'); |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - if ( is_string( $characters ) ) { |
|
| 434 | - $characters = str_split( $characters ); |
|
| 433 | + if (is_string($characters)) { |
|
| 434 | + $characters = str_split($characters); |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | $this->forbidden_characters = $characters; |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | * |
| 452 | 452 | * @param string $url Success URL. |
| 453 | 453 | */ |
| 454 | - public function set_success_url( $url ) { |
|
| 454 | + public function set_success_url($url) { |
|
| 455 | 455 | $this->success_url = $url; |
| 456 | 456 | } |
| 457 | 457 | |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | * |
| 470 | 470 | * @param string $url Cancel URL. |
| 471 | 471 | */ |
| 472 | - public function set_cancel_url( $url ) { |
|
| 472 | + public function set_cancel_url($url) { |
|
| 473 | 473 | $this->cancel_url = $url; |
| 474 | 474 | } |
| 475 | 475 | |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | * |
| 488 | 488 | * @param string $url Error URL. |
| 489 | 489 | */ |
| 490 | - public function set_error_url( $url ) { |
|
| 490 | + public function set_error_url($url) { |
|
| 491 | 491 | $this->error_url = $url; |
| 492 | 492 | } |
| 493 | 493 | |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | * |
| 506 | 506 | * @param Items $items Items. |
| 507 | 507 | */ |
| 508 | - public function set_items( Items $items ) { |
|
| 508 | + public function set_items(Items $items) { |
|
| 509 | 509 | $this->items = $items; |
| 510 | 510 | } |
| 511 | 511 | |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | $string[] = $this->get_sub_id(); |
| 535 | 535 | |
| 536 | 536 | // Total amount of transaction. |
| 537 | - $string[] = intval( $this->get_amount()->get_cents() ); |
|
| 537 | + $string[] = intval($this->get_amount()->get_cents()); |
|
| 538 | 538 | |
| 539 | 539 | // The online shop's unique order number, also known as purchase id. |
| 540 | 540 | $string[] = $this->get_purchase_id(); |
@@ -544,10 +544,10 @@ discard block |
||
| 544 | 544 | |
| 545 | 545 | // yyyy-MMddTHH:mm:ss.SSS Z Time at which the transaction expires (maximum of 1 hour later). |
| 546 | 546 | // The consumer has time until then to pay with iDEAL. |
| 547 | - $string[] = $this->get_expire_date()->format( $this->get_expire_date_format() ); |
|
| 547 | + $string[] = $this->get_expire_date()->format($this->get_expire_date_format()); |
|
| 548 | 548 | |
| 549 | 549 | // Iterate through the items and concat. |
| 550 | - foreach ( $this->get_items() as $item ) { |
|
| 550 | + foreach ($this->get_items() as $item) { |
|
| 551 | 551 | // Article number. <n> is 1 for the first product, 2 for the second, etc. |
| 552 | 552 | // N.B. Note that for every product type the parameters |
| 553 | 553 | // itemNumber<n>, itemDescription<n>, itemQuantity<n> and itemPrice<n> are mandatory. |
@@ -560,17 +560,17 @@ discard block |
||
| 560 | 560 | $string[] = $item->get_quantity(); |
| 561 | 561 | |
| 562 | 562 | // Price of article <n> in whole eurocents. |
| 563 | - $string[] = intval( $item->get_price()->get_cents() ); |
|
| 563 | + $string[] = intval($item->get_price()->get_cents()); |
|
| 564 | 564 | } |
| 565 | 565 | |
| 566 | - $concat_string = implode( '', $string ); |
|
| 566 | + $concat_string = implode('', $string); |
|
| 567 | 567 | |
| 568 | 568 | // The characters "\t", "\n", "\r", " " (spaces) may not exist in the string. |
| 569 | 569 | $forbidden_characters = $this->get_forbidden_characters(); |
| 570 | - $concat_string = str_replace( $forbidden_characters, '', $concat_string ); |
|
| 570 | + $concat_string = str_replace($forbidden_characters, '', $concat_string); |
|
| 571 | 571 | |
| 572 | 572 | // Delete special HTML entities. |
| 573 | - $concat_string = html_entity_decode( $concat_string, ENT_COMPAT, 'UTF-8' ); |
|
| 573 | + $concat_string = html_entity_decode($concat_string, ENT_COMPAT, 'UTF-8'); |
|
| 574 | 574 | |
| 575 | 575 | return $concat_string; |
| 576 | 576 | } |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | * @return string Hash |
| 582 | 582 | */ |
| 583 | 583 | public function create_hash() { |
| 584 | - return sha1( $this->create_hash_string() ); |
|
| 584 | + return sha1($this->create_hash_string()); |
|
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | /** |
@@ -596,23 +596,23 @@ discard block |
||
| 596 | 596 | $fields['merchantID'] = $this->get_merchant_id(); |
| 597 | 597 | $fields['subID'] = $this->get_sub_id(); |
| 598 | 598 | |
| 599 | - $fields['amount'] = intval( $this->get_amount()->get_cents() ); |
|
| 599 | + $fields['amount'] = intval($this->get_amount()->get_cents()); |
|
| 600 | 600 | $fields['purchaseID'] = $this->get_purchase_id(); |
| 601 | 601 | $fields['language'] = $this->get_language(); |
| 602 | 602 | $fields['currency'] = $this->get_currency(); |
| 603 | 603 | $fields['description'] = $this->get_description(); |
| 604 | 604 | $fields['hash'] = $this->create_hash(); |
| 605 | 605 | $fields['paymentType'] = $this->get_payment_type(); |
| 606 | - $fields['validUntil'] = $this->get_expire_date()->format( $this->get_expire_date_format() ); |
|
| 606 | + $fields['validUntil'] = $this->get_expire_date()->format($this->get_expire_date_format()); |
|
| 607 | 607 | |
| 608 | 608 | $serial_number = 1; |
| 609 | - foreach ( $this->get_items() as $item ) { |
|
| 610 | - $fields[ 'itemNumber' . $serial_number ] = $item->get_number(); |
|
| 611 | - $fields[ 'itemDescription' . $serial_number ] = $item->get_description(); |
|
| 612 | - $fields[ 'itemQuantity' . $serial_number ] = $item->get_quantity(); |
|
| 613 | - $fields[ 'itemPrice' . $serial_number ] = intval( $item->get_price()->get_cents() ); |
|
| 609 | + foreach ($this->get_items() as $item) { |
|
| 610 | + $fields['itemNumber' . $serial_number] = $item->get_number(); |
|
| 611 | + $fields['itemDescription' . $serial_number] = $item->get_description(); |
|
| 612 | + $fields['itemQuantity' . $serial_number] = $item->get_quantity(); |
|
| 613 | + $fields['itemPrice' . $serial_number] = intval($item->get_price()->get_cents()); |
|
| 614 | 614 | |
| 615 | - $serial_number ++; |
|
| 615 | + $serial_number++; |
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | $fields['urlCancel'] = $this->get_cancel_url(); |