File tree 6 files changed +17
-12
lines changed
6 files changed +17
-12
lines changed Original file line number Diff line number Diff line change 7
7
$ dotenv ->load ();
8
8
}
9
9
10
- Braintree \Configuration::environment (getenv ('BT_ENVIRONMENT ' ));
11
- Braintree \Configuration::merchantId (getenv ('BT_MERCHANT_ID ' ));
12
- Braintree \Configuration::publicKey (getenv ('BT_PUBLIC_KEY ' ));
13
- Braintree \Configuration::privateKey (getenv ('BT_PRIVATE_KEY ' ));
10
+ $ gateway = new Braintree \Gateway ([
11
+ 'environment ' => getenv ('BT_ENVIRONMENT ' ),
12
+ 'merchantId ' => getenv ('BT_MERCHANT_ID ' ),
13
+ 'publicKey ' => getenv ('BT_PUBLIC_KEY ' ),
14
+ 'privateKey ' => getenv ('BT_PRIVATE_KEY ' )
15
+ ]);
Original file line number Diff line number Diff line change 4
4
$ amount = $ _POST ["amount " ];
5
5
$ nonce = $ _POST ["payment_method_nonce " ];
6
6
7
- $ result = Braintree \Transaction:: sale ([
7
+ $ result = $ gateway -> transaction ()-> sale ([
8
8
'amount ' => $ amount ,
9
9
'paymentMethodNonce ' => $ nonce ,
10
10
'options ' => [
Original file line number Diff line number Diff line change 39
39
<script src="https://js.braintreegateway.com/web/dropin/1.9.2/js/dropin.min.js"></script>
40
40
<script>
41
41
var form = document.querySelector('#payment-form');
42
- var client_token = "<?php echo (Braintree \ ClientToken:: generate ()); ?> ";
42
+ var client_token = "<?php echo ($ gateway -> ClientToken ()-> generate ()); ?> ";
43
43
44
44
braintree.dropin.create({
45
45
authorization: client_token,
Original file line number Diff line number Diff line change 6
6
require_once ("../includes/braintree_init.php " );
7
7
require_once ("../includes/header.php " );
8
8
if (isset ($ _GET ["id " ])) {
9
- $ transaction = Braintree \Transaction:: find ($ _GET ["id " ]);
9
+ $ transaction = $ gateway -> transaction ()-> find ($ _GET ["id " ]);
10
10
11
11
$ transactionSuccessStatuses = [
12
12
Braintree \Transaction::AUTHORIZED ,
Original file line number Diff line number Diff line change 7
7
$ dotenv ->load ();
8
8
}
9
9
10
- Braintree \Configuration::environment (getenv ('BT_ENVIRONMENT ' ));
11
- Braintree \Configuration::merchantId (getenv ('BT_MERCHANT_ID ' ));
12
- Braintree \Configuration::publicKey (getenv ('BT_PUBLIC_KEY ' ));
13
- Braintree \Configuration::privateKey (getenv ('BT_PRIVATE_KEY ' ));
10
+ $ gateway = new Braintree \Gateway ([
11
+ 'environment ' => getenv ('BT_ENVIRONMENT ' ),
12
+ 'merchantId ' => getenv ('BT_MERCHANT_ID ' ),
13
+ 'publicKey ' => getenv ('BT_PUBLIC_KEY ' ),
14
+ 'privateKey ' => getenv ('BT_PRIVATE_KEY ' )
15
+ ]);
Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ class TransactionPageTest extends PHPUnit_Framework_TestCase
5
5
{
6
6
function test_showsTransactionInformation ()
7
7
{
8
- $ result = Braintree \Transaction::sale ([
8
+ global $ gateway ;
9
+ $ result = $ gateway ->transaction ()->sale ([
9
10
'amount ' => 10 ,
10
11
'paymentMethodNonce ' => 'fake-valid-nonce '
11
12
]);
You can’t perform that action at this time.
0 commit comments