Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

add 3DS v2.0 params with external authentication in FOP #458

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Unreleased
* Added Support for 3DS v2.0 with external Authentication in FOP_CreateFormOfPayment

## Release 1.13.0 (5 Apr 2021)
* Add support for multiple pax types in Fare_MasterPricerTravelBoardSearch (https://github.com/amabnl/amadeus-ws-client/pull/432) - Artem Zakharchenko
Expand Down
62 changes: 62 additions & 0 deletions docs/samples/fop-createfop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,68 @@ Query and response for handling 3DS data.
$fopResponse = $client->fopCreateFormOfPayment($options);


3D-Secure payment version 2.x with external authentication
=================

.. code-block:: php

use Amadeus\Client\RequestOptions\Fop\CreditCardInfo;
use Amadeus\Client\RequestOptions\Fop\CreditCardSupplementaryData;
use Amadeus\Client\RequestOptions\Fop\Group;
use Amadeus\Client\RequestOptions\Fop\MopInfo;
use Amadeus\Client\RequestOptions\Fop\ThreeDSecureInfo;
use Amadeus\Client\RequestOptions\FopCreateFopOptions;
use Amadeus\Client\Struct\Fop\AttributeDetails;

$options = new FopCreateFopOptions([
'transactionCode' => FopCreateFopOptions::TRANS_CREATE_FORM_OF_PAYMENT,
'fopGroup' => [
new Group([
'mopInfo' => [
new MopInfo([
'fopType' => 'CC',
'attributeType' => AttributeDetails::TYPE_FP_ELEMENT,
'payMerchant' => 'EW',
'mopPaymentType' => MopInfo::MOP_PAY_TYPE_CREDIT_CARD,
'creditCardInfo' => new CreditCardInfo([
'name' => 'Name Surname',
'cardNumber' => 'XXXXXXXXXXXX0003',
'vendorCode' => 'VI',
'expiryDate' => '1020',
'securityId' => '999',
'threeDSecure' => new ThreeDSecureInfo([
'transactionsStatus' => ThreeDSecureInfo::PARES_AUTHENTICATION_SUCCESSFUL,
'tdsVersion' => '2.0.1',
'creditCardCompany' => ThreeDSecureInfo::CC_COMP_VISA_DIRECTORY_SERVER,
'authenticationIndicator' => '05',
'tdsServerTransactionId' => 'U0RTRzNTRUczNEdTR1NFUldXRkNXRkRXRUZFRw==',
'tdsServerTransactionIdLength' => 28,
'directoryServerTransactionId' => 'Q2pENDJ0Tll0WlZ6VFcwSEVvdDVIRGt4TXpFPQ',
'directoryServerTransactionIdLength' => 28,
'tdsAuthenticationVerificationCode' => 'QUFBQkJYbGprUUFBQUFBRUFXT1JBQUFBQUFBPQ',
'tdsAuthenticationVerificationCodeLength' => 28,
'tdsAuthenticationVerificationCodeReference' => ThreeDSecureInfo::AUTHENTICATION_VERIFICATION_CODE_VISA
]),
'supplementaryData' => [
new CreditCardSupplementaryData([
'setType' => CreditCardSupplementaryData::SET_TYPE_3DS,
'attributeType' => CreditCardSupplementaryData::ATTRIBUTE_TYPE_EXTERNAL_AUTHENTICATION,
'attributeDescription' => CreditCardSupplementaryData::ATTRIBUTE_DESCRIPTION_Y,
])
]
]),
'sequenceNr' => 1,
'fopCode' => CC,
'fopStatus' => MopInfo::STATUS_NEW,
])
]
])
]
]);

$fopResponse = $client->fopCreateFormOfPayment($options);


Best Effort
===========

Expand Down
5 changes: 5 additions & 0 deletions src/Amadeus/Client/RequestOptions/Fop/CreditCardInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,9 @@ class CreditCardInfo extends LoadParamsFromArray
* @var ThreeDSecureInfo
*/
public $threeDSecure;

/**
* @var CreditCardSupplementaryData[]
*/
public $supplementaryData = [];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php
/**
* amadeus-ws-client
*
* Copyright 2015 Amadeus Benelux NV
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @package Amadeus
* @license https://opensource.org/licenses/Apache-2.0 Apache 2.0
*/

namespace Amadeus\Client\RequestOptions\Fop;

use Amadeus\Client\LoadParamsFromArray;

/**
* CreditCardInfo
*
* @package Amadeus\Client\RequestOptions\Fop
* @author Friedemann Schmuhl <friedemann.schmuhl@invia.de>
*/
class CreditCardSupplementaryData extends LoadParamsFromArray
{
const SET_TYPE_AUTHENTICATION = 'ATN';
const SET_TYPE_AUTHORIZATION = 'AUT';
const SET_TYPE_3DS = '3DS';

const ATTRIBUTE_TYPE_EXTERNAL_AUTHENTICATION = 'EXTERNAL_AUTHENTICATION';

const ATTRIBUTE_DESCRIPTION_Y = 'Y';

/**
* Type of Data related to FOP account
*
* @var string
*/
public $setType;

/**
* Used to add data related to FOP Account
*
* @var string
*/
public $attributeType;

/**
* This is the data value. This may contain: - a potential attribute of the switch - the value of the structured data of the FOP
*
* @var string
*/
public $attributeDescription;
}
9 changes: 9 additions & 0 deletions src/Amadeus/Client/RequestOptions/Fop/MopInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ class MopInfo extends LoadParamsFromArray
*/
public $fopType;

/**
* Describe one processing option at FOP level
*
* AttributeDetails::TYPE_*
*
* @var string
*/
public $attributeType;

/**
* The Merchant company
*
Expand Down
103 changes: 103 additions & 0 deletions src/Amadeus/Client/RequestOptions/Fop/ThreeDSecureInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,27 @@ class ThreeDSecureInfo extends LoadParamsFromArray
const PARES_AUTHENTICATION_UNABLE = "U";
const PARES_AUTHENTICATION_SUCCESSFUL = "Y";

const TRANSACTION_STATUS_ATTEMPTED_AUTHENTICATION = "A";
const TRANSACTION_STATUS_AUTHENTICATION_FAILED = "N";
const TRANSACTION_STATUS_AUTHENTICATION_UNABLE = "U";
const TRANSACTION_STATUS_AUTHENTICATION_SUCCESSFUL = "Y";

const CC_COMP_MASTERCARD_DIRECTORY_SERVER = "CADS";
const CC_COMP_VISA_DIRECTORY_SERVER = "VIDS";

const DATATYPE_BINARY = "B";
const DATATYPE_EDIFACT = "E";

const CREDIT_CARD_COMPANY_VISA = 'VIDS';
const CREDIT_CARD_COMPANY_MASTER_CARD = 'CADS';
const CREDIT_CARD_COMPANY_AMERICAN_EXPRESS = 'AXDS';
const CREDIT_CARD_COMPANY_DINERS = 'DCDS';
const CREDIT_CARD_COMPANY_JCB = 'JCDS';

const AUTHENTICATION_VERIFICATION_CODE_VISA = 'CAVV';
const AUTHENTICATION_VERIFICATION_CODE_AMERICAN_EXPRESS = 'AEVV';
const AUTHENTICATION_VERIFICATION_CODE_MASTERCARD = 'AAV';

/**
* VERES status
*
Expand All @@ -66,13 +81,28 @@ class ThreeDSecureInfo extends LoadParamsFromArray
*/
public $paresStatus;

/**
* Transaction status
*
* self::TRANSACTION_STATUS_*
*
* @var string
*/
public $transactionsStatus;
/**
* self::CC_COMP_*
*
* @var string
*/
public $creditCardCompany;

/**
* Indicates the status of the enrolment and authentication phases
*
* @var string
*/
public $authenticationIndicator;

/**
* Access Control Server URL
*
Expand Down Expand Up @@ -101,6 +131,79 @@ class ThreeDSecureInfo extends LoadParamsFromArray
*/
public $transactionIdentifierLength;

/**
* 3DS protocol version
*
* @var string
*/
public $tdsVersion;

/**
* 3DS 2.0 partner transaction identifier
*
* @var string
*/
public $tdsServerTransactionId;

/**
* @var string
*/
public $tdsServerTransactionIdDataType = self::DATATYPE_BINARY;

/**
* Length of 3DS 2.0 partner transaction identifier
*
* @var string
*/
public $tdsServerTransactionIdLength;

/**
* 3DS authentication verification code
*
* @var string
*/
public $tdsAuthenticationVerificationCode;

/**
* 3DS authentication verification code reference (CAVV : Visa, Diners, JCB AEVV : American Express AAV : Mastercard)
*
* @var string
*/
public $tdsAuthenticationVerificationCodeReference;

/**
* @var string
*/
public $tdsAuthenticationVerificationCodeDataType = self::DATATYPE_BINARY;

/**
* 3DS authentication verification code
*
* @var int
*/
public $tdsAuthenticationVerificationCodeLength;

/**
* Transaction identifier related to the Directory Server
*
* @package Amadeus\Client\RequestOptions\Fop
*
* @var string
*/
public $directoryServerTransactionId;

/**
* @var string
*/
public $directoryServerTransactionIdDataType = self::DATATYPE_BINARY;

/**
* Length of Directory Server Transaction Identifier string
*
* @var int
*/
public $directoryServerTransactionIdLength;

/**
* PARES Authentication response
*
Expand Down
16 changes: 14 additions & 2 deletions src/Amadeus/Client/Struct/Fop/AuthenticationData.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,31 @@ class AuthenticationData
*/
public $authenticationDataDetails;

/**
* Version of the 3DS protocol
* @var string
*/
public $tdsVersion;

/**
* AuthenticationData constructor.
*
* @param string|null $veresStatus
* @param string|null $paresStatus
* @param string|null $company
*/
public function __construct($veresStatus, $paresStatus, $company)
public function __construct($veresStatus, $paresStatus, $company, $transactionsStatus, $authenticationIndicator, $tdsVersion)
{
if (false === empty($tdsVersion)) {
$this->tdsVersion = $tdsVersion;
}

$this->authenticationDataDetails = new AuthenticationDataDetails(
$veresStatus,
$paresStatus,
$company
$company,
$transactionsStatus,
$authenticationIndicator
);
}
}
22 changes: 17 additions & 5 deletions src/Amadeus/Client/Struct/Fop/AuthenticationDataDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* AuthenticationDataDetails
*
* @package Amadeus\Client\Struct\Fop
* @author Dieter Devlieghere <dermikagh@gmail.com>
* @author Dieter Devlieghere <dermikagh@gmail.com>
*/
class AuthenticationDataDetails
{
Expand All @@ -51,6 +51,16 @@ class AuthenticationDataDetails
*/
public $pares;

/**
* A : attempt processing performed
* N : authentication failed
* U : unable to authenticate
* Y : authentication successful
*
* @var string
*/
public $transStatus;

/**
* CADS MasterCard Directory Server
* VIDS VISA Directory Server
Expand Down Expand Up @@ -92,10 +102,12 @@ class AuthenticationDataDetails
* @param string|null $paresStatus
* @param string|null $company
*/
public function __construct($veresStatus, $paresStatus, $company)
public function __construct($veresStatus, $paresStatus, $company, $transactionsStatus, $authenticationIndicator)
{
$this->veres = $veresStatus;
$this->pares = $paresStatus;
$this->creditCardCompany = $company;
$this->veres = $veresStatus;
$this->pares = $paresStatus;
$this->creditCardCompany = $company;
$this->transStatus = $transactionsStatus;
$this->authenticationIndicator = $authenticationIndicator;
}
}
Loading