/** * Get the evidence string from $data, Calls object_form_data to format the evidence string * * @param $txn_id * @param $evidence_str * @param $initial_payment - True only for recurring subs initial payment */ private static function record_transaction($txn_id, $evidence_str, $initial_payment = false, $plan_details = array()) { $data = array(); //If not initial payment, then store the transaction details directly if (!$initial_payment) { //Fetch Details From Paypal for the transaction ID $data = PaypalApiHelper::GetTransactionDetails($txn_id); } else { //If it's a initial payment, then we consider it as setup fee or first month sub charges $data['setup_details'] = PaypalApiHelper::GetTransactionDetails($txn_id); if (!empty($plan_details['ipn'])) { //These details are used for actual billing details $data['CURRENCYCODE'] = $plan_details['ipn']['currency_code']; $data['TRANSACTIONID'] = $plan_details['ipn']['initial_payment_txn_id']; $data['TIMESTAMP'] = $plan_details['ipn']['time_created']; //It might be problematic, since the paypal login email can be differenr then signup email $data['EMAIL'] = $plan_details['ipn']['payer_email']; $data['rp_invoice_id'] = $plan_details['ipn']['rp_invoice_id']; $data['AMT'] = $plan_details['ipn']['amount']; $data['SUBJECT'] = $plan_details['ipn']['product_name']; $data['PAYERID'] = $plan_details['ipn']['payer_id']; } } $data['evidence_string'] = $evidence_str; // Get the object $object = ProSites_Helper_Transaction::object_from_data($data, get_class()); // Record the object ProSites_Helper_Transaction::record($object); }
public static function record_transaction($data) { $data = $data->data->object; // Get the object $object = ProSites_Helper_Transaction::object_from_data($data, get_class()); // Record the object ProSites_Helper_Transaction::record($object); }