本文整理汇总了PHP中Subscription::write方法的典型用法代码示例。如果您正苦于以下问题:PHP Subscription::write方法的具体用法?PHP Subscription::write怎么用?PHP Subscription::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subscription
的用法示例。
在下文中一共展示了Subscription::write方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createSubscription
function createSubscription($request)
{
//Get product id
$productID = $request->param('ProductID');
// Get AttentionWizard member
$member = Member::currentUser();
//Get InfusionSoft Api
$app = $this->getInfusionSoftApi();
// Get IndusionSoft contact ID
$isConID = $member->ISContactID;
$product = Product::get()->byID($productID);
$credits = $product->Credits;
// Get existing credit card ID
$creditCard = $this->getCurrentCreditCard($member->ID);
if (!$creditCard) {
$this->setMessage('Error', 'Sorry,the payment failed,please update your credit card.');
return $this->redirect('/account-settings/#tabs-2');
}
$ccID = $creditCard->ISCCID;
$subscriptionID = $this->createISSubscription($isConID, $product->ISProductID, $product->RecurringPrice, $ccID, 30);
if ($subscriptionID && is_int($subscriptionID)) {
if ($productID == 1 && !$this->isCCUsedForTrial($creditCard->CreditCardNumber)) {
$orderAmount = $product->TrialPrice;
$productName = "30 days 1-dollar Trial";
$isProductID = 38;
$trial = 1;
$subscriptionCount = 0;
} else {
$productName = $product->Name;
$orderAmount = $product->RecurringPrice;
$isProductID = $product->ISInitialProductID;
$trial = 0;
$subscriptionCount = 1;
}
// Create an order
$order = new Order();
$order->OrderStatus = 'P';
$order->Amount = $orderAmount;
$order->MemberID = $member->ID;
$order->ProductID = $productID;
$order->CreditCardID = $creditCard->ID;
$orderID = $order->write();
//get the current date
$curdate = $app->infuDate(date('j-n-Y'));
//Create an infusionsoft order
$config = SiteConfig::current_site_config();
$invoiceId = $app->blankOrder($isConID, $productName, $curdate, 0, 0);
$orderItem = $app->addOrderItem($invoiceId, $isProductID, 9, floatval($orderAmount), 1, $productName, $productName);
$result = $app->chargeInvoice($invoiceId, $productName, $ccID, $config->MerchantAccount, false);
if ($result['Successful']) {
// Update order
$order->OrderStatus = 'c';
$order->IsTrial = $trial;
$order->write();
// Create a Subscription record
$nextBillDate = $this->getSubscriptionNextBillDate($subscriptionID);
$expireDate = date('Y-m-d H:i:s', strtotime($nextBillDate));
$startDate = date('Y-m-d H:i:s', strtotime($expireDate . "-30 days"));
$subscription = new Subscription();
$subscription->SubscriptionID = $subscriptionID;
$subscription->StartDate = $startDate;
$subscription->ExpireDate = $expireDate;
$subscription->Status = 1;
$subscription->IsTrial = $trial;
$subscription->SubscriptionCount = $subscriptionCount;
$subscription->MemberID = $member->ID;
$subscription->ProductID = $productID;
$subscription->OrderID = $orderID;
$subscription->write();
// Create a MemberCredits record
$memberCredits = new MemberCredits();
$memberCredits->Credits = $credits;
$memberCredits->ExpireDate = $expireDate;
$memberCredits->MemberID = $member->ID;
$memberCredits->ProductID = $productID;
$memberCredits->SubscriptionID = $subscription->ID;
$memberCredits->write();
//Get contact custom fields
$returnFields = array('_AWofmonths', '_AWstartdate');
$conDat1 = $app->loadCon($isConID, $returnFields);
if ($productID == 1 && !$this->isCCUsedForTrial($creditCard->CreditCardNumber)) {
// Update Member
$member->SignUpTrial = 1;
$member->write();
//Add the Trial tag
$app->grpAssign($isConID, 2216);
//Update the contact
$conDat = array('_AttentionWizard' => 'Free', 'ContactType' => 'AW Customer', '_AWcanceldate' => null);
if (!isset($conDat1['_AWstartdate'])) {
$conDat['_AWstartdate'] = $curdate;
}
$app->updateCon($isConID, $conDat);
// Mark credit card as TrialCreditCard
$creditCard->UsedForTrial = 1;
$creditCard->write();
} else {
if (!isset($conDat1['_AWofmonths'])) {
$conDat1['_AWofmonths'] = 0;
}
// Add the InfusionSoft tag
//.........这里部分代码省略.........
示例2: doPrepaidSignup
function doPrepaidSignup()
{
$data = $_POST;
//Check for existing member email address
if ($member = DataObject::get_one("Member", "`Email` = '" . Convert::raw2sql($data['Email']) . "'")) {
return "inlineMsg1";
}
$currentYear = date('Y');
$currentMonth = date('n');
//Stop sign-up when the credit card is expired
if ($data['ExpirationYear'] < $currentYear) {
return "inlineMsg6";
}
if ($data['ExpirationYear'] == $currentYear) {
if ($data['ExpirationMonth'] < $currentMonth) {
return "inlineMsg6";
}
}
//Get InfusionSoft Api
$app = $this->getInfusionSoftApi();
// Get country text from code
$country = Geoip::countryCode2name($data['Country']);
// Create IndusionSoft contact
$returnFields = array('Id');
$conInfo = $app->findByEmail($data['Email'], $returnFields);
if (count($conInfo)) {
$isConID = $conInfo[0]['Id'];
} else {
$conDat = array('FirstName' => $data['FirstName'], 'LastName' => $data['LastName'], 'Company' => $data['Company'], 'StreetAddress1' => $data['StreetAddress1'], 'StreetAddress2' => $data['StreetAddress2'], 'City' => $data['City'], 'State' => $data['State'], 'PostalCode' => $data['PostalCode'], 'Country' => $country, 'Email' => $data['Email']);
$isConID = $app->addCon($conDat);
}
// Locate existing credit card
$ccID = $app->locateCard($isConID, substr($data['CreditCardNumber'], -4, 4));
$creditCardType = $this->getISCreditCardType($data['CreditCardType']);
if (!$ccID) {
//Validate the credit card
$card = array('CardType' => $creditCardType, 'ContactId' => $isConID, 'CardNumber' => $data['CreditCardNumber'], 'ExpirationMonth' => sprintf("%02s", $data['ExpirationMonth']), 'ExpirationYear' => $data['ExpirationYear'], 'CVV2' => $data['CVVCode']);
$result = $app->validateCard($card);
if ($result['Valid'] == 'false') {
return "inlineMsg5";
}
$ccData = array('ContactId' => $isConID, 'FirstName' => $data['FirstName'], 'LastName' => $data['LastName'], 'BillAddress1' => $data['StreetAddress1'], 'BillAddress2' => $data['StreetAddress2'], 'BillCity' => $data['City'], 'BillState' => $data['State'], 'BillZip' => $data['PostalCode'], 'BillCountry' => $country, 'CardType' => $creditCardType, 'NameOnCard' => $data['NameOnCard'], 'CardNumber' => $data['CreditCardNumber'], 'CVV2' => $data['CVVCode'], 'ExpirationMonth' => sprintf("%02s", $data['ExpirationMonth']), 'ExpirationYear' => $data['ExpirationYear']);
$ccID = $app->dsAdd("CreditCard", $ccData);
}
// Create AttentionWizard member
$member = new Member();
$member->FirstName = $data['FirstName'];
$member->Surname = $data['LastName'];
$member->Email = $data['Email'];
$member->Password = $data['Password']['_Password'];
$member->ISContactID = $isConID;
$memberID = $member->write();
//Find or create the 'user' group
if (!($userGroup = DataObject::get_one('Group', "Code = 'customers'"))) {
$userGroup = new Group();
$userGroup->Code = "customers";
$userGroup->Title = "Customers";
$userGroup->Write();
}
//Add member to user group
$userGroup->Members()->add($member);
//Get the current date
$curdate = $app->infuDate(date('j-n-Y'));
$product = Product::get()->byID(7);
// Store credit card info
$creditCard = new CreditCard();
$creditCard->CreditCardType = $data['CreditCardType'];
$creditCard->CreditCardNumber = $data['CreditCardNumber'];
$creditCard->NameOnCard = $data['NameOnCard'];
$creditCard->CreditCardCVV = $data['CVVCode'];
$creditCard->ExpiryMonth = $data['ExpirationMonth'];
$creditCard->ExpiryYear = $data['ExpirationYear'];
$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'];
$creditCard->Current = 1;
$creditCard->ISCCID = $ccID;
$creditCard->MemberID = $memberID;
$creditCardID = $creditCard->write();
// Create an Infusionsoft order
$config = SiteConfig::current_site_config();
$invoiceId = $app->blankOrder($isConID, $product->Name, $curdate, 0, 0);
$orderItem = $app->addOrderItem($invoiceId, $this->getNonExpiringIsProductId(7), 3, floatval($data['Price']), intval($data['Quantity']), $product->Name, $product->Name);
$result = $app->chargeInvoice($invoiceId, $product->Name, $ccID, $config->MerchantAccount, false);
// Create an order
$order = new Order();
$order->OrderStatus = 'P';
$order->Amount = $data['Price'] * $data['Quantity'];
$order->MemberID = $memberID;
$order->ProductID = 7;
$order->CreditCardID = $creditCardID;
$orderID = $order->write();
$returnFields = array('_AttentionWizard', 'Leadsource');
$conDat1 = $app->loadCon($isConID, $returnFields);
if ($result['Successful']) {
// Add tag Paid member - prepaid
//.........这里部分代码省略.........
示例3: moveSubscriptionsFromJoomlaToSS
public function moveSubscriptionsFromJoomlaToSS()
{
die('test2');
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('max_execution_time', 0);
ini_set('memory_limit', '-1');
$mysqli = $this->getDbConnection();
$count = 0;
$result = $mysqli->query("SELECT * FROM jos_users u\n\t\tINNER JOIN jos_osemsc_orders o ON u.id = o.user_id where o.order_status = 'c'");
while ($obj = $result->fetch_object()) {
$ssMember = $this->getSSMember($obj->email);
if (!$ssMember) {
continue;
}
$subscription = new Subscription();
$subscription->Created = $obj->date;
$subscription->LastEdited = $obj->date;
if (ctype_digit($obj->order_number)) {
$subscription->SubscriptionID = intval($obj->order_number);
}
$member = $this->getJoomlaMember($obj->user_id, $obj->msc_id, $obj->subscription_status_new);
if ($member) {
$subscription->StartDate = $member->start_date;
$subscription->ExpireDate = $member->expired_date;
}
$subscription->Status = $obj->subscription_status_new;
if (($obj->payment_price == 0.01 || $obj->payment_price == 1) && !$obj->subscription_count) {
$subscription->IsTrial = 1;
}
$subscription->SubscriptionCount = $obj->subscription_count;
$subscription->MemberID = $ssMember->ID;
$subscription->ProductID = $obj->msc_id;
if ($ssOrder = $this->getSSOrder($obj->order_number)) {
$subscription->OrderID = $ssOrder->ID;
}
if ($obj->subscription_status_new == 0 && ($obj->msc_id == 1 || $obj->msc_id == 2 || $obj->msc_id == 3) && $member) {
if ($reasons = $this->getReasonCancelled($obj->user_id, $member->expired_date)) {
$subscription->ReasonCancelled = $reasons;
}
}
$subscription->write();
$count++;
}
$result = $mysqli->query("SELECT * FROM jos_users u\n\t\tINNER JOIN jos_osemsc_member_credits mc ON u.id = mc.member_id\n\t\tWHERE mc.msc_id =10");
while ($obj = $result->fetch_object()) {
$ssMember = $this->getSSMember($obj->email);
if (!$ssMember) {
continue;
}
$subscription = new Subscription();
$subscription->MemberID = $ssMember->ID;
$subscription->ProductID = $obj->msc_id;
$subscription->write();
$count++;
}
$mysqli->close();
echo "Total Subscriptions moved: {$count}";
}
示例4: doPurchase
function doPurchase($data, $form)
{
//Get InfusionSoft Api
$app = $this->getInfusionSoftApi();
// Get curent date
$curdate = $app->infuDate(date('j-n-Y'));
$member = Member::currentUser();
$isConID = $member->ISContactID;
$product = Product::get()->byID($data['ProductID']);
// Get existing credit card ID
$creditCard = $this->getCurrentCreditCard($member->ID);
// Get the current InfusionSoft credit card ID
$ccID = $creditCard->ISCCID;
// Create an Infusionsoft order
$config = SiteConfig::current_site_config();
$invoiceId = $app->blankOrder($isConID, $product->Name, $curdate, 0, 0);
$orderItem = $app->addOrderItem($invoiceId, intval($this->getNonExpiringIsProductId($data['ProductID'])), 3, floatval($product->Price), intval($data['Quantity']), $product->Name, $product->Name);
$result = $app->chargeInvoice($invoiceId, $product->Name, $ccID, $config->MerchantAccount, false);
// Create an order
$order = new Order();
$order->OrderStatus = 'P';
$order->Amount = $product->Price * $data['Quantity'];
$order->MemberID = $member->ID;
$order->ProductID = $data['ProductID'];
$order->CreditCardID = $creditCard->ID;
$orderID = $order->write();
if ($result['Successful']) {
// Add tag Paid member - prepaid
$app->grpAssign($isConID, 2290);
$conDat = array('ContactType' => 'AW Customer');
$returnFields = array('_AttentionWizard');
$conDat1 = $app->loadCon($isConID, $returnFields);
if ($conDat1['_AttentionWizard'] != 'Paid and Current' && $conDat1['_AttentionWizard'] != 'Free') {
$conDat['_AttentionWizard'] = 'Prepaid only - no subscription';
}
$conID = $app->updateCon($isConID, $conDat);
// Note is added
$conActionDat = array('ContactId' => $isConID, 'ActionType' => 'UPDATE', 'ActionDescription' => "Purchased AW Prepaid Credits", 'CreationDate' => $curdate, 'ActionDate' => $curdate, 'CompletionDate' => $curdate, 'UserID' => 1);
$conActionID = $app->dsAdd("ContactAction", $conActionDat);
// Update order
$order->OrderStatus = 'c';
$order->write();
// Create a Subscription record
$subscription = new Subscription();
$subscription->StartDate = date("Y-m-d H:i:s");
$subscription->MemberID = $member->ID;
$subscription->ProductID = $data['ProductID'];
$subscription->OrderID = $orderID;
$subscription->write();
// Create a MemberCredits record
$memberCredits = new MemberCredits();
$memberCredits->Credits = $product->Credits * $data['Quantity'];
$memberCredits->MemberID = $member->ID;
$memberCredits->ProductID = $product->ID;
$memberCredits->SubscriptionID = $subscription->ID;
$memberCredits->write();
$this->setMessage('Success', 'Purchased non-expiring heatmaps successfully.');
} else {
// Add an AW prospect tag
$app->grpAssign($isConID, $this->getISTagIdByPaymentCode(strtoupper($result['Code'])));
// Add a note
$conActionDat = array('ContactId' => $isConID, 'ActionType' => 'UPDATE', 'ActionDescription' => "Unsuccessful attempt to purchase prepaid plan", 'CreationDate' => $curdate, 'ActionDate' => $curdate, 'CompletionDate' => $curdate, 'UserID' => 1);
$conActionID = $app->dsAdd("ContactAction", $conActionDat);
$this->setMessage('Error', 'Sorry,the payment failed,please update your credit card.');
return $this->redirect('/account-settings/#tabs-2');
}
return $this->redirect('/account-settings');
}
示例5: changeSubscription
public function changeSubscription($data, $form)
{
//Get the record ID
$id = Controller::curr()->request->param('ID');
// Get the subscription
$subscription = Subscription::get()->byID($id);
//Get the new product ID
$newProductID = $data['ProductID'];
if ($subscription->ProductID == $newProductID) {
$form->sessionMessage("Please select a new subscription.", 'bad');
return $this->edit(Controller::curr()->getRequest());
}
// Get the Page controller
$Pg_Ctrl = new Page_Controller();
// Get InfusionSoft Api
$app = $Pg_Ctrl->getInfusionSoftApi();
// Get AttentionWizard member
$member = Member::get()->byID($data['MemberID']);
// Get IndusionSoft contact ID
$isConID = $member->ISContactID;
//Get current date
$curdate = $app->infuDate(date('j-n-Y'));
//Get old order
$oldOrder = $subscription->Order();
//Get new product
$product = Product::get()->byID($newProductID);
$credits = $product->Credits;
$isProductID = $product->ISInitialProductID;
// Get the current InfusionSoft credit card ID
$creditCard = $Pg_Ctrl->getCurrentCreditCard($member->ID);
if (!$creditCard) {
$form->sessionMessage("The user does not have a Credit Card on account, please add a credit card.", 'bad');
return $this->edit(Controller::curr()->getRequest());
}
$ccID = $creditCard->ISCCID;
$subscriptionID = $Pg_Ctrl->createISSubscription($isConID, $product->ISProductID, $product->RecurringPrice, $ccID, 30);
if ($subscriptionID && is_int($subscriptionID)) {
// Create an order
$order = new Order();
$order->OrderStatus = 'P';
$order->Amount = $product->RecurringPrice;
$order->MemberID = $member->ID;
$order->ProductID = $newProductID;
$order->CreditCardID = $creditCard->ID;
$orderID = $order->write();
//Create an infusionsoft order
$config = SiteConfig::current_site_config();
$invoiceId = $app->blankOrder($isConID, $product->Name, $curdate, 0, 0);
$orderItem = $app->addOrderItem($invoiceId, $isProductID, 9, floatval($product->RecurringPrice), 1, $product->Name, $product->Name);
$result = $app->chargeInvoice($invoiceId, $product->Name, $ccID, $config->MerchantAccount, false);
if ($result['Successful']) {
$nextBillDate = $Pg_Ctrl->getSubscriptionNextBillDate($subscriptionID);
$expireDate = date('Y-m-d H:i:s', strtotime($nextBillDate));
$startDate = date('Y-m-d H:i:s', strtotime($expireDate . "-30 days"));
//Set the current subscription to Inactive
$Pg_Ctrl->setSubscriptionStatus($subscription->SubscriptionID, 'Inactive');
//Remove trial tag if exists
$app->grpRemove($isConID, 2216);
//get old Tag ID
if ($Pg_Ctrl->isTrialMember($member->ID)) {
$oldISTagID = 2216;
} else {
$oldISTagID = $Pg_Ctrl->getISTagIdByProduct($oldOrder->ProductID);
}
//Remove old tag ID
$app->grpRemove($isConID, $oldISTagID);
$newISTagID = $Pg_Ctrl->getISTagIdByProduct($newProductID);
//Add new tag ID
$app->grpAssign($isConID, $newISTagID);
//Add a note
$conActionDat = array('ContactId' => $isConID, 'ActionType' => 'UPDATE', 'ActionDescription' => "Payment made for AW service", 'CreationDate' => $curdate, 'ActionDate' => $curdate, 'CompletionDate' => $curdate, 'CreationNotes' => "{$product->Name} Subscription", 'UserID' => 1);
$app->dsAdd("ContactAction", $conActionDat);
$returnFields = array('_AWofmonths');
$conData = $app->loadCon($isConID, $returnFields);
$conDat = array('_AWofmonths' => (isset($conData['_AWofmonths']) ? $conData['_AWofmonths'] : 0) + 1, '_AttentionWizard' => 'Paid and Current');
$app->updateCon($isConID, $conDat);
//Create a new Subscription
$newSubscription = new Subscription();
$newSubscription->StartDate = $startDate;
$newSubscription->ExpireDate = $expireDate;
$newSubscription->SubscriptionID = $subscriptionID;
$newSubscription->Status = 1;
$newSubscription->IsTrial = 0;
$newSubscription->SubscriptionCount = 1;
$newSubscription->MemberID = $member->ID;
$newSubscription->ProductID = $newProductID;
$newSubscription->OrderID = $orderID;
$newSubscription->write();
// Create a MemberCredits record
$memberCredits = new MemberCredits();
$memberCredits->Credits = $credits;
$memberCredits->Expire = 1;
$memberCredits->ExpireDate = $expireDate;
$memberCredits->MemberID = $member->ID;
$memberCredits->ProductID = $newProductID;
$memberCredits->SubscriptionID = $newSubscription->ID;
$memberCredits->write();
// Update order
$order->OrderStatus = 'c';
$order->write();
//.........这里部分代码省略.........
示例6: doSignup
function doSignup()
{
$data = $_POST;
//Stop sign-up if the user does not check the chebox
if (!isset($data['Agreement'])) {
return "inlineMsg5";
}
if ($this->isCCUsedForTrial("{$data['CreditCardNumber']}") && $data['SubscriptionType'] == 1) {
return "inlineMsg1";
}
$currentYear = date('Y');
$currentMonth = date('n');
//Stop sign-up when the credit card is expired
if ($data['ExpirationYear'] < $currentYear) {
return "inlineMsg4";
}
if ($data['ExpirationYear'] == $currentYear) {
if ($data['ExpirationMonth'] < $currentMonth) {
return "inlineMsg4";
}
}
//Get InfusionSoft Api
$app = $this->getInfusionSoftApi();
//Get current date
$curdate = $app->infuDate(date('j-n-Y'));
//Get the registration form from session
$regFormData = Session::get('RegistrationFormData');
// Get country text from code
$country = Geoip::countryCode2name($data['Country']);
// Get InfusionSoft Contact ID
$returnFields = array('Id', 'Leadsource');
$conInfo = $app->findByEmail($regFormData['Email'], $returnFields);
if (empty($conInfo)) {
// If IS contact doesn't exist create one
$conDat = array('FirstName' => $data['FirstName'], 'LastName' => $data['LastName'], 'Company' => $data['Company'], 'StreetAddress1' => $data['StreetAddress1'], 'StreetAddress2' => $data['StreetAddress2'], 'City' => $data['City'], 'State' => $data['State'], 'PostalCode' => $data['PostalCode'], 'Country' => $country, 'Email' => $regFormData['Email']);
if (empty($conInfo)) {
$conDat['Leadsource'] = 'AttentionWizard';
}
$isConID = $app->addCon($conDat);
} else {
$isConID = $conInfo[0]['Id'];
}
// Locate existing credit card
$ccID = $app->locateCard($isConID, substr($data['CreditCardNumber'], -4, 4));
$creditCardType = $this->getISCreditCardType($data['CreditCardType']);
if (!$ccID) {
//Validate the credit card
$card = array('CardType' => $creditCardType, 'ContactId' => $isConID, 'CardNumber' => $data['CreditCardNumber'], 'ExpirationMonth' => sprintf("%02s", $data['ExpirationMonth']), 'ExpirationYear' => $data['ExpirationYear'], 'CVV2' => $data['CVVCode']);
$result = $app->validateCard($card);
if ($result['Valid'] == 'false') {
return "inlineMsg3";
}
$ccData = array('ContactId' => $isConID, 'FirstName' => $data['FirstName'], 'LastName' => $data['LastName'], 'BillAddress1' => $data['StreetAddress1'], 'BillAddress2' => $data['StreetAddress2'], 'BillCity' => $data['City'], 'BillState' => $data['State'], 'BillZip' => $data['PostalCode'], 'BillCountry' => $country, 'CardType' => $creditCardType, 'NameOnCard' => $data['NameOnCard'], 'CardNumber' => $data['CreditCardNumber'], 'CVV2' => $data['CVVCode'], 'ExpirationMonth' => sprintf("%02s", $data['ExpirationMonth']), 'ExpirationYear' => $data['ExpirationYear']);
$ccID = $app->dsAdd("CreditCard", $ccData);
}
// Create AttentionWizard member
$member = new Member();
$member->FirstName = $data['FirstName'];
$member->Surname = $data['LastName'];
$member->Email = $regFormData['Email'];
$member->Password = $regFormData['Password']['_Password'];
$member->ISContactID = $isConID;
$memberID = $member->write();
//Find or create the 'user' group and add the member to the group
if (!($userGroup = DataObject::get_one('Group', "Code = 'customers'"))) {
$userGroup = new Group();
$userGroup->Code = "customers";
$userGroup->Title = "Customers";
$userGroup->Write();
$userGroup->Members()->add($member);
} else {
$userGroup->Members()->add($member);
}
//Get product details
$product = Product::get()->byID($data['SubscriptionType']);
$credits = $product->Credits;
if ($data['SubscriptionType'] == 1) {
$orderAmount = $product->TrialPrice;
$productName = "30 days 1-dollar Trial";
$isProductID = 38;
} else {
$productName = $product->Name;
$orderAmount = $product->RecurringPrice;
$isProductID = $product->ISInitialProductID;
}
// Store credit card info
$creditCard = new CreditCard();
$creditCard->CreditCardType = $data['CreditCardType'];
$creditCard->CreditCardNumber = $data['CreditCardNumber'];
$creditCard->NameOnCard = $data['NameOnCard'];
$creditCard->CreditCardCVV = $data['CVVCode'];
$creditCard->ExpiryMonth = $data['ExpirationMonth'];
$creditCard->ExpiryYear = $data['ExpirationYear'];
$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'];
//.........这里部分代码省略.........