mincdev / wirecard-wrapper
一个封装类,简化了与 Adumo(之前为 Wirecard / MyGate)web 服务的集成。
1.1.3
2021-10-29 09:46 UTC
README
一个封装类,简化了与 Adumo(之前为 Wirecard / MyGate)web 服务的集成。
🚨弃用警告 ⚠️
此存储库已弃用,不再维护。用于创建此项目的文档不再可用,且无法为新项目提供集成。
文档
此封装基于在 Adumo Online 网站上找到的企业集成文档:[https://developers.adumoonline.com/enterprise.php](https://developers.adumoonline.com/enterprise.php)
Composer
要在您的项目中使用此包,请使用 Composer 安装它
composer require mincdev/wirecard-wrapper
示例
初始化服务
$adumo = new WirecardDelegate([ 'merchantUID' => '9BA5008C-08EE-4286-A349-54AF91A621B0', // Your Merchant UID 'applicationUID' => '23ADADC0-DA2D-4DAC-A128-4845A5D71293', // Your Application UID 'mode' => Constants::WIRECARD_MODE_TEST // Specify Test or Live mode ]);
设置交易信息和卡片。您可以在测试环境中使用测试卡。
// Create the transaction $transaction = new Transaction(9.95, "Your Merchant Reference"); $adumo->setTransaction($transaction); // To use a test card, call one of the functions in the TestCards class $card = (new TestCards())->visa3DSecure(); // To use a real card, assign it using the below $card = new Card("Joe Soap", "4111111111111111", "10", "2027", 001);
进行 3D Secure 查询以查看此卡是否需要 3D Secure 验证。
$tdsLookupResult = $adumo->setCard($card) ->lookup3DSecure(); if ($tdsLookupResult->getTdsLookupAuthRequired() == "Y") { $token = $adumo->createToken(); // Store this where you can access it from your return URL $adumo->requireAuthentication($tdsLookupResult->getTdsLookupAcsUrl(), $tdsLookupResult->getTdsLookupPayload(), "https://www.yourcallbackurl.com"); }
在您的返回 URL 中捕获 POST 变量,并执行以下操作
$tdsAuthenticateResult = $adumo->tdsAuthenticate($_POST["MD"], $_POST["PaRes"]); if ($tdsAuthenticateResult->getTdsAuthCcAuthAllowed() == "Y" && $tdsAuthenticateResult->getTdsAuthParesStatus() == "Y" && $tdsAuthenticateResult->getTdsAuthSignatureVerification() == "Y") { $authorise = $adumo->setSalesItems($items) // Make sure you stored your items somewhere before calling the authentication ->authoriseSale($tdsAuthenticateResult->getUidTransactionIndex(), Constants::ACTION_AUTHORISE, true); $capture = $adumo->capture($authorise->getUidTransactionIndex()); // Capture the sale $deleteToken = $adumo->deleteToken(); // Optional - Remove the token }
如果卡片不需要 3D Secure 验证,您可以继续进行捕获步骤。
所有功能
有关每个操作的完整描述,请参阅文档。
操作 14 : lookup3DSecure();
requireAuthentication() // 此操作将发送到第三方银行
操作 1, 5 : authoriseSale();
操作 3 : capture();
操作 2 : authReversal();
操作 15 : tdsAuthenticate();
操作 4, 12 : credit();
操作 21 : createToken();
操作 22 : readToken();
操作 23 : deleteToken();