| 1 |
<?php |
| 2 |
|
| 3 |
defined( 'ABSPATH' ) || exit; |
| 4 |
|
| 5 |
return apply_filters( |
| 6 |
'wc_vipps_recurring_settings', |
| 7 |
[ |
| 8 |
'enabled' => [ |
| 9 |
'title' => __( 'Enable/Disable', 'woo-vipps' ), |
| 10 |
'label' => __( 'Enable Vipps/MobilePay Recurring Payments', 'woo-vipps' ), |
| 11 |
'type' => 'checkbox', |
| 12 |
'description' => '', |
| 13 |
'default' => 'no', |
| 14 |
], |
| 15 |
'title_brand' => [ |
| 16 |
'type' => 'title', |
| 17 |
'title' => __( 'Brand settings', 'woo-vipps' ), |
| 18 |
], |
| 19 |
'brand' => [ |
| 20 |
'title' => __( 'Brand', 'woo-vipps' ), |
| 21 |
'type' => 'select', |
| 22 |
'description' => __( 'Controls the payment flow brand (Vipps or MobilePay).', 'woo-vipps' ), |
| 23 |
'default' => '', // We set this in the init_form_fields function |
| 24 |
'options' => [ |
| 25 |
WC_Vipps_Recurring_Helper::BRAND_VIPPS => __( 'Vipps', 'woo-vipps' ), |
| 26 |
WC_Vipps_Recurring_Helper::BRAND_MOBILEPAY => __( 'MobilePay', 'woo-vipps' ) |
| 27 |
] |
| 28 |
], |
| 29 |
'auto_capture_mobilepay' => [ |
| 30 |
'type' => 'checkbox', |
| 31 |
'title' => __( 'Automatically capture payments made with MobilePay', 'woo-vipps' ), |
| 32 |
'label' => __( 'Automatically capture payments made with MobilePay', 'woo-vipps' ), |
| 33 |
'description' => __( 'If this option is checked we will start automatically capturing MobilePay payments. This prevents reservations from being cancelled after 7 days.', 'woo-vipps' ), |
| 34 |
'default' => 'no', |
| 35 |
], |
| 36 |
'description' => [ |
| 37 |
'title' => __( 'Description', 'woo-vipps' ), |
| 38 |
'type' => 'text', |
| 39 |
'description' => __( 'This controls the description which the user sees during checkout. {brand} is substituted with either Vipps or MobilePay.', 'woo-vipps' ), |
| 40 |
// translators: {brand}: brand title (Vipps or MobilePay) |
| 41 |
'default' => __( 'Pay with {brand}.', 'woo-vipps' ), |
| 42 |
], |
| 43 |
// todo: remove the checkout settings in a future release. |
| 44 |
'title_checkout' => [ |
| 45 |
'type' => 'title', |
| 46 |
'title' => __( 'Checkout settings', 'woo-vipps' ), |
| 47 |
'description' => __( 'Vipps MobilePay Checkout replaces the normal WooCommerce checkout with an easier and more seamless checkout that allows you to pay with Vipps MobilePay (and soon also a credit card). Your customers will be able to provide their billing/shipping details directly from the Vipps MobilePay app. <br><br><strong>Important!</strong> Checkout for recurring payments <strong>only supports static shipping</strong> at the moment.', 'woo-vipps' ), |
| 48 |
], |
| 49 |
'checkout_enabled' => [ |
| 50 |
'title' => __( 'Enable/Disable', 'woo-vipps' ), |
| 51 |
'label' => __( 'Enable Vipps/MobilePay Checkout', 'woo-vipps' ), |
| 52 |
'type' => 'checkbox', |
| 53 |
'default' => 'no', |
| 54 |
], |
| 55 |
'checkout_cleanup_abandoned_orders' => [ |
| 56 |
'title' => __( 'Cleanup changed/abandoned orders', 'woo-vipps' ), |
| 57 |
'label' => __( 'Cleanup changed/abandoned orders', 'woo-vipps' ), |
| 58 |
'description' => __( 'Automatically clean up Checkout orders where the order was abandoned, or the specification changed (runs every hour).', 'woo-vipps' ), |
| 59 |
'type' => 'checkbox', |
| 60 |
'default' => 'no', |
| 61 |
], |
| 62 |
'title_api' => [ |
| 63 |
'type' => 'title', |
| 64 |
'title' => __( 'API settings', 'woo-vipps' ), |
| 65 |
'description' => __( 'These settings control the connection between your store and Vipps MobilePay.', 'woo-vipps' ), |
| 66 |
], |
| 67 |
'merchant_serial_number' => [ |
| 68 |
'title' => __( 'Merchant Serial Number (MSN)', 'woo-vipps' ), |
| 69 |
'type' => 'text', |
| 70 |
'description' => __( 'Get your Merchant Serial Number your Vipps/MobilePay developer portal.', 'woo-vipps' ), |
| 71 |
'default' => '', |
| 72 |
'desc_tip' => true, |
| 73 |
], |
| 74 |
'client_id' => [ |
| 75 |
'title' => __( 'client_id', 'woo-vipps' ), |
| 76 |
'type' => 'text', |
| 77 |
'description' => __( 'Get your API keys from your Vipps/MobilePay developer portal.', 'woo-vipps' ), |
| 78 |
'default' => '', |
| 79 |
'desc_tip' => true, |
| 80 |
], |
| 81 |
'secret_key' => [ |
| 82 |
'title' => __( 'client_secret', 'woo-vipps' ), |
| 83 |
'type' => 'password', |
| 84 |
'description' => __( 'Get your API keys from your Vipps/MobilePay developer portal.', 'woo-vipps' ), |
| 85 |
'default' => '', |
| 86 |
'desc_tip' => true, |
| 87 |
], |
| 88 |
'subscription_key' => [ |
| 89 |
'title' => __( 'Ocp-Apim-Subscription-Key', 'woo-vipps' ), |
| 90 |
'type' => 'password', |
| 91 |
'description' => __( 'Get your API keys from your Vipps/MobilePay developer portal.', 'woo-vipps' ), |
| 92 |
'default' => '', |
| 93 |
'desc_tip' => true, |
| 94 |
], |
| 95 |
'title_orders' => [ |
| 96 |
'type' => 'title', |
| 97 |
'title' => __( 'Order settings', 'woo-vipps' ), |
| 98 |
'description' => __( 'Orders, renewals and status settings.', 'woo-vipps' ), |
| 99 |
], |
| 100 |
'order_prefix' => [ |
| 101 |
'type' => 'text', |
| 102 |
'title' => __( 'OrderId prefix', 'woo-vipps' ), |
| 103 |
'label' => __( 'OrderId prefix', 'woo-vipps' ), |
| 104 |
'description' => __( 'An alphanumeric text string to use as a prefix on checkout orders from your shop, to avoid duplicate order ids.', 'woo-vipps' ), |
| 105 |
'default' => '' |
| 106 |
], |
| 107 |
'continue_shopping_link_page' => [ |
| 108 |
'type' => 'page_dropdown', |
| 109 |
'title' => __( '"Continue shopping" link', 'woo-vipps' ), |
| 110 |
'description' => __( 'The page to redirect customers to when they click "Continue shopping" after a cancelled payment.', 'woo-vipps' ), |
| 111 |
'show_option_none' => __( '[Default] Shop or homepage', 'woo-vipps' ) |
| 112 |
], |
| 113 |
'default_reserved_charge_status' => [ |
| 114 |
'type' => 'select', |
| 115 |
'title' => __( 'Default status to give orders with a reserved charge', 'woo-vipps' ), |
| 116 |
'description' => __( 'The status to give orders when the charge is reserved in Vipps/MobilePay (i.e. tangible goods). Notice: This option only counts for newly signed agreements by the customer. Use the setting below to set the default status for renewal orders.', 'woo-vipps' ), |
| 117 |
'default' => 'wc-on-hold', |
| 118 |
'options' => array_filter( wc_get_order_statuses(), static function ( $key ) { |
| 119 |
return in_array( $key, [ 'wc-processing', 'wc-on-hold' ] ); |
| 120 |
}, ARRAY_FILTER_USE_KEY ) |
| 121 |
], |
| 122 |
'default_renewal_status' => [ |
| 123 |
'type' => 'select', |
| 124 |
'title' => __( 'Default status to give pending renewal orders', 'woo-vipps' ), |
| 125 |
'description' => __( 'When a renewal order happens we have to wait a few days for the money to be drawn from the customer. This settings controls the status to give these renewal orders before the charge completes.', 'woo-vipps' ), |
| 126 |
'default' => 'wc-processing', |
| 127 |
'options' => array_filter( wc_get_order_statuses(), static function ( $key ) { |
| 128 |
return in_array( $key, [ 'wc-processing', 'wc-on-hold' ] ); |
| 129 |
}, ARRAY_FILTER_USE_KEY ) |
| 130 |
], |
| 131 |
'transition_renewals_to_completed' => [ |
| 132 |
'type' => 'checkbox', |
| 133 |
'title' => __( 'Transition order status for renewals to "completed"', 'woo-vipps' ), |
| 134 |
'label' => __( 'Transition order status for renewals to "completed"', 'woo-vipps' ), |
| 135 |
'description' => __( 'This option will make sure order statuses always transition to "completed" when the renewal charge is completed in Vipps/MobilePay.', 'woo-vipps' ), |
| 136 |
'default' => 'no', |
| 137 |
], |
| 138 |
'title_cron' => [ |
| 139 |
'type' => 'title', |
| 140 |
'title' => __( 'Cron settings', 'woo-vipps' ), |
| 141 |
'description' => __( 'We use webhooks in most instances, but they are not guaranteed to be reliable. In those cases we rely on cron.', 'woo-vipps' ), |
| 142 |
], |
| 143 |
'check_charges_amount' => [ |
| 144 |
'type' => 'number', |
| 145 |
'title' => __( 'Amount of charges to check per status check', 'woo-vipps' ), |
| 146 |
'description' => __( 'The amount of charges to check the status for in wp-cron per scheduled event. It is recommended to keep this between 5 and 100. The higher the value, the more performance issues you may run into.', 'woo-vipps' ), |
| 147 |
'default' => 10, |
| 148 |
], |
| 149 |
'check_charges_sort_order' => [ |
| 150 |
'type' => 'select', |
| 151 |
'title' => __( 'Status checking sort order for charges', 'woo-vipps' ), |
| 152 |
'description' => __( 'The sort order we use when checking charges in wp-cron. Random sort order is the best for most use cases. Oldest first may be useful if you use synchronized renewals.', 'woo-vipps' ), |
| 153 |
'default' => 'rand', |
| 154 |
'options' => [ |
| 155 |
'rand' => __( 'Random', 'woo-vipps' ), |
| 156 |
'asc' => __( 'Oldest first', 'woo-vipps' ), |
| 157 |
'desc' => __( 'Newest first', 'woo-vipps' ) |
| 158 |
] |
| 159 |
], |
| 160 |
'title_developer' => [ |
| 161 |
'type' => 'title', |
| 162 |
'title' => __( 'Developer settings', 'woo-vipps' ), |
| 163 |
'description' => __( 'Developer, test, and debugging options.', 'woo-vipps' ), |
| 164 |
], |
| 165 |
'logging' => [ |
| 166 |
'title' => __( 'Logging', 'woo-vipps' ), |
| 167 |
'label' => __( 'Log debug messages', 'woo-vipps' ), |
| 168 |
'type' => 'checkbox', |
| 169 |
'description' => __( 'Save debug messages to the WooCommerce System Status log.', 'woo-vipps' ), |
| 170 |
'default' => 'yes', |
| 171 |
], |
| 172 |
'test_mode' => [ |
| 173 |
'title' => __( 'Test mode', 'woo-vipps' ), |
| 174 |
'label' => __( 'Enable test mode', 'woo-vipps' ), |
| 175 |
'type' => 'checkbox', |
| 176 |
'description' => __( 'Enabling this will route all API requests to the Vipps MobilePay test API.', 'woo-vipps' ), |
| 177 |
'default' => 'no', |
| 178 |
'disabled' => WC_VIPPS_RECURRING_TEST_MODE, |
| 179 |
'desc_tip' => WC_VIPPS_RECURRING_TEST_MODE ? __( 'This value is being overriden by WC_VIPPS_RECURRING_TEST_MODE.', 'woo-vipps' ) : null, |
| 180 |
], |
| 181 |
] |
| 182 |
); |
| 183 |
|