Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

adds missing data to requests in the workflow demo #602

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
19 changes: 15 additions & 4 deletions demos/workflow/scripts/payin-card-direct.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,24 @@
$PayIn->Fees->Amount = 0;
$PayIn->ExecutionType = \MangoPay\PayInExecutionType::Direct;
$PayIn->ExecutionDetails = new \MangoPay\PayInExecutionDetailsDirect();
$PayIn->ExecutionDetails->SecureModeReturnURL = "http".(isset($_SERVER['HTTPS']) ? "s" : null)."://".$_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"]."?stepId=".($stepId+1);
$PayIn->ExecutionDetails->SecureModeReturnURL = "http" . (isset($_SERVER['HTTPS']) ? "s" : null) . "://" . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"] . "?stepId=" . ($stepId + 1);
$PayIn->ExecutionDetails->CardId = $_SESSION["MangoPayDemo"]["Card"];
$PayIn->PaymentDetails->IpAddress = "2001:0620:0000:0000:0211:24FF:FE80:C12C";
$PayIn->PaymentDetails->BrowserInfo = new \MangoPay\BrowserInfo();
$PayIn->PaymentDetails->BrowserInfo->AcceptHeader = "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8";
$PayIn->PaymentDetails->BrowserInfo->JavaEnabled = true;
$PayIn->PaymentDetails->BrowserInfo->Language = "FR-FR";
$PayIn->PaymentDetails->BrowserInfo->ColorDepth = 4;
$PayIn->PaymentDetails->BrowserInfo->ScreenHeight = 1800;
$PayIn->PaymentDetails->BrowserInfo->ScreenWidth = 400;
$PayIn->PaymentDetails->BrowserInfo->TimeZoneOffset = 60;
$PayIn->PaymentDetails->BrowserInfo->UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148";
$PayIn->PaymentDetails->BrowserInfo->JavascriptEnabled = true;
$result = $mangoPayApi->PayIns->Create($PayIn);

//Display result
pre_dump($result);
$_SESSION["MangoPayDemo"]["PayInCardDirect"] = $result->Id;
if ($result->ExecutionDetails->SecureModeNeeded && $result->Status!=\MangoPay\PayInStatus::Failed) {
$nextButton = array("url"=>$result->ExecutionDetails->SecureModeRedirectURL, "text"=>"Go to 3DS payment page");
}
if ($result->ExecutionDetails->SecureModeNeeded && $result->Status != \MangoPay\PayInStatus::Failed) {
$nextButton = array("url" => $result->ExecutionDetails->SecureModeRedirectURL, "text" => "Go to 3DS payment page");
}
19 changes: 15 additions & 4 deletions demos/workflow/scripts/preauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,24 @@
$CardPreAuthorization->DebitedFunds->Amount = 1500;
$CardPreAuthorization->SecureMode = "DEFAULT";
$CardPreAuthorization->CardId = $_SESSION["MangoPayDemo"]["Card"];
$CardPreAuthorization->SecureModeReturnURL = "http".(isset($_SERVER['HTTPS']) ? "s" : null)."://".$_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"]."?stepId=".($stepId+1);
$CardPreAuthorization->SecureModeReturnURL = "http" . (isset($_SERVER['HTTPS']) ? "s" : null) . "://" . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"] . "?stepId=" . ($stepId + 1);
$CardPreAuthorization->IpAddress = "2001:0620:0000:0000:0211:24FF:FE80:C12C";
$CardPreAuthorization->BrowserInfo = new \MangoPay\BrowserInfo();
$CardPreAuthorization->BrowserInfo->AcceptHeader = "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8";
$CardPreAuthorization->BrowserInfo->JavaEnabled = true;
$CardPreAuthorization->BrowserInfo->Language = "FR-FR";
$CardPreAuthorization->BrowserInfo->ColorDepth = 4;
$CardPreAuthorization->BrowserInfo->ScreenHeight = 1800;
$CardPreAuthorization->BrowserInfo->ScreenWidth = 400;
$CardPreAuthorization->BrowserInfo->TimeZoneOffset = 60;
$CardPreAuthorization->BrowserInfo->UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148";
$CardPreAuthorization->BrowserInfo->JavascriptEnabled = true;
$result = $mangoPayApi->CardPreAuthorizations->Create($CardPreAuthorization);


//Display result
pre_dump($result);
$_SESSION["MangoPayDemo"]["PreAuth"] = $result->Id;
if ($result->SecureModeNeeded && $result->Status!=\MangoPay\CardPreAuthorizationStatus::Failed) {
$nextButton = array("url"=>$result->SecureModeRedirectURL, "text"=>"Go to 3DS payment page");
}
if ($result->SecureModeNeeded && $result->Status != \MangoPay\CardPreAuthorizationStatus::Failed) {
$nextButton = array("url" => $result->SecureModeRedirectURL, "text" => "Go to 3DS payment page");
}
14 changes: 13 additions & 1 deletion demos/workflow/scripts/user-create-legal.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,20 @@
$User->LegalRepresentativeBirthday = 121271;
$User->LegalRepresentativeNationality = "FR";
$User->LegalRepresentativeCountryOfResidence = "ZA";
$User->CompanyNumber = 'LU123456';
$User->UserCategory = 'Owner';

$address = new \MangoPay\Address();
$address->AddressLine1 = 'Rue des plantes';
$address->AddressLine2 = '2nd floor';
$address->City = 'Paris';
$address->Country = 'FR';
$address->PostalCode = '75000';
$address->Region = 'IDF';

$User->HeadquartersAddress = $address;
$result = $mangoPayApi->Users->Create($User);

//Display result
pre_dump($result);
$_SESSION["MangoPayDemo"]["UserLegal"] = $result->Id;
$_SESSION["MangoPayDemo"]["UserLegal"] = $result->Id;
1 change: 1 addition & 0 deletions demos/workflow/scripts/user-create-natural.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$User->Birthday = 121271;
$User->Nationality = "FR";
$User->CountryOfResidence = "ZA";
$User->UserCategory = 'Payer';
$result = $mangoPayApi->Users->Create($User);

//Display result
Expand Down