diff --git a/src/Config.php b/src/Config.php
index fba3162..ee1a198 100644
--- a/src/Config.php
+++ b/src/Config.php
@@ -70,6 +70,13 @@ final class Config extends GatewayConfig implements JsonSerializable {
*/
public $order_id = '';
+ /**
+ * Skip hosted result page.
+ *
+ * @var bool
+ */
+ public $skip_hosted_result_page = false;
+
/**
* Construct config.
*/
diff --git a/src/Gateway.php b/src/Gateway.php
index f28d174..7639267 100644
--- a/src/Gateway.php
+++ b/src/Gateway.php
@@ -344,6 +344,9 @@ public function start( Payment $payment ) {
}
}
+ // Skip hosted result page.
+ $order->set_skip_hosted_result_page( $this->config->skip_hosted_result_page );
+
// Maybe update access token.
$this->maybe_update_access_token();
diff --git a/src/Integration.php b/src/Integration.php
index 2532be5..1d77e65 100644
--- a/src/Integration.php
+++ b/src/Integration.php
@@ -164,6 +164,31 @@ public function get_settings_fields() {
'type' => 'text',
];
+ // Skip hosted result page.
+ $code_field = \sprintf( '%s
', 'skipHppResultPage' );
+
+ $fields[] = [
+ 'classes' => [ 'regular-text', 'code' ],
+ 'description' => \sprintf(
+ /* translators: %s: skipHppResultPage
*/
+ \__(
+ 'The Rabo Smart Pay %s field makes it possible to skip the hosted result page (also referred to as the "Success" or "Thank you" page).',
+ 'pronamic_ideal'
+ ),
+ $code_field
+ ),
+ 'label' => \__( 'Skip hosted result page', 'pronamic_ideal' ),
+ 'meta_key' => '_pronamic_gateway_omnikassa_2_skip_hosted_result_page',
+ 'section' => 'advanced',
+ 'title' => \__( 'Skip hosted result page', 'pronamic_ideal' ),
+ 'tooltip' => \sprintf(
+ /* translators: %s: skipHppResultPage
*/
+ \__( 'This setting defines the Rabo Smart Pay %s field.', 'pronamic_ideal' ),
+ $code_field
+ ),
+ 'type' => 'checkbox',
+ ];
+
// Webhook.
$fields[] = [
'classes' => [ 'large-text', 'code' ],
@@ -203,6 +228,10 @@ public function get_config( $post_id ) {
$config->access_token_valid_until = $this->get_meta( $post_id, 'omnikassa_2_access_token_valid_until' );
$config->order_id = $this->get_meta( $post_id, 'omnikassa_2_order_id' );
+ $skip_hosted_result_page = $this->get_meta( $post_id, 'omnikassa_2_skip_hosted_result_page' );
+
+ $config->skip_hosted_result_page = 1 === \intval( $skip_hosted_result_page );
+
return $config;
}
diff --git a/src/Order.php b/src/Order.php
index 594b2e8..db261ef 100644
--- a/src/Order.php
+++ b/src/Order.php
@@ -154,6 +154,13 @@ final class Order extends Message implements JsonSerializable {
*/
private $payment_brand_meta_data;
+ /**
+ * Skip hosted result page (also referred to as the success/thank you page) in the payment process.
+ *
+ * @var bool|null
+ */
+ private $skip_hosted_result_page;
+
/**
* Construct order.
*
@@ -291,6 +298,16 @@ public function set_payment_brand_meta_data( $payment_brand_meta_data ) {
$this->payment_brand_meta_data = $payment_brand_meta_data;
}
+ /**
+ * Set skip hosted result page.
+ *
+ * @param bool $skip_hosted_result_page Skip hosted result page.
+ * @return void
+ */
+ public function set_skip_hosted_result_page( $skip_hosted_result_page ) {
+ $this->skip_hosted_result_page = $skip_hosted_result_page;
+ }
+
/**
* Create and set new order items.
*
@@ -394,6 +411,10 @@ public function jsonSerialize() {
$data['paymentBrandMetaData'] = $this->payment_brand_meta_data;
}
+ if ( null !== $this->skip_hosted_result_page ) {
+ $data['skipHppResultPage'] = $this->skip_hosted_result_page;
+ }
+
return (object) $data;
}