[wp-meta] [Making WordPress.org] #1074: Gracefully handle unrefundable ticket refund attempts

Making WordPress.org noreply at wordpress.org
Fri Oct 16 15:13:52 UTC 2015


#1074: Gracefully handle unrefundable ticket refund attempts
----------------------+----------------------------
  Reporter:  iandunn  |      Owner:
      Type:  defect   |     Status:  new
  Priority:  normal   |  Component:  wordcamp.org
Resolution:           |   Keywords:  good-first-bug
----------------------+----------------------------

Comment (by saurabhshukla):

 Added a patch. A summary of changes:

 1. added new option to Paypal gateway: ''refund-expiry'' set to 60
 2. added a new error after comparing the payment timestamp (from paypal
 stored in ''tix_transaction_details''): ''Paypal only allows refunds
 within %d days of purchase.''

 However, I need advice
 * I have returned false immediately after adding this error in
 ''payment_refund'' function.
 * Because of which in the ''form_refund_request'' function:

 {{{
 // Attempt to process the refund transaction
 $result = $payment_method_obj->payment_refund(
 $transaction['payment_token'] );
 $this->log( 'Individual refund request result.', $attendee->ID, $result,
 'refund' );

 if ( CampTix_Plugin::PAYMENT_STATUS_REFUNDED == $result ) {
         foreach ( $attendees as $attendee ) {
                 update_post_meta( $attendee->ID, 'tix_refund_reason',
 $reason );
                 $this->log( 'Refund reason attached with data.',
 $attendee->ID, $reason, 'refund' );
         }

         $this->info( __( 'Your tickets have been successfully refunded.',
 'camptix' ) );
         return $this->form_refund_success();
 } else {
         $this->error( __( 'Can not refund the transaction at this time.
 Please try again later.', 'camptix' ) );
 }
 }}}

 also adds another error because ''$result'' happens to be false.

 So, it seems rather unusable because the second error is confusing. Should
 we convert this if statement into a switch statement?

 And, should I just continue return false and check for that or create a
 new status constant in the Camptix class and return that instead of false?

--
Ticket URL: <https://meta.trac.wordpress.org/ticket/1074#comment:2>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org


More information about the wp-meta mailing list