コード例 #1
0
        public void AddAndGetAccountCharge()
        {
            var request = new AccountChargeRequest
            {
                Id            = Guid.NewGuid(),
                Name          = "1000",
                AccountNumber = "1000",
                Questions     = new[]
                {
                    new AccountChargeQuestion
                    {
                        Question = "Question?",
                        Answer   = "Answer"
                    }
                }
            };

            _sut.CreateAccountCharge(request);

            var account = _sut.GetAccountCharge(request.AccountNumber);

            Assert.That(account, Is.Not.Null);
        }
コード例 #2
0
        public void create_order_with_charge_account_with_card_on_file_payment_from_web_app()
        {
            var accountChargeSut      = new AdministrationServiceClient(BaseUrl, SessionId, new DummyPackageInfo(), null);
            var accountChargeName     = "NAME" + new Random(DateTime.Now.Millisecond).Next(0, 5236985);
            var accountChargeNumber   = "NUMBER" + new Random(DateTime.Now.Millisecond).Next(0, 5236985);
            var accountCustomerNumber = "CUSTOMER" + new Random(DateTime.Now.Millisecond).Next(0, 5236985);

            accountChargeSut.CreateAccountCharge(new AccountChargeRequest
            {
                Id                      = Guid.NewGuid(),
                Name                    = accountChargeName,
                AccountNumber           = accountChargeNumber,
                UseCardOnFileForPayment = true,
                Questions               = new[]
                {
                    new AccountChargeQuestion
                    {
                        Question = "Question?",
                        Answer   = "Answer"
                    }
                }
            });

            var sut = new OrderServiceClient(BaseUrl, SessionId, new DummyPackageInfo {
                UserAgent = "FireFox"
            }, null, null);
            var order = new CreateOrderRequest
            {
                Id             = Guid.NewGuid(),
                FromWebApp     = true,
                PickupAddress  = TestAddresses.GetAddress1(),
                DropOffAddress = TestAddresses.GetAddress2(),
                Estimate       = new RideEstimate
                {
                    Price    = 10,
                    Distance = 3
                },
                Settings = new BookingSettings
                {
                    ChargeTypeId   = ChargeTypes.Account.Id,
                    VehicleTypeId  = 1,
                    ProviderId     = Provider.ApcuriumIbsProviderId,
                    Phone          = "5145551212",
                    Country        = new CountryISOCode("CA"),
                    Passengers     = 6,
                    NumberOfTaxi   = 1,
                    Name           = "Joe Smith",
                    LargeBags      = 1,
                    AccountNumber  = accountChargeNumber,
                    CustomerNumber = accountCustomerNumber
                },
                Payment = new PaymentSettings
                {
                    CreditCardId = Guid.NewGuid(),
                    TipPercent   = 15
                },
                QuestionsAndAnswers = new[]
                {
                    new AccountChargeQuestion
                    {
                        Answer = "Answer"
                    }
                },
                ClientLanguageCode = SupportedLanguages.fr.ToString()
            };

            var ex = Assert.Throws <WebServiceException>(async() => await sut.CreateOrder(order));

            Assert.AreEqual("Ce compte n'est pas supporté par la page web", ex.ErrorMessage);
        }