public void OneTimeTearDown()
        {
            //TestContext.Progress.WriteLine($"{DateTimeOffset.Now:yyyy'-'MM'-'dd HH':'mm':'ss.fff} - Eyes: sending json: {JsonConvert.SerializeObject(reportSummary_)}");
            HttpRestClient client = new HttpRestClient(new Uri("http://sdk-test-results.herokuapp.com"));

            client.PostJson("/result", reportSummary_);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Check the [EPayRequest] with the given ApiKey and Token.
        /// </summary>
        /// <param name="apiKey"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public EPayRequestCheckResult CheckEPayRequest(string apiKey, string token)
        {
            var client = new HttpRestClient <string, EPayRequestCheckResult>(_httpClient, ENDPOINT_CheckEpayRequest);

            client.WithApiKey(apiKey);

            try {
                return(client.PostJson(token));
            }
            catch (Exception ex) {
                return(SeptaOperationResult.FailWith <EPayRequestCheckResult>(ex));
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create an [EpayRequest] with the given model and return payment's token and Url.
        /// </summary>
        /// <param name="terminalId">Terminal access key</param>
        /// <param name="apiKey">Your [ApiKey]</param>
        /// <param name="request">[EPayRequest] model to create.</param>
        /// <returns>Payment Url and Payment Token.</returns>
        public EPayRequestResult CreateEpayRequest(Guid terminalId, string apiKey, EPayRequest request)
        {
            var client = new HttpRestClient <EPayRequest, EPayRequestResult>(_httpClient, ENDPOINT_NewEpayRequest);

            client.WithApiKey(apiKey);
            client.WithTerminalId(terminalId);

            try {
                return(client.PostJson(request));
            }
            catch (Exception ex) {
                return(SeptaOperationResult.FailWith <EPayRequestResult>(ex));
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Cancel payment based on the given Token.
        /// </summary>
        /// <param name="apiKey">Divider [ApiKey]</param>
        /// <param name="token">Payment token</param>
        /// <returns>A boolean value representing if cancel process is successful or not.</returns>
        public CancelPaymentResult CancelPayment(string apiKey, string token)
        {
            apiKey.CheckArgumentIsNull(nameof(apiKey));
            token.CheckArgumentIsNull(nameof(token));

            var client = new HttpRestClient <string, bool>(_httpClient, ENDPOINT_CancelPayment);

            client.WithApiKey(apiKey);

            try {
                var result = client.PostJson(token);
                return(CancelPaymentResult.Ok(result));
            }
            catch (Exception ex) {
                return(CancelPaymentResult.Failed(ex));
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Cancel the payment amount and Refund it's amount
        /// </summary>
        /// <param name="apiKey">Divider [ApiKey]</param>
        /// <param name="request">Cancel amount request model</param>
        /// <returns></returns>
        public CancelAmountResult CancelAmount(string apiKey, CancelAmountRequest request)
        {
            apiKey.CheckArgumentIsNull(nameof(apiKey));
            request.CheckArgumentIsNull(nameof(request));

            var client = new HttpRestClient <CancelAmountRequest, CancelAmountResult>
                             (_httpClient, ENDPOINT_CancelAmount);

            client.WithApiKey(apiKey);

            try {
                var svcResult = client.PostJson(request);
                return(CancelAmountResult.Ok(svcResult.CancelledAmount));
            }
            catch (Exception ex) {
                return(CancelAmountResult.Failed(ex));
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Unblock amount of an [EPayRequest]
        /// </summary>
        /// <param name="apiKey">Divider User [ApiKey]</param>
        /// <param name="request">Divide Unblock amount request model</param>
        /// <returns></returns>
        public UnblockAmountResult UnblockAmount(string apiKey, UnblockAmountRequest request)
        {
            apiKey.CheckArgumentIsNull(nameof(apiKey));
            request.CheckArgumentIsNull(nameof(request));

            var client = new HttpRestClient <UnblockAmountRequest, UnblockAmountResult>
                             (_httpClient, ENDPOINT_UnblockAmount);

            client.WithApiKey(apiKey);

            try {
                var svcResult = client.PostJson(request);
                return(UnblockAmountResult.Ok(svcResult.UnblockedAmount));
            }
            catch (Exception ex) {
                return(SeptaOperationResult.FailWith <UnblockAmountResult>(ex));
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Create a Divided [EPayRequest] with the given model.
        /// </summary>
        /// <param name="terminalId">Terminal access key</param>
        /// <param name="apiKey">User's (Divider) [ApiKey]</param>
        /// <param name="request">[EPayRequest] model to create</param>
        /// <returns>Payment Token and Url</returns>
        public EPayRequestResult CreateDivideEPayRequest(Guid terminalId,
                                                         string apiKey,
                                                         DividedEPayRequest request)
        {
            request.CheckArgumentIsNull(nameof(request));
            apiKey.CheckArgumentIsNull(nameof(apiKey));

            var client = new HttpRestClient <DividedEPayRequest, EPayRequestResult>
                             (_httpClient, ENDPOINT_NewDivideEpayRequest);

            client.WithApiKey(apiKey);
            client.WithTerminalId(terminalId);

            try {
                return(client.PostJson(request));
            }
            catch (Exception ex) {
                return(SeptaOperationResult.FailWith <EPayRequestResult>(ex));
            }
        }
        public void OneTimeTearDown()
        {
            HttpRestClient client = new HttpRestClient(new Uri("http://sdk-test-results.herokuapp.com"));

            client.PostJson("/result", reportSummary_);
        }