/// <summary>
        /// Initializes a new instance of the <see cref="AuthorizePayment"/> class.
        /// </summary>
        /// <param name="paymentGateway">The payment gateway to use for authorization.</param>
        /// <param name="amountToCharge">The amount to charge.</param>
        public AuthorizePayment(IPaymentGateway paymentGateway, decimal amountToCharge)
        {
            paymentGateway.AssertNotNull(nameof(paymentGateway));
            amountToCharge.AssertPositive(nameof(amountToCharge));

            this.Amount         = amountToCharge;
            this.PaymentGateway = paymentGateway;
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CommerceOperations"/> class.
        /// </summary>
        /// <param name="applicationDomain">An application domain instance.</param>
        /// <param name="customerId">The customer ID who owns the transaction.</param>
        /// <param name="paymentGateway">A payment gateway to use for processing payments resulting from the transaction.</param>
        public CommerceOperations(ApplicationDomain applicationDomain, string customerId, IPaymentGateway paymentGateway) : base(applicationDomain)
        {
            customerId.AssertNotEmpty(nameof(customerId));
            paymentGateway.AssertNotNull(nameof(paymentGateway));

            CustomerId     = customerId;
            PaymentGateway = paymentGateway;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CapturePayment"/> class.
        /// </summary>
        /// <param name="paymentGateway">The payment gateway to use for capturing payments.</param>
        /// <param name="authorizationCode">The authorization code to capture.</param>
        public CapturePayment(IPaymentGateway paymentGateway, string authorizationCode)
        {
            paymentGateway.AssertNotNull(nameof(paymentGateway));
            authorizationCode.AssertNotEmpty(nameof(paymentGateway));

            this.PaymentGateway    = paymentGateway;
            this.AuthorizationCode = authorizationCode;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CapturePayment"/> class.
        /// </summary>
        /// <param name="paymentGateway">The payment gateway to use for capturing payments.</param>
        /// <param name="acquireAuthorizationCallFunction">The function to call to obtain the authorization code.</param>
        public CapturePayment(IPaymentGateway paymentGateway, Func <string> acquireAuthorizationCallFunction)
        {
            paymentGateway.AssertNotNull(nameof(paymentGateway));
            acquireAuthorizationCallFunction.AssertNotNull(nameof(acquireAuthorizationCallFunction));

            this.PaymentGateway = paymentGateway;
            this.AcquireInput   = acquireAuthorizationCallFunction;
        }
示例#5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AuthorizePayment"/> class.
        /// </summary>
        /// <param name="paymentGateway">The payment gateway to use for authorization.</param>
        public AuthorizePayment(IPaymentGateway paymentGateway)
        {
            paymentGateway.AssertNotNull(nameof(paymentGateway));

            this.PaymentGateway = paymentGateway;
        }