[Chicago] Braintree Environment, Configuration, and Thread Safety

Don Sheu dinaldo at gmail.com
Wed Jul 20 14:29:53 EDT 2016


Sending to print

On Wed, Jul 20, 2016, 11:17 AM Mark Graves <mgraves87 at gmail.com> wrote:

> Thank you so much Ray!
>
> This does help.
>
> -Mark
>
> On Mon, Jul 18, 2016 at 4:21 PM, Raymond W Berg <raymondwberg at gmail.com>
> wrote:
>
>> Mark,
>>
>> I hope this helps. They're almost identical, but because you're accessing
>> an attribute on the gateway instance you just downcase the attribute:
>>
>> ##########################################
>> import braintree
>>
>> #Global
>> braintree.Configuration.configure(
>>     braintree.Environment.Sandbox,
>>     "some_bad_public_id",
>>     "some_bad_public_key",
>>     "some_bad_private_key"
>> )
>>
>> #Instance
>> working_gateway = braintree.BraintreeGateway(braintree.Configuration(
>>     braintree.Environment.Sandbox,
>>     "some_good_public_id",
>>     "some_good_public_key",
>>     "some_good_private_key"
>> ))
>>
>> sale_params = {
>>     "amount": "1000.00",
>>     "payment_method_nonce": "fake-valid-nonce",
>>     "options": {
>>         "submit_for_settlement": True
>>     }
>> }
>>
>> result_1 = braintree.Transaction.sale(sale_params)
>> ## Will fail, because the keys ar bad
>>
>> result_2 = braintree.transaction.sale(sale_params)
>> ## Will succeed, because the instance keys are good
>>
>> result_3 = braintree.Transaction.sale(sale_params)
>> ## Will fail, because the static keys are still bad!
>> ##########################################
>>
>>
>> Respectfully,
>> Ray Berg
>>
>>
>> _______________________________________________
>> Chicago mailing list
>> Chicago at python.org
>> https://mail.python.org/mailman/listinfo/chicago
>>
>>
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> https://mail.python.org/mailman/listinfo/chicago
>
-- 


-- 
Don Sheu
312.880.9389
- - - - - - - - - - - - - - - - - -

My Python user group in July meets at Accolade
http://www.meetup.com/PSPPython/events/231767570/
<http://www.meetup.com/PSPPython/events/230373146/>

*CONFIDENTIALITY NOTICE*: *The information contained in this message may be
protected trade secrets or protected by applicable intellectual property
laws of the United States and International agreements. If you believe that
it has been sent to you in error, do not read it. Please immediately reply
to the sender that you have received the message in error. Then delete it.
Thank you.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20160720/20b2a98d/attachment.html>


More information about the Chicago mailing list