/** * Set payment options for payment settings page. * * @since 1.8 */ static function pmpro_payment_options($options) { //get stripe options $authorizenet_options = PMProGateway_authorizenet::getGatewayOptions(); //merge with others. $options = array_merge($authorizenet_options, $options); return $options; }
/** * it handles authorize.net payments */ public function payAction() { $authorize = new \PMProGateway_authorizenet(); $order = new \MemberOrder(); $order->billing = new \stdClass(); $order->membership_level = new \stdClass(); $user = wp_get_current_user(); if (isset($_SESSION["pac"])) { unset($_SESSION["pac"]); } $order->InitialPayment = get_user_meta($user->ID, self::MEMBERSHIP_TOTAL_COST, true); $order->Address1 = $this->getPost("address1"); $order->Address2 = $this->getPost("address2"); $order->Email = $this->getPost("email"); $order->billing->phone = $this->getPost("phone"); $order->cardtype = $this->getPost("card_type"); $order->accountnumber = $this->getPost("account_number"); $order->ExpirationDate = $this->getPost("expiration_date"); $order->membership_level->name = "DCBIA"; $order->FirstName = $this->getPost("first_name"); $order->LastName = $this->getPost("last_name"); $order->billing->city = $this->getPost("city"); $order->billing->state = $this->getPost("state"); $order->billing->zip = $this->getPost("zip"); $order->billing->country = $this->getPost("country"); $order->CVV2 = $this->getPost("cvv"); $order->billing->name = $order->FirstName . " " . $order->LastName; $order->billing->street = $order->Address1 . " " . $order->Address2; $status = $authorize->charge($order); if ($status === true && !isset($status["status"])) { $order->user_id = $user->ID; $order->status = self::SUCCESS_STATUS; $order->payment_type = "Credit Card"; $order->membership_id = $this->getStoredMembershipLevel($user->ID)->id; pmpro_changeMembershipLevel($this->getStoredMembershipLevel($user->ID)->id, $user->ID); $this->updateToMembershipLevel(get_user_meta($user->ID, self::ADDITIONAL_USERS_ARRAY, true)); $this->sendOrderEmail($order, $user, $this->getPost("isRenewal")); $this->updateExpirationDate($user->ID); $order->saveOrder(); } return array("status" => $status); }