public async Task <IActionResult> Checkout([FromBody] CheckoutRequest message) { var request = new CheckoutInput(message.CustomerId, message.BasketId, message.FinalPrice); await checkoutInput.Process(request); return(checkoutPresenter.ViewModel); }
public async Task CancellationRethrows( CheckoutInput checkoutInput, CancellationToken cancelledToken, PrepareRunnerRepository sut) { await Assert.ThrowsAsync <OperationCanceledException>(async() => { await sut.Checkout(checkoutInput, cancelledToken); }); }
/// <summary> /// controllers.Base for authorize.net. Sets up the environment needed for authorize.net to run. We had also created/ set up a credit card, sets up our transactions /// </summary> /// <param name="checkoutInput">The users input from the checkout form</param> /// <returns></returns> public string Run(CheckoutInput checkoutInput) { ApiOperationBase <ANetApiRequest, ANetApiResponse> .RunEnvironment = AuthorizeNet.Environment.SANDBOX; ApiOperationBase <ANetApiRequest, ANetApiResponse> .MerchantAuthentication = new merchantAuthenticationType() { name = _config["AN-ApiLoginID"], ItemElementName = ItemChoiceType.transactionKey, Item = _config["AN-TransactionKey"] }; // creates the credits cards and passes in the type of card the user chooses to use. Either it be mastercard, visa, or american express var creditCard = new creditCardType { cardNumber = checkoutInput.Payment, expirationDate = "1021", cardCode = "102" }; customerAddressType billingAddress = GetAddress(checkoutInput); var paymentType = new paymentType { Item = creditCard }; var transaction = new transactionRequestType { transactionType = transactionTypeEnum.authCaptureTransaction.ToString(), amount = 200.0m, payment = paymentType, billTo = billingAddress }; var request = new createTransactionRequest { transactionRequest = transaction }; var controller = new createTransactionController(request); controller.Execute(); var response = controller.GetApiResponse(); // if the response fails, the user will see an error that the payment has failed to recieve a response if (response != null) { if (response.messages.resultCode == messageTypeEnum.Ok) { return("Response recieved."); } } return("Failed to recieve response"); }
public async Task PassesLocalRepoDirToCheckout( DirectoryPath dir, CheckoutInput checkoutInput, CancellationToken cancel, PrepareRunnerRepository sut) { sut.RunnerRepoDirectoryProvider.Path.Returns(dir); await sut.Checkout(checkoutInput, cancel); sut.RepoCheckouts.Received(1).Get(dir); }
public async Task RepoCheckPasedToResetToTarget( DirectoryPath dir, IRepositoryCheckout checkout, CheckoutInput checkoutInput, CancellationToken cancel, PrepareRunnerRepository sut) { sut.RepoCheckouts.Get(dir).ReturnsForAnyArgs(checkout); await sut.Checkout(checkoutInput, cancel); sut.ResetToTarget.Received(1).Reset(checkout.Repository, checkoutInput.PatcherVersioning, cancel); }
/// <summary> /// Brings in what user types into the entry to create the user's address /// </summary> /// <param name="checkoutInput">the input of the user from the form</param> /// <returns>the address</returns> public customerAddressType GetAddress(CheckoutInput checkoutInput) { customerAddressType address = new customerAddressType { firstName = checkoutInput.FirstName, lastName = checkoutInput.LastName, address = $"{checkoutInput.ShippingAddressLine1} {checkoutInput.ShippingAddressLine2}", city = checkoutInput.City, state = checkoutInput.StateOrProvince, zip = checkoutInput.ZipCode, country = checkoutInput.Country }; return(address); }
public async Task <ConfigurationState <RunnerRepoInfo> > Checkout( CheckoutInput checkoutInput, CancellationToken cancel) { try { cancel.ThrowIfCancellationRequested(); _logger.Information("Targeting {PatcherVersioning}", checkoutInput.PatcherVersioning); using var repoCheckout = RepoCheckouts.Get(RunnerRepoDirectoryProvider.Path); var target = ResetToTarget.Reset(repoCheckout.Repository, checkoutInput.PatcherVersioning, cancel); if (target.Failed) { return(target.BubbleFailure <RunnerRepoInfo>()); } cancel.ThrowIfCancellationRequested(); checkoutInput.LibraryNugets.Log(_logger); var slnPath = SolutionFileLocator.GetPath(RunnerRepoDirectoryProvider.Path); if (slnPath == null) { return(GetResponse <RunnerRepoInfo> .Fail("Could not locate solution to run.")); } var foundProjSubPath = RunnerRepoProjectPathRetriever.Get(slnPath.Value, checkoutInput.Proj); if (foundProjSubPath == null) { return(GetResponse <RunnerRepoInfo> .Fail($"Could not locate target project file: {checkoutInput.Proj}.")); } cancel.ThrowIfCancellationRequested(); ModifyRunnerProjects.Modify( slnPath.Value, drivingProjSubPath: foundProjSubPath.SubPath, versions: checkoutInput.LibraryNugets.ReturnIfMatch(new NugetVersionPair(null, null)), listedVersions: out var listedVersions); var runInfo = new RunnerRepoInfo( SolutionPath: slnPath, ProjPath: foundProjSubPath.FullPath, MetaPath: _metaFilePathProvider.Path, Target: target.Value.Target, CommitMessage: target.Value.CommitMessage, CommitDate: target.Value.CommitDate, ListedVersions: listedVersions, TargetVersions: checkoutInput.LibraryNugets.ReturnIfMatch(listedVersions)); return(GetResponse <RunnerRepoInfo> .Succeed(runInfo)); } catch (OperationCanceledException) { throw; } catch (Exception ex) { return(GetResponse <RunnerRepoInfo> .Fail(ex)); } }
public bool CheckOut([FromBody] CheckoutInput input) { return(garage.CheckOut(input.LicensePlateID)); }
public async Task FailedResetToTargetFails( CheckoutInput checkoutInput, CancellationToken cancel, PrepareRunnerRepository sut) { sut.ResetToTarget.Reset(default !, default !, default)