public function __construct($post_type = BID) { // init mail instance to send mail $this->mail = Fre_Mailing::get_instance(); $this->post_type = $post_type; /* add more data when convert a bid */ $this->add_filter('ae_convert_bid', 'ae_convert_bid'); // sync to update bid $this->add_ajax('ae-sync-bid', 'bid_sync'); $this->add_ajax('ae-bid-sync', 'bid_sync'); /* accept a bid */ $this->add_ajax('ae-accept-bid', 'bid_accept'); $this->add_ajax('ae-skip-bid', 'bid_skip'); // request list bid $this->add_ajax('ae-fetch-bid', 'fetch_post'); /* * check permission before insert bid. */ $this->add_filter('ae_pre_insert_bid', 'fre_check_before_insert_bid', 12, 1); /* * update project and bid after bid success. */ $this->add_action('ae_insert_bid', 'fre_update_after_bidding', 12, 1); /* * aftion after delete a bid * use this action insteated the action trashed_post */ $this->add_action('et_delete_bid', 'fre_delete_bid', 12, 1); //$this->add_action('trashed_post','fre_delete_bid'); /* * Filter for post title in back-end */ $this->add_filter('the_title', 'the_title_bid', 10, 2); /* * Add column project tile in wrodpress */ $this->add_filter('manage_bid_posts_columns', 'manage_bid_column_project', 1); $this->add_action('manage_bid_posts_custom_column', 'project_title_column_render', 2, 10); self::$instance = $this; }
function fre_process_escrow($payment_type, $data) { $payment_return = array('ACK' => false); if ($payment_type == 'paypaladaptive') { $ppadaptive = AE_PPAdaptive::get_instance(); $response = $ppadaptive->PaymentDetails($data['payKey']); $payment_return['payment_status'] = $response->responseEnvelope->ack; // email confirm if (strtoupper($response->responseEnvelope->ack) == 'SUCCESS') { $payment_return['ACK'] = true; // UPDATE order $paymentInfo = $response->paymentInfoList->paymentInfo; if ($paymentInfo[0]->transactionStatus == 'COMPLETED') { wp_update_post(array('ID' => $data['order_id'], 'post_status' => 'publish')); // assign project $bid_action = Fre_BidAction::get_instance(); $bid_action->assign_project($data['bid_id']); } if ($paymentInfo[0]->transactionStatus == 'PENDING') { //pendingReason $payment_return['pending_msg'] = $ppadaptive->get_pending_message($paymentInfo[0]->pendingReason); $payment_return['msg'] = $ppadaptive->get_pending_message($paymentInfo[0]->pendingReason); } } if (strtoupper($response->responseEnvelope->ack) == 'FAILURE') { $payment_return['msg'] = $response->error[0]->message; } } return apply_filters('fre_process_escrow', $payment_return, $payment_type, $data); }