Making WordPress.org

Changeset 7043


Ignore:
Timestamp:
04/05/2018 10:47:54 PM (8 years ago)
Author:
iandunn
Message:

WordCamp Payments: Show error messages thrown by Stripe Client.

Location:
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/sponsor-payment-stripe.php

    r7028 r7043  
    254254
    255255                        $body = array(
    256                                 'amount'      => round( $payment_data['amount'], 2 ) * 100, // TODO handle zero-decimal currencies.
     256                                'amount'      => round( $payment_data['amount'], 0 ) * 100, // TODO handle zero-decimal currencies and currencies with multipliers other than 100.
    257257                                'currency'    => $payment_data['currency'],
    258258                                'source'      => $stripe_token,
     
    265265                                $charge = $stripe->charge( $body );
    266266                        } catch ( Exception $exception ) {
    267                                 $data['errors'][] = sprintf(
    268                                         "An error occurred, please try another card. If that doesn't work, please contact %s.",
    269                                         EMAIL_CENTRAL_SUPPORT
    270                                 );
     267                                $data['errors'][] = $exception->getMessage();
    271268                                return;
    272269                        }
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/sponsor-payment/main.php

    r6709 r7043  
    1616                                <p class="notice notice-error">
    1717                                        <strong><?php esc_html_e( 'Error:', 'wordcamporg' ); ?></strong>
    18                                         <?php echo esc_html( $error ); ?>
     18                                        <?php echo wp_kses_data( $error ); ?>
    1919                                </p>
    2020                        <?php endforeach; ?>
     
    121121                                <script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
    122122                                        data-key="<?php echo esc_attr( $data['keys']['publishable'] ); ?>"
    123                                         data-amount="<?php echo esc_attr( round( $data['payment']['amount'], 2 ) * 100 ); ?>"
     123                                        data-amount="<?php echo esc_attr( round( $data['payment']['amount'], 2 ) * 100 ); ?>" <?php // @todo: Handle currencies with multipliers other than 100. ?>
    124124                                        data-currency="<?php echo esc_attr( $data['payment']['currency'] ); ?>"
    125125                                        data-name="WordPress Community Support, PBC"
Note: See TracChangeset for help on using the changeset viewer.