protected override void SetupValidations() { Validations.For(TransactionType.Capture | TransactionType.Edit | TransactionType.Hold | TransactionType.Release) .Check(() => TransactionId).IsNotNull(); Validations.For(TransactionType.Edit).With(TransactionModifier.LevelII) .Check(() => TaxType).IsNotNull(); Validations.For(TransactionType.Refund) .When(() => Amount).IsNotNull() .Check(() => Currency).IsNotNull(); Validations.For(TransactionType.VerifySignature) .Check(() => PayerAuthenticationResponse).IsNotNull() .Check(() => Amount).IsNotNull() .Check(() => Currency).IsNotNull() .Check(() => OrderId).IsNotNull(); Validations.For(TransactionType.TokenDelete | TransactionType.TokenUpdate) .Check(() => PaymentMethod).IsNotNull() .Check(() => PaymentMethod).Is <ITokenizable>(); Validations.For(TransactionType.TokenUpdate) .Check(() => PaymentMethod).Is <CreditCardData>(); }
protected override void SetupValidations() { Validations.For(ReportType.TransactionDetail) .Check(() => TransactionId).IsNotNull(); Validations.For(ReportType.Activity).Check(() => TransactionId).IsNull(); }
public ValidationTarget IsNotNull(string message = null) { callback = (builder) => { var value = property.GetValue(builder); return(value != null); }; this.message = message ?? string.Format("{0} cannot be null for this transaction type.", property.Name); if (precondition) { return(target); } else { return(parent.For(target.type).With(target.constraint)); } }
public void setupValidations() { Validations.For(TransactionType.Sale) .Check(() => PaymentMethod).IsNotNull() .Check(() => Amount).IsNotNull() .Check(() => Currency).IsNotNull(); }
protected override void SetupValidations() { Validations.For(ReportType.TransactionDetail) .Check(() => TransactionId).IsNotNull(); Validations.For(ReportType.Activity).Check(() => TransactionId).IsNull(); Validations.For(ReportType.DocumentDisputeDetail).Check(() => DisputeDocumentId).IsNotNull(); Validations.For(ReportType.PayLinkDetail).Check(() => PayLinkId).IsNotNull(); }
protected override void SetupValidations() { Validations.For(TransactionType.Auth | TransactionType.Sale | TransactionType.Refund | TransactionType.AddValue) .With(TransactionModifier.None) .Check(() => Amount).IsNotNull() .Check(() => Currency).IsNotNull() .Check(() => PaymentMethod).IsNotNull(); Validations.For(TransactionType.Auth | TransactionType.Sale) .With(TransactionModifier.HostedRequest) .Check(() => Amount).IsNotNull() .Check(() => Currency).IsNotNull(); Validations.For(TransactionType.Verify) .With(TransactionModifier.HostedRequest) .Check(() => Currency).IsNotNull() .Check(() => Amount).IsNull(); Validations.For(TransactionType.Auth | TransactionType.Sale) .With(TransactionModifier.Offline) .Check(() => Amount).IsNotNull() .Check(() => Currency).IsNotNull() .Check(() => OfflineAuthCode).IsNotNull(); Validations.For(TransactionType.BenefitWithdrawal).With(TransactionModifier.CashBack) .Check(() => Amount).IsNotNull() .Check(() => Currency).IsNotNull() .Check(() => PaymentMethod).IsNotNull(); Validations.For(TransactionType.Balance).Check(() => PaymentMethod).IsNotNull(); Validations.For(TransactionType.Alias) .Check(() => AliasAction).IsNotNull() .Check(() => Alias).IsNotNull(); Validations.For(TransactionType.Replace).Check(() => ReplacementCard).IsNotNull(); Validations.For(PaymentMethodType.ACH).Check(() => BillingAddress).IsNotNull(); Validations.For(PaymentMethodType.Debit).When(() => ReversalReasonCode).IsNotNull().Check(() => TransactionType).Equals(TransactionType.Reversal); Validations.For(PaymentMethodType.Debit | PaymentMethodType.Credit) .When(() => HasEmvFallbackData).IsTrue() .Check(() => TagData).IsNull(); Validations.For(PaymentMethodType.Debit | PaymentMethodType.Credit) .When(() => TagData).IsNotNull() .Check(() => HasEmvFallbackData).IsFalse(); Validations.For(TransactionType.Auth | TransactionType.Sale) .With(TransactionModifier.EncryptedMobile) .Check(() => PaymentMethod).IsNotNull(); Validations.For(PaymentMethodType.Recurring).Check(() => ShippingAmt).IsNull(); }
protected override void SetupValidations() { Validations.For(TransactionType.Capture | TransactionType.Edit | TransactionType.Hold | TransactionType.Release) .Check(() => PaymentMethod).IsNotNull(); Validations.For(TransactionType.Capture | TransactionType.Edit | TransactionType.Hold | TransactionType.Release | TransactionType.Reauth) .Check(() => TransactionId).IsNotNull(); // TODO: Need level validations //Validations.For(TransactionType.Edit).With(TransactionModifier.Level_II) // .Check(() => TaxType).IsNotNull(); Validations.For(TransactionType.Refund) .When(() => Amount).IsNotNull() .Check(() => Currency).IsNotNull(); Validations.For(TransactionType.VerifySignature) .Check(() => PayerAuthenticationResponse).IsNotNull() .Check(() => Amount).IsNotNull() .Check(() => Currency).IsNotNull() .Check(() => OrderId).IsNotNull(); Validations.For(TransactionType.TokenDelete | TransactionType.TokenUpdate) .Check(() => PaymentMethod).IsNotNull() .Check(() => PaymentMethod).Is <ITokenizable>(); Validations.For(TransactionType.TokenUpdate) .Check(() => PaymentMethod).Is <CreditCardData>(); Validations.For(TransactionType.PayLinkUpdate) .Check(() => PayLinkData).IsNotNull() .Check(() => Amount).IsNotNull() .Check(() => UsageMode).IsNotNull() .Check(() => UsageLimit).IsNotNull() .Check(() => Type).IsNotNull(); Validations.For( TransactionType.Capture | TransactionType.Edit | TransactionType.Hold | TransactionType.Release | TransactionType.TokenUpdate | TransactionType.TokenDelete | TransactionType.VerifySignature | TransactionType.Refund) .Check(() => VoidReason).IsNull(); }
public void setupValidations() { Validations.For(TransactionType.VerifyEnrolled) .Check(() => PaymentMethod).IsNotNull(); Validations.For(TransactionType.VerifyEnrolled) .When(() => PaymentMethod).IsNotNull() .Check(() => PaymentMethod).Is <ISecure3d>(); Validations.For(TransactionType.VerifySignature) .When(() => Version).Equals(Secure3dVersion.One) .Check(() => ThreeDSecure).IsNotNull() .When(() => Version).Equals(Secure3dVersion.One) .Check(() => PayerAuthenticationResponse).IsNotNull(); Validations.For(TransactionType.VerifySignature) .When(() => Version).Equals(Secure3dVersion.Two) .Check(() => ServerTransactionId).IsNotNull(); Validations.For(TransactionType.InitiateAuthentication) .Check(() => ThreeDSecure).IsNotNull(); Validations.For(TransactionType.InitiateAuthentication) .When(() => PaymentMethod).IsNotNull() .Check(() => PaymentMethod).Is <ISecure3d>(); Validations.For(TransactionType.InitiateAuthentication) .When(() => MerchantInitiatedRequestType).IsNotNull() .Check(() => MerchantInitiatedRequestType).DoesNotEqual(AuthenticationRequestType.PAYMENT_TRANSACTION); Validations.For(TransactionType.InitiateAuthentication) .When(() => AccountAgeIndicator).IsNotNull() .Check(() => AccountAgeIndicator).DoesNotEqual(AgeIndicator.NO_CHANGE); Validations.For(TransactionType.InitiateAuthentication) .When(() => PasswordChangeIndicator).IsNotNull() .Check(() => PasswordChangeIndicator).DoesNotEqual(AgeIndicator.NO_ACCOUNT); Validations.For(TransactionType.InitiateAuthentication) .When(() => ShippingAddressUsageIndicator).IsNotNull() .Check(() => ShippingAddressUsageIndicator).DoesNotEqual(AgeIndicator.NO_CHANGE) .When(() => ShippingAddressUsageIndicator).IsNotNull() .Check(() => ShippingAddressUsageIndicator).DoesNotEqual(AgeIndicator.NO_ACCOUNT); }
protected override void SetupValidations() { Validations.For(TransactionType.Edit | TransactionType.Delete | TransactionType.Fetch).Check(() => Key).IsNotNull(); Validations.For(TransactionType.Search).Check(() => SearchCriteria).IsNotNull(); }
protected override void SetupValidations() { // Account Management Methods Validations.For(TransactionType.CreateAccount) .With(TransactionModifier.None) .Check(() => BeneficialOwnerData).IsNotNull() .Check(() => BusinessData).IsNotNull() .Check(() => UserPersonalData).IsNotNull() .Check(() => CreditCardInformation).IsNotNull(); Validations.For(TransactionType.EditAccount) .With(TransactionModifier.None) .Check(() => AccountNumber).IsNotNull(); Validations.For(TransactionType.ResetPassword) .With(TransactionModifier.None) .Check(() => AccountNumber).IsNotNull(); Validations.For(TransactionType.RenewAccount) .With(TransactionModifier.None) .Check(() => AccountNumber).IsNotNull(); Validations.For(TransactionType.UpdateBeneficialOwnership) .With(TransactionModifier.None) .Check(() => AccountNumber).IsNotNull() .Check(() => BeneficialOwnerData).IsNotNull(); Validations.For(TransactionType.DisownAccount) .With(TransactionModifier.None) .Check(() => AccountNumber).IsNotNull(); Validations.For(TransactionType.UploadDocumentChargeback) .With(TransactionModifier.None) .Check(() => AccountNumber).IsNotNull() .Check(() => DocumentUploadData).IsNotNull(); Validations.For(TransactionType.UploadDocument) .With(TransactionModifier.None) .Check(() => AccountNumber).IsNotNull() .Check(() => DocumentUploadData).IsNotNull(); Validations.For(TransactionType.ObtainSSOKey) .With(TransactionModifier.None) .Check(() => AccountNumber).IsNotNull() .Check(() => SSORequestData).IsNotNull(); Validations.For(TransactionType.UpdateBankAccountOwnership) .With(TransactionModifier.None) .Check(() => AccountNumber).IsNotNull(); // Funds Management Methods Validations.For(TransactionType.AddFunds) .With(TransactionModifier.None) .Check(() => AccountNumber).IsNotNull() .Check(() => Amount).IsNotNull(); Validations.For(TransactionType.SweepFunds) .With(TransactionModifier.None) .Check(() => AccountNumber).IsNotNull() .Check(() => Amount).IsNotNull(); Validations.For(TransactionType.AddCardFlashFunds) .With(TransactionModifier.None) .Check(() => AccountNumber).IsNotNull() .Check(() => FlashFundsPaymentCardData).IsNotNull(); Validations.For(TransactionType.PushMoneyFlashFunds) .With(TransactionModifier.None) .Check(() => AccountNumber).IsNotNull() .Check(() => Amount).IsNotNull(); // In-Network Transaction Methods Validations.For(TransactionType.DisburseFunds) .With(TransactionModifier.None) .Check(() => Amount).IsNotNull() .Check(() => ReceivingAccountNumber).IsNotNull(); Validations.For(TransactionType.SpendBack) .With(TransactionModifier.None) .Check(() => Amount).IsNotNull() .Check(() => AccountNumber).IsNotNull() .Check(() => ReceivingAccountNumber).IsNotNull() .Check(() => AllowPending).IsNotNull(); Validations.For(TransactionType.ReverseSplitPay) .With(TransactionModifier.None) .Check(() => AccountNumber).IsNotNull() .Check(() => Amount).IsNotNull() .Check(() => CCAmount).IsNotNull() .Check(() => RequireCCRefund).IsNotNull() .Check(() => TransNum).IsNotNull(); Validations.For(TransactionType.SplitFunds) .With(TransactionModifier.None) .Check(() => AccountNumber).IsNotNull() .Check(() => ReceivingAccountNumber).IsNotNull() .Check(() => Amount).IsNotNull() .Check(() => TransNum).IsNotNull(); // Get Information Methods // For GetAccountDetails, there are "required" 3 parameter types // But we can only send one type per request. If we send more than one, the method will fail // As a result, we need to do some more thorough validation work // Each .When must be paired with a .Check, hence the duplicate .When calls in each section below // Check if AccountNumber is passed in (and ExternalID/SourceEmail have not) Validations.For(TransactionType.GetAccountDetails) .With(TransactionModifier.None) .When(() => AccountNumber).IsNotNull() .Check(() => ExternalID).IsNull() .When(() => AccountNumber).IsNotNull() .Check(() => SourceEmail).IsNull(); // Check if ExternalID has been passed in (and AccountNumber/SourceEmail have not) Validations.For(TransactionType.GetAccountDetails) .With(TransactionModifier.None) .When(() => ExternalID).IsNotNull() .Check(() => SourceEmail).IsNull() .When(() => ExternalID).IsNotNull() .Check(() => AccountNumber).IsNull(); // Check if SourceEmail has been passed in (and AccountNumber/ExternalID have not) Validations.For(TransactionType.GetAccountDetails) .With(TransactionModifier.None) .When(() => SourceEmail).IsNotNull() .Check(() => ExternalID).IsNull() .When(() => SourceEmail).IsNotNull() .Check(() => AccountNumber).IsNull(); Validations.For(TransactionType.GetAccountBalance) .With(TransactionModifier.None) .Check(() => AccountNumber).IsNotNull(); }