1 | <?php |
||
2 | |||
3 | namespace Pronamic\WordPress\Pay\Gateways\PayNL; |
||
4 | |||
5 | use Pronamic\WordPress\Pay\Gateways\Common\AbstractIntegration; |
||
6 | |||
7 | /** |
||
8 | * Title: Pay.nl 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 | public function __construct() { |
||
19 | $this->id = 'pay_nl'; |
||
20 | $this->name = 'Pay.nl'; |
||
21 | $this->url = 'https://www.pay.nl/'; |
||
22 | $this->product_url = 'http://www.pay.nl/'; |
||
23 | $this->dashboard_url = 'https://admin.pay.nl/'; |
||
24 | $this->register_url = 'https://www.pay.nl/registreren/?id=M-7393-3100'; |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
25 | $this->provider = 'pay_nl'; |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Get settings fields. |
||
30 | * |
||
31 | * @return array |
||
32 | */ |
||
33 | public function get_settings_fields() { |
||
34 | $fields = array(); |
||
35 | |||
36 | // Intro. |
||
37 | $fields[] = array( |
||
38 | 'section' => 'general', |
||
39 | 'type' => 'html', |
||
40 | 'html' => sprintf( |
||
41 | /* translators: 1: Pay.nl */ |
||
42 | __( 'Account details are provided by %1$s after registration. These settings need to match with the %1$s dashboard.', 'pronamic_ideal' ), |
||
43 | __( 'Pay.nl', 'pronamic_ideal' ) |
||
44 | ), |
||
45 | ); |
||
46 | |||
47 | // Token. |
||
48 | $fields[] = array( |
||
49 | 'section' => 'general', |
||
50 | 'filter' => FILTER_SANITIZE_STRING, |
||
51 | 'meta_key' => '_pronamic_gateway_pay_nl_token', |
||
52 | 'title' => __( 'Token', 'pronamic_ideal' ), |
||
53 | 'type' => 'text', |
||
54 | 'classes' => array( 'regular-text', 'code' ), |
||
55 | 'tooltip' => __( 'Token as mentioned at <strong>Merchant » Company data (Connection)</strong> in the payment provider dashboard.', 'pronamic_ideal' ), |
||
56 | ); |
||
57 | |||
58 | // Service ID. |
||
59 | $fields[] = array( |
||
60 | 'section' => 'general', |
||
61 | 'filter' => FILTER_SANITIZE_STRING, |
||
62 | 'meta_key' => '_pronamic_gateway_pay_nl_service_id', |
||
63 | 'title' => __( 'Service ID', 'pronamic_ideal' ), |
||
64 | 'type' => 'text', |
||
65 | 'classes' => array( 'regular-text', 'code' ), |
||
66 | 'tooltip' => __( 'Service ID as mentioned at <strong>Manage » Services</strong> in the payment provider dashboard.', 'pronamic_ideal' ), |
||
67 | ); |
||
68 | |||
69 | // Return fields. |
||
70 | return $fields; |
||
71 | } |
||
72 | |||
73 | public function get_config( $post_id ) { |
||
74 | $config = new Config(); |
||
75 | |||
76 | $config->token = get_post_meta( $post_id, '_pronamic_gateway_pay_nl_token', true ); |
||
77 | $config->service_id = get_post_meta( $post_id, '_pronamic_gateway_pay_nl_service_id', true ); |
||
78 | |||
79 | return $config; |
||
80 | } |
||
81 | |||
82 | /** |
||
83 | * Get gateway. |
||
84 | * |
||
85 | * @param int $post_id Post ID. |
||
86 | * @return Gateway |
||
87 | */ |
||
88 | public function get_gateway( $post_id ) { |
||
89 | return new Gateway( $this->get_config( $post_id ) ); |
||
90 | } |
||
91 | } |
||
92 |