@@ -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; |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | // Function name "getIterator" is in camel caps format, try 'get_iterator' |
41 | 41 | public function getIterator() { |
42 | 42 | // @codingStandardsIgnoreEnd |
43 | - return new ArrayIterator( $this->items ); |
|
43 | + return new ArrayIterator($this->items); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Add item |
48 | 48 | */ |
49 | - public function add_item( Item $item ) { |
|
49 | + public function add_item(Item $item) { |
|
50 | 50 | $this->items[] = $item; |
51 | 51 | } |
52 | 52 | |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | public function get_amount() { |
57 | 57 | $amount = 0; |
58 | 58 | |
59 | - foreach ( $this->items as $item ) { |
|
59 | + foreach ($this->items as $item) { |
|
60 | 60 | $amount += $item->get_amount(); |
61 | 61 | } |
62 | 62 | |
63 | - return new Money( $amount ); |
|
63 | + return new Money($amount); |
|
64 | 64 | } |
65 | 65 | } |
@@ -23,19 +23,19 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @param Config $config |
25 | 25 | */ |
26 | - public function __construct( Config $config ) { |
|
27 | - parent::__construct( $config ); |
|
26 | + public function __construct(Config $config) { |
|
27 | + parent::__construct($config); |
|
28 | 28 | |
29 | - $this->set_method( Gateway::METHOD_HTML_FORM ); |
|
30 | - $this->set_has_feedback( false ); |
|
31 | - $this->set_amount_minimum( 0.01 ); |
|
29 | + $this->set_method(Gateway::METHOD_HTML_FORM); |
|
30 | + $this->set_has_feedback(false); |
|
31 | + $this->set_amount_minimum(0.01); |
|
32 | 32 | |
33 | 33 | $this->client = new Client(); |
34 | 34 | |
35 | - $this->client->set_payment_server_url( $config->get_payment_server_url() ); |
|
36 | - $this->client->set_merchant_id( $config->merchant_id ); |
|
37 | - $this->client->set_sub_id( $config->sub_id ); |
|
38 | - $this->client->set_hash_key( $config->hash_key ); |
|
35 | + $this->client->set_payment_server_url($config->get_payment_server_url()); |
|
36 | + $this->client->set_merchant_id($config->merchant_id); |
|
37 | + $this->client->set_sub_id($config->sub_id); |
|
38 | + $this->client->set_hash_key($config->hash_key); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -65,31 +65,31 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @see Pronamic_WP_Pay_Gateway::start() |
67 | 67 | */ |
68 | - public function start( Payment $payment ) { |
|
69 | - $payment->set_action_url( $this->client->get_payment_server_url() ); |
|
68 | + public function start(Payment $payment) { |
|
69 | + $payment->set_action_url($this->client->get_payment_server_url()); |
|
70 | 70 | |
71 | 71 | // Purchase ID |
72 | - $purchase_id = $payment->format_string( $this->config->purchase_id ); |
|
72 | + $purchase_id = $payment->format_string($this->config->purchase_id); |
|
73 | 73 | |
74 | - $payment->set_meta( 'purchase_id', $purchase_id ); |
|
74 | + $payment->set_meta('purchase_id', $purchase_id); |
|
75 | 75 | |
76 | 76 | // General |
77 | - $this->client->set_language( $payment->get_language() ); |
|
78 | - $this->client->set_currency( $payment->get_currency() ); |
|
79 | - $this->client->set_purchase_id( $purchase_id ); |
|
80 | - $this->client->set_description( $payment->get_description() ); |
|
77 | + $this->client->set_language($payment->get_language()); |
|
78 | + $this->client->set_currency($payment->get_currency()); |
|
79 | + $this->client->set_purchase_id($purchase_id); |
|
80 | + $this->client->set_description($payment->get_description()); |
|
81 | 81 | |
82 | 82 | // Items |
83 | 83 | $items = new Items(); |
84 | 84 | |
85 | - $items->add_item( new Item( 1, $payment->get_description(), 1, $payment->get_amount()->get_amount() ) ); |
|
85 | + $items->add_item(new Item(1, $payment->get_description(), 1, $payment->get_amount()->get_amount())); |
|
86 | 86 | |
87 | - $this->client->set_items( $items ); |
|
87 | + $this->client->set_items($items); |
|
88 | 88 | |
89 | 89 | // URLs |
90 | - $this->client->set_cancel_url( add_query_arg( 'status', Statuses::CANCELLED, $payment->get_return_url() ) ); |
|
91 | - $this->client->set_success_url( add_query_arg( 'status', Statuses::SUCCESS, $payment->get_return_url() ) ); |
|
92 | - $this->client->set_error_url( add_query_arg( 'status', Statuses::FAILURE, $payment->get_return_url() ) ); |
|
90 | + $this->client->set_cancel_url(add_query_arg('status', Statuses::CANCELLED, $payment->get_return_url())); |
|
91 | + $this->client->set_success_url(add_query_arg('status', Statuses::SUCCESS, $payment->get_return_url())); |
|
92 | + $this->client->set_error_url(add_query_arg('status', Statuses::FAILURE, $payment->get_return_url())); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -97,23 +97,23 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @param Payment $payment |
99 | 99 | */ |
100 | - public function update_status( Payment $payment ) { |
|
100 | + public function update_status(Payment $payment) { |
|
101 | 101 | $status = null; |
102 | 102 | |
103 | 103 | // Handle XML notification |
104 | 104 | $notification = Util::get_notification(); |
105 | 105 | |
106 | - if ( $notification ) { |
|
107 | - $payment->set_transaction_id( $notification->get_transaction_id() ); |
|
106 | + if ($notification) { |
|
107 | + $payment->set_transaction_id($notification->get_transaction_id()); |
|
108 | 108 | |
109 | 109 | $status = $notification->get_status(); |
110 | - } elseif ( filter_has_var( INPUT_GET, 'status' ) ) { |
|
111 | - $status = filter_input( INPUT_GET, 'status', FILTER_SANITIZE_STRING ); |
|
110 | + } elseif (filter_has_var(INPUT_GET, 'status')) { |
|
111 | + $status = filter_input(INPUT_GET, 'status', FILTER_SANITIZE_STRING); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | // Set payment status |
115 | - if ( $status ) { |
|
116 | - $payment->set_status( $status ); |
|
115 | + if ($status) { |
|
116 | + $payment->set_status($status); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | } |
@@ -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,30 +17,30 @@ |
||
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 | 42 | // Update payment. |
43 | - Plugin::update_payment( $payment ); |
|
43 | + Plugin::update_payment($payment); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
@@ -17,22 +17,22 @@ |
||
17 | 17 | class ConfigFactory extends GatewayConfigFactory { |
18 | 18 | private $config_class; |
19 | 19 | |
20 | - public function __construct( $config_class = null, $config_test_class = null ) { |
|
21 | - $this->config_class = is_null( $config_class ) ? __NAMESPACE__ . '\Config' : $config_class; |
|
22 | - $this->config_test_class = is_null( $config_test_class ) ? __NAMESPACE__ . '\Config' : $config_test_class; |
|
20 | + public function __construct($config_class = null, $config_test_class = null) { |
|
21 | + $this->config_class = is_null($config_class) ? __NAMESPACE__ . '\Config' : $config_class; |
|
22 | + $this->config_test_class = is_null($config_test_class) ? __NAMESPACE__ . '\Config' : $config_test_class; |
|
23 | 23 | } |
24 | 24 | |
25 | - public function get_config( $post_id ) { |
|
26 | - $mode = get_post_meta( $post_id, '_pronamic_gateway_mode', true ); |
|
25 | + public function get_config($post_id) { |
|
26 | + $mode = get_post_meta($post_id, '_pronamic_gateway_mode', true); |
|
27 | 27 | |
28 | - $config_class = ( 'test' === $mode ) ? $this->config_test_class : $this->config_class; |
|
28 | + $config_class = ('test' === $mode) ? $this->config_test_class : $this->config_class; |
|
29 | 29 | |
30 | 30 | $config = new $config_class(); |
31 | 31 | |
32 | - $config->merchant_id = get_post_meta( $post_id, '_pronamic_gateway_ideal_merchant_id', true ); |
|
33 | - $config->sub_id = get_post_meta( $post_id, '_pronamic_gateway_ideal_sub_id', true ); |
|
34 | - $config->hash_key = get_post_meta( $post_id, '_pronamic_gateway_ideal_hash_key', true ); |
|
35 | - $config->purchase_id = get_post_meta( $post_id, '_pronamic_gateway_ideal_purchase_id', true ); |
|
32 | + $config->merchant_id = get_post_meta($post_id, '_pronamic_gateway_ideal_merchant_id', true); |
|
33 | + $config->sub_id = get_post_meta($post_id, '_pronamic_gateway_ideal_sub_id', true); |
|
34 | + $config->hash_key = get_post_meta($post_id, '_pronamic_gateway_ideal_hash_key', true); |
|
35 | + $config->purchase_id = get_post_meta($post_id, '_pronamic_gateway_ideal_purchase_id', true); |
|
36 | 36 | |
37 | 37 | return $config; |
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; |