Skip to content

Commit

Permalink
Store entrance code in meta.
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Oct 1, 2021
1 parent 6eab83f commit 6893734
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/Gateway.php
Expand Up @@ -141,14 +141,32 @@ public function start( Payment $payment ) {

$payment->set_meta( 'purchase_id', $purchase_id );

/**
* The Transaction.entranceCode is an 'authentication identifier' to
* facilitate continuation of the session between Merchant and Consumer,
* even if the existing session has been lost. It enables the Merchant to
* recognise the Consumer associated with a (completed) transaction.
* The Transaction.entranceCode is sent to the Merchant in the Redirect.
* The Transaction.entranceCode must have a minimum variation of 1
* million and should comprise letters and/or figures (maximum 40
* positions).
* The Transaction.entranceCode is created by the Merchant and passed
* to the Issuer.
*
* @link https://www.pronamic.eu/wp-content/uploads/sites/2/2016/06/Merchant-Integration-Guide-v3-3-1-ENG-February-2015.pdf
*/
$entrance_code = \wp_generate_password( 40 );

$payment->set_meta( 'entrance_code', $entrance_code );

// Transaction.
$transaction = new Transaction();
$transaction->set_purchase_id( $purchase_id );
$transaction->set_amount( $payment->get_total_amount()->number_format( null, '.', '' ) );
$transaction->set_currency( $payment->get_total_amount()->get_currency()->get_alphabetic_code() );
$transaction->set_expiration_period( 'PT30M' );
$transaction->set_description( $payment->get_description() );
$transaction->set_entrance_code( $payment->get_entrance_code() );
$transaction->set_entrance_code( $entrance_code );

$customer = $payment->get_customer();

Expand Down

0 comments on commit 6893734

Please sign in to comment.