2017-07-16 22 views
0

私はLaravel 5.3を使用し、ここで Laravel 5.3ブレーントリーの使用方法 WebhookNotificationは

WebhookController

に新しいウェブフックのイベントハンドラを追加しようとしていますが、私のコントローラ

namespace App\Http\Controllers; 
 

 
use Braintree\WebhookNotification; 
 
use Laravel\Cashier\Http\Controllers\WebhookController as CashierController; 
 

 
use Log; 
 
use App\Models\BraintreeMerchant; 
 

 
class WebhookController extends CashierController 
 
{ 
 
    public function handleSubMerchantAccountApproved(WebhookNotification $notification) 
 
    { 
 
\t \t if(isset($_POST["bt_signature"]) && isset($_POST["bt_payload"])) 
 
\t \t { 
 
\t \t \t $notification = Braintree_WebhookNotification::parse($_POST["bt_signature"], $_POST["bt_payload"]); 
 
\t \t \t 
 
\t \t \t $notification->kind == Braintree_WebhookNotification::SUB_MERCHANT_ACCOUNT_APPROVED; 
 
\t \t \t // true 
 
\t \t \t $notification->merchantAccount->status; 
 
\t \t \t // "active" 
 
\t \t \t $notification->merchantAccount->id; 
 
\t \t \t // "blue_ladders_store" 
 
\t \t \t $notification->merchantAccount->masterMerchantAccount->id; 
 
\t \t \t // "14ladders_marketplace" 
 
\t \t \t $notification->merchantAccount->masterMerchantAccount->status; 
 
\t \t } 
 
    } 
 
}

はなくなっています次のエラーメッセージが表示されます。 BindingResolutionException in Container.php line 763: ターゲット[Braintree \ WebhookNotification]はインスタンス化できません。

+0

あなたは[この1](https://stackoverflow.com/questions/28595862/target-is-not-instantiable-laravel-のようないくつかの類似したLaravelの問題を見てとっています5-app-binding-service-provider)とは何ですか?この特定のエラー構造 "Target [x]は満足できるものではありません"は、更新されていないcompiled.phpファイルからのものかもしれないというコンセンサスがあります。 –

答えて

0

私は答えを見つけました。これはBraintree webhookコントローラを実装する方法です。

<?php 
 

 
namespace App\Http\Controllers; 
 

 
use Braintree\WebhookNotification; 
 
use Laravel\Cashier\Http\Controllers\WebhookController as CashierController; 
 
use Illuminate\Http\Request; 
 

 
class WebhookController extends CashierController 
 
{ 
 
    public function handleSubMerchantAccountApproved(Request $request) 
 
    { 
 
\t \t $notification = WebhookNotification::parse($request->bt_signature, $request->bt_payload); 
 
\t 
 
\t \t \t $merchantId = $notification->merchantAccount->id; 
 
\t \t \t $result_merchant_status = $notification->merchantAccount->status; 
 
    } 
 
\t 
 
}

関連する問題