Created
May 19, 2019 01:07
-
-
Save akmalhazim/983b5e0022cda6d032aa39ed007fd303 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Services; | |
use App\Traits\Braintree\Helpers; | |
use App\Traits\Braintree\Base; | |
use App\User; | |
use App\PaymentMethod; | |
use App\Jobs\PaymentMethod\DeleteCard; | |
use Braintree_Gateway; | |
class BraintreeService implements \App\Contracts\PaymentGateway { | |
use Base; | |
use Helpers; | |
protected $gateway; | |
protected $user; | |
/** | |
* Construct new Braintree instance | |
*/ | |
public function __construct() { | |
$this->gateway = new Braintree_Gateway([ | |
'environment' => config('braintree.environment', 'sandbox'), | |
'merchantId' => config('braintree.merchant_id'), | |
'publicKey' => config('braintree.public_key'), | |
'privateKey' => config('braintree.private_key') | |
]); | |
} | |
/** | |
* Set user | |
*/ | |
public function setUser(User $user) { | |
$this->user = $user; | |
return $this; | |
} | |
/** | |
* Return Braintree SDK Customer Instance | |
*/ | |
public function customer() { | |
return $this->gateway->customer(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment