Braintree\WebhookTesting::sampleNotification PHP Метод

sampleNotification() публичный статический Метод

public static sampleNotification ( $kind, $id )
    public static function sampleNotification($kind, $id)
    {
        $payload = base64_encode(self::_sampleXml($kind, $id)) . "\n";
        $signature = Configuration::publicKey() . "|" . Digest::hexDigestSha1(Configuration::privateKey(), $payload);
        return ['bt_signature' => $signature, 'bt_payload' => $payload];
    }

Usage Example

 public function testAccountUpdaterDailyReportWebhook()
 {
     $sampleNotification = Braintree\WebhookTesting::sampleNotification(Braintree\WebhookNotification::ACCOUNT_UPDATER_DAILY_REPORT, "my_id");
     $webhookNotification = Braintree\WebhookNotification::parse($sampleNotification['bt_signature'], $sampleNotification['bt_payload']);
     $this->assertEquals(Braintree\WebhookNotification::ACCOUNT_UPDATER_DAILY_REPORT, $webhookNotification->kind);
     $this->assertEquals("link-to-csv-report", $webhookNotification->accountUpdaterDailyReport->reportUrl);
     $this->assertEquals(new DateTime("2016-01-14"), $webhookNotification->accountUpdaterDailyReport->reportDate);
 }
All Usage Examples Of Braintree\WebhookTesting::sampleNotification