Beispiel #1
0
        private RestRequest buildAuthorizeRequest(
            string amount,
            string currency,
            MobilePayOnlineInfo mpoInfo,
            string pares,
            AuthorizationRequestOptions opts)
        {
            var restRequest = buildRestRequest("authorizations/");

            restRequest.AddParameter("amount", amount);
            restRequest.AddParameter("currency", currency);
            restRequest.AddParameters(mpoInfo.GetArgs());

            if (!string.IsNullOrWhiteSpace(pares))
            {
                restRequest.AddParameter("mobilepayonline[pares]", pares);
            }

            if (opts != null)
            {
                restRequest.AddParameters(opts.GetArgs());
            }

            return(restRequest);
        }
Beispiel #2
0
        /*
         * AUTHORIZATION IMPLEMENTATION
         */

        // Build an authorization request using a credit card.
        private RestRequest buildAuthorizeRequest(
            string amount,
            string currency,
            Card cc,
            string pares,
            AuthorizationRequestOptions opts)
        {
            var restRequest = buildRestRequest("authorizations/");

            restRequest.AddParameter("amount", amount);
            restRequest.AddParameter("currency", currency);
            restRequest.AddParameters(cc.GetArgs());

            if (!string.IsNullOrWhiteSpace(pares))
            {
                restRequest.AddParameter("card[pares]", pares);
            }

            if (opts != null)
            {
                restRequest.AddParameters(opts.GetArgs());
            }

            return(restRequest);
        }
Beispiel #3
0
        private RestRequest buildAuthorizeRequest(
            string amount,
            string currency,
            ApplePayInfo apInfo,
            AuthorizationRequestOptions opts)
        {
            var restRequest = buildRestRequest("authorizations/");

            restRequest.AddParameter("amount", amount);
            restRequest.AddParameter("currency", currency);
            restRequest.AddParameters(apInfo.GetArgs());

            if (opts != null)
            {
                restRequest.AddParameters(opts.GetArgs());
            }

            return(restRequest);
        }
Beispiel #4
0
 /// <summary>
 /// <see cref="Authorize(string, string, MobilePayOnlineInfo, string, AuthorizationRequestOptions)"/>
 /// </summary>
 /// <param name="amount">Amount of money to reserve, minor units of <c>currency</c> (Required)</param>
 /// <param name="currency">Currency in which <c>amount</c> is specified (Required)</param>
 /// <param name="mpoInfo">MobilePay Online payment information (Required)</param>
 /// <param name="pares">3D-Secure result (omittable)</param>
 /// <param name="opts">Optional parameters for authorizations or null (Omittable)</param>
 /// <exception cref="ClrhsNetException">Network error communicating with gateway</exception>
 /// <exception cref="ClrhsAuthException">Thrown if APIKey is invalid</exception>
 /// <exception cref="ClrhsGatewayException">Thrown if gateway responds with internal server error</exception>
 /// <exception cref="ClrhsException">Unexpected connection error</exception>
 /// <remarks>Signing must be enabled for this method to function</remarks>
 async public Task <Authorization> AuthorizeAsync(string amount, string currency, MobilePayOnlineInfo mpoInfo, string pares, AuthorizationRequestOptions opts)
 {
     using (var restRequest = buildAuthorizeRequest(amount, currency, mpoInfo, pares, opts))
     {
         return(await POSTtoObjectAsync <Authorization>(restRequest));
     }
 }
Beispiel #5
0
 /// <summary>
 /// Creates an authorization against the Gateway.
 /// See https://github.com/clearhaus/gateway-api-docs/blob/master/source/index.md#authentication
 /// </summary>
 /// <param name="amount">Amount of money to reserve, minor units of <c>currency</c> (Required)</param>
 /// <param name="currency">Currency in which <c>amount</c> is specified (Required)</param>
 /// <param name="mpoInfo">MobilePay Online payment information (Required)</param>
 /// <param name="pares">3D-Secure result (omittable)</param>
 /// <param name="opts">Optional parameters for authorizations or null (Omittable)</param>
 /// <exception cref="ClrhsNetException">Network error communicating with gateway</exception>
 /// <exception cref="ClrhsAuthException">Thrown if APIKey is invalid</exception>
 /// <exception cref="ClrhsGatewayException">Thrown if gateway responds with internal server error</exception>
 /// <exception cref="ClrhsException">Unexpected connection error</exception>
 /// <remarks>Signing must be enabled for this method to function</remarks>
 public Authorization Authorize(string amount, string currency, MobilePayOnlineInfo mpoInfo, string pares, AuthorizationRequestOptions opts)
 {
     using (var restRequest = buildAuthorizeRequest(amount, currency, mpoInfo, pares, opts))
     {
         return(POSTtoObject <Authorization>(restRequest));
     }
 }
Beispiel #6
0
 /// <summary>
 /// <see cref="Authorize(string, string, ApplePayInfo, AuthorizationRequestOptions)"/>
 /// </summary>
 /// <param name="amount">Amount of money to reserve, minor units of <c>currency</c> (Required)</param>
 /// <param name="currency">Currency in which <c>amount</c> is specified (Required)</param>
 /// <param name="apInfo">Apple Pay payment information (Required)</param>
 /// <param name="opts">Optional parameters for authorizations or null (Omittable)</param>
 /// <exception cref="ClrhsNetException">Network error communicating with gateway</exception>
 /// <exception cref="ClrhsAuthException">Thrown if APIKey is invalid</exception>
 /// <exception cref="ClrhsGatewayException">Thrown if gateway responds with internal server error</exception>
 /// <exception cref="ClrhsException">Unexpected connection error</exception>
 /// <remarks>Signing must be enabled for this method to function</remarks>
 async public Task <Authorization> AuthorizeAsync(string amount, string currency, ApplePayInfo apInfo, AuthorizationRequestOptions opts)
 {
     using (var restRequest = buildAuthorizeRequest(amount, currency, apInfo, opts))
     {
         return(await POSTtoObjectAsync <Authorization>(restRequest));
     }
 }
Beispiel #7
0
 /// <summary>
 /// Creates an authorization against the Gateway.
 /// See https://github.com/clearhaus/gateway-api-docs/blob/master/source/index.md#authentication
 /// </summary>
 /// <param name="amount">Amount of money to reserve, minor units of <c>currency</c> (Required)</param>
 /// <param name="currency">Currency in which <c>amount</c> is specified (Required)</param>
 /// <param name="apInfo">Apple Pay payment information (Required)</param>
 /// <param name="opts">Optional parameters for authorizations or null (Omittable)</param>
 /// <exception cref="ClrhsNetException">Network error communicating with gateway</exception>
 /// <exception cref="ClrhsAuthException">Thrown if APIKey is invalid</exception>
 /// <exception cref="ClrhsGatewayException">Thrown if gateway responds with internal server error</exception>
 /// <exception cref="ClrhsException">Unexpected connection error</exception>
 /// <remarks>Signing must be enabled for this method to function</remarks>
 public Authorization Authorize(string amount, string currency, ApplePayInfo apInfo, AuthorizationRequestOptions opts)
 {
     using (var restRequest = buildAuthorizeRequest(amount, currency, apInfo, opts))
     {
         return(POSTtoObject <Authorization>(restRequest));
     }
 }
Beispiel #8
0
 /// <summary>
 /// <see cref="Authorize(string, string, Card, string, AuthorizationRequestOptions)"/>
 /// </summary>
 /// <param name="amount">Amount of money to reserve, minor units of <c>currency</c> (Required)</param>
 /// <param name="currency">Currency in which <c>amount</c> is specified (Required)</param>
 /// <param name="cc">Card to authorize against. <see cref="Clearhaus.Gateway.Card"/> (Required)</param>
 /// <param name="pares">3D-Secure result (omittable)</param>
 /// <param name="opts">Optional parameters for authorizations or null (Omittable)</param>
 /// <exception cref="ClrhsNetException">Network error communicating with gateway</exception>
 /// <exception cref="ClrhsAuthException">Thrown if APIKey is invalid</exception>
 /// <exception cref="ClrhsGatewayException">Thrown if gateway responds with internal server error</exception>
 /// <exception cref="ClrhsException">Unexpected connection error</exception>
 async public Task <Authorization> AuthorizeAsync(string amount, string currency, Card cc, string pares, AuthorizationRequestOptions opts)
 {
     using (var restRequest = buildAuthorizeRequest(amount, currency, cc, pares, opts))
     {
         return(await POSTtoObjectAsync <Authorization>(restRequest));
     }
 }
Beispiel #9
0
 /// <summary>
 /// Creates an authorization against the Gateway.
 /// See https://github.com/clearhaus/gateway-api-docs/blob/master/source/index.md#authentication
 /// </summary>
 /// <param name="amount">Amount of money to reserve, minor units of <c>currency</c> (Required)</param>
 /// <param name="currency">Currency in which <c>amount</c> is specified (Required)</param>
 /// <param name="cc">Card to authorize against. <see cref="Clearhaus.Gateway.Card"/> (Required)</param>
 /// <param name="pares">3D-Secure result (omittable)</param>
 /// <param name="opts">Optional parameters for authorizations or null (Omittable)</param>
 /// <exception cref="ClrhsNetException">Network error communicating with gateway</exception>
 /// <exception cref="ClrhsAuthException">Thrown if APIKey is invalid</exception>
 /// <exception cref="ClrhsGatewayException">Thrown if gateway responds with internal server error</exception>
 /// <exception cref="ClrhsException">Unexpected connection error</exception>
 public Authorization Authorize(string amount, string currency, Card cc, string pares, AuthorizationRequestOptions opts)
 {
     using (var restRequest = buildAuthorizeRequest(amount, currency, cc, pares, opts))
     {
         return(POSTtoObject <Authorization>(restRequest));
     }
 }