Making WordPress.org


Ignore:
Timestamp:
01/10/2018 12:54:11 AM (6 years ago)
Author:
iandunn
Message:

CampTix Tweaks: Add predefined accounts for Stripe.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/camptix-tweaks/camptix-tweaks.php

    r6059 r6334  
    1010add_filter( 'camptix_dashboard_paypal_credentials',          __NAMESPACE__ . '\paypal_credentials'                  );
    1111add_filter( 'camptix_paypal_predefined_accounts',            __NAMESPACE__ . '\paypal_credentials'                  );
     12add_filter( 'camptix_stripe_predefined_accounts',            __NAMESPACE__ . '\stripe_credentials'                  );
    1213add_action( 'init',                                          __NAMESPACE__ . '\hide_empty_tickets'                  );
    1314add_action( 'wp_print_styles',                               __NAMESPACE__ . '\print_login_message_styles'          );
     
    120121}
    121122
     123/**
     124 * Setup our pre-defined Stripe payment credentials.
     125 *
     126 * @param array $credentials
     127 *
     128 * @return array
     129 */
     130function stripe_credentials( $credentials ) {
     131    // Sandbox account
     132    $credentials = array(
     133        'wpcs-sandbox' => array(
     134            'label'          => 'WordCamp Sandbox',
     135            'sandbox'        => true,
     136            'api_public_key' => defined( 'WORDCAMP_CAMPTIX_STRIPE_TEST_PUBLIC' ) ? WORDCAMP_CAMPTIX_STRIPE_TEST_PUBLIC : '',
     137            'api_secret_key' => defined( 'WORDCAMP_CAMPTIX_STRIPE_TEST_SECRET' ) ? WORDCAMP_CAMPTIX_STRIPE_TEST_SECRET : '',
     138        ),
     139    );
     140
     141    // Production account
     142    if ( defined( 'WORDCAMP_CAMPTIX_STRIPE_LIVE_PUBLIC' ) ) {
     143        $credentials['wpcs-production'] = array(
     144            'label'          => 'WordPress Community Support, PBC',
     145            'sandbox'        => false,
     146            'api_public_key' => defined( 'WORDCAMP_CAMPTIX_STRIPE_LIVE_PUBLIC' ) ? WORDCAMP_CAMPTIX_STRIPE_LIVE_PUBLIC : '',
     147            'api_secret_key' => defined( 'WORDCAMP_CAMPTIX_STRIPE_LIVE_SECRET' ) ? WORDCAMP_CAMPTIX_STRIPE_LIVE_SECRET : '',
     148        );
     149    }
     150
     151    return $credentials;
     152}
     153
    122154/*
    123155 * Show empty tickets
Note: See TracChangeset for help on using the changeset viewer.