1 | <?php |
||
2 | /** |
||
3 | * Integration |
||
4 | * |
||
5 | * @author Pronamic <[email protected]> |
||
6 | * @copyright 2005-2019 Pronamic |
||
7 | * @license GPL-3.0-or-later |
||
8 | * @package Pronamic\WordPress\Pay\Payments |
||
9 | */ |
||
10 | |||
11 | namespace Pronamic\WordPress\Pay\Gateways\Sisow; |
||
12 | |||
13 | use Pronamic\WordPress\Pay\Gateways\Common\AbstractIntegration; |
||
14 | |||
15 | /** |
||
16 | * Title: Sisow integration |
||
17 | * Description: |
||
18 | * Copyright: 2005-2019 Pronamic |
||
19 | * Company: Pronamic |
||
20 | * |
||
21 | * @author Remco Tolsma |
||
22 | * @version 2.0.0 |
||
23 | * @since 1.0.0 |
||
24 | */ |
||
25 | class Integration extends AbstractIntegration { |
||
26 | /** |
||
27 | * Construct integration. |
||
28 | */ |
||
29 | public function __construct() { |
||
30 | $this->id = 'sisow-ideal'; |
||
31 | $this->name = 'Sisow'; |
||
32 | $this->url = 'https://www.sisow.nl/'; |
||
33 | $this->product_url = 'https://www.sisow.nl/epay-online-betaalmogelijkheden/epay-informatie'; |
||
34 | $this->dashboard_url = 'https://www.sisow.nl/Sisow/iDeal/Login.aspx'; |
||
35 | $this->register_url = 'https://www.sisow.nl/Sisow/iDeal/Aanmelden.aspx?r=120872'; |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
36 | $this->provider = 'sisow'; |
||
37 | $this->supports = array( |
||
38 | 'webhook', |
||
39 | 'webhook_log', |
||
40 | 'webhook_no_config', |
||
41 | ); |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * Get settings fields. |
||
46 | * |
||
47 | * @return array |
||
48 | */ |
||
49 | public function get_settings_fields() { |
||
50 | $fields = array(); |
||
51 | |||
52 | // Intro. |
||
53 | $fields[] = array( |
||
54 | 'section' => 'general', |
||
55 | 'type' => 'html', |
||
56 | 'html' => sprintf( |
||
57 | /* translators: %s: Sisow */ |
||
58 | __( 'Account details are provided by %1$s after registration. These settings need to match with the %1$s dashboard.', 'pronamic_ideal' ), |
||
59 | __( 'Sisow', 'pronamic_ideal' ) |
||
60 | ), |
||
61 | ); |
||
62 | |||
63 | // Merchant ID. |
||
64 | $fields[] = array( |
||
65 | 'section' => 'general', |
||
66 | 'filter' => FILTER_SANITIZE_STRING, |
||
67 | 'methods' => array( 'sisow' ), |
||
68 | 'meta_key' => '_pronamic_gateway_sisow_merchant_id', |
||
69 | 'title' => _x( 'Merchant ID', 'sisow', 'pronamic_ideal' ), |
||
70 | 'type' => 'text', |
||
71 | 'classes' => array( 'code' ), |
||
72 | 'tooltip' => __( 'Merchant ID as mentioned at <strong>My Profile</strong> in the Sisow dashboard.', 'pronamic_ideal' ), |
||
73 | ); |
||
74 | |||
75 | // Merchant Key. |
||
76 | $fields[] = array( |
||
77 | 'section' => 'general', |
||
78 | 'filter' => FILTER_SANITIZE_STRING, |
||
79 | 'methods' => array( 'sisow' ), |
||
80 | 'meta_key' => '_pronamic_gateway_sisow_merchant_key', |
||
81 | 'title' => _x( 'Merchant Key', 'sisow', 'pronamic_ideal' ), |
||
82 | 'type' => 'text', |
||
83 | 'classes' => array( 'regular-text', 'code' ), |
||
84 | 'tooltip' => __( 'Merchant Key as mentioned at <strong>My Profile</strong> in the Sisow dashboard.', 'pronamic_ideal' ), |
||
85 | ); |
||
86 | |||
87 | // Shop ID. |
||
88 | $fields[] = array( |
||
89 | 'section' => 'general', |
||
90 | 'filter' => FILTER_SANITIZE_STRING, |
||
91 | 'methods' => array( 'sisow' ), |
||
92 | 'meta_key' => '_pronamic_gateway_sisow_shop_id', |
||
93 | 'title' => _x( 'Shop ID', 'sisow', 'pronamic_ideal' ), |
||
94 | 'type' => 'text', |
||
95 | 'classes' => array( 'regular-text', 'code' ), |
||
96 | 'tooltip' => __( 'Shop ID as mentioned at <strong>My Profile</strong> in the Sisow dashboard.', 'pronamic_ideal' ), |
||
97 | /* translators: %s: 0 */ |
||
98 | 'description' => sprintf( __( 'Default: <code>%s</code>', 'pronamic_ideal' ), 0 ), |
||
99 | 'default' => 0, |
||
100 | ); |
||
101 | |||
102 | return $fields; |
||
103 | } |
||
104 | |||
105 | /** |
||
106 | * Get configuration. |
||
107 | * |
||
108 | * @param int $post_id Post ID. |
||
109 | * @return Config |
||
110 | */ |
||
111 | public function get_config( $post_id ) { |
||
112 | $config = new Config(); |
||
113 | |||
114 | $config->merchant_id = $this->get_meta( $post_id, 'sisow_merchant_id' ); |
||
115 | $config->merchant_key = $this->get_meta( $post_id, 'sisow_merchant_key' ); |
||
116 | $config->shop_id = $this->get_meta( $post_id, 'sisow_shop_id' ); |
||
117 | $config->mode = $this->get_meta( $post_id, 'mode' ); |
||
118 | |||
119 | return $config; |
||
120 | } |
||
121 | |||
122 | /** |
||
123 | * Get gateway. |
||
124 | * |
||
125 | * @param int $post_id Post ID. |
||
126 | * @return Gateway |
||
127 | */ |
||
128 | public function get_gateway( $post_id ) { |
||
129 | return new Gateway( $this->get_config( $post_id ) ); |
||
130 | } |
||
131 | } |
||
132 |