Пример #1
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));
            }
        }
Пример #2
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));
            }
        }