Skip to content

Commit

Permalink
Changes manual_purchases to manual.
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvankooten committed Jun 20, 2014
1 parent c2412b3 commit ff339f3
Showing 1 changed file with 24 additions and 29 deletions.
53 changes: 24 additions & 29 deletions includes/class-endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,39 +202,34 @@ private function process() {
* @return string
*/
private function get_payment_method( $payment_id ) {
$payment_method = edd_get_payment_gateway( $payment_id );

// create link to transaction if stripe or paypal was used
if ( in_array( $payment_method, array( 'stripe', 'paypal' ) ) ) {

$notes = edd_get_payment_notes( $payment_id );

switch ( $payment_method ) {
case 'paypal':
$payment_method = edd_get_payment_gateway( $payment_id );

foreach ( $notes as $note ) {
if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) {
$transaction_id = $match[1];
$payment_method = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=' . esc_attr( $transaction_id ) . '" target="_blank">PayPal</a>';
break;
}
switch ( $payment_method ) {
case 'paypal':
$notes = edd_get_payment_notes( $payment_id );
foreach ( $notes as $note ) {
if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) {
$transaction_id = $match[1];
$payment_method = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=' . esc_attr( $transaction_id ) . '" target="_blank">PayPal</a>';
break;
}
break;

case 'stripe':
foreach ( $notes as $note ) {
if ( preg_match( '/^Stripe Charge ID: ([^\s]+)/', $note->comment_content, $match ) ) {
$transaction_id = $match[1];
$payment_method = '<a href="https://dashboard.stripe.com/payments/' . esc_attr( $transaction_id ) . '" target="_blank">Stripe</a>';
break;
}
}
break;

case 'stripe':
$notes = edd_get_payment_notes( $payment_id );
foreach ( $notes as $note ) {
if ( preg_match( '/^Stripe Charge ID: ([^\s]+)/', $note->comment_content, $match ) ) {
$transaction_id = $match[1];
$payment_method = '<a href="https://dashboard.stripe.com/payments/' . esc_attr( $transaction_id ) . '" target="_blank">Stripe</a>';
break;
}
break;
case 'manual_purchases':
$payment_method = 'manual';
break;
}

}
break;
case 'manual_purchases':
$payment_method = 'manual';
break;
}

return $payment_method;
Expand Down

0 comments on commit ff339f3

Please sign in to comment.