/** * 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; }
$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); $strPaymentItems .= sprintf("%s - \$%01.2f ,", $objFund->Name, $objDonationItem->Amount); } sendSuccessEmail($objPaymentObject->Person->Id, $objPaymentObject->Id, $objCrypto->Decrypt($objRecurringPayment->CardHolderName), $objCrypto->Decrypt($objRecurringPayment->AccountNumber), $objRecurringPayment->CreditCardTypeId, $strPaymentItems, $objRecurringPayment->Amount);