'.esc_html(rest_url('jvb/v1/webhooks/helcim')).''
];
$this->defaults = [
];
$this->handleWebhooks = true;
parent::__construct($userID);
$this->actions = array_merge(
$this->actions,
[
'import_from_helcim' => 'handleImportFromHelcim',
'sync_to_helcim' => 'handleSyncToHelcim'
]
);
// Initialize field mappings
$this->initializeFieldMappings();
}
/**
* Initialize service-specific settings
*/
protected function initialize(): void
{
$this->api_token = $this->credentials['api_token'] ?? '';
$this->account_id = $this->credentials['account_id'] ?? '';
$this->terminal_id = $this->credentials['terminal_id'] ?? '';
$this->webhook_secret = $this->credentials['webhook_secret'] ?? '';
$this->is_test_mode = (bool)($this->credentials['test_mode'] ?? false);
// Set the appropriate API base
$this->apiBase = $this->is_test_mode ? $this->apiBase['sandbox'] : $this->apiBase['production'];
// Load payment form settings
$this->payment_form_settings = [
'card' => $this->credentials['enable_card_payments'] ?? true,
'ach' => $this->credentials['enable_ach_payments'] ?? false,
'apple_pay' => $this->credentials['enable_apple_pay'] ?? false,
'google_pay' => $this->credentials['enable_google_pay'] ?? false,
];
}
/**
* Register additional WordPress hooks
*/
protected function registerAdditionalHooks(): void
{
$this->ensureInitialized();
if (!$this->isSetUp()) {
return;
}
// User login tracking for security
add_action('wp_login', [$this, 'trackUserLogin'], 10, 2);
add_action('wp_footer', [$this, 'outputCheckout']);
// Enqueue checkout scripts
add_action('wp_enqueue_scripts', [$this, 'enqueueScripts']);
// REST API endpoints for checkout
add_action('rest_api_init', [$this, 'registerRestRoutes']);
}
/**
* Register REST API routes
*/
public function registerRestRoutes(): void
{
register_rest_route('jvb/v1', '/helcim/checkout', [
'methods' => 'POST',
'callback' => [$this, 'handleCheckout'],
'permission_callback' => '__return_true'
]);
register_rest_route('jvb/v1', '/helcim/customer', [
'methods' => 'POST',
'callback' => [$this, 'handleCustomerLookup'],
'permission_callback' => '__return_true'
]);
register_rest_route('jvb/v1', '/helcim/order-status/(?PWelcome back, = esc_html($user->display_name) ?>!
Login with your email to access saved cards and order history
You can checkout as a guest or create an account after your order
Order #
| Item | Price | Total |
|---|