示例#1
0
        public async Task InitPayment_SpecifiedRequestEncodingAndReturnType_Succeeds(
            HttpRequestEncodingType encodingType, InitPaymentResponseType responseType)
        {
            var connection = new Connection(PlatronClient.PlatronUrl, SettingsStorage.Credentials, encodingType);
            var client     = new PlatronClient(connection);
            // To find out what really happens enable proxy (thru fiddler)
            // and use custom connection over http to watch plain requests
            //.EnableProxy(new WebProxy("http://localhost:8888", false));

            var initPayment = new InitPaymentRequest(1.Rub(), "Money first");

            initPayment.InTestMode();
            initPayment.OrderId = Guid.NewGuid().ToString("N");

            switch (responseType)
            {
            case InitPaymentResponseType.RedirectLink:
                var response = await client.InitPaymentAsync(initPayment);

                Assert.NotNull(response);
                break;

            case InitPaymentResponseType.HtmlForm:
                var html = await client.InitPaymentAsHtmlAsync(initPayment);

                Assert.NotNull(html);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(responseType), responseType, null);
            }
        }
示例#2
0
 public static Uri InitPayment(InitPaymentResponseType urlType)
 {
     switch (urlType)
     {
         case InitPaymentResponseType.RedirectLink:
             return _initPaymentDirectTransitionFromShop;
         case InitPaymentResponseType.HtmlForm:
             return _initPaymentThroughUserBrowser;
         default:
             throw new ArgumentOutOfRangeException(nameof(urlType), urlType, null);
     }
 }
示例#3
0
        public static Uri InitPayment(InitPaymentResponseType urlType)
        {
            switch (urlType)
            {
            case InitPaymentResponseType.RedirectLink:
                return(_initPaymentDirectTransitionFromShop);

            case InitPaymentResponseType.HtmlForm:
                return(_initPaymentThroughUserBrowser);

            default:
                throw new ArgumentOutOfRangeException(nameof(urlType), urlType, null);
            }
        }
        public async Task InitPayment_SpecifiedRequestEncodingAndReturnType_Succeeds(
            HttpRequestEncodingType encodingType, InitPaymentResponseType responseType)
        {
            var connection = new Connection(PlatronClient.PlatronUrl, SettingsStorage.Credentials, encodingType);
            var client = new PlatronClient(connection);
            // To find out what really happens enable proxy (thru fiddler)
            // and use custom connection over http to watch plain requests
            //.EnableProxy(new WebProxy("http://localhost:8888", false));

            var initPayment = new InitPaymentRequest(1.Rur(), "Money first");
            initPayment.InTestMode();
            initPayment.OrderId = Guid.NewGuid().ToString("N");

            switch (responseType)
            {
                case InitPaymentResponseType.RedirectLink:
                    var response = await client.InitPaymentAsync(initPayment);
                    Assert.NotNull(response);
                    break;
                case InitPaymentResponseType.HtmlForm:
                    var html = await client.InitPaymentAsHtmlAsync(initPayment);
                    Assert.NotNull(html);
                    break;
                default:
                    throw new ArgumentOutOfRangeException(nameof(responseType), responseType, null);
            }
        }