1 | <?php |
||||||
2 | |||||||
3 | namespace Pronamic\WordPress\Pay\Gateways\IDealBasic; |
||||||
4 | |||||||
5 | use Pronamic\WordPress\Pay\Gateways\IDeal\AbstractIntegration; |
||||||
6 | |||||||
7 | /** |
||||||
8 | * Title: Integration |
||||||
9 | * Description: |
||||||
10 | * Copyright: 2005-2019 Pronamic |
||||||
11 | * Company: Pronamic |
||||||
12 | * |
||||||
13 | * @author Remco Tolsma |
||||||
14 | * @version 2.0.0 |
||||||
15 | * @since 1.0.0 |
||||||
16 | */ |
||||||
17 | class Integration extends AbstractIntegration { |
||||||
18 | /** |
||||||
19 | * Construct and initialize integration. |
||||||
20 | */ |
||||||
21 | public function __construct( $args = array() ) { |
||||||
22 | $args = wp_parse_args( $args, array( |
||||||
23 | 'id' => 'ideal-basic', |
||||||
24 | 'name' => 'iDEAL Basic', |
||||||
25 | 'url' => __( 'https://www.ideal.nl/en/', 'pronamic_ideal' ), |
||||||
26 | 'product_url' => __( 'https://www.ideal.nl/en/', 'pronamic_ideal' ), |
||||||
27 | 'dashboard_url' => null, |
||||||
28 | 'provider' => null, |
||||||
29 | 'aquirer_url' => null, |
||||||
30 | 'aquirer_test_url' => null, |
||||||
31 | ) ); |
||||||
32 | |||||||
33 | $this->id = $args['id']; |
||||||
34 | $this->name = $args['name']; |
||||||
35 | $this->url = $args['url']; |
||||||
36 | $this->product_url = $args['product_url']; |
||||||
37 | $this->dashboard_url = $args['dashboard_url']; |
||||||
38 | $this->provider = $args['provider']; |
||||||
39 | |||||||
40 | $this->aquirer_url = $args['aquirer_url']; |
||||||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||||||
41 | $this->aquirer_test_url = $args['aquirer_test_url']; |
||||||
0 ignored issues
–
show
|
|||||||
42 | |||||||
43 | $this->supports = array( |
||||||
0 ignored issues
–
show
|
|||||||
44 | 'webhook', |
||||||
45 | ); |
||||||
46 | |||||||
47 | // Actions. |
||||||
48 | $function = array( __NAMESPACE__ . '\Listener', 'listen' ); |
||||||
49 | |||||||
50 | if ( ! has_action( 'wp_loaded', $function ) ) { |
||||||
51 | add_action( 'wp_loaded', $function ); |
||||||
52 | } |
||||||
53 | } |
||||||
54 | |||||||
55 | public function get_settings_fields() { |
||||||
56 | $fields = parent::get_settings_fields(); |
||||||
0 ignored issues
–
show
The method
get_settings_fields() does not exist on Pronamic\WordPress\Pay\G...eal\AbstractIntegration . Did you maybe mean get_settings() ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||
57 | |||||||
58 | // Hash Key |
||||||
59 | $fields[] = array( |
||||||
60 | 'section' => 'general', |
||||||
61 | 'filter' => FILTER_SANITIZE_STRING, |
||||||
62 | 'meta_key' => '_pronamic_gateway_ideal_hash_key', |
||||||
63 | 'title' => __( 'Hash Key', 'pronamic_ideal' ), |
||||||
64 | 'type' => 'text', |
||||||
65 | 'classes' => array( 'regular-text', 'code' ), |
||||||
66 | 'tooltip' => __( 'Hash key (also known as: key or secret key) as mentioned in the payment provider dashboard.', 'pronamic_ideal' ), |
||||||
67 | 'methods' => array( 'ideal-basic' ), |
||||||
68 | ); |
||||||
69 | |||||||
70 | // XML Notification URL. |
||||||
71 | $fields[] = array( |
||||||
72 | 'section' => 'feedback', |
||||||
73 | 'title' => __( 'XML Notification URL', 'pronamic_ideal' ), |
||||||
74 | 'type' => 'text', |
||||||
75 | 'classes' => array( 'regular-text', 'code' ), |
||||||
76 | 'value' => add_query_arg( |
||||||
77 | array( |
||||||
78 | 'gateway' => 'IDealBasic', |
||||||
79 | 'xml_notification' => 'true', |
||||||
80 | ), |
||||||
81 | site_url( '/' ) |
||||||
82 | ), |
||||||
83 | 'methods' => array( 'ideal-basic' ), |
||||||
84 | 'readonly' => true, |
||||||
85 | 'size' => 200, |
||||||
86 | 'tooltip' => __( 'Copy the XML notification URL to the payment provider dashboard to receive automatic transaction status updates.', 'pronamic_ideal' ), |
||||||
87 | ); |
||||||
88 | |||||||
89 | // Return fields. |
||||||
90 | return $fields; |
||||||
91 | } |
||||||
92 | |||||||
93 | public function get_config( $post_id ) { |
||||||
94 | $mode = get_post_meta( $post_id, '_pronamic_gateway_mode', true ); |
||||||
95 | |||||||
96 | $config = new Config(); |
||||||
97 | |||||||
98 | $config->url = $this->aquirer_url; |
||||||
99 | |||||||
100 | if ( 'test' === $mode && null !== $this->aquirer_test_url ) { |
||||||
101 | $config->url = $this->aquirer_test_url; |
||||||
102 | } |
||||||
103 | |||||||
104 | $config->merchant_id = get_post_meta( $post_id, '_pronamic_gateway_ideal_merchant_id', true ); |
||||||
105 | $config->sub_id = get_post_meta( $post_id, '_pronamic_gateway_ideal_sub_id', true ); |
||||||
106 | $config->hash_key = get_post_meta( $post_id, '_pronamic_gateway_ideal_hash_key', true ); |
||||||
107 | $config->purchase_id = get_post_meta( $post_id, '_pronamic_gateway_ideal_purchase_id', true ); |
||||||
108 | |||||||
109 | return $config; |
||||||
110 | } |
||||||
111 | |||||||
112 | /** |
||||||
113 | * Get gateway. |
||||||
114 | * |
||||||
115 | * @param int $post_id Post ID. |
||||||
116 | * @return Gateway |
||||||
117 | */ |
||||||
118 | public function get_gateway( $post_id ) { |
||||||
119 | return new Gateway( $this->get_config( $post_id ) ); |
||||||
120 | } |
||||||
121 | } |
||||||
122 |