1 | <?php |
||
2 | |||
3 | namespace Pronamic\WordPress\Pay\Gateways\EMS\ECommerce; |
||
4 | |||
5 | use Pronamic\WordPress\Pay\Gateways\Common\AbstractIntegration; |
||
6 | |||
7 | /** |
||
8 | * Title: EMS e-Commerce integration |
||
9 | * Description: |
||
10 | * Copyright: 2005-2019 Pronamic |
||
11 | * Company: Pronamic |
||
12 | * |
||
13 | * @author Reüel van der Steege |
||
14 | * @version 2.0.0 |
||
15 | * @since 1.0.0 |
||
16 | */ |
||
17 | class Integration extends AbstractIntegration { |
||
18 | public function __construct() { |
||
19 | $this->id = 'ems-ecommerce'; |
||
20 | $this->name = 'EMS e-Commerce'; |
||
21 | $this->product_url = ''; |
||
22 | $this->dashboard_url = array( |
||
23 | __( 'test', 'pronamic_ideal' ) => 'https://test.ipg-online.com/vt/login', |
||
24 | __( 'live', 'pronamic_ideal' ) => 'https://www.ipg-online.com/vt/login', |
||
25 | ); |
||
26 | $this->provider = 'ems'; |
||
27 | $this->supports = array( |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
28 | 'webhook', |
||
29 | 'webhook_no_config', |
||
30 | ); |
||
31 | |||
32 | // Actions |
||
33 | $function = array( __NAMESPACE__ . '\Listener', 'listen' ); |
||
34 | |||
35 | if ( ! has_action( 'wp_loaded', $function ) ) { |
||
36 | add_action( 'wp_loaded', $function ); |
||
37 | } |
||
38 | } |
||
39 | |||
40 | public function get_config_factory_class() { |
||
41 | return __NAMESPACE__ . '\ConfigFactory'; |
||
42 | } |
||
43 | |||
44 | public function get_settings_fields() { |
||
45 | $fields = array(); |
||
46 | |||
47 | // Storename. |
||
48 | $fields[] = array( |
||
49 | 'section' => 'general', |
||
50 | 'filter' => FILTER_UNSAFE_RAW, |
||
51 | 'meta_key' => '_pronamic_gateway_ems_ecommerce_storename', |
||
52 | 'title' => _x( 'Storename', 'ems', 'pronamic_ideal' ), |
||
53 | 'type' => 'text', |
||
54 | 'classes' => array( 'code' ), |
||
55 | ); |
||
56 | |||
57 | // Shared secret. |
||
58 | $fields[] = array( |
||
59 | 'section' => 'general', |
||
60 | 'filter' => FILTER_UNSAFE_RAW, |
||
61 | 'meta_key' => '_pronamic_gateway_ems_ecommerce_secret', |
||
62 | 'title' => _x( 'Shared Secret', 'ems', 'pronamic_ideal' ), |
||
63 | 'type' => 'text', |
||
64 | 'classes' => array( 'large-text', 'code' ), |
||
65 | ); |
||
66 | |||
67 | // Purchase ID. |
||
68 | $fields[] = array( |
||
69 | 'section' => 'advanced', |
||
70 | 'filter' => array( |
||
71 | 'filter' => FILTER_SANITIZE_STRING, |
||
72 | 'flags' => FILTER_FLAG_NO_ENCODE_QUOTES, |
||
73 | ), |
||
74 | 'meta_key' => '_pronamic_gateway_ems_ecommerce_order_id', |
||
75 | 'title' => __( 'Order ID', 'pronamic_ideal' ), |
||
76 | 'type' => 'text', |
||
77 | 'classes' => array( 'regular-text', 'code' ), |
||
78 | 'tooltip' => sprintf( |
||
79 | /* translators: %s: <code>{orderId}</code> */ |
||
80 | __( 'The EMS e-Commerce %s parameter.', 'pronamic_ideal' ), |
||
81 | sprintf( '<code>%s</code>', 'orderId' ) |
||
82 | ), |
||
83 | 'description' => sprintf( |
||
84 | '%s %s<br />%s', |
||
85 | __( 'Available tags:', 'pronamic_ideal' ), |
||
86 | sprintf( |
||
87 | '<code>%s</code> <code>%s</code>', |
||
88 | '{order_id}', |
||
89 | '{payment_id}' |
||
90 | ), |
||
91 | sprintf( |
||
92 | /* translators: %s: {order_id} */ |
||
93 | __( 'Default: <code>%s</code>', 'pronamic_ideal' ), |
||
94 | '{order_id}' |
||
95 | ) |
||
96 | ), |
||
97 | ); |
||
98 | |||
99 | // Notification URL. |
||
100 | $fields[] = array( |
||
101 | 'section' => 'feedback', |
||
102 | 'title' => __( 'Notification URL', 'pronamic_ideal' ), |
||
103 | 'type' => 'text', |
||
104 | 'classes' => array( 'large-text', 'code' ), |
||
105 | 'value' => home_url( '/' ), |
||
106 | 'readonly' => true, |
||
107 | 'tooltip' => __( |
||
108 | 'The Notification URL as sent with each transaction to receive automatic payment status updates on.', |
||
109 | 'pronamic_ideal' |
||
110 | ), |
||
111 | ); |
||
112 | |||
113 | return $fields; |
||
114 | } |
||
115 | } |
||
116 |