本文整理汇总了PHP中Page_Controller::getISCreditCardType方法的典型用法代码示例。如果您正苦于以下问题:PHP Page_Controller::getISCreditCardType方法的具体用法?PHP Page_Controller::getISCreditCardType怎么用?PHP Page_Controller::getISCreditCardType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page_Controller
的用法示例。
在下文中一共展示了Page_Controller::getISCreditCardType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFullCardType
public function getFullCardType()
{
$Page_Cntl = new Page_Controller();
return $Page_Cntl->getISCreditCardType($this->CreditCardType);
}
示例2: updateCreditCard
public function updateCreditCard($data, $form)
{
$member = Member::get()->byID($data['MemberID']);
$isConID = $member->ISContactID;
// Get the Page controller
$Pg_Ctrl = new Page_Controller();
//Get InfusionSoft Api
$creditCardType = $Pg_Ctrl->getISCreditCardType($data['CreditCardType']);
$app = $Pg_Ctrl->getInfusionSoftApi();
// Validate credit card
$card = array('CardType' => $creditCardType, 'ContactId' => $isConID, 'CardNumber' => $data['CreditCardNumber'], 'ExpirationMonth' => sprintf("%02s", $data['ExpiryMonth']), 'ExpirationYear' => $data['ExpiryYear'], 'CVV2' => $data['CreditCardCVV']);
$result = $app->validateCard($card);
if ($result['Valid'] != 'true') {
$form->sessionMessage("The credit card details are invalid!", 'bad');
return $this->edit(Controller::curr()->getRequest());
}
//Update the credit card on InfusionSoft
$country = Geoip::countryCode2name($data['Country']);
$ccData = array('BillAddress1' => $data['StreetAddress1'], 'BillAddress2' => $data['StreetAddress2'], 'BillCity' => $data['City'], 'BillState' => $data['State'], 'BillZip' => $data['PostalCode'], 'BillCountry' => $country, 'CardType' => $creditCardType, 'NameOnCard' => $data['NameOnCard'], 'CVV2' => $data['CreditCardCVV'], 'ExpirationMonth' => sprintf("%02s", $data['ExpiryMonth']), 'ExpirationYear' => $data['ExpiryYear']);
$app->dsUpdate("CreditCard", $data['ISCCID'], $ccData);
if (isset($data['Current'])) {
// Update billing address on InfusionSoft
$conDat = array('Company' => $data['Company'], 'StreetAddress1' => $data['StreetAddress1'], 'StreetAddress2' => $data['StreetAddress2'], 'City' => $data['City'], 'State' => $data['State'], 'PostalCode' => $data['PostalCode'], 'Country' => $country);
$conID = $app->updateCon($isConID, $conDat);
}
//Get the credit card
$creditCard = CreditCard::get()->filter(array('CreditCardNumber' => $data['CreditCardNumber']))->First();
//Unset the current card
if (isset($data['Current']) && !$creditCard->Current) {
$Pg_Ctrl->unsetCurrentCreditCard($member->ID);
}
//Update the credit card on site
$creditCard->CreditCardType = $data['CreditCardType'];
$creditCard->NameOnCard = $data['NameOnCard'];
$creditCard->CreditCardCVV = $data['CreditCardCVV'];
$creditCard->ExpiryMonth = $data['ExpiryMonth'];
$creditCard->ExpiryYear = $data['ExpiryYear'];
$creditCard->Company = $data['Company'];
$creditCard->StreetAddress1 = $data['StreetAddress1'];
$creditCard->StreetAddress2 = $data['StreetAddress2'];
$creditCard->City = $data['City'];
$creditCard->State = $data['State'];
$creditCard->PostalCode = $data['PostalCode'];
$creditCard->Country = $data['Country'];
if (isset($data['Current']) && !$creditCard->Current) {
$creditCard->Current = 1;
}
if (isset($data['UsedForTrial'])) {
$creditCard->UsedForTrial = 1;
}
$creditCard->write();
$form->sessionMessage("Credit Card and Billing Address successfully updated.", 'good');
$randomNumber = rand();
return $this->getController()->redirect("admin/manage-data/CreditCard/EditForm/field/CreditCard/item/{$creditCard->ID}/edit?rand={$randomNumber}");
}