protected function processForm(sfWebRequest $request, sfForm $form, $next_step) { $taintedValues = $request->getParameter($form->getName()); $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName())); //die(); if ($form->isValid()) { //die("ok"); /* @var $application_temp ApplicationTemp */ $application_temp = $form->save(); if ($application_temp->getIsComplete() == -4 && $form instanceof ApplicationTempStep1Form) { $application_temp->setIsComplete(-3); # step1 complete $this->fillStepsRemaining($application_temp); } elseif ($application_temp->getIsComplete() == -3 && $form instanceof ApplicationTempStep2Form) { $application_temp->setIsComplete(-2); # step2 complete } elseif ($application_temp->getIsComplete() == -2 && $form instanceof ApplicationTempStep3Form) { $application_temp->setIsComplete(-1); # step3 complete } elseif ($application_temp->getIsComplete() == 0 && $form instanceof ApplicationTempStep5Form) { $application_temp->setIsComplete(1); # step5 complete //echo $application_temp->getFirstName(); //echo "ddd"; //die(); $donation_amount = $request->getParameter('donation_amount'); $member_due_amount = $request->getParameter('member_due_amount'); $totalAmount = $donation_amount + $member_due_amount; //$request->getParameter('total_amount'); if ($totalAmount > 0) { //echo $request->getParameter('total_amount'); //die(); //list($month, $year) = explode('/', $taintedValues['ccard_expire']); $month = $request->getParameter('month'); $year = $request->getParameter('year'); $cardnumber = str_replace('-', '', $taintedValues['ccard_number']); $ccardcode = $taintedValues['ccard_code']; $payment = new afids_paymentGateway(); //echo "DOA :".$donation_amount."Due".$member_due_amount."Total :".$totalAmount; //die(); $payment->gateway_name = "novapointe"; $payment->transaction_type = "sale"; $item_data = "&total=" . $totalAmount; $item_data .= "&tax=" . sfConfig::get('app_membership_tax', 0); $item_data .= "&bill_first_name=" . $application_temp->getFirstName(); $item_data .= "&bill_last_name=" . $application_temp->getLastName(); $item_data .= "&bill_address1=" . $application_temp->getAddress1(); $item_data .= "&bill_address2=" . $application_temp->getAddress2(); $item_data .= "&bill_city=" . $application_temp->getCity(); $item_data .= "&bill_state=" . $application_temp->getState(); $item_data .= "&bill_zip=" . $application_temp->getZipcode(); $item_data .= "&bill_country=" . $application_temp->getCountry(); $item_data .= "&bill_phone=" . $application_temp->getDayPhone(); $item_data .= "&ccard=" . $cardnumber; $item_data .= "&expmonth=" . $month; $item_data .= "&expyear=" . $year; $item_data .= "&cvv2=" . $ccardcode; $payment->item_data = $item_data; $payment->shipping_code = "USPS"; $data = json_decode($payment->submitPayment()); if ($data->http_result == 'success' && $data->transaction_result == 'success') { $this->getUser()->setFlash('success', 'Successfully charged membership renewal fee using the credit card information.'); if ($application_temp->getEmail()) { $application_temp->setDuesAmountPaid($member_due_amount); $application_temp->setDonationAmountPaid($donation_amount); # send email //Member Renewal Acknowledgement email $this->getComponent('mail', 'memberRenewalReceived', array('email' => $application_temp->getEmail(), 'donation_amount' => $donation_amount, 'due_amount' => $member_due_amount, 'totalAmount' => $totalAmount, 'name' => $application_temp->getFirstName() . ' ' . $application_temp->getLastName())); //Member Renewal Notice email $this->getComponent('mail', 'memberRenewalNotice', array('email' => $application_temp->getEmail(), 'first_name' => $application_temp->getFirstName(), 'last_name' => $application_temp->getLastName(), 'address' => $application_temp->getAddress1() . ' ' . $application_temp->getAddress2(), 'city' => $application_temp->getCity(), 'state' => $application_temp->getState(), 'zipcode' => $application_temp->getZipcode())); } } else { $this->getUser()->setFlash('warning', 'Membership Fee Transaction failed. Please check your credit card information.'); $this->getUser()->setFlash('pendingMemberTaintedvalue', $taintedValues); //Member Renewal Failure email if ($application_temp->getEmail()) { # send email $this->getComponent('mail', 'memberRenewalFailure', array('email' => $application_temp->getEmail(), 'name' => $application_temp->getFirstName() . ' ' . $application_temp->getLastName())); } return $this->redirect('/renewal/step5?id=' . $application_temp->getId()); // return sfView::SUCCESS; } if (preg_match("#(\\d{2})#", $month, $match)) { $month = $match[1]; } if (preg_match("#(\\d{4})#", $year, $match)) { $year = $match[1]; } if ($month != '' && $year != '') { $month = $month; $year = $year; $day = "01"; $application_temp->setCcardExpire("{$year}-{$month}-{$day}"); } /* if(preg_match("#(\d{2})/(\d{4})#", $application[ccard_expire], $match)) { $month = $match[1]; $year = $match[2]; $day = "01"; $application_temp->setCcardExpire("{$year}-{$month}"); }*/ } else { $this->getUser()->setFlash('success', 'Successfully completed your renewal application.'); if ($application_temp->getEmail()) { $member_due_amount = 0; # send email //Member Renewal Acknowledgement email $this->getComponent('mail', 'memberRenewalReceived', array('email' => $application_temp->getEmail(), 'donation_amount' => $donation_amount, 'due_amount' => $member_due_amount, 'totalAmount' => $totalAmount, 'name' => $application_temp->getFirstName() . ' ' . $application_temp->getLastName())); //Member Renewal Notice email $this->getComponent('mail', 'memberRenewalNotice', array('email' => $application_temp->getEmail(), 'first_name' => $application_temp->getFirstName(), 'last_name' => $application_temp->getLastName(), 'address' => $application_temp->getAddress1() . ' ' . $application_temp->getAddress2(), 'city' => $application_temp->getCity(), 'state' => $application_temp->getState(), 'zipcode' => $application_temp->getZipcode())); } } } $application_temp->save(); $this->redirect('renewal/' . $next_step . '?id=' . $application_temp->getId()); } }
<?php error_reporting(E_ALL); ini_set('display_errors', true); require_once 'afids_paymentGateway.php'; $payment = new afids_paymentGateway(); $payment->gateway_name = "novapointe"; $payment->transaction_type = "sale"; $item_data = "total=25"; $item_data .= "&tax=0"; $item_data .= "&bill_first_name=Stephan"; $item_data .= "&bill_last_name=Fopeano"; $item_data .= "&bill_address1=10554 Ohio Ave"; $item_data .= "&bill_address2="; $item_data .= "&bill_city=Los Angeles"; $item_data .= "&bill_state=CA"; $item_data .= "&bill_zip=90024"; $item_data .= "&bill_country=USA"; $item_data .= "&bill_phone=3104701772"; $item_data .= "&ccard=475632"; $item_data .= "&expmonth=12"; $item_data .= "&expyear=2011"; $item_data .= "&cvv2=312"; $payment->item_data = $item_data; $payment->shipping_code = "USPS"; echo $payment->submitPayment();
protected function processForm(sfWebRequest $request, sfForm $form, $next_step) { $taintedValues = $request->getParameter($form->getName()); $form->bind($taintedValues, $request->getFiles($form->getName())); if ($form->isValid()) { $application_temp = $form->getObject(); if ($application_temp->getIsComplete() == -4 && $form instanceof ApplicationTempStep1Form) { $application_temp->setIsComplete(-3); # step1 complete } elseif ($application_temp->getIsComplete() == -3 && $form instanceof ApplicationTempStep2Form) { $application_temp->setIsComplete(-2); # step2 complete } elseif ($application_temp->getIsComplete() == -2 && $form instanceof ApplicationTempStep3Form) { $application_temp->setIsComplete(-1); # step3 complete } elseif ($application_temp->getIsComplete() == 0 && $form instanceof ApplicationTempStep5Form) { $application_temp->setIsComplete(1); # step5 complete //echo print_r($taintedValues); die(); //payment //$lib_folder = sfConfig::get('sf_lib_dir').DIRECTORY_SEPARATOR. //; if (!$this->getUser()->hasCredential(array('Administrator', 'Staff'), false)) { list($month, $year) = explode('/', $taintedValues['ccard_expire']); $cardnumber = str_replace('-', '', $taintedValues['ccard_number']); $ccardcode = $taintedValues['ccard_code']; $payment = new afids_paymentGateway(); $payment->gateway_name = "novapointe"; $payment->transaction_type = "sale"; $item_data = "&total=" . sfConfig::get('app_membership_fee', 25); $item_data .= "&tax=" . sfConfig::get('app_membership_tax', 0); $item_data .= "&bill_first_name=" . $application_temp->getFirstName(); $item_data .= "&bill_last_name=" . $application_temp->getLastName(); $item_data .= "&bill_address1=" . $application_temp->getAddress1(); $item_data .= "&bill_address2=" . $application_temp->getAddress2(); $item_data .= "&bill_city=" . $application_temp->getCity(); $item_data .= "&bill_state=" . $application_temp->getState(); $item_data .= "&bill_zip=" . $application_temp->getZipcode(); $item_data .= "&bill_country=" . $application_temp->getCountry(); $item_data .= "&bill_phone=" . $application_temp->getDayPhone(); $item_data .= "&ccard=" . $cardnumber; $item_data .= "&expmonth=" . $month; $item_data .= "&expyear=" . $year; $item_data .= "&cvv2=" . $ccardcode; $payment->item_data = $item_data; $payment->shipping_code = "USPS"; $data = json_decode($payment->submitPayment()); if ($data->http_result == 'success' && $data->transaction_result == 'success') { $this->getUser()->setFlash('success', 'Successfully charged membership fee using the credit card information.'); /* if ($application_temp->getEmail()) { # send email for success payment $this->getComponent('mail', 'memberApplicationRecieved', array('email' => $application_temp->getEmail(), 'name' => $application_temp->getFirstName() . ' ' . $application_temp->getLastName())); $this->getComponent('mail', 'memberApplicationNotice', array('email' => $application_temp->getEmail(), 'first_name' => $application_temp->getFirstName(),'last_name'=>$application_temp->getLastName(),'address' => $application_temp->getAddress1() . ' ' . $application_temp->getAddress2(),'city'=>$application_temp->getCity(),'state'=>$application_temp->getState(),'zipcode'=>$application_temp->getZipcode())); }*/ } else { $this->getUser()->setFlash('warning', 'Membership Fee Transaction failed. Please check your credit card information.'); $this->getUser()->setFlash('pendingMemberTaintedvalue', $taintedValues); /* if ($application_temp->getEmail()) { # send email failure to payment $this->getComponent('mail', 'memberApplicationFailure', array('email' => $application_temp->getEmail(), 'name' => $application_temp->getFirstName() . ' ' . $application_temp->getLastName())); }*/ return $this->redirect('/pending_member/step5?id=' . $application_temp->getId()); // return sfView::SUCCESS; } if (preg_match("#(\\d{2})/(\\d{4})#", $taintedValues['ccard_expire'], $match)) { $month = $match[1]; $year = $match[2]; $day = "01"; $application_temp->setCcardExpire("{$year}-{$month}-{$day}"); } } } $form->save(); $application_temp->setRenewal(0); $application_temp->save(); $this->redirect('pending_member/' . $next_step . '?id=' . $application_temp->getId()); } }
public function executeCheck(sfWebRequest $request) { $eventReservation = $this->getUser()->getAttribute('eventReservation'); $event = EventPeer::retrieveByPK($eventReservation['event_id']); $card_number = $eventReservation['credit_card_no']; $security_code = $eventReservation['security_code']; //transection check $month = $eventReservation['expiration_month']; $year = $eventReservation['expiration_year']; $cardnumber = str_replace('-', '', $card_number); $ccardcode = $security_code; //find out total amount $adult_per_cost = $event->getAdultCost(); $child_per_cost = $event->getChildCost(); $adult_guests = $eventReservation['adult_guests']; $child_guests = $eventReservation['child_guests']; $total_adult_cost = $adult_per_cost * $adult_guests; $total_child_cost = $child_per_cost * $child_guests; $total = $adult_per_cost + $total_adult_cost + $total_child_cost; //end total $payment = new afids_paymentGateway(); $payment->gateway_name = "novapointe"; $payment->transaction_type = "sale"; $item_data = "&total=" . $total; $item_data .= "&tax=" . 0; $item_data .= "&bill_first_name=" . $eventReservation['first_name']; $item_data .= "&bill_last_name=" . $eventReservation['last_name']; $item_data .= "&bill_address1=" . $eventReservation['address']; $item_data .= "&bill_city=" . $eventReservation['city']; $item_data .= "&bill_state=" . $eventReservation['state']; $item_data .= "&bill_zip=" . $eventReservation['zipcode']; $item_data .= "&bill_country=" . $eventReservation['country']; $item_data .= "&bill_phone=" . $eventReservation['phone']; $item_data .= "&ccard=" . $cardnumber; $item_data .= "&expmonth=" . $month; $item_data .= "&expyear=" . $year; $item_data .= "&cvv2=" . $ccardcode; $payment->item_data = $item_data; $payment->shipping_code = "USPS"; $data = json_decode($payment->submitPayment()); if ($data->http_result == 'success' && $data->transaction_result == 'success') { # send email $this->getComponent('mail', 'EventReservationSuccessMail', array('first_name' => $eventReservation['first_name'], 'email' => $eventReservation['email'], 'event_name' => $event->getEventName(), 'date' => $event->getEventDate(), 'time' => $event->getEventTime(), 'location' => $event->getLocation(), 'Adult_guest' => $eventReservation['adult_guests'], 'child_guest' => $eventReservation['child_guests'], 'total_amount' => $total)); //saving date to event_reservation table $date = date(); //find out member $query = "select member.id from member,person where member.person_id=person.id and person.first_name ='" . trim($eventReservation['first_name']) . "' and person.last_name='" . trim($eventReservation['last_name']) . "' and person.city='" . trim($eventReservation['city']) . "' and person.state='" . trim($eventReservation['state']) . "' and person.zipcode='" . trim($eventReservation['zipcode']) . "' and person.email='" . trim($eventReservation['email']) . "' limit 1"; $conn = Propel::getConnection(); $statement = $conn->prepare($query); $statement->execute(); $row = $statement->fetch(PDO::FETCH_ASSOC); if (!empty($row)) { $member_id = $row['id']; } else { $member_id = NULL; } //end find member $event_reservaton = new EventReservation(); $event_reservaton->setEventId($eventReservation['event_id']); $event_reservaton->setMemberId($member_id); $event_reservaton->setReservationDate($date); $event_reservaton->setFirstName($eventReservation['first_name']); $event_reservaton->setLastName($eventReservation['last_name']); $event_reservaton->setAddress($eventReservation['address']); $event_reservaton->setCity($eventReservation['city']); $event_reservaton->setState($eventReservation['state']); $event_reservaton->setZipcode($eventReservation['zipcode']); $event_reservaton->setPhone($eventReservation['phone']); $event_reservaton->setEmail($eventReservation['email']); $event_reservaton->setAdultGuests($eventReservation['adult_guests']); $event_reservaton->setChildGuests($eventReservation['child_guests']); $event_reservaton->setGuestNames($eventReservation['guest_names']); $event_reservaton->setAmtPaid($total); $event_reservaton->setPaymentDate($date); $event_reservaton->setAuthNumber($data->ccard_approval_number); $event_reservaton->setStatus('success'); $event_reservaton->setNovapointeTransId($data->transaction_id); $event_reservaton->save(); //decrement max person $remaning_people = $event->getMaxPersons(); $remaning_people = $remaning_people - 1; $event->setMaxPersons($remaning_people); $event->save(); //end //end of event event_reservation entry $this->redirect('eventReservation/thankyou'); } else { $this->getUser()->setFlash('warning', 'Event reservation Transaction failed. Please check your credit card information.'); $this->redirect('eventReservation/step3'); } //transection check end }