本文整理汇总了PHP中CRM_Contribute_BAO_ContributionPage::recurringNofify方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_BAO_ContributionPage::recurringNofify方法的具体用法?PHP CRM_Contribute_BAO_ContributionPage::recurringNofify怎么用?PHP CRM_Contribute_BAO_ContributionPage::recurringNofify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_BAO_ContributionPage
的用法示例。
在下文中一共展示了CRM_Contribute_BAO_ContributionPage::recurringNofify方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recur
function recur(&$input, &$ids, &$objects, $first)
{
if (!isset($input['txnType'])) {
CRM_Core_Error::debug_log_message("Could not find txn_type in input request");
echo "Failure: Invalid parameters<p>";
return false;
}
if ($input['txnType'] == 'subscr_payment' && $input['paymentStatus'] != 'Completed') {
CRM_Core_Error::debug_log_message("Ignore all IPN payments that are not completed");
echo "Failure: Invalid parameters<p>";
return false;
}
$recur =& $objects['contributionRecur'];
// make sure the invoice ids match
// make sure the invoice is valid and matches what we have in the contribution record
if ($recur->invoice_id != $input['invoice']) {
CRM_Core_Error::debug_log_message("Invoice values dont match between database and IPN request");
echo "Failure: Invoice values dont match between database and IPN request<p>";
return false;
}
$now = date('YmdHis');
// fix dates that already exist
$dates = array('create', 'start', 'end', 'cancel', 'modified');
foreach ($dates as $date) {
$name = "{$date}_date";
if ($recur->{$name}) {
$recur->{$name} = CRM_Utils_Date::isoToMysql($recur->{$name});
}
}
$sendNotification = false;
$subscriptionPaymentStatus = null;
require_once 'CRM/Core/Payment.php';
//set transaction type
$txnType = $_POST['txn_type'];
switch ($txnType) {
case 'subscr_signup':
$recur->create_date = $now;
//some times subscr_signup response come after the
//subscr_payment and set to pending mode.
$statusID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionRecur', $recur->id, 'contribution_status_id');
if ($statusID != 5) {
$recur->contribution_status_id = 2;
}
$recur->processor_id = $_POST['subscr_id'];
$recur->trxn_id = $recur->processor_id;
$sendNotification = true;
$subscriptionPaymentStatus = CRM_Core_Payment::RECURRING_PAYMENT_START;
break;
case 'subscr_eot':
$recur->contribution_status_id = 1;
$recur->end_date = $now;
$sendNotification = true;
$subscriptionPaymentStatus = CRM_Core_Payment::RECURRING_PAYMENT_END;
break;
case 'subscr_cancel':
$recur->contribution_status_id = 3;
$recur->cancel_date = $now;
break;
case 'subscr_failed':
$recur->contribution_status_id = 4;
$recur->cancel_date = $now;
break;
case 'subscr_modify':
CRM_Core_Error::debug_log_message("We do not handle modifications to subscriptions right now");
echo "Failure: We do not handle modifications to subscriptions right now<p>";
return false;
case 'subscr_payment':
if ($first) {
$recur->start_date = $now;
} else {
$recur->modified_date = $now;
}
// make sure the contribution status is not done
// since order of ipn's is unknown
if ($recur->contribution_status_id != 1) {
$recur->contribution_status_id = 5;
}
break;
}
$recur->save();
if ($sendNotification) {
//send recurring Notification email for user
require_once 'CRM/Contribute/BAO/ContributionPage.php';
CRM_Contribute_BAO_ContributionPage::recurringNofify($subscriptionPaymentStatus, $ids['contact'], $ids['contributionPage'], $recur);
}
if ($txnType != 'subscr_payment') {
return;
}
if (!$first) {
// create a contribution and then get it processed
$contribution =& new CRM_Contribute_DAO_Contribution();
$contribution->contact_id = $ids['contact'];
$contribution->contribution_type_id = $objects['contributionType']->id;
$contribution->contribution_page_id = $ids['contributionPage'];
$contribution->contribution_recur_id = $ids['contributionRecur'];
$contribution->receive_date = $now;
$contribution->currency = $objects['contribution']->currency;
$contribution->payment_instrument_id = $objects['contribution']->payment_instrument_id;
$contribution->amount_level = $objects['contribution']->amount_level;
$objects['contribution'] =& $contribution;
//.........这里部分代码省略.........
示例2: recur
function recur(&$input, &$ids, &$objects, $first)
{
if (!isset($input['txnType'])) {
CRM_Core_Error::debug_log_message("Could not find txn_type in input request");
echo "Failure: Invalid parameters<p>";
return false;
}
if ($input['txnType'] == 'recurring_payment' && $input['paymentStatus'] != 'Completed') {
CRM_Core_Error::debug_log_message("Ignore all IPN payments that are not completed");
echo "Failure: Invalid parameters<p>";
return false;
}
$recur =& $objects['contributionRecur'];
// make sure the invoice ids match
// make sure the invoice is valid and matches what we have in
// the contribution record
if ($recur->invoice_id != $input['invoice']) {
CRM_Core_Error::debug_log_message("Invoice values dont match between database and IPN request");
echo "Failure: Invoice values dont match between database and IPN request<p>";
return false;
}
$now = date('YmdHis');
// fix dates that already exist
$dates = array('create', 'start', 'end', 'cancel', 'modified');
foreach ($dates as $date) {
$name = "{$date}_date";
if ($recur->{$name}) {
$recur->{$name} = CRM_Utils_Date::isoToMysql($recur->{$name});
}
}
$sendNotification = false;
$subscriptionPaymentStatus = null;
//List of Transaction Type
/*
recurring_payment_profile_created RP Profile Created
recurring_payment RP Sucessful Payment
recurring_payment_failed RP Failed Payment
recurring_payment_profile_cancel RP Profile Cancelled
recurring_payment_expired RP Profile Expired
recurring_payment_skipped RP Profile Skipped
recurring_payment_outstanding_payment RP Sucessful Outstanding Payment
recurring_payment_outstanding_payment_failed RP Failed Outstanding Payment
recurring_payment_suspended RP Profile Suspended
recurring_payment_suspended_due_to_max_failed_payment RP Profile Suspended due to Max Failed Payment
*/
//set transaction type
$txnType = $_POST['txn_type'];
require_once 'CRM/Core/Payment.php';
//Changes for paypal pro recurring payment
switch ($txnType) {
case 'recurring_payment_profile_created':
$recur->create_date = $now;
$recur->contribution_status_id = 2;
$recur->processor_id = $_POST['recurring_payment_id'];
$recur->trxn_id = $recur->processor_id;
$subscriptionPaymentStatus = CRM_Core_Payment::RECURRING_PAYMENT_START;
$sendNotification = true;
break;
case 'recurring_payment':
if ($first) {
$recur->start_date = $now;
} else {
$recur->modified_date = $now;
}
//contribution installment is completed
if ($_POST['profile_status'] == 'Expired') {
$recur->contribution_status_id = 1;
$recur->end_date = $now;
$sendNotification = true;
$subscriptionPaymentStatus = CRM_Core_Payment::RECURRING_PAYMENT_END;
}
// make sure the contribution status is not done
// since order of ipn's is unknown
if ($recur->contribution_status_id != 1) {
$recur->contribution_status_id = 5;
}
break;
}
$recur->save();
if ($sendNotification) {
//send recurring Notification email for user
require_once 'CRM/Contribute/BAO/ContributionPage.php';
CRM_Contribute_BAO_ContributionPage::recurringNofify($subscriptionPaymentStatus, $ids['contact'], $ids['contributionPage'], $recur);
}
if ($txnType != 'recurring_payment') {
return;
}
if (!$first) {
// create a contribution and then get it processed
$contribution =& new CRM_Contribute_DAO_Contribution();
$contribution->contact_id = $ids['contact'];
$contribution->contribution_type_id = $objects['contributionType']->id;
$contribution->contribution_page_id = $ids['contributionPage'];
$contribution->contribution_recur_id = $ids['contributionRecur'];
$contribution->receive_date = $now;
$contribution->currency = $objects['contribution']->currency;
$contribution->payment_instrument_id = $objects['contribution']->payment_instrument_id;
$contribution->amount_level = $objects['contribution']->amount_level;
$objects['contribution'] =& $contribution;
}
//.........这里部分代码省略.........