File tree Expand file tree Collapse file tree 6 files changed +17
-12
lines changed Expand file tree Collapse file tree 6 files changed +17
-12
lines changed Original file line number Diff line number Diff line change 77 $ dotenv ->load ();
88}
99
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 44$ amount = $ _POST ["amount " ];
55$ nonce = $ _POST ["payment_method_nonce " ];
66
7- $ result = Braintree \Transaction:: sale ([
7+ $ result = $ gateway -> transaction ()-> sale ([
88 'amount ' => $ amount ,
99 'paymentMethodNonce ' => $ nonce ,
1010 'options ' => [
Original file line number Diff line number Diff line change 3939 <script src="https://js.braintreegateway.com/web/dropin/1.9.4/js/dropin.min.js"></script>
4040 <script>
4141 var form = document.querySelector('#payment-form');
42- var client_token = "<?php echo (Braintree \ ClientToken:: generate ()); ?> ";
42+ var client_token = "<?php echo ($ gateway -> ClientToken ()-> generate ()); ?> ";
4343
4444 braintree.dropin.create({
4545 authorization: client_token,
Original file line number Diff line number Diff line change 66 require_once ("../includes/braintree_init.php " );
77 require_once ("../includes/header.php " );
88 if (isset ($ _GET ["id " ])) {
9- $ transaction = Braintree \Transaction:: find ($ _GET ["id " ]);
9+ $ transaction = $ gateway -> transaction ()-> find ($ _GET ["id " ]);
1010
1111 $ transactionSuccessStatuses = [
1212 Braintree \Transaction::AUTHORIZED ,
Original file line number Diff line number Diff line change 77 $ dotenv ->load ();
88}
99
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
55{
66 function test_showsTransactionInformation ()
77 {
8- $ result = Braintree \Transaction::sale ([
8+ global $ gateway ;
9+ $ result = $ gateway ->transaction ()->sale ([
910 'amount ' => 10 ,
1011 'paymentMethodNonce ' => 'fake-valid-nonce '
1112 ]);
You can’t perform that action at this time.
0 commit comments