query_vars); $transaction_id_msg = '

'; $transaction_id_msg.= sprintf(__('Your Transaction ID is %s.'), "$transaction_id"); $transaction = AWPCP_Payment_Transaction::find_by_id($transaction_id); if (is_null($transaction)) { $msg = __('An error ocurred while processing your Payment Transaction. Please contact the administrator about this error.', 'AWPCP'); $msg.= $transaction_id_msg; // TODO: send email? return $msg; } $verified = apply_filters('awpcp-payments-verify-transaction', false, $transaction); if (!$verified) { if (empty($transaction->errors)) { $msg = __("There appears to be a problem. Please contact customer service if you are viewing this message after having made a payment. If you have not tried to make a payment and you are viewing this message, it means this message is being shown in error and can be disregarded.","AWPCP"); $msg.= $transaction_id_msg; } else { $msg = join('

', $transaction->errors); } $transaction->set('verified', false); $transaction->save(); // TODO: send email // $output .= abort_payment_no_email($message,$ad_id,$txn_id,$gateway); return $msg; } else { $transaction->set('verified', true); $transaction->save(); } $valid = apply_filters('awpcp-payments-validate-transaction', false, $transaction); if (!$valid) { $transaction->set('validated', false); $transaction->save(); return join('

', $transaction->errors); } else { $transaction->set('validated', true); $transaction->save(); } $payment_status = $transaction->get('payment-status'); if (in_array($payment_status, array(AWPCP_Payment_Transaction::$PAYMENT_STATUS_COMPLETED, AWPCP_Payment_Transaction::$PAYMENT_STATUS_PENDING))) { $texts = array( 'title' => __('Payment Completed'), 'subtitle' => __('Congratulations', 'AWPCP'), 'text' => __('Your Payment has been processed succesfully. Please press the button below to continue with the process.', 'AWPCP') ); $continue = true; } else if (in_array($payment_status, array(AWPCP_Payment_Transaction::$PAYMENT_STATUS_SUBSCRIPTION_CANCELED, AWPCP_Payment_Transaction::$PAYMENT_STATUS_FAILED))) { $text = __("Your Payment has been processed succesfully. However, the payment gateway didn't return a payment status that allows us to continue with the checkout process. Please contact the website admin to solve this issue.", 'AWPCP'); $text.= '

'; $text.= sprintf(__('The payment status was set to %s', 'AWPCP'), $payment_status); $texts = array('title' => __('Payment Failed'), 'subtitle' => '', 'text' => $text); $continue = false; } else { $text = __("There was an error processing your payment. The payment status couldn't be found. Please contact the website admin to solve this issue.", 'AWPCP'); $texts = array('title' => __('Payment Failed'), 'subtitle' => '', 'text' => $text); $continue = false; } // TODO: update Ads related stuff? disabled Ads? // TODO: update Subscriptions related stuff? disable Subscriptions? // TODO: disable Ad (if one exists) if payment was refunded or canceled $texts = apply_filters('awpcp-payments-transaction-processed', $texts, $transaction); $header = array(); $transaction->save(); ob_start(); include(AWPCP_DIR . 'frontend/templates/page-payment-thank-you.tpl.php'); $html = ob_get_contents(); ob_end_clean(); return $html; } }