public void ReturnOutOfProvisionWhenFutureSoldIsLessThanZero() { const uint amountToBeDebited = 301; var creditMock = new Mock <Credit>(); var debitBankAccount = new DebitBankAccount(300); var actualState = debitBankAccount.Debit(amountToBeDebited, creditMock.Object); actualState.ShouldBe(StateTransfer.OutOfProvision); creditMock.Verify(credit => credit(It.IsAny <uint>()), Times.Never); }
public void ReturnLimitTransferIsEqual400ByDefault() { const uint amountToBeDebited = 401; var creditMock = new Mock <Credit>(); var debitBankAccount = new DebitBankAccount(600); var actualState = debitBankAccount.Debit(amountToBeDebited, creditMock.Object); actualState.ShouldBe(StateTransfer.LimitExceed); creditMock.Verify(credit => credit(It.IsAny <uint>()), Times.Never); }
public void UnChangeSoldWhenCreditHasFailed() { const uint expectedSold = 300; const uint amountToBeDebited = 100; var creditMock = new Mock <Credit>(); creditMock.Setup(credit => credit(amountToBeDebited)) .Returns(StateTransfer.Fail); var debitBankAccount = new DebitBankAccount(300); debitBankAccount.Debit(amountToBeDebited, creditMock.Object); debitBankAccount.Sold.ShouldBe(expectedSold); }
public void SubtractSoldWhenCallDebitAndDebitAccountHaveProvisionAndAmountNotExceededLimitAndCreditIsSuccess() { const uint expectedSold = 200; const uint amountToBeDebited = 100; var creditMock = new Mock <Credit>(); creditMock.Setup(credit => credit(amountToBeDebited)) .Returns(StateTransfer.Success); var debitBankAccount = new DebitBankAccount(300); debitBankAccount.Debit(amountToBeDebited, creditMock.Object); debitBankAccount.Sold.ShouldBe(expectedSold); }
ReturnCreditStateOfTransferWhenCallDebitAndDebitAccountHaveProvisionAndAmountNotExceededLimitAndCreditIsSuccess() { const uint amountToBeDebited = 100; var creditMock = new Mock <Credit>(); creditMock.Setup(credit => credit(amountToBeDebited)) .Returns(StateTransfer.Success).Verifiable(); var debitBankAccount = new DebitBankAccount(300); var actualState = debitBankAccount.Debit(amountToBeDebited, creditMock.Object); creditMock.Verify(); actualState.ShouldBe(StateTransfer.Success); }
public ANetApiResponse TestDebitBankAccount() { return(DebitBankAccount.Run(apiLoginId, transactionKey, GetAmount())); }
public void GivenJAiUnCompteChequeAvecUnSoldeDe(uint soldInitial) { this.debitBankAccount = new DebitBankAccount(soldInitial); }
private static void RunMethod(string methodName) { // These are default transaction keys. // You can create your own keys in seconds by signing up for a sandbox account here: https://developer.authorize.net/sandbox/ string apiLoginId = "5KP3u95bQpv"; string transactionKey = "4Ktq966gC55GAX7S"; string transactionAmount; string transactionId = string.Empty; switch (methodName) { case "ValidateCustomerPaymentProfile": ValidateCustomerPaymentProfile.Run(apiLoginId, transactionKey); break; case "UpdateCustomerShippingAddress": UpdateCustomerShippingAddress.Run(apiLoginId, transactionKey); break; case "UpdateCustomerProfile": UpdateCustomerProfile.Run(apiLoginId, transactionKey); break; case "UpdateCustomerPaymentProfile": UpdateCustomerPaymentProfile.Run(apiLoginId, transactionKey); break; case "GetCustomerShippingAddress": GetCustomerShippingAddress.Run(apiLoginId, transactionKey); break; case "GetCustomerProfileIds": GetCustomerProfileIds.Run(apiLoginId, transactionKey); break; case "GetCustomerProfile": GetCustomerProfile.Run(apiLoginId, transactionKey); break; case "GetCustomerPaymentProfile": GetCustomerPaymentProfile.Run(apiLoginId, transactionKey); break; case "DeleteCustomerShippingAddress": DeleteCustomerShippingAddress.Run(apiLoginId, transactionKey); break; case "DeleteCustomerProfile": DeleteCustomerProfile.Run(apiLoginId, transactionKey); break; case "DeleteCustomerPaymentProfile": DeleteCustomerPaymentProfile.Run(apiLoginId, transactionKey); break; case "CreateCustomerShippingAddress": CreateCustomerShippingAddress.Run(apiLoginId, transactionKey); break; case "CreateCustomerProfileFromTransaction": CreateCustomerProfileFromTransaction.Run(apiLoginId, transactionKey); break; case "GetTransactionDetails": GetTransactionDetails.Run(apiLoginId, transactionKey); break; case "GetTransactionList": GetTransactionList.Run(apiLoginId, transactionKey); break; //case "CreateAnApplePayTransaction": // CreateAnApplePayTransaction.Run(apiLoginId, transactionKey); // break; case "DecryptVisaCheckoutData": DecryptVisaCheckoutData.Run(apiLoginId, transactionKey); break; case "CreateVisaCheckoutTransaction": CreateVisaCheckoutTransaction.Run(apiLoginId, transactionKey); break; case "ChargeCreditCard": ChargeCreditCard.Run(apiLoginId, transactionKey); break; case "CaptureOnly": CaptureOnly.Run(apiLoginId, transactionKey); break; case "CapturePreviouslyAuthorizedAmount": Console.WriteLine("Enter An Transaction Amount"); transactionAmount = Console.ReadLine(); Console.WriteLine("Enter An Transaction ID"); transactionId = Console.ReadLine(); CapturePreviouslyAuthorizedAmount.Run(apiLoginId, transactionKey, Convert.ToDecimal(transactionAmount), transactionId); break; case "CaptureFundsAuthorizedThroughAnotherChannel": CaptureFundsAuthorizedThroughAnotherChannel.Run(apiLoginId, transactionKey); break; case "AuthorizeCreditCard": AuthorizeCreditCard.Run(apiLoginId, transactionKey); break; case "Refund": Console.WriteLine("Enter An Transaction Amount"); transactionAmount = Console.ReadLine(); Console.WriteLine("Enter An Transaction ID"); transactionId = Console.ReadLine(); RefundTransaction.Run(apiLoginId, transactionKey, Convert.ToDecimal(transactionAmount), transactionId); break; case "Void": Console.WriteLine("Enter An Transaction ID"); transactionId = Console.ReadLine(); VoidTransaction.Run(apiLoginId, transactionKey, transactionId); break; case "DebitBankAccount": DebitBankAccount.Run(apiLoginId, transactionKey); break; case "CreditBankAccount": Console.WriteLine("Enter An Transaction ID"); transactionId = Console.ReadLine(); CreditBankAccount.Run(apiLoginId, transactionKey, transactionId); break; case "ChargeCustomerProfile": ChargeCustomerProfile.Run(apiLoginId, transactionKey); break; case "ChargeTokenizedCard": ChargeTokenizedCreditCard.Run(apiLoginId, transactionKey); break; case "PayPalVoid": PayPalVoid.Run(apiLoginId, transactionKey, transactionId); break; case "PayPalAuthorizeCapture": PayPalAuthorizeCapture.Run(apiLoginId, transactionKey); break; case "PayPalAuthorizeCaptureContinue": PayPalAuthorizeCaptureContinue.Run(apiLoginId, transactionKey, transactionId); break; case "PayPalAuthorizeOnly": PayPalAuthorizeOnly.Run(apiLoginId, transactionKey); break; case "PayPalAuthorizeOnlyContinue": PayPalAuthorizeCaptureContinue.Run(apiLoginId, transactionKey, transactionId); break; case "PayPalCredit": PayPalCredit.Run(apiLoginId, transactionKey, transactionId); break; case "PayPalGetDetails": PayPalGetDetails.Run(apiLoginId, transactionKey, transactionId); break; case "PayPalPriorAuthorizationCapture": PayPalPriorAuthorizationCapture.Run(apiLoginId, transactionKey, transactionId); break; case "CancelSubscription": CancelSubscription.Run(apiLoginId, transactionKey); break; case "CreateSubscription": CreateSubscription.Run(apiLoginId, transactionKey); break; case "GetSubscriptionList": GetListSubscriptions.Run(apiLoginId, transactionKey); break; case "GetSubscriptionStatus": GetSubscriptionStatus.Run(apiLoginId, transactionKey); break; case "UpdateSubscription": UpdateSubscription.Run(apiLoginId, transactionKey); break; case "CreateCustomerProfile": CreateCustomerProfile.Run(apiLoginId, transactionKey); break; case "CreateCustomerPaymentProfile": CreateCustomerPaymentProfile.Run(apiLoginId, transactionKey); break; case "GetUnsettledTransactionList": GetUnsettledTransactionList.Run(apiLoginId, transactionKey); break; case "GetBatchStatistics": GetBatchStatistics.Run(apiLoginId, transactionKey); break; case "GetSettledBatchList": GetSettledBatchList.Run(apiLoginId, transactionKey); break; default: ShowUsage(); break; } }