@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return DataCustomerHelper |
| 25 | 25 | */ |
| 26 | - public function set_name( $name ) { |
|
| 27 | - return $this->set_field( 'CN', $name ); |
|
| 26 | + public function set_name($name) { |
|
| 27 | + return $this->set_field('CN', $name); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @return DataCustomerHelper |
| 36 | 36 | */ |
| 37 | - public function set_email( $email ) { |
|
| 38 | - return $this->set_field( 'EMAIL', $email ); |
|
| 37 | + public function set_email($email) { |
|
| 38 | + return $this->set_field('EMAIL', $email); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | * |
| 46 | 46 | * @return DataCustomerHelper |
| 47 | 47 | */ |
| 48 | - public function set_address( $address ) { |
|
| 49 | - return $this->set_field( 'OWNERADDRESS', $address ); |
|
| 48 | + public function set_address($address) { |
|
| 49 | + return $this->set_field('OWNERADDRESS', $address); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | * @return DataCustomerHelper |
| 58 | 58 | */ |
| 59 | - public function set_zip( $zip ) { |
|
| 60 | - return $this->set_field( 'OWNERZIP', $zip ); |
|
| 59 | + public function set_zip($zip) { |
|
| 60 | + return $this->set_field('OWNERZIP', $zip); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -67,8 +67,8 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @return DataCustomerHelper |
| 69 | 69 | */ |
| 70 | - public function set_town( $town ) { |
|
| 71 | - return $this->set_field( 'OWNERTOWN', $town ); |
|
| 70 | + public function set_town($town) { |
|
| 71 | + return $this->set_field('OWNERTOWN', $town); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @return DataCustomerHelper |
| 80 | 80 | */ |
| 81 | - public function set_country( $country ) { |
|
| 82 | - return $this->set_field( 'OWNERCTY', $country ); |
|
| 81 | + public function set_country($country) { |
|
| 82 | + return $this->set_field('OWNERCTY', $country); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * @return DataCustomerHelper |
| 91 | 91 | */ |
| 92 | - public function set_telephone_number( $number ) { |
|
| 93 | - return $this->set_field( 'OWNERTELNO', $number ); |
|
| 92 | + public function set_telephone_number($number) { |
|
| 93 | + return $this->set_field('OWNERTELNO', $number); |
|
| 94 | 94 | } |
| 95 | 95 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @param string $param_var |
| 20 | 20 | */ |
| 21 | - public static function get_param_var( $param_var ) { |
|
| 21 | + public static function get_param_var($param_var) { |
|
| 22 | 22 | // Find and replace |
| 23 | 23 | // @link https://github.com/woothemes/woocommerce/blob/v2.0.19/classes/emails/class-wc-email-new-order.php |
| 24 | 24 | $find = array(); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $replace[] = home_url(); |
| 32 | 32 | |
| 33 | 33 | // Parameter Variable |
| 34 | - $param_var = str_replace( $find, $replace, $param_var ); |
|
| 34 | + $param_var = str_replace($find, $replace, $param_var); |
|
| 35 | 35 | |
| 36 | 36 | return $param_var; |
| 37 | 37 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * |
| 86 | 86 | * @return bool|OrderResponse |
| 87 | 87 | */ |
| 88 | - public function order_direct( array $data = array() ) { |
|
| 88 | + public function order_direct(array $data = array()) { |
|
| 89 | 89 | $order_response = false; |
| 90 | 90 | |
| 91 | 91 | $result = Util::remote_get_body( |
@@ -98,23 +98,23 @@ discard block |
||
| 98 | 98 | ) |
| 99 | 99 | ); |
| 100 | 100 | |
| 101 | - if ( is_wp_error( $result ) ) { |
|
| 101 | + if (is_wp_error($result)) { |
|
| 102 | 102 | $this->error = $result; |
| 103 | 103 | } else { |
| 104 | - $xml = Util::simplexml_load_string( $result ); |
|
| 104 | + $xml = Util::simplexml_load_string($result); |
|
| 105 | 105 | |
| 106 | - if ( is_wp_error( $xml ) ) { |
|
| 106 | + if (is_wp_error($xml)) { |
|
| 107 | 107 | $this->error = $xml; |
| 108 | 108 | } else { |
| 109 | - $order_response = OrderResponseParser::parse( $xml ); |
|
| 109 | + $order_response = OrderResponseParser::parse($xml); |
|
| 110 | 110 | |
| 111 | - if ( ! empty( $order_response->nc_error ) ) { |
|
| 111 | + if ( ! empty($order_response->nc_error)) { |
|
| 112 | 112 | $ogone_error = new Error( |
| 113 | - Security::filter( $order_response->nc_error ), |
|
| 114 | - Security::filter( $order_response->nc_error_plus ) |
|
| 113 | + Security::filter($order_response->nc_error), |
|
| 114 | + Security::filter($order_response->nc_error_plus) |
|
| 115 | 115 | ); |
| 116 | 116 | |
| 117 | - $this->error = new WP_Error( 'ogone_error', (string) $ogone_error, $ogone_error ); |
|
| 117 | + $this->error = new WP_Error('ogone_error', (string) $ogone_error, $ogone_error); |
|
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @param Data $data Data. |
| 29 | 29 | */ |
| 30 | - public function __construct( Data $data ) { |
|
| 30 | + public function __construct(Data $data) { |
|
| 31 | 31 | $this->data = $data; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @return DataHelper |
| 40 | 40 | */ |
| 41 | - public function set_user_id( $user_id ) { |
|
| 42 | - $this->data->set_field( 'USERID', $user_id ); |
|
| 41 | + public function set_user_id($user_id) { |
|
| 42 | + $this->data->set_field('USERID', $user_id); |
|
| 43 | 43 | |
| 44 | 44 | return $this; |
| 45 | 45 | } |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @return DataHelper |
| 53 | 53 | */ |
| 54 | - public function set_password( $password ) { |
|
| 55 | - $this->data->set_field( 'PSWD', $password ); |
|
| 54 | + public function set_password($password) { |
|
| 55 | + $this->data->set_field('PSWD', $password); |
|
| 56 | 56 | |
| 57 | 57 | return $this; |
| 58 | 58 | } |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @param Config $config Config. |
| 46 | 46 | */ |
| 47 | - public function __construct( Config $config ) { |
|
| 48 | - parent::__construct( $config ); |
|
| 47 | + public function __construct(Config $config) { |
|
| 48 | + parent::__construct($config); |
|
| 49 | 49 | |
| 50 | - $this->set_method( self::METHOD_HTTP_REDIRECT ); |
|
| 51 | - $this->set_slug( self::SLUG ); |
|
| 50 | + $this->set_method(self::METHOD_HTTP_REDIRECT); |
|
| 51 | + $this->set_slug(self::SLUG); |
|
| 52 | 52 | |
| 53 | 53 | $this->client = new Client(); |
| 54 | 54 | $this->client->psp_id = $config->psp_id; |
@@ -65,112 +65,112 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @param Payment $payment Payment. |
| 67 | 67 | */ |
| 68 | - public function start( Payment $payment ) { |
|
| 68 | + public function start(Payment $payment) { |
|
| 69 | 69 | $ogone_data = new Data(); |
| 70 | 70 | |
| 71 | 71 | // General. |
| 72 | - $ogone_data_general = new DataGeneralHelper( $ogone_data ); |
|
| 72 | + $ogone_data_general = new DataGeneralHelper($ogone_data); |
|
| 73 | 73 | |
| 74 | 74 | $ogone_data_general |
| 75 | - ->set_psp_id( $this->client->psp_id ) |
|
| 76 | - ->set_order_id( $payment->format_string( $this->config->order_id ) ) |
|
| 77 | - ->set_order_description( $payment->get_description() ) |
|
| 78 | - ->set_param_plus( 'payment_id=' . $payment->get_id() ) |
|
| 79 | - ->set_currency( $payment->get_total_amount()->get_currency()->get_alphabetic_code() ) |
|
| 80 | - ->set_amount( $payment->get_total_amount()->get_cents() ); |
|
| 75 | + ->set_psp_id($this->client->psp_id) |
|
| 76 | + ->set_order_id($payment->format_string($this->config->order_id)) |
|
| 77 | + ->set_order_description($payment->get_description()) |
|
| 78 | + ->set_param_plus('payment_id=' . $payment->get_id()) |
|
| 79 | + ->set_currency($payment->get_total_amount()->get_currency()->get_alphabetic_code()) |
|
| 80 | + ->set_amount($payment->get_total_amount()->get_cents()); |
|
| 81 | 81 | |
| 82 | 82 | $customer = $payment->get_customer(); |
| 83 | 83 | |
| 84 | - if ( null !== $customer ) { |
|
| 84 | + if (null !== $customer) { |
|
| 85 | 85 | // Localised language. |
| 86 | - $ogone_data_general->set_language( $customer->get_locale() ); |
|
| 86 | + $ogone_data_general->set_language($customer->get_locale()); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | // Customer. |
| 90 | - $ogone_data_customer = new DataCustomerHelper( $ogone_data ); |
|
| 90 | + $ogone_data_customer = new DataCustomerHelper($ogone_data); |
|
| 91 | 91 | |
| 92 | - if ( null !== $customer ) { |
|
| 92 | + if (null !== $customer) { |
|
| 93 | 93 | $name = $customer->get_name(); |
| 94 | 94 | |
| 95 | - if ( null !== $name ) { |
|
| 96 | - $ogone_data_customer->set_name( strval( $name ) ); |
|
| 95 | + if (null !== $name) { |
|
| 96 | + $ogone_data_customer->set_name(strval($name)); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - $ogone_data_customer->set_email( $customer->get_email() ); |
|
| 99 | + $ogone_data_customer->set_email($customer->get_email()); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | $billing_address = $payment->get_billing_address(); |
| 103 | 103 | |
| 104 | - if ( null !== $billing_address ) { |
|
| 104 | + if (null !== $billing_address) { |
|
| 105 | 105 | $ogone_data_customer |
| 106 | - ->set_address( $billing_address->get_line_1() ) |
|
| 107 | - ->set_zip( $billing_address->get_postal_code() ) |
|
| 108 | - ->set_town( $billing_address->get_city() ) |
|
| 109 | - ->set_country( $billing_address->get_country_code() ) |
|
| 110 | - ->set_telephone_number( $billing_address->get_phone() ); |
|
| 106 | + ->set_address($billing_address->get_line_1()) |
|
| 107 | + ->set_zip($billing_address->get_postal_code()) |
|
| 108 | + ->set_town($billing_address->get_city()) |
|
| 109 | + ->set_country($billing_address->get_country_code()) |
|
| 110 | + ->set_telephone_number($billing_address->get_phone()); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | // DirectLink. |
| 114 | - $ogone_data_directlink = new DataHelper( $ogone_data ); |
|
| 114 | + $ogone_data_directlink = new DataHelper($ogone_data); |
|
| 115 | 115 | |
| 116 | 116 | $ogone_data_directlink |
| 117 | - ->set_user_id( $this->client->user_id ) |
|
| 118 | - ->set_password( $this->client->password ); |
|
| 117 | + ->set_user_id($this->client->user_id) |
|
| 118 | + ->set_password($this->client->password); |
|
| 119 | 119 | |
| 120 | 120 | // Credit card. |
| 121 | - $ogone_data_credit_card = new DataCreditCardHelper( $ogone_data ); |
|
| 121 | + $ogone_data_credit_card = new DataCreditCardHelper($ogone_data); |
|
| 122 | 122 | |
| 123 | 123 | $credit_card = $payment->get_credit_card(); |
| 124 | 124 | |
| 125 | - if ( $credit_card ) { |
|
| 125 | + if ($credit_card) { |
|
| 126 | 126 | $ogone_data_credit_card |
| 127 | - ->set_number( $credit_card->get_number() ) |
|
| 128 | - ->set_expiration_date( $credit_card->get_expiration_date() ) |
|
| 129 | - ->set_security_code( $credit_card->get_security_code() ); |
|
| 127 | + ->set_number($credit_card->get_number()) |
|
| 128 | + ->set_expiration_date($credit_card->get_expiration_date()) |
|
| 129 | + ->set_security_code($credit_card->get_security_code()); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - $ogone_data->set_field( 'OPERATION', 'SAL' ); |
|
| 132 | + $ogone_data->set_field('OPERATION', 'SAL'); |
|
| 133 | 133 | |
| 134 | 134 | // 3-D Secure |
| 135 | - if ( $this->config->enabled_3d_secure ) { |
|
| 136 | - $secure_data_helper = new SecureDataHelper( $ogone_data ); |
|
| 135 | + if ($this->config->enabled_3d_secure) { |
|
| 136 | + $secure_data_helper = new SecureDataHelper($ogone_data); |
|
| 137 | 137 | |
| 138 | 138 | $secure_data_helper |
| 139 | - ->set_3d_secure_flag( true ) |
|
| 140 | - ->set_http_accept( Server::get( 'HTTP_ACCEPT' ) ) |
|
| 141 | - ->set_http_user_agent( Server::get( 'HTTP_USER_AGENT' ) ) |
|
| 142 | - ->set_window( 'MAINW' ); |
|
| 143 | - |
|
| 144 | - $ogone_data->set_field( 'ACCEPTURL', $payment->get_return_url() ); |
|
| 145 | - $ogone_data->set_field( 'DECLINEURL', $payment->get_return_url() ); |
|
| 146 | - $ogone_data->set_field( 'EXCEPTIONURL', $payment->get_return_url() ); |
|
| 147 | - $ogone_data->set_field( 'COMPLUS', '' ); |
|
| 139 | + ->set_3d_secure_flag(true) |
|
| 140 | + ->set_http_accept(Server::get('HTTP_ACCEPT')) |
|
| 141 | + ->set_http_user_agent(Server::get('HTTP_USER_AGENT')) |
|
| 142 | + ->set_window('MAINW'); |
|
| 143 | + |
|
| 144 | + $ogone_data->set_field('ACCEPTURL', $payment->get_return_url()); |
|
| 145 | + $ogone_data->set_field('DECLINEURL', $payment->get_return_url()); |
|
| 146 | + $ogone_data->set_field('EXCEPTIONURL', $payment->get_return_url()); |
|
| 147 | + $ogone_data->set_field('COMPLUS', ''); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | // Signature. |
| 151 | 151 | $calculation_fields = Security::get_calculations_parameters_in(); |
| 152 | 152 | |
| 153 | - $fields = Security::get_calculation_fields( $calculation_fields, $ogone_data->get_fields() ); |
|
| 153 | + $fields = Security::get_calculation_fields($calculation_fields, $ogone_data->get_fields()); |
|
| 154 | 154 | |
| 155 | - $signature = Security::get_signature( $fields, $this->config->sha_in_pass_phrase, $this->config->hash_algorithm ); |
|
| 155 | + $signature = Security::get_signature($fields, $this->config->sha_in_pass_phrase, $this->config->hash_algorithm); |
|
| 156 | 156 | |
| 157 | - $ogone_data->set_field( 'SHASIGN', $signature ); |
|
| 157 | + $ogone_data->set_field('SHASIGN', $signature); |
|
| 158 | 158 | |
| 159 | 159 | // Order. |
| 160 | - $result = $this->client->order_direct( $ogone_data->get_fields() ); |
|
| 160 | + $result = $this->client->order_direct($ogone_data->get_fields()); |
|
| 161 | 161 | |
| 162 | 162 | $error = $this->client->get_error(); |
| 163 | 163 | |
| 164 | - if ( is_wp_error( $error ) ) { |
|
| 164 | + if (is_wp_error($error)) { |
|
| 165 | 165 | $this->error = $error; |
| 166 | 166 | } else { |
| 167 | - $payment->set_transaction_id( $result->pay_id ); |
|
| 168 | - $payment->set_action_url( $payment->get_return_url() ); |
|
| 169 | - $payment->set_status( Statuses::transform( $result->status ) ); |
|
| 167 | + $payment->set_transaction_id($result->pay_id); |
|
| 168 | + $payment->set_action_url($payment->get_return_url()); |
|
| 169 | + $payment->set_status(Statuses::transform($result->status)); |
|
| 170 | 170 | |
| 171 | - if ( ! empty( $result->html_answer ) ) { |
|
| 172 | - $payment->set_meta( 'ogone_directlink_html_answer', $result->html_answer ); |
|
| 173 | - $payment->set_action_url( add_query_arg( 'payment_redirect', $payment->get_id(), home_url( '/' ) ) ); |
|
| 171 | + if ( ! empty($result->html_answer)) { |
|
| 172 | + $payment->set_meta('ogone_directlink_html_answer', $result->html_answer); |
|
| 173 | + $payment->set_action_url(add_query_arg('payment_redirect', $payment->get_id(), home_url('/'))); |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | } |
@@ -180,22 +180,22 @@ discard block |
||
| 180 | 180 | * |
| 181 | 181 | * @param Payment $payment Payment. |
| 182 | 182 | */ |
| 183 | - public function update_status( Payment $payment ) { |
|
| 183 | + public function update_status(Payment $payment) { |
|
| 184 | 184 | $data = Security::get_request_data(); |
| 185 | 185 | |
| 186 | - $data = array_change_key_case( $data, CASE_UPPER ); |
|
| 186 | + $data = array_change_key_case($data, CASE_UPPER); |
|
| 187 | 187 | |
| 188 | 188 | $calculation_fields = Security::get_calculations_parameters_out(); |
| 189 | 189 | |
| 190 | - $fields = Security::get_calculation_fields( $calculation_fields, $data ); |
|
| 190 | + $fields = Security::get_calculation_fields($calculation_fields, $data); |
|
| 191 | 191 | |
| 192 | 192 | $signature = $data['SHASIGN']; |
| 193 | - $signature_out = Security::get_signature( $fields, $this->config->sha_out_pass_phrase, $this->config->hash_algorithm ); |
|
| 193 | + $signature_out = Security::get_signature($fields, $this->config->sha_out_pass_phrase, $this->config->hash_algorithm); |
|
| 194 | 194 | |
| 195 | - if ( 0 === strcasecmp( $signature, $signature_out ) ) { |
|
| 196 | - $status = Statuses::transform( $data[ Parameters::STATUS ] ); |
|
| 195 | + if (0 === strcasecmp($signature, $signature_out)) { |
|
| 196 | + $status = Statuses::transform($data[Parameters::STATUS]); |
|
| 197 | 197 | |
| 198 | - $payment->set_status( $status ); |
|
| 198 | + $payment->set_status($status); |
|
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @param Data $data Data. |
| 27 | 27 | */ |
| 28 | - public function __construct( Data $data ) { |
|
| 28 | + public function __construct(Data $data) { |
|
| 29 | 29 | $this->data = $data; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @return mixed |
| 39 | 39 | */ |
| 40 | - public function set_field( $name, $value ) { |
|
| 41 | - $this->data->set_field( $name, $value ); |
|
| 40 | + public function set_field($name, $value) { |
|
| 41 | + $this->data->set_field($name, $value); |
|
| 42 | 42 | |
| 43 | 43 | return $this; |
| 44 | 44 | } |
@@ -17,34 +17,34 @@ |
||
| 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__ . '\TestConfig' : $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__ . '\TestConfig' : $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 = ( Gateway::MODE_TEST === $mode ) ? $this->config_test_class : $this->config_class; |
|
| 28 | + $config_class = (Gateway::MODE_TEST === $mode) ? $this->config_test_class : $this->config_class; |
|
| 29 | 29 | |
| 30 | 30 | $config = new $config_class(); |
| 31 | 31 | |
| 32 | - $form_action_url = get_post_meta( $post_id, '_pronamic_gateway_ogone_form_action_url', true ); |
|
| 32 | + $form_action_url = get_post_meta($post_id, '_pronamic_gateway_ogone_form_action_url', true); |
|
| 33 | 33 | |
| 34 | - if ( '' !== $form_action_url ) { |
|
| 35 | - $config->set_form_action_url( $form_action_url ); |
|
| 34 | + if ('' !== $form_action_url) { |
|
| 35 | + $config->set_form_action_url($form_action_url); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $config->mode = $mode; |
| 39 | - $config->psp_id = get_post_meta( $post_id, '_pronamic_gateway_ogone_psp_id', true ); |
|
| 40 | - $config->hash_algorithm = get_post_meta( $post_id, '_pronamic_gateway_ogone_hash_algorithm', true ); |
|
| 41 | - $config->sha_in_pass_phrase = get_post_meta( $post_id, '_pronamic_gateway_ogone_sha_in_pass_phrase', true ); |
|
| 42 | - $config->sha_out_pass_phrase = get_post_meta( $post_id, '_pronamic_gateway_ogone_sha_out_pass_phrase', true ); |
|
| 43 | - $config->user_id = get_post_meta( $post_id, '_pronamic_gateway_ogone_user_id', true ); |
|
| 44 | - $config->password = get_post_meta( $post_id, '_pronamic_gateway_ogone_password', true ); |
|
| 45 | - $config->order_id = get_post_meta( $post_id, '_pronamic_gateway_ogone_order_id', true ); |
|
| 46 | - $config->param_var = get_post_meta( $post_id, '_pronamic_gateway_ogone_param_var', true ); |
|
| 47 | - $config->template_page = get_post_meta( $post_id, '_pronamic_gateway_ogone_template_page', true ); |
|
| 39 | + $config->psp_id = get_post_meta($post_id, '_pronamic_gateway_ogone_psp_id', true); |
|
| 40 | + $config->hash_algorithm = get_post_meta($post_id, '_pronamic_gateway_ogone_hash_algorithm', true); |
|
| 41 | + $config->sha_in_pass_phrase = get_post_meta($post_id, '_pronamic_gateway_ogone_sha_in_pass_phrase', true); |
|
| 42 | + $config->sha_out_pass_phrase = get_post_meta($post_id, '_pronamic_gateway_ogone_sha_out_pass_phrase', true); |
|
| 43 | + $config->user_id = get_post_meta($post_id, '_pronamic_gateway_ogone_user_id', true); |
|
| 44 | + $config->password = get_post_meta($post_id, '_pronamic_gateway_ogone_password', true); |
|
| 45 | + $config->order_id = get_post_meta($post_id, '_pronamic_gateway_ogone_order_id', true); |
|
| 46 | + $config->param_var = get_post_meta($post_id, '_pronamic_gateway_ogone_param_var', true); |
|
| 47 | + $config->template_page = get_post_meta($post_id, '_pronamic_gateway_ogone_template_page', true); |
|
| 48 | 48 | |
| 49 | 49 | return $config; |
| 50 | 50 | } |
@@ -45,27 +45,27 @@ discard block |
||
| 45 | 45 | * |
| 46 | 46 | * @param Config $config Config. |
| 47 | 47 | */ |
| 48 | - public function __construct( Config $config ) { |
|
| 49 | - parent::__construct( $config ); |
|
| 48 | + public function __construct(Config $config) { |
|
| 49 | + parent::__construct($config); |
|
| 50 | 50 | |
| 51 | 51 | $this->supports = array( |
| 52 | 52 | 'payment_status_request', |
| 53 | 53 | ); |
| 54 | 54 | |
| 55 | - $this->set_method( self::METHOD_HTML_FORM ); |
|
| 56 | - $this->set_slug( self::SLUG ); |
|
| 55 | + $this->set_method(self::METHOD_HTML_FORM); |
|
| 56 | + $this->set_slug(self::SLUG); |
|
| 57 | 57 | |
| 58 | - $this->client = new Client( $this->config->psp_id ); |
|
| 58 | + $this->client = new Client($this->config->psp_id); |
|
| 59 | 59 | |
| 60 | - $this->client->set_payment_server_url( $config->get_form_action_url() ); |
|
| 61 | - $this->client->set_direct_query_url( $config->get_direct_query_url() ); |
|
| 62 | - $this->client->set_pass_phrase_in( $config->sha_in_pass_phrase ); |
|
| 63 | - $this->client->set_pass_phrase_out( $config->sha_out_pass_phrase ); |
|
| 64 | - $this->client->set_user_id( $config->user_id ); |
|
| 65 | - $this->client->set_password( $config->password ); |
|
| 60 | + $this->client->set_payment_server_url($config->get_form_action_url()); |
|
| 61 | + $this->client->set_direct_query_url($config->get_direct_query_url()); |
|
| 62 | + $this->client->set_pass_phrase_in($config->sha_in_pass_phrase); |
|
| 63 | + $this->client->set_pass_phrase_out($config->sha_out_pass_phrase); |
|
| 64 | + $this->client->set_user_id($config->user_id); |
|
| 65 | + $this->client->set_password($config->password); |
|
| 66 | 66 | |
| 67 | - if ( ! empty( $config->hash_algorithm ) ) { |
|
| 68 | - $this->client->set_hash_algorithm( $config->hash_algorithm ); |
|
| 67 | + if ( ! empty($config->hash_algorithm)) { |
|
| 68 | + $this->client->set_hash_algorithm($config->hash_algorithm); |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
@@ -89,50 +89,50 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * @param Payment $payment Payment. |
| 91 | 91 | */ |
| 92 | - public function start( Payment $payment ) { |
|
| 93 | - $payment->set_action_url( $this->client->get_payment_server_url() ); |
|
| 92 | + public function start(Payment $payment) { |
|
| 93 | + $payment->set_action_url($this->client->get_payment_server_url()); |
|
| 94 | 94 | |
| 95 | 95 | $ogone_data = $this->client->get_data(); |
| 96 | 96 | |
| 97 | 97 | // General. |
| 98 | - $ogone_data_general = new DataGeneralHelper( $ogone_data ); |
|
| 98 | + $ogone_data_general = new DataGeneralHelper($ogone_data); |
|
| 99 | 99 | |
| 100 | 100 | $ogone_data_general |
| 101 | - ->set_order_id( $payment->format_string( $this->config->order_id ) ) |
|
| 102 | - ->set_order_description( $payment->get_description() ) |
|
| 103 | - ->set_param_plus( 'payment_id=' . $payment->get_id() ) |
|
| 104 | - ->set_currency( $payment->get_total_amount()->get_currency()->get_alphabetic_code() ) |
|
| 105 | - ->set_amount( $payment->get_total_amount()->get_cents() ); |
|
| 101 | + ->set_order_id($payment->format_string($this->config->order_id)) |
|
| 102 | + ->set_order_description($payment->get_description()) |
|
| 103 | + ->set_param_plus('payment_id=' . $payment->get_id()) |
|
| 104 | + ->set_currency($payment->get_total_amount()->get_currency()->get_alphabetic_code()) |
|
| 105 | + ->set_amount($payment->get_total_amount()->get_cents()); |
|
| 106 | 106 | |
| 107 | 107 | $customer = $payment->get_customer(); |
| 108 | 108 | |
| 109 | - if ( null !== $customer ) { |
|
| 109 | + if (null !== $customer) { |
|
| 110 | 110 | // Localised language. |
| 111 | - $ogone_data_general->set_language( $customer->get_locale() ); |
|
| 111 | + $ogone_data_general->set_language($customer->get_locale()); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | // Customer. |
| 115 | - $ogone_data_customer = new DataCustomerHelper( $ogone_data ); |
|
| 115 | + $ogone_data_customer = new DataCustomerHelper($ogone_data); |
|
| 116 | 116 | |
| 117 | - if ( null !== $customer ) { |
|
| 117 | + if (null !== $customer) { |
|
| 118 | 118 | $name = $customer->get_name(); |
| 119 | 119 | |
| 120 | - if ( null !== $name ) { |
|
| 121 | - $ogone_data_customer->set_name( strval( $name ) ); |
|
| 120 | + if (null !== $name) { |
|
| 121 | + $ogone_data_customer->set_name(strval($name)); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $ogone_data_customer->set_email( $customer->get_email() ); |
|
| 124 | + $ogone_data_customer->set_email($customer->get_email()); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | $billing_address = $payment->get_billing_address(); |
| 128 | 128 | |
| 129 | - if ( null !== $billing_address ) { |
|
| 129 | + if (null !== $billing_address) { |
|
| 130 | 130 | $ogone_data_customer |
| 131 | - ->set_address( $billing_address->get_line_1() ) |
|
| 132 | - ->set_zip( $billing_address->get_postal_code() ) |
|
| 133 | - ->set_town( $billing_address->get_city() ) |
|
| 134 | - ->set_country( $billing_address->get_country_code() ) |
|
| 135 | - ->set_telephone_number( $billing_address->get_phone() ); |
|
| 131 | + ->set_address($billing_address->get_line_1()) |
|
| 132 | + ->set_zip($billing_address->get_postal_code()) |
|
| 133 | + ->set_town($billing_address->get_city()) |
|
| 134 | + ->set_country($billing_address->get_country_code()) |
|
| 135 | + ->set_telephone_number($billing_address->get_phone()); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /* |
@@ -140,14 +140,14 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @link https://github.com/wp-pay-gateways/ogone/wiki/Brands |
| 142 | 142 | */ |
| 143 | - switch ( $payment->get_method() ) { |
|
| 143 | + switch ($payment->get_method()) { |
|
| 144 | 144 | case Core_PaymentMethods::CREDIT_CARD: |
| 145 | 145 | /* |
| 146 | 146 | * Set credit card payment method. |
| 147 | 147 | * @since 1.2.3 |
| 148 | 148 | */ |
| 149 | 149 | $ogone_data_general |
| 150 | - ->set_payment_method( PaymentMethods::CREDIT_CARD ); |
|
| 150 | + ->set_payment_method(PaymentMethods::CREDIT_CARD); |
|
| 151 | 151 | |
| 152 | 152 | break; |
| 153 | 153 | case Core_PaymentMethods::IDEAL: |
@@ -156,41 +156,41 @@ discard block |
||
| 156 | 156 | * @since 1.2.3 |
| 157 | 157 | */ |
| 158 | 158 | $ogone_data_general |
| 159 | - ->set_brand( Brands::IDEAL ) |
|
| 160 | - ->set_payment_method( PaymentMethods::IDEAL ); |
|
| 159 | + ->set_brand(Brands::IDEAL) |
|
| 160 | + ->set_payment_method(PaymentMethods::IDEAL); |
|
| 161 | 161 | |
| 162 | 162 | break; |
| 163 | 163 | case Core_PaymentMethods::BANCONTACT: |
| 164 | 164 | case Core_PaymentMethods::MISTER_CASH: |
| 165 | 165 | $ogone_data_general |
| 166 | - ->set_brand( Brands::BCMC ) |
|
| 167 | - ->set_payment_method( PaymentMethods::CREDIT_CARD ); |
|
| 166 | + ->set_brand(Brands::BCMC) |
|
| 167 | + ->set_payment_method(PaymentMethods::CREDIT_CARD); |
|
| 168 | 168 | |
| 169 | 169 | break; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | // Parameter Variable. |
| 173 | - $param_var = Util::get_param_var( $this->config->param_var ); |
|
| 173 | + $param_var = Util::get_param_var($this->config->param_var); |
|
| 174 | 174 | |
| 175 | - if ( ! empty( $param_var ) ) { |
|
| 176 | - $ogone_data->set_field( 'PARAMVAR', $param_var ); |
|
| 175 | + if ( ! empty($param_var)) { |
|
| 176 | + $ogone_data->set_field('PARAMVAR', $param_var); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | // Template Page. |
| 180 | 180 | $template_page = $this->config->param_var; |
| 181 | 181 | |
| 182 | - if ( ! empty( $template_page ) ) { |
|
| 183 | - $ogone_data->set_field( 'TP', $template_page ); |
|
| 182 | + if ( ! empty($template_page)) { |
|
| 183 | + $ogone_data->set_field('TP', $template_page); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | // URLs. |
| 187 | - $ogone_url_helper = new DataUrlHelper( $ogone_data ); |
|
| 187 | + $ogone_url_helper = new DataUrlHelper($ogone_data); |
|
| 188 | 188 | |
| 189 | 189 | $ogone_url_helper |
| 190 | - ->set_accept_url( add_query_arg( 'status', 'accept', $payment->get_return_url() ) ) |
|
| 191 | - ->set_cancel_url( add_query_arg( 'status', 'cancel', $payment->get_return_url() ) ) |
|
| 192 | - ->set_decline_url( add_query_arg( 'status', 'decline', $payment->get_return_url() ) ) |
|
| 193 | - ->set_exception_url( add_query_arg( 'status', 'exception', $payment->get_return_url() ) ); |
|
| 190 | + ->set_accept_url(add_query_arg('status', 'accept', $payment->get_return_url())) |
|
| 191 | + ->set_cancel_url(add_query_arg('status', 'cancel', $payment->get_return_url())) |
|
| 192 | + ->set_decline_url(add_query_arg('status', 'decline', $payment->get_return_url())) |
|
| 193 | + ->set_exception_url(add_query_arg('status', 'exception', $payment->get_return_url())); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
@@ -208,27 +208,27 @@ discard block |
||
| 208 | 208 | * |
| 209 | 209 | * @param Payment $payment Payment. |
| 210 | 210 | */ |
| 211 | - public function update_status( Payment $payment ) { |
|
| 211 | + public function update_status(Payment $payment) { |
|
| 212 | 212 | $data = Security::get_request_data(); |
| 213 | 213 | |
| 214 | - $data = $this->client->verify_request( $data ); |
|
| 214 | + $data = $this->client->verify_request($data); |
|
| 215 | 215 | |
| 216 | - if ( false !== $data ) { |
|
| 217 | - $status = Statuses::transform( $data[ Parameters::STATUS ] ); |
|
| 216 | + if (false !== $data) { |
|
| 217 | + $status = Statuses::transform($data[Parameters::STATUS]); |
|
| 218 | 218 | |
| 219 | - $payment->set_status( $status ); |
|
| 219 | + $payment->set_status($status); |
|
| 220 | 220 | |
| 221 | - $this->update_status_payment_note( $payment, $data ); |
|
| 221 | + $this->update_status_payment_note($payment, $data); |
|
| 222 | 222 | |
| 223 | 223 | return; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - $order_id = $payment->format_string( $this->config->order_id ); |
|
| 226 | + $order_id = $payment->format_string($this->config->order_id); |
|
| 227 | 227 | |
| 228 | - $status = $this->client->get_order_status( $order_id ); |
|
| 228 | + $status = $this->client->get_order_status($order_id); |
|
| 229 | 229 | |
| 230 | - if ( null !== $status ) { |
|
| 231 | - $payment->set_status( $status ); |
|
| 230 | + if (null !== $status) { |
|
| 231 | + $payment->set_status($status); |
|
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | 234 | |
@@ -238,42 +238,42 @@ discard block |
||
| 238 | 238 | * @param Payment $payment Payment. |
| 239 | 239 | * @param array $data Data. |
| 240 | 240 | */ |
| 241 | - private function update_status_payment_note( Payment $payment, $data ) { |
|
| 241 | + private function update_status_payment_note(Payment $payment, $data) { |
|
| 242 | 242 | $labels = array( |
| 243 | - 'STATUS' => __( 'Status', 'pronamic_ideal' ), |
|
| 244 | - 'ORDERID' => __( 'Order ID', 'pronamic_ideal' ), |
|
| 245 | - 'CURRENCY' => __( 'Currency', 'pronamic_ideal' ), |
|
| 246 | - 'AMOUNT' => __( 'Amount', 'pronamic_ideal' ), |
|
| 247 | - 'PM' => __( 'Payment Method', 'pronamic_ideal' ), |
|
| 248 | - 'ACCEPTANCE' => __( 'Acceptance', 'pronamic_ideal' ), |
|
| 249 | - 'CARDNO' => __( 'Card Number', 'pronamic_ideal' ), |
|
| 250 | - 'ED' => __( 'End Date', 'pronamic_ideal' ), |
|
| 251 | - 'CN' => __( 'Customer Name', 'pronamic_ideal' ), |
|
| 252 | - 'TRXDATE' => __( 'Transaction Date', 'pronamic_ideal' ), |
|
| 253 | - 'PAYID' => __( 'Pay ID', 'pronamic_ideal' ), |
|
| 254 | - 'NCERROR' => __( 'NC Error', 'pronamic_ideal' ), |
|
| 255 | - 'BRAND' => __( 'Brand', 'pronamic_ideal' ), |
|
| 256 | - 'IP' => __( 'IP', 'pronamic_ideal' ), |
|
| 257 | - 'SHASIGN' => __( 'SHA Signature', 'pronamic_ideal' ), |
|
| 243 | + 'STATUS' => __('Status', 'pronamic_ideal'), |
|
| 244 | + 'ORDERID' => __('Order ID', 'pronamic_ideal'), |
|
| 245 | + 'CURRENCY' => __('Currency', 'pronamic_ideal'), |
|
| 246 | + 'AMOUNT' => __('Amount', 'pronamic_ideal'), |
|
| 247 | + 'PM' => __('Payment Method', 'pronamic_ideal'), |
|
| 248 | + 'ACCEPTANCE' => __('Acceptance', 'pronamic_ideal'), |
|
| 249 | + 'CARDNO' => __('Card Number', 'pronamic_ideal'), |
|
| 250 | + 'ED' => __('End Date', 'pronamic_ideal'), |
|
| 251 | + 'CN' => __('Customer Name', 'pronamic_ideal'), |
|
| 252 | + 'TRXDATE' => __('Transaction Date', 'pronamic_ideal'), |
|
| 253 | + 'PAYID' => __('Pay ID', 'pronamic_ideal'), |
|
| 254 | + 'NCERROR' => __('NC Error', 'pronamic_ideal'), |
|
| 255 | + 'BRAND' => __('Brand', 'pronamic_ideal'), |
|
| 256 | + 'IP' => __('IP', 'pronamic_ideal'), |
|
| 257 | + 'SHASIGN' => __('SHA Signature', 'pronamic_ideal'), |
|
| 258 | 258 | ); |
| 259 | 259 | |
| 260 | 260 | $note = ''; |
| 261 | 261 | |
| 262 | 262 | $note .= '<p>'; |
| 263 | - $note .= __( 'Ogone transaction data in response message:', 'pronamic_ideal' ); |
|
| 263 | + $note .= __('Ogone transaction data in response message:', 'pronamic_ideal'); |
|
| 264 | 264 | $note .= '</p>'; |
| 265 | 265 | |
| 266 | 266 | $note .= '<dl>'; |
| 267 | 267 | |
| 268 | - foreach ( $labels as $key => $label ) { |
|
| 269 | - if ( isset( $data[ $key ] ) && '' !== $data[ $key ] ) { |
|
| 270 | - $note .= sprintf( '<dt>%s</dt>', esc_html( $label ) ); |
|
| 271 | - $note .= sprintf( '<dd>%s</dd>', esc_html( $data[ $key ] ) ); |
|
| 268 | + foreach ($labels as $key => $label) { |
|
| 269 | + if (isset($data[$key]) && '' !== $data[$key]) { |
|
| 270 | + $note .= sprintf('<dt>%s</dt>', esc_html($label)); |
|
| 271 | + $note .= sprintf('<dd>%s</dd>', esc_html($data[$key])); |
|
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | $note .= '</dl>'; |
| 276 | 276 | |
| 277 | - $payment->add_note( $note ); |
|
| 277 | + $payment->add_note($note); |
|
| 278 | 278 | } |
| 279 | 279 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * Constructs and initializes Ogone config object. |
| 43 | 43 | */ |
| 44 | 44 | public function __construct() { |
| 45 | - $this->set_form_action_url( $this->get_default_form_action_url() ); |
|
| 45 | + $this->set_form_action_url($this->get_default_form_action_url()); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | * @return string |
| 53 | 53 | */ |
| 54 | 54 | protected function get_default_form_action_url() { |
| 55 | - $is_utf8 = strcasecmp( get_bloginfo( 'charset' ), 'UTF-8' ) === 0; |
|
| 55 | + $is_utf8 = strcasecmp(get_bloginfo('charset'), 'UTF-8') === 0; |
|
| 56 | 56 | |
| 57 | - if ( $is_utf8 ) { |
|
| 57 | + if ($is_utf8) { |
|
| 58 | 58 | return 'https://secure.ogone.com/ncol/prod/orderstandard_utf8.asp'; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @param string $url Ogone e-Commerce form action URL. |
| 80 | 80 | */ |
| 81 | - public function set_form_action_url( $url ) { |
|
| 81 | + public function set_form_action_url($url) { |
|
| 82 | 82 | $this->form_action_url = $url; |
| 83 | 83 | } |
| 84 | 84 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @return string |
| 100 | 100 | */ |
| 101 | 101 | public function get_direct_query_url() { |
| 102 | - if ( Core_Gateway::MODE_TEST === $this->mode ) { |
|
| 102 | + if (Core_Gateway::MODE_TEST === $this->mode) { |
|
| 103 | 103 | return 'https://secure.ogone.com/ncol/test/querydirect.asp'; |
| 104 | 104 | } |
| 105 | 105 | |