public async Task GetPaymentRequestAsync_ExpectedResult_VerifiesCall() { // Arrange var singlePaymentRequest = new SinglePaymentRequest() { PlatformToken = "PlatformToken", UserToken = "UserToken", PaymentRequestToken = "PaymentRequestToken" }; var expectedResult = new SinglePaymentRequestResponse(); var urlSuffix = UrlProvider.GetPaymentUrlSuffix(singlePaymentRequest.PlatformToken, singlePaymentRequest.UserToken, singlePaymentRequest.PaymentRequestToken); _mockAuthorizedRequestsHandler .Setup(m => m.GetOrExceptionAsync <SinglePaymentRequestResponse>(urlSuffix)) .ReturnsAsync(expectedResult) .Verifiable(); var sut = CreateSut(); // Act var result = await sut.GetPaymentRequestAsync(singlePaymentRequest); // Assert Assert.IsNotNull(result); Assert.AreEqual(expectedResult, result); _mockAuthorizedRequestsHandler .Verify(m => m.GetOrExceptionAsync <SinglePaymentRequestResponse>(urlSuffix), Times.Once); }
/// <summary> /// Gets a Single Payment Request using HTTP GET. /// </summary> /// <param name="request">The SinglePaymentRequest object</param> /// <returns>The SinglePaymentRequestResponse object</returns> /// <exception cref="ArgumentNullException">If the SinglePaymentRequest object is null</exception> /// <exception cref="TikkieErrorResponseException">If the Tikkie API returns an error response.</exception> public async Task <SinglePaymentRequestResponse> GetPaymentRequestAsync(SinglePaymentRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return(await _authorizedRequestsHandler .GetOrExceptionAsync <SinglePaymentRequestResponse>(UrlProvider.GetPaymentUrlSuffix(request.PlatformToken, request.UserToken, request.PaymentRequestToken))); }
public void transfer() { SinglePaymentRequest singlePaymentReq = new SinglePaymentRequest(); singlePaymentReq.request = new Request(); singlePaymentReq.request.header = new RequestHeader(); singlePaymentReq.request.body = new RequestBody(); singlePaymentReq.request.header.transactionID = "6301042"; singlePaymentReq.request.header.corporateID = "DSPBR"; singlePaymentReq.request.body.amount = "100"; singlePaymentReq.request.body.debitAccountNo = "1000110010007511"; singlePaymentReq.request.body.debitAccountName = "ABC"; singlePaymentReq.request.body.debitAccountIFSC = "RBLB1122123"; singlePaymentReq.request.body.debitAccountMobile = "7023923603"; singlePaymentReq.request.body.debitTransactionParticulars = "AB"; singlePaymentReq.request.body.debitPartTransactionRemarks = "BC"; singlePaymentReq.request.body.beneficiaryAccountIFSC = "CBIN0R10001"; singlePaymentReq.request.body.beneficiaryAccountNo = "1006211030035980"; singlePaymentReq.request.body.beneficiaryName = "BEN"; singlePaymentReq.request.body.beneficiaryAddress = "ADD"; singlePaymentReq.request.body.beneficiaryTransactionParticulars = "AB"; singlePaymentReq.request.body.beneficiaryPartTransactionRemarks = "BC"; singlePaymentReq.request.body.modeOfPayment = "NEFT"; String userName = System.Environment.GetEnvironmentVariable("API_RBL_USER"); String userPassword = System.Environment.GetEnvironmentVariable("API_RBL_PASSWORD"); String clientId = System.Environment.GetEnvironmentVariable("API_RBL_CLIENT_ID"); String clientSecret = System.Environment.GetEnvironmentVariable("API_RBL_CLIENT_SECRET"); String clientCert = System.Environment.GetEnvironmentVariable("API_RBL_CLIENT_CERT"); String clientCertPassword = System.Environment.GetEnvironmentVariable("API_RBL_CLIENT_CERT_PASSWORD"); UAT env = new APIBanking.Environments.RBL.UAT(userName, userPassword, clientId, clientSecret, clientCert, clientCertPassword); SinglePaymentResponse x = SinglePayment.doSomething(env, singlePaymentReq); Console.WriteLine(x.response.header.status); Console.WriteLine(x.response.header.errorCode); Console.WriteLine(x.response.header.errorDescription); }
public async Task GetPaymentRequestAsync_ExpectedResponse_VerifiesCall() { // Arrange var singlePaymentRequest = new SinglePaymentRequest(); var expectedResult = new SinglePaymentRequestResponse(); var mockPaymentRequestsHandler = new Mock <IPaymentRequestsHandler>(); mockPaymentRequestsHandler .Setup(m => m.GetPaymentRequestAsync(singlePaymentRequest)) .ReturnsAsync(expectedResult) .Verifiable(); var sut = new TikkieClient(Mock.Of <IPlatformRequestsHandler>(), Mock.Of <IUserRequestsHandler>(), mockPaymentRequestsHandler.Object); // Act var result = await sut.GetPaymentRequestAsync(singlePaymentRequest); // Assert Assert.IsNotNull(result); Assert.AreEqual(expectedResult, result); mockPaymentRequestsHandler .Verify(m => m.GetPaymentRequestAsync(singlePaymentRequest), Times.Once); }
/// <summary> /// Gets a Single Payment Request using HTTP GET. /// </summary> /// <param name="request">The SinglePaymentRequest object</param> /// <returns>The SinglePaymentRequestResponse object</returns> /// <exception cref="ArgumentNullException">If the SinglePaymentRequest object is null</exception> /// <exception cref="TikkieErrorResponseException">If the Tikkie API returns an error response.</exception> public async Task <SinglePaymentRequestResponse> GetPaymentRequestAsync(SinglePaymentRequest request) { return(await _paymentRequestsHandler.GetPaymentRequestAsync(request)); }