Glad that it worked!

To figure it out I looked at the default handler,
https://bitbucket.org/stephenmcd/cartridge/src/8fa5745f9f6a54618afb753a4eb96e9947f2e251/cartridge/shop/checkout.py?at=default#cl-57,
and saw that it is a function.  That tells me that the value of
SHOP_HANDLER_PAYMENT should also be a function (a clever person might be
able to make a class that could also work using it's init, but that would
be a bit odd).  Next I looked in cartridge.shop.payment.stripe_api and saw
that the only function defined is process (it also has the same signature
as the default handler which is further confirmation).

Another way you could figure out the same thing is by looking where the
payment handler is called,
https://bitbucket.org/stephenmcd/cartridge/src/8fa5745f9f6a54618afb753a4eb96e9947f2e251/cartridge/shop/views.py?at=default#cl-274.
Based on that you could figure out that it wouldn't make sense/be possible
to do something like:

from cartridge.shop.payment import stripe_api
...
stripe_api(request, form, order)

Since stripe_api is just a module, not callable.


On Fri, Feb 28, 2014 at 1:50 PM, Tom Brander <[email protected]> wrote:

> Awesome but how in the heck should I have known that?? :-)
> Got a nice decline from stripe!
>
>
> On Friday, February 28, 2014 3:44:44 PM UTC-6, Josh Cartmell wrote:
>
>> Hey Tom, I think the problem is that you imported the module that
>> contains the stripe payment handler, but you didn't import the handler
>> itself. i.e.:
>>
>> SHOP_HANDLER_PAYMENT = "cartridge.shop.payment.stripe_api"
>>
>> should be
>>
>> SHOP_HANDLER_PAYMENT = "cartridge.shop.payment.stripe_api.process"
>>
>> I didn't try it out, but I'm fairly certain that is the problem.
>>
>>
>> On Fri, Feb 28, 2014 at 1:40 PM, Tom Brander <[email protected]> wrote:
>>
>>>  Ha.. putting this in:
>>> SHOP_HANDLER_PAYMENT = "cartridge.shop.payment.stripe_api.py"
>>> got me to the need to put in the stripe api key in the settings module
>>> something like
>>> SHOP_HANDLER_PAYMENT = "cartridge.shop.payment.stripe_api"
>>> STRIPE_API_KEY = "sk_test_jXXXXXXXXXXXXXPrCuXXXXXXXX"
>>> when I did that
>>>  I got: which sort of says leave off the .py but of course we have
>>> already seen that does not work...
>>> stuck..
>>> Exception Value:
>>>
>>>
>>> Could not import the name: cartridge.shop.payment.stripe_api.py: 'module' 
>>> object has no attribute 'py'
>>>
>>> Exception Location:/home/tom/myvenv3/lib/python3.
>>> 3/site-packages/mezzanine/utils/importing.py in import_dotted_path,
>>> line 25 Python Executable:/home/tom/myvenv3/bin/python Python Version:
>>> 3.3.2Python Path:
>>>
>>> ['/home/tom',
>>>  '/home/tom/whiteplume',
>>>  '/home/tom/myvenv3/lib/python3.3/site-packages/setuptools-2.2-py3.3.egg',
>>>  '/usr/lib/python3.3',
>>>
>>>
>>> On Friday, February 28, 2014 2:59:11 PM UTC-6, Tom Brander wrote:
>>>>
>>>> Ok what  needed was: SHOP_HANDLER_PAYMENT = "cartridge.shop.payment.
>>>> stripe_api.py"
>>>>
>>>> On Friday, February 28, 2014 1:31:34 PM UTC-6, Tom Brander wrote:
>>>>>
>>>>> Dumb import issue....
>>>>> So I went into the project settings file and put SHOP_HANDLER_PAYMENT
>>>>> = "cartridge.shop.payment.stripe_api"
>>>>> At line 50 in the settings file
>>>>> Do I need to add it in installed apps? (I don't think so.)
>>>>> I did install the stripe library module via pip
>>>>> Again, using P3 (trying to be a supporter!)
>>>>>
>>>>>
>>>>> I'm planning to put that file in my local project, to put the
>>>>> parameters in..., but I could not even get it to work in the cartridge
>>>>> directory..
>>>>>
>>>>> however that gives me:
>>>>> Exception Value:
>>>>>
>>>>> Could not import the name: cartridge.shop.payment.stripe_api: 'module' 
>>>>> object has no attribute 'stripe_api'
>>>>>
>>>>> Exception Location:/home/tom/myvenv3/lib/python3.
>>>>> 3/site-packages/mezzanine/utils/importing.py in import_dotted_path,
>>>>> line 25
>>>>>
>>>>>
>>>>>
>>>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Mezzanine Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to