本文整理汇总了C#中FinancialScheduledTransaction类的典型用法代码示例。如果您正苦于以下问题:C# FinancialScheduledTransaction类的具体用法?C# FinancialScheduledTransaction怎么用?C# FinancialScheduledTransaction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FinancialScheduledTransaction类属于命名空间,在下文中一共展示了FinancialScheduledTransaction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddScheduledPayment
/// <summary>
/// Adds the scheduled payment.
/// </summary>
/// <param name="financialGateway">The financial gateway.</param>
/// <param name="schedule">The schedule.</param>
/// <param name="paymentInfo">The payment info.</param>
/// <param name="errorMessage">The error message.</param>
/// <returns></returns>
public override FinancialScheduledTransaction AddScheduledPayment( FinancialGateway financialGateway, PaymentSchedule schedule, PaymentInfo paymentInfo, out string errorMessage )
{
errorMessage = string.Empty;
var scheduledTransaction = new FinancialScheduledTransaction();
scheduledTransaction.IsActive = true;
scheduledTransaction.StartDate = schedule.StartDate;
scheduledTransaction.NextPaymentDate = schedule.StartDate;
scheduledTransaction.TransactionCode = "T" + RockDateTime.Now.ToString("yyyyMMddHHmmssFFF");
scheduledTransaction.GatewayScheduleId = "P" + RockDateTime.Now.ToString("yyyyMMddHHmmssFFF");
scheduledTransaction.LastStatusUpdateDateTime = RockDateTime.Now;
return scheduledTransaction;
}
示例2: GetStatus
/// <summary>
/// Sets the status.
/// </summary>
/// <param name="scheduledTransaction">The scheduled transaction.</param>
/// <param name="errorMessages">The error messages.</param>
/// <returns></returns>
public bool GetStatus( FinancialScheduledTransaction scheduledTransaction, out string errorMessages )
{
if ( scheduledTransaction.GatewayEntityType != null )
{
var gateway = Rock.Financial.GatewayContainer.GetComponent( scheduledTransaction.GatewayEntityType.Guid.ToString() );
if ( gateway != null && gateway.IsActive )
{
return gateway.GetScheduledPaymentStatus( scheduledTransaction, out errorMessages );
}
}
errorMessages = "Gateway is invalid or not active";
return false;
}
示例3: GetStatus
/// <summary>
/// Sets the status.
/// </summary>
/// <param name="scheduledTransaction">The scheduled transaction.</param>
/// <param name="errorMessages">The error messages.</param>
/// <returns></returns>
public bool GetStatus( FinancialScheduledTransaction scheduledTransaction, out string errorMessages )
{
if ( scheduledTransaction != null &&
scheduledTransaction.FinancialGateway != null &&
scheduledTransaction.FinancialGateway.IsActive )
{
if ( scheduledTransaction.FinancialGateway.Attributes == null )
{
scheduledTransaction.FinancialGateway.LoadAttributes( (RockContext)this.Context );
}
var gateway = scheduledTransaction.FinancialGateway.GetGatewayComponent();
if ( gateway != null )
{
return gateway.GetScheduledPaymentStatus( scheduledTransaction, out errorMessages );
}
}
errorMessages = "Gateway is invalid or not active";
return false;
}
示例4: OnLoad
/// <summary>
/// Raises the <see cref="E:System.Web.UI.Control.Load" /> event.
/// </summary>
/// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
protected override void OnLoad( EventArgs e )
{
base.OnLoad( e );
nbClosedWarning.Visible = false;
nbResult.Visible = false;
var contextEntity = this.ContextEntity();
if ( contextEntity != null )
{
if ( contextEntity is Person )
{
_person = contextEntity as Person;
}
else if ( contextEntity is FinancialBatch )
{
_batch = contextEntity as FinancialBatch;
gfTransactions.Visible = false;
}
else if ( contextEntity is FinancialScheduledTransaction )
{
_scheduledTxn = contextEntity as FinancialScheduledTransaction;
gfTransactions.Visible = false;
}
else if ( contextEntity is Registration )
{
_registration = contextEntity as Registration;
gfTransactions.Visible = false;
}
}
if ( !Page.IsPostBack )
{
BindFilter();
BindGrid();
}
else
{
ShowDialog();
}
if ( _canEdit && _batch != null )
{
string script = string.Format( @"
$('#{0}').change(function( e ){{
var count = $(""#{1} input[id$='_cbSelect_0']:checked"").length;
if (count == 0) {{
{2};
}}
else
{{
var $ddl = $(this);
if ($ddl.val() != '') {{
Rock.dialogs.confirm('Are you sure you want to move the selected transactions to a new batch (the control amounts on each batch will be updated to reflect the moved transaction\'s amounts)?', function (result) {{
if (result) {{
{2};
}}
$ddl.val('');
}});
}}
}}
}});
", _ddlMove.ClientID, gTransactions.ClientID, Page.ClientScript.GetPostBackEventReference( this, "MoveTransactions" ) );
ScriptManager.RegisterStartupScript( _ddlMove, _ddlMove.GetType(), "moveTransaction", script, true );
}
}
示例5: InitializeTransfer
/// <summary>
/// Fetches the old (to be transferred) scheduled transaction and verifies
/// that the target person is the same on the scheduled transaction. Then
/// it puts it into the _scheduledTransactionToBeTransferred private field
/// for use throughout the entry process so that its values can be used on
/// the form for the new transaction.
/// </summary>
/// <param name="scheduledTransactionId">The scheduled transaction identifier.</param>
private void InitializeTransfer( int? scheduledTransactionId )
{
if ( scheduledTransactionId == null )
{
return;
}
RockContext rockContext = new RockContext();
var scheduledTransaction = new FinancialScheduledTransactionService( rockContext ).Get( scheduledTransactionId.Value );
var personService = new PersonService( rockContext );
// get business giving id
var givingIds = personService.GetBusinesses( _targetPerson.Id ).Select( g => g.GivingId ).ToList();
// add the person's regular giving id
givingIds.Add( _targetPerson.GivingId );
// Make sure the current person is the authorized person, otherwise return
if ( scheduledTransaction == null || ! givingIds.Contains( scheduledTransaction.AuthorizedPersonAlias.Person.GivingId ) )
{
return;
}
_scheduledTransactionToBeTransferred = scheduledTransaction;
// Set the frequency to be the same on the initial page build
if ( !IsPostBack )
{
btnFrequency.SelectedValue = scheduledTransaction.TransactionFrequencyValueId.ToString();
dtpStartDate.SelectedDate = ( scheduledTransaction.NextPaymentDate.HasValue ) ? scheduledTransaction.NextPaymentDate : RockDateTime.Today.AddDays( 1 );
}
}
示例6: GetAccounts
private void GetAccounts(FinancialScheduledTransaction scheduledTransaction)
{
var selectedGuids = GetAttributeValues( "Accounts" ).Select( Guid.Parse ).ToList();
bool showAll = !selectedGuids.Any();
bool additionalAccounts = true;
if ( !bool.TryParse( GetAttributeValue( "AdditionalAccounts" ), out additionalAccounts ) )
{
additionalAccounts = true;
}
SelectedAccounts = new List<AccountItem>();
AvailableAccounts = new List<AccountItem>();
// Enumerate through all active accounts that have a public name
foreach ( var account in new FinancialAccountService().Queryable()
.Where( f =>
f.IsActive &&
f.PublicName != null &&
f.PublicName.Trim() != "" &&
( f.StartDate == null || f.StartDate <= DateTime.Today ) &&
( f.EndDate == null || f.EndDate >= DateTime.Today ) )
.OrderBy( f => f.Order ) )
{
var accountItem = new AccountItem( account.Id, account.Order, account.Name, account.CampusId );
if ( showAll )
{
SelectedAccounts.Add( accountItem );
}
else
{
if ( selectedGuids.Contains( account.Guid ) )
{
SelectedAccounts.Add( accountItem );
}
else
{
if ( additionalAccounts )
{
AvailableAccounts.Add( accountItem );
}
}
}
}
foreach ( var txnDetail in scheduledTransaction.ScheduledTransactionDetails )
{
var selectedAccount = SelectedAccounts.Where( a => a.Id == txnDetail.AccountId ).FirstOrDefault();
if ( selectedAccount != null )
{
selectedAccount.Amount = txnDetail.Amount;
}
else
{
var selected = AvailableAccounts.Where( a => a.Id == txnDetail.AccountId ).ToList();
if ( selected != null )
{
selected.ForEach( a => a.Amount = txnDetail.Amount );
AvailableAccounts = AvailableAccounts.Except( selected ).ToList();
SelectedAccounts.AddRange( selected );
}
}
}
BindAccounts();
}
示例7: GetPaymentInfo
/// <summary>
/// Gets the payment information.
/// </summary>
/// <returns></returns>
private PaymentInfo GetPaymentInfo(PersonService personService, FinancialScheduledTransaction scheduledTransaction)
{
PaymentInfo paymentInfo = null;
if ( hfPaymentTab.Value == "ACH" )
{
if ( rblSavedAch.Items.Count > 0 && ( rblSavedAch.SelectedValueAsId() ?? 0 ) > 0 )
{
paymentInfo = GetReferenceInfo( rblSavedAch.SelectedValueAsId().Value );
}
else
{
paymentInfo = GetACHInfo();
}
}
else if ( hfPaymentTab.Value == "CreditCard" )
{
if ( rblSavedCC.Items.Count > 0 && ( rblSavedCC.SelectedValueAsId() ?? 0 ) > 0 )
{
paymentInfo = GetReferenceInfo( rblSavedCC.SelectedValueAsId().Value );
}
else
{
paymentInfo = GetCCInfo();
}
}
else
{
paymentInfo = new PaymentInfo();
}
if ( paymentInfo != null )
{
paymentInfo.Amount = SelectedAccounts.Sum( a => a.Amount );
paymentInfo.FirstName = scheduledTransaction.AuthorizedPerson.FirstName;
paymentInfo.LastName = scheduledTransaction.AuthorizedPerson.LastName;
paymentInfo.Email = scheduledTransaction.AuthorizedPerson.Email;
bool displayPhone = false;
if ( bool.TryParse( GetAttributeValue( "DisplayPhone" ), out displayPhone ) && displayPhone )
{
var phoneNumber = personService.GetPhoneNumber( scheduledTransaction.AuthorizedPerson, DefinedValueCache.Read( new Guid( Rock.SystemGuid.DefinedValue.PERSON_PHONE_TYPE_HOME ) ) );
paymentInfo.Phone = phoneNumber != null ? phoneNumber.NumberFormatted : string.Empty;
}
Guid addressTypeGuid = Guid.Empty;
if ( !Guid.TryParse( GetAttributeValue( "AddressType" ), out addressTypeGuid ) )
{
addressTypeGuid = new Guid( Rock.SystemGuid.DefinedValue.GROUP_LOCATION_TYPE_HOME );
}
var address = personService.GetFirstLocation( scheduledTransaction.AuthorizedPerson, DefinedValueCache.Read( addressTypeGuid ).Id );
if ( address != null )
{
paymentInfo.Street = address.Street1;
paymentInfo.City = address.City;
paymentInfo.State = address.State;
paymentInfo.Zip = address.Zip;
}
}
return paymentInfo;
}
示例8: UpdateScheduledPayment
/// <summary>
/// Updates the scheduled payment.
/// </summary>
/// <param name="schedule">The schedule.</param>
/// <param name="paymentInfo">The payment info.</param>
/// <param name="errorMessage">The error message.</param>
/// <returns></returns>
public override bool UpdateScheduledPayment( FinancialScheduledTransaction transaction, PaymentInfo paymentInfo, out string errorMessage )
{
errorMessage = string.Empty;
RecurringModifyTransaction ppTransaction = null;
if ( paymentInfo != null )
{
ppTransaction = new RecurringModifyTransaction( GetUserInfo(), GetConnection(), GetRecurring( transaction ), GetInvoice( paymentInfo ), GetTender( paymentInfo ), PayflowUtility.RequestId );
}
else
{
ppTransaction = new RecurringModifyTransaction( GetUserInfo(), GetConnection(), GetRecurring( transaction ), PayflowUtility.RequestId );
}
var ppResponse = ppTransaction.SubmitTransaction();
if ( ppResponse != null )
{
TransactionResponse txnResponse = ppResponse.TransactionResponse;
if ( txnResponse != null )
{
if ( txnResponse.Result == 0 ) // Success
{
RecurringResponse recurringResponse = ppResponse.RecurringResponse;
if ( recurringResponse != null )
{
return true;
}
else
{
errorMessage = "Invalid recurring response from the financial gateway";
}
}
else
{
errorMessage = string.Format( "[{0}] {1}", txnResponse.Result, txnResponse.RespMsg );
}
}
else
{
errorMessage = "Invalid transaction response from the financial gateway";
}
}
else
{
errorMessage = "Invalid response from the financial gateway.";
}
return false;
}
示例9: SetFrequency
/// <summary>
/// Sets the frequency.
/// </summary>
/// <param name="scheduledTransaction">The scheduled transaction.</param>
private void SetFrequency( FinancialScheduledTransaction scheduledTransaction )
{
// Enable payment options based on the configured gateways
bool ccEnabled = false;
bool achEnabled = false;
if ( scheduledTransaction != null && Gateway != null )
{
if ( scheduledTransaction.FinancialPaymentDetail != null &&
scheduledTransaction.FinancialPaymentDetail.CurrencyTypeValueId == DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.CURRENCY_TYPE_CREDIT_CARD ).Id )
{
ccEnabled = true;
txtCardFirstName.Visible = Gateway.SplitNameOnCard;
var authorizedPerson = scheduledTransaction.AuthorizedPersonAlias.Person;
txtCardFirstName.Text = authorizedPerson.FirstName;
txtCardLastName.Visible = Gateway.SplitNameOnCard;
txtCardLastName.Text = authorizedPerson.LastName;
txtCardName.Visible = !Gateway.SplitNameOnCard;
txtCardName.Text = authorizedPerson.FullName;
var groupLocation = new PersonService( new RockContext() ).GetFirstLocation(
authorizedPerson.Id, DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.GROUP_LOCATION_TYPE_HOME.AsGuid() ).Id );
if ( groupLocation != null )
{
acBillingAddress.SetValues( groupLocation.Location );
}
else
{
acBillingAddress.SetValues( null );
}
mypExpiration.MinimumYear = RockDateTime.Now.Year;
}
if ( scheduledTransaction.FinancialPaymentDetail != null &&
scheduledTransaction.FinancialPaymentDetail.CurrencyTypeValueId == DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.CURRENCY_TYPE_ACH ).Id )
{
achEnabled = true;
}
if ( Gateway.SupportedPaymentSchedules.Any() )
{
var oneTimeFrequency = DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.TRANSACTION_FREQUENCY_ONE_TIME );
divRepeatingPayments.Visible = true;
btnFrequency.DataSource = Gateway.SupportedPaymentSchedules;
btnFrequency.DataBind();
btnFrequency.SelectedValue = scheduledTransaction.TransactionFrequencyValueId.ToString();
}
liCreditCard.Visible = ccEnabled;
divCCPaymentInfo.Visible = ccEnabled;
liACH.Visible = achEnabled;
divACHPaymentInfo.Visible = achEnabled;
if ( ccEnabled )
{
divCCPaymentInfo.AddCssClass( "tab-pane" );
}
if ( achEnabled )
{
divACHPaymentInfo.AddCssClass( "tab-pane" );
}
}
}
示例10: UpdateScheduledPayment
/// <summary>
/// Updates the scheduled payment.
/// </summary>
/// <param name="schedule">The schedule.</param>
/// <param name="paymentInfo">The payment info.</param>
/// <param name="errorMessage">The error message.</param>
/// <returns></returns>
public override bool UpdateScheduledPayment( FinancialScheduledTransaction transaction, PaymentInfo paymentInfo, out string errorMessage )
{
errorMessage = string.Empty;
var financialGateway = transaction.FinancialGateway;
RequestMessage request = GetPaymentInfo( financialGateway, paymentInfo );
if ( request == null )
{
errorMessage = "Payment type not implemented";
return false;
}
if ( request.recurringSubscriptionInfo == null )
{
request.recurringSubscriptionInfo = new RecurringSubscriptionInfo();
request.recurringSubscriptionInfo.subscriptionID = transaction.TransactionCode;
}
request.recurringSubscriptionInfo.amount = paymentInfo.Amount.ToString();
request.paySubscriptionUpdateService = new PaySubscriptionUpdateService();
request.paySubscriptionUpdateService.run = "true";
request.purchaseTotals = GetTotals();
request.billTo = GetBillTo( paymentInfo );
request.item = GetItems( paymentInfo );
request.subscription = new Subscription();
if ( !paymentInfo.CurrencyTypeValue.Guid.Equals( new Guid( Rock.SystemGuid.DefinedValue.CURRENCY_TYPE_CREDIT_CARD ) ) )
{
request.subscription.paymentMethod = "check";
}
else
{
request.subscription.paymentMethod = "credit card";
}
// Update the schedule
ReplyMessage reply = SubmitTransaction( financialGateway, request, out errorMessage );
if ( reply != null && reply.reasonCode.Equals( GATEWAY_RESPONSE_SUCCESS ) )
{
return true;
}
else if ( string.IsNullOrEmpty( errorMessage ) )
{
errorMessage = string.Format( "Unable to update this transaction. {0}", ProcessError( reply ) );
}
return false;
}
示例11: ReactivateScheduledPayment
/// <summary>
/// Reactivates the scheduled payment (CyberSource not supported).
/// </summary>
/// <param name="transaction">The transaction.</param>
/// <param name="errorMessage">The error message.</param>
/// <returns></returns>
public override bool ReactivateScheduledPayment( FinancialScheduledTransaction transaction, out string errorMessage )
{
errorMessage = string.Empty;
return false;
}
示例12: GetScheduledPaymentStatus
/// <summary>
/// Gets the scheduled payment status.
/// </summary>
/// <param name="transaction">The transaction.</param>
/// <param name="errorMessage">The error message.</param>
/// <returns></returns>
public override bool GetScheduledPaymentStatus( FinancialScheduledTransaction transaction, out string errorMessage )
{
errorMessage = string.Empty;
var financialGateway = transaction.FinancialGateway;
RequestMessage verifyRequest = GetMerchantInfo( financialGateway );
verifyRequest.paySubscriptionRetrieveService = new PaySubscriptionRetrieveService();
verifyRequest.paySubscriptionRetrieveService.run = "true";
verifyRequest.recurringSubscriptionInfo = new RecurringSubscriptionInfo();
verifyRequest.recurringSubscriptionInfo.subscriptionID = transaction.TransactionCode;
// Get the payment status
ReplyMessage reply = SubmitTransaction( financialGateway, verifyRequest, out errorMessage );
if ( reply != null && reply.reasonCode.Equals( GATEWAY_RESPONSE_SUCCESS ) )
{
transaction.IsActive = reply.paySubscriptionRetrieveReply.status.ToUpper() == "CURRENT";
var startDate = GetDate( reply.paySubscriptionRetrieveReply.startDate );
transaction.StartDate = startDate ?? transaction.StartDate;
transaction.NextPaymentDate = NextPaymentDate( startDate, reply.paySubscriptionRetrieveReply.frequency ) ?? transaction.NextPaymentDate;
transaction.NumberOfPayments = reply.paySubscriptionRetrieveReply.totalPayments.AsIntegerOrNull() ?? transaction.NumberOfPayments;
transaction.LastStatusUpdateDateTime = DateTime.Now;
return true;
}
else if ( string.IsNullOrEmpty( errorMessage ) )
{
errorMessage = ProcessError( reply );
}
return false;
}
示例13: CancelScheduledPayment
/// <summary>
/// Cancels the scheduled payment.
/// </summary>
/// <param name="transaction">The transaction.</param>
/// <param name="errorMessage">The error message.</param>
/// <returns></returns>
public override bool CancelScheduledPayment( FinancialScheduledTransaction transaction, out string errorMessage )
{
errorMessage = string.Empty;
var financialGateway = transaction.FinancialGateway;
RequestMessage request = GetMerchantInfo( transaction.FinancialGateway, false );
request.recurringSubscriptionInfo = new RecurringSubscriptionInfo();
request.recurringSubscriptionInfo.subscriptionID = transaction.TransactionCode;
request.paySubscriptionUpdateService = new PaySubscriptionUpdateService();
request.recurringSubscriptionInfo.status = "cancel";
request.paySubscriptionUpdateService.run = "true";
// Cancel the payment
ReplyMessage reply = SubmitTransaction( financialGateway, request, out errorMessage );
if ( reply != null && reply.reasonCode.Equals( GATEWAY_RESPONSE_SUCCESS ) )
{
return true;
}
else if ( string.IsNullOrEmpty( errorMessage ) )
{
errorMessage = string.Format( "Unable to cancel this transaction. {0}", ProcessError( reply ) );
}
return false;
}
示例14: AddScheduledPayment
/// <summary>
/// Adds the scheduled payment.
/// </summary>
/// <param name="schedule">The schedule.</param>
/// <param name="paymentInfo">The payment info.</param>
/// <param name="errorMessage">The error message.</param>
/// <returns></returns>
public override FinancialScheduledTransaction AddScheduledPayment( FinancialGateway financialGateway, PaymentSchedule schedule, PaymentInfo paymentInfo, out string errorMessage )
{
errorMessage = string.Empty;
RequestMessage request = GetPaymentInfo( financialGateway, paymentInfo );
if ( request == null )
{
errorMessage = "Payment type not implemented";
return null;
}
if ( request.recurringSubscriptionInfo == null )
{
request.recurringSubscriptionInfo = new RecurringSubscriptionInfo();
}
request.recurringSubscriptionInfo.startDate = GetStartDate( schedule );
request.recurringSubscriptionInfo.frequency = GetFrequency( schedule );
request.recurringSubscriptionInfo.amount = paymentInfo.Amount.ToString();
request.paySubscriptionCreateService = new PaySubscriptionCreateService();
request.paySubscriptionCreateService.run = "true";
request.purchaseTotals = GetTotals();
request.billTo = GetBillTo( paymentInfo );
request.item = GetItems( paymentInfo );
request.subscription = new Subscription();
if ( !paymentInfo.CurrencyTypeValue.Guid.Equals( new Guid( Rock.SystemGuid.DefinedValue.CURRENCY_TYPE_CREDIT_CARD ) ) )
{
request.subscription.paymentMethod = "check";
}
if ( paymentInfo is ReferencePaymentInfo )
{
request.paySubscriptionCreateService.paymentRequestID = ( (ReferencePaymentInfo)paymentInfo ).TransactionCode;
}
// Schedule the payment
ReplyMessage reply = SubmitTransaction( financialGateway, request, out errorMessage );
if ( reply != null && reply.reasonCode.Equals( GATEWAY_RESPONSE_SUCCESS ) )
{
var transactionGuid = new Guid( reply.merchantReferenceCode );
var scheduledTransaction = new FinancialScheduledTransaction { Guid = transactionGuid };
scheduledTransaction.TransactionCode = reply.paySubscriptionCreateReply.subscriptionID;
scheduledTransaction.GatewayScheduleId = reply.paySubscriptionCreateReply.subscriptionID;
scheduledTransaction.FinancialGateway = financialGateway;
scheduledTransaction.FinancialGatewayId = financialGateway.Id;
GetScheduledPaymentStatus( scheduledTransaction, out errorMessage );
return scheduledTransaction;
}
else if ( string.IsNullOrEmpty( errorMessage ) )
{
errorMessage = string.Format( "Your order was not approved.{0}", ProcessError( reply ) );
}
return null;
}
示例15: CancelScheduledPayment
/// <summary>
/// Cancels the scheduled payment.
/// </summary>
/// <param name="transaction">The transaction.</param>
/// <param name="errorMessage">The error message.</param>
/// <returns></returns>
public override bool CancelScheduledPayment( FinancialScheduledTransaction transaction, out string errorMessage )
{
transaction.IsActive = false;
errorMessage = string.Empty;
return true;
}