Exemplo n.º 1
0
 public void TearDown()
 {
     this.checksumService = null;
     this.items = null;
     this.billingAddress = null;
     this.shippingAddress = null;
     this.fee = null;
 }
Exemplo n.º 2
0
        public void Initialize()
        {
            base.Initialize();
            this.checksumService = _paymill.ChecksumService;

            this.items = new List<ShoppingCartItem>();
            this.items.Add(createShopingCardItem("Rambo Poster", "John J. Rambo", 2200, 3, "898-24342-343",
                "http://www.store.com/items/posters/12121-rambo"));
            this.items.Add(createShopingCardItem("Comando Poster", "John Matrix", 3100, 1, "898-24342-341",
                "http://www.store.com/items/posters/12121-comando"));

            this.billingAddress = createAddress("John Rambo", "TH", "Buriram", "Buriram", "Wat Sawai So 2", "23/4/14",
                "1527", "+66 32 12-555-23");
            this.shippingAddress = createAddress("Rocky Balboa", "US", "Pennsylvania", "Philadelphia",
                "1818 East Tusculum Street", "34/2B", "19134", "+1 215 23-555-32");

            this.fee = new Fee();
            this.fee.Amount = this.feeAmount;
            this.fee.Payment = this.feePayment;
        }
Exemplo n.º 3
0
        static internal void ValidatesFee(Fee fee)
        {
            if (fee != null)
            {
                if (fee.Amount.HasValue && String.IsNullOrWhiteSpace(fee.Payment))
                    throw new ArgumentException("When fee amount is given, fee payment is mandatory");

                if (fee.Amount.HasValue == false && String.IsNullOrEmpty(fee.Payment) == false)
                    throw new ArgumentException("When fee payment is given, fee amount is mandatory");

                if (fee.Amount.HasValue && String.IsNullOrEmpty(fee.Payment) == false)
                {
                    if (fee.Amount.Value < 0)
                        throw new ArgumentException("Fee amount can not be negative");
                    if (!fee.Payment.StartsWith("pay_"))
                    {
                        throw new ArgumentException("Fee payment should statrt with 'pay_' prefix");
                    }
                }
            }
        }