public void should_call_AttemptPayment() { //arrange var customerId = AddCustomer(); int creditcardId = StoreCreditCard(customerId); var request = new AttemptPayment { Amount = 10, CustomerId = customerId, Paymentods = new[] { new Paymentod { CreditcardId = creditcardId } } }; //act var actual = Sut.AttemptPayment(request); //assert Assert.AreEqual(200, actual.Code); Assert.IsEmpty(actual.Message); Assert.AreEqual("OK", actual.Status); }
public void Run() { var customerId = AddCustomer(); int creditcardId = StoreCreditCard(customerId); var request = new AttemptPayment { Amount = 10, CustomerId = customerId, PayMethods = new[] { new PayMethod { CreditCardId = creditcardId } } }; try { var result = _transactionsService.AttemptPayment(request); if (!result.IsSuccess()) { throw new Exception("Attempt payment failed."); } Console.WriteLine("Payment attempt with id: " + result.Id); } catch (Exception) { } }
public int AttemptPayment() { var customerId = this._customerId; int creditcardId = StoreCreditCard(customerId); int invoiceId = CreateInvoice(customerId); var request = new AttemptPayment { Amount = 10, CustomerId = customerId, PayMethods = new[] { new PayMethod { CreditCardId = creditcardId } }, AppliedTo = new[] { new TransactionAppliedTo { InvoiceId = invoiceId } } }; try { var result = _transactionsService.AttemptPayment(request); if (!result.IsSuccess()) { throw new Exception("Attempt payment failed."); } return(result.Id); } catch (Exception) { } return(0); }
/// <summary> /// Attempt a payment /// details: https://developer.chargeover.com/apidocs/rest/#pay-transaction /// </summary> public IIdentityResponse AttemptPayment(AttemptPayment request) { return(Create("transaction?action=pay", request)); }