Automattic / camptix

Moved to https://github.com/WordPress/wordcamp.org/
177 stars 97 forks source link

Tickets with titles greater than 40 characters result in failed payments when using Stripe #228

Closed thomasplevy closed 5 years ago

thomasplevy commented 6 years ago

Recreation Steps

  1. Create a ticket with a title longer than 40 characters: My working example at 2018.la.wordcamp.org is: "Early Bird – General Admission (Saturday & Sunday)"
  2. Enable Stripe
  3. Try to purchase a ticket with a valid testing card

What Happens

  1. Checkout fails on frontend. Asks users to try again later
  2. In the logs you'll see an error like
stdClass Object
(
    [errors] => stdClass Object
        (
            [camptix_stripe_request_error_400] => Array
                (
                    [0] => 400 error: invalid_request_error
                )

        )

    [error_data] => stdClass Object
        (
            [camptix_stripe_request_error_400] => stdClass Object
                (
                    [message] => Invalid key: Early Bird – General Admission (Saturday & Sunday) must be a string under 40 characters
                    [param] => metadata
                    [type] => invalid_request_error
                )

        )

)

Some weirdness

Edit: no so weird

Ticket title had & instead of & resulting in a 41 character title. Changed it to "and" and we're good for now.

Our non early bird tickets are also resulting in this error and these tickets have a 37 character title: "General Admission (Saturday & Sunday)" (quotes aren't part of the actual title!)

Results in same error:

stdClass Object
(
    [errors] => stdClass Object
        (
            [camptix_stripe_request_error_400] => Array
                (
                    [0] => 400 error: invalid_request_error
                )

        )

    [error_data] => stdClass Object
        (
            [camptix_stripe_request_error_400] => stdClass Object
                (
                    [message] => Invalid key: General Admission (Saturday & Sunday) must be a string under 40 characters
                    [param] => metadata
                    [type] => invalid_request_error
                )

        )

)

I installed Camptix locally and setup some test cases and this error is not encountered with the 37 character title on my local install but the same error is encountered with a 40+ ticket title (as expected).

I'm also seeing locally that the logged data isn't the same so I'm wondering if there's a slightly different version running on the wordcamp.org multisite or if there's some filters / hooks that I'm missing which add the additional logging data and those functions are causing a 37 character title to move into Stripe as 40 characters. Although if that were the case the error message would likely log that data too, right?

EliW commented 5 years ago

@thomasplevy @coreymckrill - Looks like code was been merged - Should this issue be closed?