vendor/braintree/braintree_php/lib/Braintree/WebhookTestingGateway.php
(开头部分) 28KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Braintree;
/**
* WebhookTestingGateway module
* Creates and manages test webhooks
*/
class WebhookTestingGateway
{
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
public function __construct($gateway)
{
$this->config = $gateway->config;
$this->config->assertHasAccessTokenOrKeys();
}
/**
* Build a sample Webhook
*
* @param string $kind the kind of Webhook you want to generate
* @param string $id unique identifier
* @param string $sourceMerchantId optional
*
* @return Webhook
*/
public function sampleNotification($kind, $id, $sourceMerchantId = null)
{
$xml = self::_sampleXml($kind, $id, $sourceMerchantId);
$payload = base64_encode($xml) . "\n";
$publicKey = $this->config->getPublicKey();
$sha = Digest::hexDigestSha1($this->config->getPrivateKey(), $payload);
$signature = $publicKey . "|" . $sha;
return [
'bt_signature' => $signature,
'bt_payload' => $payload
];
}
private static function _sampleXml($kind, $id, $sourceMerchantId)
{
switch ($kind) {
case WebhookNotification::SUB_MERCHANT_ACCOUNT_APPROVED:
$subjectXml = self::_merchantAccountApprovedSampleXml($id);
break;
case WebhookNotification::SUB_MERCHANT_ACCOUNT_DECLINED:
$subjectXml = self::_merchantAccountDeclinedSampleXml($id);
break;
case WebhookNotification::TRANSACTION_DISBURSED:
$subjectXml = self::_transactionDisbursedSampleXml($id);
break;
case WebhookNotification::TRANSACTION_REVIEWED:
$subjectXml = self::_transactionReviewedSampleXml($id);
break;
case WebhookNotification::TRANSACTION_SETTLED:
$subjectXml = self::_transactionSettledSampleXml($id);
break;
case WebhookNotification::TRANSACTION_SETTLEMENT_DECLINED:
$subjectXml = self::_transactionSettlementDeclinedSampleXml($id);
后面还有 753 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
