Skip to content

Commit

Permalink
update to phpClasses and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
MonerisSolutions committed Feb 29, 2024
1 parent 1c9ce57 commit e4b0f1f
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 24 deletions.
1 change: 0 additions & 1 deletion Examples/CA/TestCavvPreAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
print("\nIssuerId = " . $mpgResponse->getIssuerId());
print("\nThreeDSVersion = " . $mpgResponse->getThreeDSVersion());
print("\nSourcePanLast4 = " . $mpgResponse->getSourcePanLast4());
print("\nAdviceCode = " . $mpgResponse->getAdviceCode());

?>

32 changes: 28 additions & 4 deletions Examples/CA/TestMpiThreeDSAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
$mpiThreeDSAuthentication = new MpiThreeDSAuthentication();
$mpiThreeDSAuthentication->setOrderId("ord-110920-10:36:43"); //must be the same one that was used in MpiCardLookup call
$mpiThreeDSAuthentication->setCardholderName("Moneris Test");
$mpiThreeDSAuthentication->setPan("4740611374762707");
$mpiThreeDSAuthentication->setPan("340087427838525");
//$mpiThreeDSAuthentication->setDataKey("8OOXGiwxgvfbZngigVFeld9d2"); //Optional - For Moneris Vault and Hosted Tokenization tokens in place of setPan
$mpiThreeDSAuthentication->setExpdate("2310");
$mpiThreeDSAuthentication->setAmount("1.00");
$mpiThreeDSAuthentication->setThreeDSCompletionInd("Y"); //(Y|N|U) indicates whether 3ds method MpiCardLookup was successfully completed
$mpiThreeDSAuthentication->setRequestType("01"); //(01=payment|02=recur)
$mpiThreeDSAuthentication->setPurchaseDate("20200911035249"); //(YYYYMMDDHHMMSS)
$mpiThreeDSAuthentication->setNotificationURL("https://yournotificationurl.com"); //(Website where response from RRes or CRes after challenge will go)
$mpiThreeDSAuthentication->setChallengeWindowSize("03"); //(01 = 250 x 400, 02 = 390 x 400, 03 = 500 x 600, 04 = 600 x 400, 05 = Full screen)
$mpiThreeDSAuthentication->setChallengeWindowSize("03"); //(01 = 250 x 400, 02 = 390 x 400, 03 = 500 x 600, 04 = 600 x 400, 05 = Full screen)

$mpiThreeDSAuthentication->setBrowserUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36\\");
$mpiThreeDSAuthentication->setBrowserJavaEnabled("true"); //(true|false)
Expand All @@ -41,8 +41,25 @@
$mpiThreeDSAuthentication->setEmail("test@email.com");
$mpiThreeDSAuthentication->setRequestChallenge("Y"); //(Y|N Requesting challenge regardless of outcome)

/****************************** Transaction Object *******************************/
$mpiThreeDSAuthentication->setMessageCategory("01");
$mpiThreeDSAuthentication->setDeviceChannel("02");
$mpiThreeDSAuthentication->setDecoupledRequestIndicator("Y");
$mpiThreeDSAuthentication->setDecoupledRequestMaxTime("00010");
$mpiThreeDSAuthentication->setDecoupledRequestAsyncUrl("https://yourasyncnotificationurl.com");
$mpiThreeDSAuthentication->setRiIndicator("03");
// $mpiThreeDSAuthentication->setRecurringFrequency("031");
// $mpiThreeDSAuthentication->setRecurringExpiry("20251230");

$paiTemplate = array(
'prior_request_auth_data'=>"d7c1ee99-9478-44a6-b1f2-391e29c6b340",
'prior_request_ref'=>"d7c1ee99-9478-44a6-b1f2-391e29c6b340",
'prior_request_auth_method'=>"01",
'prior_request_auth_timestamp'=>"201710282113"
);
// $mpiThreeDSAuthentication->setPriorAuthenticationInfo( $paiTemplate );


/****************************** Transaction Object *******************************/
$mpgTxn = new mpgTransaction($mpiThreeDSAuthentication);

/******************************* Request Object **********************************/
Expand All @@ -51,8 +68,8 @@
$mpgRequest->setProcCountryCode("CA"); //"US" for sending transaction to US environment
$mpgRequest->setTestMode(true); //false or comment out this line for production transactions

//print_r($mpgRequest);
/****************************** HTTPS Post Object *******************************/

$mpgHttpPost =new mpgHttpsPost($store_id,$api_token,$mpgRequest);

/************************************* Response *********************************/
Expand All @@ -65,9 +82,16 @@

print("\nMessageType = " . $mpgResponse->getMpiMessageType());
print("\nTransStatus = " . $mpgResponse->getMpiTransStatus());
print("\nTransStatusReason = " . $mpgResponse->getMpiTransStatusReason());
print("\nChallengeURL = " . $mpgResponse->getMpiChallengeURL());
print("\nChallengeData = " . $mpgResponse->getMpiChallengeData());
print("\nThreeDSServerTransId = " . $mpgResponse->getMpiThreeDSServerTransId());
print("\nThreeDSVersion = " . $mpgResponse->getThreeDSVersion());
print("\nThreeDSDSTransID = " . $mpgResponse->getMpiDSTransId());
print("\nThreeDSAcsTransID = " . $mpgResponse->getMpiThreeDSAcsTransID());
print("\nThreeDSAuthTimeStamp = " . $mpgResponse->getMpiThreeDSAuthTimeStamp());
print("\nAuthenticationType = " . $mpgResponse->getMpiAuthenticationType());
print("\nCardholderInfo = " . $mpgResponse->getMpiCardholderInfo());

//In Frictionless flow, you may receive TransStatus as "Y",
//in which case you can then proceed directly to Cavv Purchase/Preauth with values below'
Expand Down
5 changes: 2 additions & 3 deletions Examples/CA/TestPreAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
$type='preauth';
$cust_id='cust id';
$order_id='ord-'.date("dmy-G:i:s");
$amount='4840.00';
$pan='5454545454545454';
$amount='6000.00';
$pan='4622943127023886';
$expdate='2212';
$crypt='7';
$dynamic_descriptor='123';
Expand Down Expand Up @@ -82,7 +82,6 @@
print("\nTimedOut = " . $mpgResponse->getTimedOut());
print("\nIssuerId = " . $mpgResponse->getIssuerId());
print("\nSourcePanLast4 = " . $mpgResponse->getSourcePanLast4());
print("\nAdviceCode = " . $mpgResponse->getAdviceCode());

// $installmentResults = $mpgResponse->getInstallmentResults();

Expand Down
6 changes: 2 additions & 4 deletions Examples/CA/TestPurchase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

$type='purchase';
$order_id='Test'.date("dmy-G:i:s");
$amount='4840.00';
$pan='5454545454545454';
$amount='6000.00';
$pan='4622943127023886';
$expdate='2212';
$crypt='7';
$dynamic_descriptor='123';
Expand Down Expand Up @@ -98,8 +98,6 @@
print("\nHostId = " . $mpgResponse->getHostId());
print("\nIssuerId = " . $mpgResponse->getIssuerId());
print("\nSourcePanLast4 = " . $mpgResponse->getSourcePanLast4());
print("\nAdviceCode = " . $mpgResponse->getAdviceCode());


// $installmentResults = $mpgResponse->getInstallmentResults();

Expand Down
3 changes: 3 additions & 0 deletions changeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Version 1.0.30:
-Added 3DS2.2 functionality

Version 1.0.29:
-Added NT to the ResIndependentRefund and ResForcePost transactions.

Expand Down
96 changes: 84 additions & 12 deletions mpgClasses.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class mpgGlobals
'MONERIS_MPI_FILE' => '/mpi/servlet/MpiServlet',
'MONERIS_MPI_2_FILE' => '/mpi2/servlet/MpiServlet',
'MONERIS_US_MPI_FILE' => '/mpi/servlet/MpiServlet',
'API_VERSION' => 'PHP NA - 1.0.22',
'API_VERSION' => 'PHP NA - 1.0.30',
'CONNECT_TIMEOUT' => '20',
'CLIENT_TIMEOUT' => '35'
);
Expand All @@ -42,7 +42,7 @@ class httpsPost
var $clientTimeOut;
var $apiVersion;
var $response;
var $debug = false; //default is false for production release
var $debug = true; //default is false for production release

This comment has been minimized.

Copy link
@rayr007

rayr007 Mar 16, 2024

This changes behaviour and is not documented in the changeLog


public function __construct($url, $dataToSend)
{
Expand Down Expand Up @@ -884,12 +884,6 @@ public function getPaymentType()
return $this->getMpgResponseValue($this->responseData,'PaymentType');
}

//MAC CODE
public function getAdviceCode()
{
return $this->getMpgResponseValue($this->responseData,'AdviceCode');
}

//------------------------------------------------------------------------------------//

public function getResolveData()
Expand Down Expand Up @@ -1692,6 +1686,31 @@ public function getThreeDSVersion()
{
return $this->getMpgResponseValue($this->responseData,"ThreeDSVersion");
}

public function getMpiThreeDSAcsTransID()
{
return $this->getMpgResponseValue($this->responseData,"ThreeDSAcsTransID");
}

public function getMpiThreeDSAuthTimeStamp()
{
return $this->getMpgResponseValue($this->responseData,"ThreeDSAuthTimeStamp");
}

public function getMpiAuthenticationType()
{
return $this->getMpgResponseValue($this->responseData,"AuthenticationType");
}

public function getMpiCardholderInfo()
{
return $this->getMpgResponseValue($this->responseData,"CardholderInfo");
}

public function getMpiTransStatusReason()
{
return $this->getMpgResponseValue($this->responseData,"TransStatusReason");
}

public function getMpiInLineForm()
{
Expand Down Expand Up @@ -2630,12 +2649,10 @@ public function getURL()

$hostId = "MONERIS".$this->procCountryCode.$this->testMode."_HOST";
$pathId = "MONERIS".$this->procCountryCode.$this->isMPI."_FILE";

$url = $gArray['MONERIS_PROTOCOL']."://".
$gArray[$hostId].":".
$gArray['MONERIS_PORT'].
$gArray[$pathId];

return $url;
}

Expand Down Expand Up @@ -3610,7 +3627,7 @@ public function getURL()
$gArray['MONERIS_PORT'].
$gArray[$pathId];

//echo "PostURL: " . $url;
// echo "PostURL: " . $url;

return $url;
}
Expand Down Expand Up @@ -6915,7 +6932,17 @@ class MpiThreeDSAuthentication extends Transaction {
"browser_screen_width" => null,
"browser_language" => null,
"email" => null,
"request_challenge" => null
"request_challenge" => null,
"message_category" => null,
"device_channel" => null,
"decoupled_request_indicator" => null,
"decoupled_request_max_time" => null,
"decoupled_request_async_url" => null,
"ri_indicator" => null,
"prior_authentication_info" => null,
"recurring_expiry" => null,
"recurring_frequency" => null

);

public function __construct()
Expand Down Expand Up @@ -7069,6 +7096,50 @@ public function setRequestChallenge($request_challenge)
{
$this->data["request_challenge"] = $request_challenge;
}

public function setMessageCategory($message_category)
{
$this->data["message_category"] = $message_category;
}

public function setDeviceChannel($device_channel)
{
$this->data["device_channel"] = $device_channel;
}

public function setDecoupledRequestIndicator($decoupled_request_indicator)
{
$this->data["decoupled_request_indicator"] = $decoupled_request_indicator;
}

public function setDecoupledRequestMaxTime($decoupled_request_max_time)
{
$this->data["decoupled_request_max_time"] = $decoupled_request_max_time;
}

public function setDecoupledRequestAsyncUrl($decoupled_request_async_url)
{
$this->data["decoupled_request_async_url"] = $decoupled_request_async_url;
}

public function setRiIndicator($ri_indicator)
{
$this->data["ri_indicator"] = $ri_indicator;
}

public function setPriorAuthenticationInfo($priorAuthenticationInfo)
{
$this->data["prior_authentication_info"] = $priorAuthenticationInfo;
}
public function setRecurringExpiry($recurringExpiry)
{
$this->data["recurring_expiry"] = $recurringExpiry;
}

public function setRecurringFrequency($recurringFrequency)
{
$this->data["recurring_frequency"] = $recurringFrequency;
}
}

class MpiCavvLookup extends Transaction {
Expand Down Expand Up @@ -7379,4 +7450,5 @@ function getPlanResponse() {
return $this->PlanResponse;
}
}

?>

0 comments on commit e4b0f1f

Please sign in to comment.