Making WordPress.org


Ignore:
Timestamp:
02/26/2016 12:41:21 AM (10 years ago)
Author:
iandunn
Message:

WordCamp Budgets: Remove Credit Card payment method from Reimbursements.

It's only used with Vendor Payments.

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

Legend:

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

    r2600 r2628  
    431431
    432432            case 'payment_method':
    433                 $value = WordCamp_Budgets::get_valid_payment_methods();
     433                $value = WordCamp_Budgets::get_valid_payment_methods( $post->post_type );
    434434                break;
    435435
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php

    r2605 r2628  
    358358     * Get a list of valid payment methods
    359359     *
     360     * @param $post_type
     361     *
    360362     * @return array
    361363     */
    362     public static function get_valid_payment_methods() {
    363         return array( 'Direct Deposit', 'Check', 'Credit Card', 'Wire' );
     364    public static function get_valid_payment_methods( $post_type ) {
     365        $methods = array( 'Direct Deposit', 'Check', 'Wire' );
     366
     367        if ( WCP_Payment_Request::POST_TYPE === $post_type ) {
     368            $methods[] = 'Credit Card';
     369        }
     370
     371        return $methods;
    364372    }
    365373
     
    416424
    417425                case 'payment_method':
    418                     if ( in_array( $unsafe_value, self::get_valid_payment_methods(), true ) ) {
     426                    if ( in_array( $unsafe_value, self::get_valid_payment_methods( $_POST['post_type'] ), true ) ) {
    419427                        $safe_value = $unsafe_value;
    420428                    } else {
Note: See TracChangeset for help on using the changeset viewer.