@@ -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 = ( 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 | - $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 | } |
@@ -30,17 +30,17 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @param Config $config Config. |
32 | 32 | */ |
33 | - public function __construct( Config $config ) { |
|
34 | - parent::__construct( $config ); |
|
33 | + public function __construct(Config $config) { |
|
34 | + parent::__construct($config); |
|
35 | 35 | |
36 | - $this->set_method( self::METHOD_HTML_FORM ); |
|
36 | + $this->set_method(self::METHOD_HTML_FORM); |
|
37 | 37 | |
38 | 38 | $this->client = new Client(); |
39 | 39 | |
40 | - $this->client->set_payment_server_url( $config->get_payment_server_url() ); |
|
41 | - $this->client->set_merchant_id( $config->merchant_id ); |
|
42 | - $this->client->set_sub_id( $config->sub_id ); |
|
43 | - $this->client->set_hash_key( $config->hash_key ); |
|
40 | + $this->client->set_payment_server_url($config->get_payment_server_url()); |
|
41 | + $this->client->set_merchant_id($config->merchant_id); |
|
42 | + $this->client->set_sub_id($config->sub_id); |
|
43 | + $this->client->set_hash_key($config->hash_key); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -70,34 +70,34 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @param Payment $payment Payment. |
72 | 72 | */ |
73 | - public function start( Payment $payment ) { |
|
74 | - $payment->set_action_url( $this->client->get_payment_server_url() ); |
|
73 | + public function start(Payment $payment) { |
|
74 | + $payment->set_action_url($this->client->get_payment_server_url()); |
|
75 | 75 | |
76 | 76 | // Purchase ID. |
77 | - $purchase_id = $payment->format_string( $this->config->purchase_id ); |
|
77 | + $purchase_id = $payment->format_string($this->config->purchase_id); |
|
78 | 78 | |
79 | - $payment->set_meta( 'purchase_id', $purchase_id ); |
|
79 | + $payment->set_meta('purchase_id', $purchase_id); |
|
80 | 80 | |
81 | 81 | // General. |
82 | - $this->client->set_currency( $payment->get_total_amount()->get_currency()->get_alphabetic_code() ); |
|
83 | - $this->client->set_purchase_id( $purchase_id ); |
|
84 | - $this->client->set_description( $payment->get_description() ); |
|
82 | + $this->client->set_currency($payment->get_total_amount()->get_currency()->get_alphabetic_code()); |
|
83 | + $this->client->set_purchase_id($purchase_id); |
|
84 | + $this->client->set_description($payment->get_description()); |
|
85 | 85 | |
86 | - if ( null !== $payment->get_customer() ) { |
|
87 | - $this->client->set_language( $payment->get_customer()->get_language() ); |
|
86 | + if (null !== $payment->get_customer()) { |
|
87 | + $this->client->set_language($payment->get_customer()->get_language()); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | // Items. |
91 | 91 | $items = new Items(); |
92 | 92 | |
93 | - $items->add_item( new Item( 1, $payment->get_description(), 1, $payment->get_total_amount() ) ); |
|
93 | + $items->add_item(new Item(1, $payment->get_description(), 1, $payment->get_total_amount())); |
|
94 | 94 | |
95 | - $this->client->set_items( $items ); |
|
95 | + $this->client->set_items($items); |
|
96 | 96 | |
97 | 97 | // URLs. |
98 | - $this->client->set_cancel_url( add_query_arg( 'status', Statuses::CANCELLED, $payment->get_return_url() ) ); |
|
99 | - $this->client->set_success_url( add_query_arg( 'status', Statuses::SUCCESS, $payment->get_return_url() ) ); |
|
100 | - $this->client->set_error_url( add_query_arg( 'status', Statuses::FAILURE, $payment->get_return_url() ) ); |
|
98 | + $this->client->set_cancel_url(add_query_arg('status', Statuses::CANCELLED, $payment->get_return_url())); |
|
99 | + $this->client->set_success_url(add_query_arg('status', Statuses::SUCCESS, $payment->get_return_url())); |
|
100 | + $this->client->set_error_url(add_query_arg('status', Statuses::FAILURE, $payment->get_return_url())); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @param Payment $payment Payment. |
107 | 107 | */ |
108 | - public function update_status( Payment $payment ) { |
|
109 | - if ( ! filter_has_var( INPUT_GET, 'status' ) ) { |
|
108 | + public function update_status(Payment $payment) { |
|
109 | + if ( ! filter_has_var(INPUT_GET, 'status')) { |
|
110 | 110 | return; |
111 | 111 | } |
112 | 112 | |
113 | - $status = filter_input( INPUT_GET, 'status', FILTER_SANITIZE_STRING ); |
|
113 | + $status = filter_input(INPUT_GET, 'status', FILTER_SANITIZE_STRING); |
|
114 | 114 | |
115 | 115 | // Update payment status. |
116 | - $payment->set_status( $status ); |
|
116 | + $payment->set_status($status); |
|
117 | 117 | } |
118 | 118 | } |