/** * Process the donation with the gateway. * * @param mixed $return * @param int $donation_id * @param Charitable_Donation_Processor $processor * @return boolean|array * @access public * @static * @since 1.0.0 */ public static function process_donation($return, $donation_id, $processor) { $gateway = new Charitable_Gateway_Extension_Boilerplate(); $donation = charitable_get_donation($donation_id); $donor = $donation->get_donor(); $values = $processor->get_donation_data(); // API keys // $keys = $gateway->get_keys(); // Donation fields // $donation_key = $donation->get_donation_key(); // $item_name = sprintf( __( 'Donation %d', 'charitable-payu-money' ), $donation->ID );; // $description = $donation->get_campaigns_donated_to(); // $amount = $donation->get_total_donation_amount( true ); // Donor fields // $first_name = $donor->get_donor_meta( 'first_name' ); // $last_name = $donor->get_donor_meta( 'last_name' ); // $address = $donor->get_donor_meta( 'address' ); // $address_2 = $donor->get_donor_meta( 'address_2' ); // $email = $donor->get_donor_meta( 'email' ); // $city = $donor->get_donor_meta( 'city' ); // $state = $donor->get_donor_meta( 'state' ); // $country = $donor->get_donor_meta( 'country' ); // $postcode = $donor->get_donor_meta( 'postcode' ); // $phone = $donor->get_donor_meta( 'phone' ); // URL fields // $return_url = charitable_get_permalink( 'donation_receipt_page', array( 'donation_id' => $donation->ID ) ); // $cancel_url = charitable_get_permalink( 'donation_cancel_page', array( 'donation_id' => $donation->ID ) ); // $notify_url = function_exists( 'charitable_get_ipn_url' ) // ? charitable_get_ipn_url( Charitable_Gateway_Sparrow::ID ) // : Charitable_Donation_Processor::get_instance()->get_ipn_url( Charitable_Gateway_Sparrow::ID ); // Credit card fields // $cc_expiration = $this->get_gateway_value( 'cc_expiration', $values ); // $cc_number = $this->get_gateway_value( 'cc_number', $values ); // $cc_year = $cc_expiration['year']; // $cc_month = $cc_expiration['month']; // $cc_cvc = $this->get_gateway_value( 'cc_cvc', $values ); /** * @todo Create donation charge through gateway. * * You should return one of three values. * * 1. If the donation fails to be processed and the user should be * returned to the donation page, return false. * 2. If the donation succeeds and the user should be directed to * the donation receipt, return true. * 3. If the user should be redirected elsewhere (for example, * a gateway-hosted payment page), you should return an array * like this: array( 'redirect' => $redirect_url, 'safe' => false // Set to false if you are redirecting away from the site. ); * */ return true; }