protected function btnSave_Click() { // Perform USPS Validation (if applicable) if (trim($this->txtCity->Text) && !$this->chkInvalidFlag->Checked) { $objAddressValidator = new AddressValidator($this->txtAddress1->Text, $this->txtAddress2->Text, $this->txtCity->Text, $this->lstState->SelectedValue, $this->txtZipCode->Text); $objAddressValidator->ValidateAddress(); if ($objAddressValidator->AddressValidFlag) { $this->txtAddress1->Text = $objAddressValidator->PrimaryAddressLine; $this->txtAddress2->Text = $objAddressValidator->SecondaryAddressLine; $this->txtCity->Text = $objAddressValidator->City; $this->lstState->SelectedValue = $objAddressValidator->State; $this->txtZipCode->Text = $objAddressValidator->ZipCode; $this->dlgMessage->HideDialogBox(); } else { $this->dlgMessage->MessageHtml = '<p style="font-weight: bold;">This address is considered invalid with the USPS.</p><p style="font-size: 13px; color: #999;">Please make corrections or select <strong>"this is an INVALID address"</strong>.</p>'; $this->dlgMessage->AddButton('Okay', MessageDialog::ButtonPrimary, 'dlgMessage_Reset'); $this->dlgMessage->ShowDialogBox(); return; } } $this->SavePerson(); $this->SaveMembership(); $this->SaveMarriage(); $this->SaveAttribute(); $this->AddToChurchEmailList(); $this->mctPerson->Person->RefreshPrimaryContactInfo(true); if ($this->mctSpouse->Person->Id) { $this->mctSpouse->Person->RefreshPrimaryContactInfo(true); } if ($objHousehold = Household::LoadByHeadPersonId($this->mctPerson->Person->Id)) { $objHousehold->RefreshMembers(); } $this->RedirectBack(true); }
/** * Called back from PaymentPanel to actually generate a PaymentObject * or in this case, a OnlineDonation entry. * @return OnlineDonation */ public function CreatePaymentObject() { // Create the PaymentObject $objPaymentObject = new OnlineDonation(); // Person we attach is either the Login Record if (QApplication::$PublicLogin) { $objPaymentObject->Person = QApplication::$PublicLogin->Person; } else { $objAddressValidator = new AddressValidator($this->pnlPayment->txtAddress1->Text, $this->pnlPayment->txtAddress2->Text, $this->pnlPayment->txtCity->Text, $this->pnlPayment->lstState->SelectedValue, $this->pnlPayment->txtZipCode->Text); $objAddressValidator->ValidateAddress(); $objAddress = $objAddressValidator->CreateAddressRecord(); $objPaymentObject->AttachPersonWithInformation($this->pnlPayment->txtFirstName->Text, $this->pnlPayment->txtLastName->Text, $objAddress); } return $objPaymentObject; }
/** * Validate this address against the USPS. * @ return boolean whether or not the address validated */ public function ValidateUsps() { $objValidator = new AddressValidator($this->strAddress1, $this->strAddress2, $this->strCity, $this->strState, $this->strZipCode); $objValidator->ValidateAddress(); if ($objValidator->AddressValidFlag) { $this->strAddress1 = $objValidator->PrimaryAddressLine; $this->strAddress2 = $objValidator->SecondaryAddressLine; $this->strCity = $objValidator->City; $this->strState = $objValidator->State; $this->strZipCode = $objValidator->ZipCode; $this->blnVerificationCheckedFlag = true; $this->blnInvalidFlag = false; $this->Save(); return true; } else { return false; } }
break; case 4: // quarterly $timePeriod = 4 * 30 * 24 * 60 * 60; break; } print sprintf("today is: %s\n", date('Y-m-d', time())); $checkTime = strtotime($startDate); while ($checkTime < strtotime($objRecurringPayment->EndDate)) { if (date('Y-m-d', $checkTime) == date('Y-m-d', time())) { print "TODAYS THE DAY. MAKE A PAYMENT!\n"; /**************/ // Create the Payment Object $objPaymentObject = new OnlineDonation(); $objAddressValidator = new AddressValidator($objCrypto->Decrypt($objRecurringPayment->Address1), $objCrypto->Decrypt($objRecurringPayment->Address2), $objCrypto->Decrypt($objRecurringPayment->City), $objRecurringPayment->State, $objCrypto->Decrypt($objRecurringPayment->Zip)); $objAddressValidator->ValidateAddress(); $objAddress = $objAddressValidator->CreateAddressRecord(); $namearray = explode(' ', $objCrypto->Decrypt($objRecurringPayment->CardHolderName)); $objPaymentObject->AttachPersonWithInformation($namearray[0], $namearray[1], $objAddress); $objPaymentObject->IsRecurringFlag = true; $objPaymentObject->RecurringPaymentId = $objRecurringPayment->Id; $mixReturn = CreditCardPayment::PerformAuthorization($objPaymentObject, null, $namearray[0], $namearray[1], $objAddress, $objRecurringPayment->Amount, $objCrypto->Decrypt($objRecurringPayment->AccountNumber), $objRecurringPayment->ExpirationDate, $objCrypto->Decrypt($objRecurringPayment->SecurityCode), $objRecurringPayment->CreditCardTypeId); // Success? if ($mixReturn instanceof CreditCardPayment) { print "Successful scheduling of payment.\n"; $objPaymentObject->Status = true; $intDonationId = $objPaymentObject->Save(); $strPaymentItems = ''; $objDonationItems = RecurringDonationItems::LoadArrayByRecurringDonationId($objRecurringPayment->RecurringDonationAsRecurringPayment->Id); foreach ($objDonationItems as $objDonationItem) { $objFund = StewardshipFund::LoadById($objDonationItem->StewardshipFundId);