Skip to content

Commit

Permalink
- (Finance) Fixed issue in the TransactionEntryV2 block where a warni…
Browse files Browse the repository at this point in the history
…ng would show if Captcha was not configured for Rock.
  • Loading branch information
ethan-sparkdevnetwork committed Jun 14, 2023
1 parent 9dc104c commit 51e6d99
Showing 1 changed file with 10 additions and 57 deletions.
67 changes: 10 additions & 57 deletions RockWeb/Blocks/Finance/TransactionEntryV2.ascx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -694,101 +694,53 @@ public partial class TransactionEntryV2 : RockBlock
private static class AttributeKey
{
public const string AccountsToDisplay = "AccountsToDisplay";

public const string AllowImpersonation = "AllowImpersonation";

public const string AllowScheduledTransactions = "AllowScheduledTransactions";

public const string BatchNamePrefix = "BatchNamePrefix";

public const string FinancialGateway = "FinancialGateway";

public const string EnableACH = "EnableACH";

public const string EnableCreditCard = "EnableCreditCard";

public const string EnableCommentEntry = "EnableCommentEntry";

public const string CommentEntryLabel = "CommentEntryLabel";

public const string EnableBusinessGiving = "EnableBusinessGiving";

public const string EnableAnonymousGiving = "EnableAnonymousGiving";

public const string AnonymousGivingTooltip = "AnonymousGivingTooltip";

public const string PaymentCommentTemplate = "PaymentCommentTemplate";

public const string EnableInitialBackButton = "EnableInitialBackButton";

public const string FinancialSourceType = "FinancialSourceType";

public const string ShowScheduledTransactions = "ShowScheduledTransactions";

public const string ScheduledTransactionsTemplate = "ScheduledTransactionsTemplate";

public const string ScheduledTransactionEditPage = "ScheduledTransactionEditPage";

public const string GiftTerm = "GiftTerm";

public const string GiveButtonNowText = "GiveButtonNowText";

public const string GiveButtonScheduledText = "GiveButtonScheduledText";

public const string AccountHeaderTemplate = "AccountHeaderTemplate";

public const string AmountSummaryTemplate = "AmountSummaryTemplate";

public const string AskForCampusIfKnown = "AskForCampusIfKnown";

public const string IncludeInactiveCampuses = "IncludeInactiveCampuses";

public const string IncludedCampusTypes = "IncludedCampusTypes";

public const string IncludedCampusStatuses = "IncludedCampusStatuses";

public const string EnableMultiAccount = "EnableMultiAccount";

public const string IntroMessageTemplate = "IntroMessageTemplate";

public const string FinishLavaTemplate = "FinishLavaTemplate";

public const string SaveAccountTitle = "SaveAccountTitle";

public const string ConfirmAccountEmailTemplate = "ConfirmAccountEmailTemplate";

public const string TransactionType = "Transaction Type";

public const string TransactionEntityType = "TransactionEntityType";

public const string EntityIdParam = "EntityIdParam";

public const string AllowedTransactionAttributesFromURL = "AllowedTransactionAttributesFromURL";

public const string AllowAccountOptionsInURL = "AllowAccountOptionsInURL";

public const string OnlyPublicAccountsInURL = "OnlyPublicAccountsInURL";

public const string InvalidAccountInURLMessage = "InvalidAccountInURLMessage";

public const string ReceiptEmail = "ReceiptEmail";

public const string PromptForPhone = "PromptForPhone";

public const string PromptForEmail = "PromptForEmail";

public const string PersonAddressType = "PersonAddressType";

public const string PersonConnectionStatus = "PersonConnectionStatus";

public const string PersonRecordStatus = "PersonRecordStatus";

public const string EnableFeeCoverage = "EnableFeeCoverage";

public const string FeeCoverageDefaultState = "FeeCoverageDefaultState";

public const string FeeCoverageMessage = "FeeCoverageMessage";

public const string DisableCaptchaSupport = "DisableCaptchaSupport";
}

Expand Down Expand Up @@ -1023,14 +975,19 @@ protected override void OnInit( EventArgs e )
this.BlockUpdated += Block_BlockUpdated;
this.AddConfigurationUpdateTrigger( upnlContent );

bool enableACH = this.GetAttributeValue( AttributeKey.EnableACH ).AsBoolean();
bool enableCreditCard = this.GetAttributeValue( AttributeKey.EnableCreditCard ).AsBoolean();
// Don't use captcha if the block is set to disable (DisableCaptchaSupport==true) it or if is not configured (IsAvailable==false)
var disableCaptchaSupport = GetAttributeValue( AttributeKey.DisableCaptchaSupport ).AsBoolean() || !cpCaptcha.IsAvailable;
cpCaptcha.Visible = !disableCaptchaSupport;
cpCaptcha.TokenReceived += CpCaptcha_TokenReceived;

var enableACH = this.GetAttributeValue( AttributeKey.EnableACH ).AsBoolean();
var enableCreditCard = this.GetAttributeValue( AttributeKey.EnableCreditCard ).AsBoolean();
if ( this.FinancialGatewayComponent != null && this.FinancialGateway != null )
{
_hostedPaymentInfoControl = this.FinancialGatewayComponent.GetHostedPaymentInfoControl( this.FinancialGateway, $"_hostedPaymentInfoControl_{this.FinancialGateway.Id}", new HostedPaymentInfoControlOptions { EnableACH = enableACH, EnableCreditCard = enableCreditCard } );
phHostedPaymentControl.Controls.Add( _hostedPaymentInfoControl );

if ( GetAttributeValue( AttributeKey.DisableCaptchaSupport ).AsBoolean() )
if ( disableCaptchaSupport )
{
hfHostPaymentInfoSubmitScript.Value = this.FinancialGatewayComponent.GetHostPaymentInfoSubmitScript( this.FinancialGateway, _hostedPaymentInfoControl );
}
Expand All @@ -1056,10 +1013,6 @@ protected override void OnInit( EventArgs e )
// Evaluate if comment entry box should be displayed
tbCommentEntry.Label = GetAttributeValue( AttributeKey.CommentEntryLabel );
tbCommentEntry.Visible = GetAttributeValue( AttributeKey.EnableCommentEntry ).AsBoolean();

var disableCaptchaSupport = GetAttributeValue( AttributeKey.DisableCaptchaSupport ).AsBoolean();
cpCaptcha.Visible = !disableCaptchaSupport;
cpCaptcha.TokenReceived += CpCaptcha_TokenReceived;
}

/// <summary>
Expand Down Expand Up @@ -3538,8 +3491,8 @@ private void SetPaymentComment( PaymentInfo paymentInfo, List<FinancialTransacti
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
protected void btnGiveNow_Click( object sender, EventArgs e )
{
var disableCaptchaSupport = GetAttributeValue( AttributeKey.DisableCaptchaSupport ).AsBoolean();
if ( !disableCaptchaSupport && cpCaptcha.Visible )
// Don't use captcha if the control is not visible
if ( cpCaptcha.Visible )
{
nbPromptForAmountsWarning.Visible = true;
nbPromptForAmountsWarning.Text = "There was an issue processing your request. Please try again. If the issue persists please contact us.";
Expand Down

0 comments on commit 51e6d99

Please sign in to comment.