henri-hulski / cartridge_braintree

Braintree Payments processing for Mezzanine/Cartridge
BSD 2-Clause "Simplified" License
9 stars 4 forks source link

Country code (alpha2) is not an accepted country. #7

Closed ryneeverett closed 8 years ago

ryneeverett commented 8 years ago

I'm getting this error message when submitting payment details:

Credit Card error: Country code (alpha2) is not an accepted country. Country code (alpha2) is not an accepted country. Country code (alpha2) is not an accepted country.

I'm hoping this is just a temporary glitch in braintree's API but I'm consistently reproducing it right now.

henri-hulski commented 8 years ago

Which country code do you use? If it's listed in https://developers.braintreepayments.com/reference/general/countries#list-of-countries normally it should work.

henri-hulski commented 8 years ago

On http://hempis.openhomeo.info it works fine for Poland.

henri-hulski commented 8 years ago

For testing with hempis.openhomeo.info you can use one of the testing credit card numbers. E.g 4111 1111 1111 1111 for Visa.

ryneeverett commented 8 years ago

Unfortunately I can no longer reproduce. I now realize that the country code is based on what country you entered in the billing field and I'm not completely sure which one I was using.

ryneeverett commented 8 years ago

Finally reproduced this again. For some reason, the country code is a text field rather than a selection box so I'm able to enter an invalid country name. (The valid one is "United States of America".) Looking at the cartridge_braintree form, I have no idea how this is possible.

<div class="form-group input_id_billing_detail_country 
    ">
    <label class="control-label" for="id_billing_detail_country">Country</label>
    <input id="id_billing_detail_country" maxlength="100" name="billing_detail_country" type="text" value="United States" class="input-xlarge">

</div>
molokov commented 8 years ago

Ryne, something must be overriding your widget then. You can see at https://github.com/henri-hulski/cartridge_braintree/blob/master/cartridge_braintree/forms.py#L78-L83 that the widget for country is set to a Select widget if it's visible.

If this isn't happening, there's either a bug in forms.py or you have something custom that's overriding it again...

ryneeverett commented 8 years ago

Yeah, I still haven't dug up enough to reliably reproduce this yet. Without any related code changes, it seems to disappear when the dev server restarts. But I don't see how anything I've written could be messing with this view