Пример #1
0
        /// <summary>
        /// Enables or disables Saman Mobile gateway.
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="enable">If true, the invoice will be sent to Saman Mobile gateway. Otherwise it will be sent to Saman Web gateway.</param>
        public static IInvoiceBuilder EnableSamanMobileGateway(this IInvoiceBuilder builder, bool enable = true)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            builder.AddOrUpdateAdditionalData(SamanHelper.MobileGatewayKey, enable);

            return(builder);
        }
Пример #2
0
        /// <summary>
        /// Sets ZarinPal Gateway data.
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="zarinPalInvoice">Describes an invoice for ZarinPal gateway.</param>
        /// <exception cref="ArgumentNullException"></exception>
        public static IInvoiceBuilder SetZarinPalData(this IInvoiceBuilder builder, ZarinPalInvoice zarinPalInvoice)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            builder.AddOrUpdateAdditionalData(ZarinPalHelper.ZarinPalRequestAdditionalKeyName, zarinPalInvoice);

            return(builder);
        }
Пример #3
0
        internal static void SetYekPayRequest(IInvoiceBuilder builder, YekPayRequest yekPayRequest)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (yekPayRequest == null)
            {
                throw new ArgumentNullException(nameof(yekPayRequest));
            }

            builder.AddOrUpdateAdditionalData(YekPayRequestKey, yekPayRequest);
        }
Пример #4
0
        public async Task Invoice_Must_Have_The_Updated_AdditionalData_Value()
        {
            const string expectedKey   = "key";
            const string expectedValue = "value";

            _builder.AddAdditionalData(expectedKey, "");
            _builder.AddOrUpdateAdditionalData(expectedKey, expectedValue);

            var invoice = await _builder.BuildAsync();

            Assert.IsNotNull(invoice.AdditionalData);
            Assert.IsTrue(invoice.AdditionalData.ContainsKey(expectedKey));
            Assert.AreEqual(expectedValue, invoice.AdditionalData[expectedKey]);
        }
        /// <summary>
        /// Sets the additional data for PayPing Gateway.
        /// </summary>
        public static IInvoiceBuilder SetPayPingData(this IInvoiceBuilder builder, PayPingRequest payPingRequest)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (payPingRequest == null)
            {
                throw new ArgumentNullException(nameof(payPingRequest));
            }

            builder.AddOrUpdateAdditionalData(PayPingRequestKey, payPingRequest);

            return(builder);
        }