Skip to content

Commit

Permalink
Set parameter checkoutoption to combinedpage for iDEAL 2.0 (fix #4).
Browse files Browse the repository at this point in the history
  • Loading branch information
rvdsteege committed May 23, 2024
1 parent 9634c25 commit e40e032
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ class Client {
*/
private $transaction_datetime;

/**
* Checkout option.
*
* @var string
*/
private $checkout_option;

/**
* Construct and initialize an EMS e-Commerce object
*/
Expand Down Expand Up @@ -359,6 +366,25 @@ public function set_transaction_datetime( DateTime $datetime ) {
$this->transaction_datetime = $datetime;
}

/**
* Get checkout option.
*
* @return string
*/
public function get_checkout_option() {
return $this->checkout_option;
}

/**
* Set checkout option.
*
* @param string $checkout_option Checkout option.
* @return void
*/
public function set_checkout_option( $checkout_option ) {
$this->checkout_option = $checkout_option;
}

/**
* Get data
*
Expand Down Expand Up @@ -397,6 +423,7 @@ public function get_data() {
'transactionNotificationURL' => $this->get_notification_url(),
'idealIssuerID' => $this->get_issuer_id(),
'ems_notify_payment_id' => (string) $this->get_payment_id(),
'checkoutoption' => (string) $this->get_checkout_option(),
];

// @link http://briancray.com/2009/04/25/remove-null-values-php-arrays/
Expand Down
11 changes: 11 additions & 0 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ public function get_output_fields( Payment $payment ) {
$this->client->set_amount( $payment->get_total_amount() );
$this->client->set_issuer_id( $payment->get_meta( 'issuer' ) );

/**
* We set the checkout option to `combinedpage` for iDEAL 2.0 transactions:
*
* "For a standard hosted payment page integration, you should use the checkout option `combinedpage`
* that consolidates the payment method choice and the typical next step in a single page."
*
* @link https://www.emspay.com/nl/en/support/implementation-guide-ideal-ipg
* @link https://github.com/pronamic/wp-pronamic-pay-ems-e-commerce/issues/4
*/
$this->client->set_checkout_option( 'combinedpage' );

// Order ID.
$order_id = $payment->format_string( (string) $this->config->order_id );

Expand Down

0 comments on commit e40e032

Please sign in to comment.