-
Notifications
You must be signed in to change notification settings - Fork 1
/
give-paybox-admin.php
125 lines (101 loc) · 3.95 KB
/
give-paybox-admin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
/*
* Copyright (c) 2016, Raphaël Droz <[email protected]>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/
defined( 'ABSPATH' ) or exit;
function give_paybox_add_gateway($sections) {
$sections += array('paybox' => esc_html__( 'Paybox', 'give-paybox' ));
return $sections;
}
// keep in sync with WP_Paybox_Settings::page_init
function give_paybox_add_settings( $settings ) {
$current_section = give_get_current_setting_section();
if ($current_section !== 'paybox') {
return $settings;
}
$prefix = 'give_paybox_';
$paybox_settings = [
// Section X: Paybox
[
'type' => 'title',
'id' => 'give_title_gateway_settings_paybox',
],
[ 'id' => 'give_title_paybox',
'name' => esc_html__( 'Paybox Settings', 'give-paybox' ),
'desc' => '<hr>'],
[ 'id' => $prefix . 'site',
'name' => esc_html__('Paybox site value', 'give-paybox'),
'type' => 'text',
'default' => '1999888'],
[ 'id' => $prefix . 'rang',
'name' => esc_html__('Paybox rang value', 'give-paybox'),
'type' => 'text',
'default' => '43'],
[ 'id' => $prefix . 'ident',
'name' => esc_html__('Paybox ident value', 'give-paybox'),
'type' => 'text',
'default' => '107975626'],
[ 'id' => $prefix . 'hmac',
'name' => esc_html__('Paybox hmac value', 'give-paybox'),
'type' => 'text',
'default' => str_repeat('0123456789ABCDEF',8)],
[ 'id' => $prefix . 'checkip',
'name' => esc_html__("Should IPN endpoint check Paybox source IP?", 'give-paybox'),
'type' => 'radio_inline',
'row_classes' => 'give-subfield',
'options' => array(
'yes' => esc_html__( 'Yes', 'give' ),
'no' => esc_html__( 'No', 'give' ),
),
'default' => 'no' ],
[ 'id' => $prefix . '3dmin',
'name' => esc_html__('Minimum amount for 3D Secure', 'give-paybox'),
'type' => 'number' ],
[ 'id' => $prefix . 'accept3x',
'name' => esc_html__('Accept 3x payments', 'give-paybox'),
'type' => 'radio_inline',
'row_classes' => 'give-subfield',
'options' => array(
'yes' => esc_html__( 'Yes', 'give' ),
'no' => esc_html__( 'No', 'give' ),
),
'default' => 'no' ],
[ 'id' => $prefix . '3xmin',
'name' => esc_html__('The minimum amount to activate the multiple payments', 'give-paybox'),
'type' => 'number' ],
[ 'id' => $prefix . 'nbdays',
'name' => esc_html__('Number of days between multiple payments', 'give-paybox'),
'type' => 'number' ],
[ 'id' => $prefix . 'limit_payment',
'name' => esc_html__('Limit payment types', 'give-paybox'),
'type' => 'select',
'options' => WP_Paybox::TYPE_PAIEMENT_POSSIBLE, // TODO: No restriction
],
// TODO: if ($this->options['limit_payment'])
/*
[ 'id' => $prefix . 'limit_card',
'name' => esc_html__('Restriction sur le type de carte', 'give-paybox'),
'description' =>
_e('Submit settings in order to select below card restrictions', 'give-paybox') .
_e('/!\ Not fully implemented yet!', 'give-paybox'),
'options' => WP_Paybox::TYPE_CARTE[xxx->options['limit_payment']] // 'CB' ? 'CB (= Any card)'
],*/
[
'type' => 'sectionend',
'id' => 'give_title_gateway_settings_paybox',
]
];
return $paybox_settings;
}
function give_paybox_link_transaction_id( $transaction_id, $payment_id ) {
$test = give_get_payment_meta( $payment_id, '_give_payment_mode' ) === 'test';
return sprintf('<a href="https://%s.paybox.com/%s" target="_blank" title="%s">%s</a>',
$test ? 'preprod-admin' : 'admin',
$transaction_id,
__('See in the Paybox UI'),
$transaction_id);
}