@@ -16,44 +16,44 @@ |
||
| 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 | // TargetPay |
| 25 | 25 | $sections['targetpay'] = array( |
| 26 | - 'title' => __( 'TargetPay', 'pronamic_ideal' ), |
|
| 27 | - 'methods' => array( 'targetpay' ), |
|
| 26 | + 'title' => __('TargetPay', 'pronamic_ideal'), |
|
| 27 | + 'methods' => array('targetpay'), |
|
| 28 | 28 | 'description' => sprintf( |
| 29 | 29 | /* translators: 1: TargetPay */ |
| 30 | - __( 'Account details are provided by %1$s after registration. These settings need to match with the %1$s dashboard.', 'pronamic_ideal' ), |
|
| 31 | - __( 'TargetPay', 'pronamic_ideal' ) |
|
| 30 | + __('Account details are provided by %1$s after registration. These settings need to match with the %1$s dashboard.', 'pronamic_ideal'), |
|
| 31 | + __('TargetPay', 'pronamic_ideal') |
|
| 32 | 32 | ), |
| 33 | 33 | ); |
| 34 | 34 | |
| 35 | 35 | return $sections; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function fields( array $fields ) { |
|
| 38 | + public function fields(array $fields) { |
|
| 39 | 39 | // Layout Code |
| 40 | 40 | $fields[] = array( |
| 41 | 41 | 'filter' => FILTER_SANITIZE_STRING, |
| 42 | 42 | 'section' => 'targetpay', |
| 43 | 43 | 'meta_key' => '_pronamic_gateway_targetpay_layoutcode', |
| 44 | - 'title' => __( 'Layout Code', 'pronamic_ideal' ), |
|
| 44 | + 'title' => __('Layout Code', 'pronamic_ideal'), |
|
| 45 | 45 | 'type' => 'text', |
| 46 | - 'tooltip' => __( 'Layout code as mentioned at <strong>Sub accounts</strong> in the TargetPay dashboard.', 'pronamic_ideal' ), |
|
| 46 | + 'tooltip' => __('Layout code as mentioned at <strong>Sub accounts</strong> in the TargetPay dashboard.', 'pronamic_ideal'), |
|
| 47 | 47 | ); |
| 48 | 48 | |
| 49 | 49 | // Transaction feedback |
| 50 | 50 | $fields[] = array( |
| 51 | 51 | 'section' => 'targetpay', |
| 52 | - 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
|
| 52 | + 'title' => __('Transaction feedback', 'pronamic_ideal'), |
|
| 53 | 53 | 'type' => 'description', |
| 54 | 54 | 'html' => sprintf( |
| 55 | 55 | '<span class="dashicons dashicons-yes"></span> %s', |
| 56 | - __( 'Payment status updates will be processed without any additional configuration.', 'pronamic_ideal' ) |
|
| 56 | + __('Payment status updates will be processed without any additional configuration.', 'pronamic_ideal') |
|
| 57 | 57 | ), |
| 58 | 58 | ); |
| 59 | 59 | |
@@ -15,11 +15,11 @@ |
||
| 15 | 15 | * @since 1.0.0 |
| 16 | 16 | */ |
| 17 | 17 | class ConfigFactory extends GatewayConfigFactory { |
| 18 | - public function get_config( $post_id ) { |
|
| 18 | + public function get_config($post_id) { |
|
| 19 | 19 | $config = new Config(); |
| 20 | 20 | |
| 21 | - $config->layoutcode = get_post_meta( $post_id, '_pronamic_gateway_targetpay_layoutcode', true ); |
|
| 22 | - $config->mode = get_post_meta( $post_id, '_pronamic_gateway_mode', true ); |
|
| 21 | + $config->layoutcode = get_post_meta($post_id, '_pronamic_gateway_targetpay_layoutcode', true); |
|
| 22 | + $config->mode = get_post_meta($post_id, '_pronamic_gateway_mode', true); |
|
| 23 | 23 | |
| 24 | 24 | return $config; |
| 25 | 25 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - private static function remote_get( $url ) { |
|
| 32 | + private static function remote_get($url) { |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -37,10 +37,10 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @param SofortStartParameters $parameters |
| 39 | 39 | */ |
| 40 | - public function start_transaction( SofortStartParameters $parameters ) { |
|
| 41 | - $url = Pay_Util::build_url( self::URL_START_TRANSACTION, (array) $parameters ); |
|
| 40 | + public function start_transaction(SofortStartParameters $parameters) { |
|
| 41 | + $url = Pay_Util::build_url(self::URL_START_TRANSACTION, (array) $parameters); |
|
| 42 | 42 | |
| 43 | - $data = self::remote_get( $url ); |
|
| 43 | + $data = self::remote_get($url); |
|
| 44 | 44 | |
| 45 | 45 | // @todo need work |
| 46 | 46 | } |
@@ -29,17 +29,17 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @param Config $config |
| 31 | 31 | */ |
| 32 | - public function __construct( Config $config ) { |
|
| 33 | - parent::__construct( $config ); |
|
| 32 | + public function __construct(Config $config) { |
|
| 33 | + parent::__construct($config); |
|
| 34 | 34 | |
| 35 | 35 | $this->supports = array( |
| 36 | 36 | 'payment_status_request', |
| 37 | 37 | ); |
| 38 | 38 | |
| 39 | - $this->set_method( Gateway::METHOD_HTTP_REDIRECT ); |
|
| 40 | - $this->set_has_feedback( true ); |
|
| 41 | - $this->set_amount_minimum( 0.84 ); |
|
| 42 | - $this->set_slug( self::SLUG ); |
|
| 39 | + $this->set_method(Gateway::METHOD_HTTP_REDIRECT); |
|
| 40 | + $this->set_has_feedback(true); |
|
| 41 | + $this->set_amount_minimum(0.84); |
|
| 42 | + $this->set_slug(self::SLUG); |
|
| 43 | 43 | |
| 44 | 44 | $this->client = new Client(); |
| 45 | 45 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | $result = $this->client->get_issuers(); |
| 56 | 56 | |
| 57 | - if ( $result ) { |
|
| 57 | + if ($result) { |
|
| 58 | 58 | $groups[] = array( |
| 59 | 59 | 'options' => $result, |
| 60 | 60 | ); |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | public function get_issuer_field() { |
| 67 | 67 | $payment_method = $this->get_payment_method(); |
| 68 | 68 | |
| 69 | - if ( null === $payment_method || PaymentMethods::IDEAL === $payment_method ) { |
|
| 69 | + if (null === $payment_method || PaymentMethods::IDEAL === $payment_method) { |
|
| 70 | 70 | return array( |
| 71 | 71 | 'id' => 'pronamic_ideal_issuer_id', |
| 72 | 72 | 'name' => 'pronamic_ideal_issuer_id', |
| 73 | - 'label' => __( 'Choose your bank', 'pronamic_ideal' ), |
|
| 73 | + 'label' => __('Choose your bank', 'pronamic_ideal'), |
|
| 74 | 74 | 'required' => true, |
| 75 | 75 | 'type' => 'select', |
| 76 | 76 | 'choices' => $this->get_transient_issuers(), |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * |
| 97 | 97 | * @param Payment $payment |
| 98 | 98 | */ |
| 99 | - public function start( Payment $payment ) { |
|
| 99 | + public function start(Payment $payment) { |
|
| 100 | 100 | $parameters = new IDealStartParameters(); |
| 101 | 101 | $parameters->rtlo = $this->config->layoutcode; |
| 102 | 102 | $parameters->bank = $payment->get_issuer(); |
@@ -106,13 +106,13 @@ discard block |
||
| 106 | 106 | $parameters->report_url = $payment->get_return_url(); |
| 107 | 107 | $parameters->cinfo_in_callback = 1; |
| 108 | 108 | |
| 109 | - $result = $this->client->start_transaction( $parameters ); |
|
| 109 | + $result = $this->client->start_transaction($parameters); |
|
| 110 | 110 | |
| 111 | - if ( $result ) { |
|
| 112 | - $payment->set_action_url( $result->url ); |
|
| 113 | - $payment->set_transaction_id( $result->transaction_id ); |
|
| 111 | + if ($result) { |
|
| 112 | + $payment->set_action_url($result->url); |
|
| 113 | + $payment->set_transaction_id($result->transaction_id); |
|
| 114 | 114 | } else { |
| 115 | - $this->set_error( $this->client->get_error() ); |
|
| 115 | + $this->set_error($this->client->get_error()); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * |
| 122 | 122 | * @param Payment $payment |
| 123 | 123 | */ |
| 124 | - public function update_status( Payment $payment ) { |
|
| 124 | + public function update_status(Payment $payment) { |
|
| 125 | 125 | $status = $this->client->check_status( |
| 126 | 126 | $this->config->layoutcode, |
| 127 | 127 | $payment->get_transaction_id(), |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | Gateway::MODE_TEST === $this->config->mode |
| 130 | 130 | ); |
| 131 | 131 | |
| 132 | - if ( $status ) { |
|
| 133 | - $payment->set_status( Statuses::transform( $status->code ) ); |
|
| 132 | + if ($status) { |
|
| 133 | + $payment->set_status(Statuses::transform($status->code)); |
|
| 134 | 134 | |
| 135 | - if ( Statuses::OK === $status->code ) { |
|
| 136 | - $payment->set_consumer_name( $status->account_name ); |
|
| 137 | - $payment->set_consumer_account_number( $status->account_number ); |
|
| 138 | - $payment->set_consumer_city( $status->account_city ); |
|
| 135 | + if (Statuses::OK === $status->code) { |
|
| 136 | + $payment->set_consumer_name($status->account_name); |
|
| 137 | + $payment->set_consumer_account_number($status->account_number); |
|
| 138 | + $payment->set_consumer_city($status->account_city); |
|
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | return array( |
| 83 | 83 | 'rtlo' => $this->rtlo, |
| 84 | 84 | 'description' => $this->description, |
| 85 | - 'amount' => Core_Util::amount_to_cents( $this->amount ), |
|
| 85 | + 'amount' => Core_Util::amount_to_cents($this->amount), |
|
| 86 | 86 | 'country' => $this->country, |
| 87 | 87 | 'lang' => $this->language, |
| 88 | 88 | 'returnurl' => $this->return_url, |
@@ -96,6 +96,6 @@ discard block |
||
| 96 | 96 | * @return ArrayIterator |
| 97 | 97 | */ |
| 98 | 98 | public function getIterator() { |
| 99 | - return new ArrayIterator( $this->get_array() ); |
|
| 99 | + return new ArrayIterator($this->get_array()); |
|
| 100 | 100 | } |
| 101 | 101 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | * @param string $code |
| 34 | 34 | * @param string $description |
| 35 | 35 | */ |
| 36 | - public function __construct( $code, $description ) { |
|
| 36 | + public function __construct($code, $description) { |
|
| 37 | 37 | $this->code = $code; |
| 38 | 38 | $this->description = $description; |
| 39 | 39 | } |
@@ -27,13 +27,13 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @return Status |
| 29 | 29 | */ |
| 30 | - public static function parse( $string ) { |
|
| 30 | + public static function parse($string) { |
|
| 31 | 31 | $status = new Status(); |
| 32 | 32 | |
| 33 | - $position_space = strpos( $string, ' ' ); |
|
| 34 | - $position_pipe = strpos( $string, '|' ); |
|
| 33 | + $position_space = strpos($string, ' '); |
|
| 34 | + $position_pipe = strpos($string, '|'); |
|
| 35 | 35 | |
| 36 | - if ( false !== $position_space ) { |
|
| 36 | + if (false !== $position_space) { |
|
| 37 | 37 | /* |
| 38 | 38 | * @see https://www.targetpay.com/info/ideal-docu |
| 39 | 39 | * |
@@ -52,19 +52,19 @@ discard block |
||
| 52 | 52 | * TP0022 No transaction found with this ID |
| 53 | 53 | * TP0023 Layoutcode does not match this transaction |
| 54 | 54 | */ |
| 55 | - $status->code = substr( $string, 0, $position_space ); |
|
| 55 | + $status->code = substr($string, 0, $position_space); |
|
| 56 | 56 | |
| 57 | 57 | $position_description = $position_space + 1; |
| 58 | - if ( false !== $position_pipe ) { |
|
| 58 | + if (false !== $position_pipe) { |
|
| 59 | 59 | $length = $position_pipe - $position_description; |
| 60 | 60 | |
| 61 | - $status->description = substr( $string, $position_description, $length ); |
|
| 61 | + $status->description = substr($string, $position_description, $length); |
|
| 62 | 62 | } else { |
| 63 | - $status->description = substr( $string, $position_description ); |
|
| 63 | + $status->description = substr($string, $position_description); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if ( false !== $position_pipe ) { |
|
| 67 | - $extra = substr( $string, $position_pipe + 1 ); |
|
| 66 | + if (false !== $position_pipe) { |
|
| 67 | + $extra = substr($string, $position_pipe + 1); |
|
| 68 | 68 | |
| 69 | 69 | /* |
| 70 | 70 | * @see https://www.targetpay.com/info/directdebit-docu |
@@ -73,9 +73,9 @@ discard block |
||
| 73 | 73 | * 00000 OK|accountnumber|accountname|accountcity |
| 74 | 74 | * You may use accountnumber and accountname as input for the cbank and cname parameters |
| 75 | 75 | */ |
| 76 | - $status->account_number = strtok( $extra, self::TOKEN ); |
|
| 77 | - $status->account_name = strtok( self::TOKEN ); |
|
| 78 | - $status->account_city = strtok( self::TOKEN ); |
|
| 76 | + $status->account_number = strtok($extra, self::TOKEN); |
|
| 77 | + $status->account_name = strtok(self::TOKEN); |
|
| 78 | + $status->account_city = strtok(self::TOKEN); |
|
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
@@ -92,8 +92,8 @@ |
||
| 92 | 92 | * |
| 93 | 93 | * @return null|string |
| 94 | 94 | */ |
| 95 | - public static function transform( $response_code ) { |
|
| 96 | - switch ( $response_code ) { |
|
| 95 | + public static function transform($response_code) { |
|
| 96 | + switch ($response_code) { |
|
| 97 | 97 | case self::OK: |
| 98 | 98 | return Core_Statuses::SUCCESS; |
| 99 | 99 | |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | public function __construct() { |
| 19 | 19 | $this->id = 'targetpay-ideal'; |
| 20 | 20 | $this->name = 'TargetPay - iDEAL'; |
| 21 | - $this->product_url = __( 'https://www.targetpay.com/info/ideal?setlang=en', 'pronamic_ideal' ); |
|
| 21 | + $this->product_url = __('https://www.targetpay.com/info/ideal?setlang=en', 'pronamic_ideal'); |
|
| 22 | 22 | $this->dashboard_url = 'https://www.targetpay.com/login'; |
| 23 | 23 | $this->provider = 'targetpay'; |
| 24 | 24 | } |