public void Init()
        {
            Configuration configuration = new Configuration();

            configuration.AddApiKey("APG-API-KEY", "APG3oNq6T4xJTzPiyaLRBIQqfW8VhswK4a79zGxG1nPM7pPtPO5JXUqooEtxQUxl"); /// CHANGE api key to yours.
            instance = new PaymentApi(configuration);
        }
Ejemplo n.º 2
0
        public IHttpActionResult Pay()
        {
            var request    = Context.AuthenticatedRequest;
            var repository = new RecordRepository();

            var siteId      = request.GetPostInt("siteId");
            var productId   = request.GetPostString("productId");
            var productName = request.GetPostString("productName");
            var fee         = request.GetPostDecimal("fee");
            var channel     = request.GetPostString("channel");
            var message     = request.GetPostString("message");
            var isMobile    = request.GetPostBool("isMobile");
            var successUrl  = request.GetPostString("successUrl");
            var orderNo     = Regex.Replace(Convert.ToBase64String(Guid.NewGuid().ToByteArray()), "[/+=]", "");

            successUrl += "&orderNo=" + orderNo;

            var paymentApi = new PaymentApi(siteId);

            var recordInfo = new RecordInfo
            {
                SiteId      = siteId,
                Message     = message,
                ProductId   = productId,
                ProductName = productName,
                Fee         = fee,
                OrderNo     = orderNo,
                Channel     = channel,
                IsPayed     = false,
                UserName    = request.UserName,
                AddDate     = DateTime.Now
            };

            repository.Insert(recordInfo);

            var redirectUrl    = string.Empty;
            var wxPayQrCodeUrl = string.Empty;
            var wxPayOrderNo   = string.Empty;

            if (channel == "AliPay")
            {
                redirectUrl = paymentApi.ChargeByAliPay(productName, fee, orderNo, successUrl);
            }
            if (channel == "WxPay")
            {
                var apiUrl = Context.Environment.ApiUrl;

                wxPayOrderNo = orderNo;
                var notifyUrl = UrlUtils.GetWxPayNotifyUrl(apiUrl, wxPayOrderNo, siteId);
                var url       = HttpUtility.UrlEncode(paymentApi.ChargeByWxPay(productName, fee, orderNo, notifyUrl));
                wxPayQrCodeUrl = UrlUtils.GetWxPayQrCodeUrl(apiUrl, url);
            }

            return(Ok(new
            {
                Value = redirectUrl,
                WxPayQrCodeUrl = wxPayQrCodeUrl,
                WxPayOrderNo = wxPayOrderNo
            }));
        }
Ejemplo n.º 3
0
        public static HttpResponseMessage WxPayNotify()
        {
            var request    = Context.AuthenticatedRequest;
            var repository = new RecordRepository();

            var siteId  = request.GetQueryInt("siteId");
            var orderNo = request.GetQueryString("orderNo");

            var paymentApi = new PaymentApi(siteId);

            paymentApi.NotifyByWxPay(HttpContext.Current.Request, out var isPayed, out var responseXml);
            //var filePath = Path.Combine(Main.PhysicalApplicationPath, "log.txt");
            //File.WriteAllText(filePath, responseXml);
            if (isPayed)
            {
                repository.UpdateIsPayed(orderNo);
            }

            var response = new HttpResponseMessage {
                Content = new StringContent(responseXml)
            };

            response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/xml");
            response.StatusCode = HttpStatusCode.OK;

            return(response);
        }
Ejemplo n.º 4
0
        public bool Pagar(Pago pago)
        {
            var mes  = pago.FechaExpiracion.Substring(0, 2);
            var anio = pago.FechaExpiracion.Substring(5, 2);

            var purchase = new Purchase()
            {
                CardNumber     = pago.NumeroTarjeta,
                CardType       = "CREDIT",
                CardCvv        = pago.CardCvv,
                CardExpireDate = new DateTime(Convert.ToInt32(anio), Convert.ToInt32(mes), 1),
                Cost           = pago.Costo,
                Description    = pago.Descripcion
            };

            var paymentApi = new PaymentApi();

            try
            {
                paymentApi.Pagar(purchase);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Ejemplo n.º 5
0
 public ActionResult Payment([FromBody] PaymentApi paymentApi)
 {
     if (paymentApi == null)
     {
         return(Json(new ResultsJson(new Message(CodeMessage.PostNull, "PostNull"), null)));
     }
     return(Json(Global.BUSS.BussResults(this, paymentApi)));
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 后台编辑表单绑定时的处理
        /// </summary>
        public void OnFormBind(PaymentApiEditForm form, PaymentApi bindFrom)
        {
            var apiData = bindFrom.ExtraData.GetOrDefault <ApiData>("ApiData") ?? new ApiData();

            ApiDataEditing.PartnerId    = apiData.PartnerId;
            ApiDataEditing.PartnerKey   = apiData.PartnerKey;
            ApiDataEditing.ReturnDomain = apiData.ReturnDomain;
        }
Ejemplo n.º 7
0
        public static object ApiPay(IRequest request)
        {
            var siteId      = request.GetPostInt("siteId");
            var productId   = request.GetPostString("productId");
            var productName = request.GetPostString("productName");
            var fee         = request.GetPostDecimal("fee");
            var channel     = request.GetPostString("channel");
            var message     = request.GetPostString("message");
            var isMobile    = request.GetPostBool("isMobile");
            var successUrl  = request.GetPostString("successUrl");
            var orderNo     = Regex.Replace(Convert.ToBase64String(Guid.NewGuid().ToByteArray()), "[/+=]", "");

            successUrl += "&orderNo=" + orderNo;

            var paymentApi = new PaymentApi(siteId);

            var recordInfo = new RecordInfo
            {
                SiteId      = siteId,
                Message     = message,
                ProductId   = productId,
                ProductName = productName,
                Fee         = fee,
                OrderNo     = orderNo,
                Channel     = channel,
                IsPaied     = false,
                UserName    = request.UserName,
                AddDate     = DateTime.Now
            };

            RecordDao.Insert(recordInfo);

            if (channel == "alipay")
            {
                return(isMobile
                    ? paymentApi.ChargeByAlipayMobi(productName, fee, orderNo, successUrl)
                    : paymentApi.ChargeByAlipayPc(productName, fee, orderNo, successUrl));
            }
            if (channel == "weixin")
            {
                var apiUrl = Context.PluginApi.GetPluginApiUrl(Main.PluginId);

                var notifyUrl = $"{apiUrl}/{nameof(ApiWeixinNotify)}/{orderNo}?siteId={siteId}";
                var url       = HttpUtility.UrlEncode(paymentApi.ChargeByWeixin(productName, fee, orderNo, notifyUrl));
                var qrCodeUrl = $"{apiUrl}/{nameof(ApiQrCode)}?qrcode={url}";
                return(new
                {
                    qrCodeUrl,
                    orderNo
                });
            }
            if (channel == "jdpay")
            {
                return(paymentApi.ChargeByJdpay(productName, fee, orderNo, successUrl));
            }

            return(null);
        }
Ejemplo n.º 8
0
        public static object ApiOrdersPay(IRequest context)
        {
            if (!context.IsUserLoggin)
            {
                return(null);
            }

            var siteId     = context.GetPostInt("siteId");
            var orderId    = context.GetPostInt("orderId");
            var channel    = context.GetPostString("channel");
            var isMobile   = context.GetPostBool("isMobile");
            var successUrl = context.GetPostString("successUrl");

            if (string.IsNullOrEmpty(successUrl))
            {
                successUrl = Context.SiteApi.GetSiteUrl(siteId);
            }

            var siteInfo  = Context.SiteApi.GetSiteInfo(siteId);
            var orderInfo = OrderDao.GetOrderInfo(orderId);

            orderInfo.Channel = channel;

            var paymentApi = new PaymentApi(siteId);

            var amount  = orderInfo.TotalFee;
            var orderNo = orderInfo.Guid;

            successUrl = $"{successUrl}?guid={orderNo}";
            if (channel == "alipay")
            {
                return(isMobile
                    ? paymentApi.ChargeByAlipayMobi(siteInfo.SiteName, amount, orderNo, successUrl)
                    : paymentApi.ChargeByAlipayPc(siteInfo.SiteName, amount, orderNo, successUrl));
            }
            if (channel == "weixin")
            {
                var apiUrl = Context.PluginApi.GetPluginApiUrl(Main.PluginId);

                var notifyUrl = $"{apiUrl}/{nameof(StlShoppingPay.ApiPayWeixinNotify)}/{orderNo}";
                var url       = HttpUtility.UrlEncode(paymentApi.ChargeByWeixin(siteInfo.SiteName, amount, orderNo, notifyUrl));
                var qrCodeUrl =
                    $"{apiUrl}/{nameof(StlShoppingPay.ApiPayQrCode)}?qrcode={url}";
                return(new
                {
                    qrCodeUrl,
                    orderNo
                });
            }
            if (channel == "jdpay")
            {
                return(paymentApi.ChargeByJdpay(siteInfo.SiteName, amount, orderNo, successUrl));
            }

            return(null);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 后台编辑表单绑定时的处理
        /// </summary>
        public void OnFormBind(PaymentApiEditForm form, IDatabaseContext context, PaymentApi bindFrom)
        {
            var apiData = bindFrom.ExtraData.GetOrDefault <ApiData>("ApiData") ?? new ApiData();

            ApiDataEditing.PartnerId    = apiData.PartnerId;
            ApiDataEditing.PartnerKey   = apiData.PartnerKey;
            ApiDataEditing.PartnerEmail = apiData.PartnerEmail;
            ApiDataEditing.ServiceType  = apiData.ServiceType;
            ApiDataEditing.ReturnDomain = apiData.ReturnDomain;
        }
        public PaymentController(IOptions <ConnectionConfiguration> connection)
        {
            _paymentsManager = new PaymentsManager(connection.Value.ConnectionString,
                                                   new BeneficiaryManager(connection.Value.ConnectionString)
                                                   );

            _paymentApi            = new PaymentApi(_paymentsManager, new Bundles.Core.Api.Response.StatusCodes());
            _userManager           = new UserManager(connection.Value.ConnectionString);
            _authenticationManager = new AuthenticationManager(_userManager);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 获取支付接口的处理器列表
        /// 没有时抛出未知类型的例外
        /// </summary>
        /// <param name="api">支付接口</param>
        /// <returns></returns>
        public static IList <IPaymentApiHandler> GetHandlers(this PaymentApi api)
        {
            var handlers = Application.Ioc.ResolveMany <IPaymentApiHandler>().Where(h => h.Type == api.Type).ToList();

            if (!handlers.Any())
            {
                throw new BadRequestException(string.Format(new T("Unknown payment api type {0}"), api.Type));
            }
            return(handlers);
        }
Ejemplo n.º 12
0
        public static object ApiPay(IRequest request)
        {
            var siteId     = request.GetPostInt("siteId");
            var channelId  = request.GetPostInt("channelId");
            var contentId  = request.GetPostInt("contentId");
            var amount     = request.GetPostDecimal("amount");
            var channel    = request.GetPostString("channel");
            var message    = request.GetPostString("message");
            var isMobile   = request.GetPostBool("isMobile");
            var successUrl = request.GetPostString("successUrl");
            var orderNo    = Regex.Replace(Convert.ToBase64String(Guid.NewGuid().ToByteArray()), "[/+=]", "");

            successUrl += "&orderNo=" + orderNo;

            var paymentApi = new PaymentApi(siteId);

            var recordInfo = new RecordInfo
            {
                PublishmentSystemId = siteId,
                ChannelId           = channelId,
                ContentId           = contentId,
                Message             = message,
                Amount  = amount,
                OrderNo = orderNo,
                IsPaied = false,
                AddDate = DateTime.Now
            };

            Main.RecordDao.Insert(recordInfo);

            if (channel == "alipay")
            {
                return(isMobile
                    ? paymentApi.ChargeByAlipayMobi("文章打赏", amount, orderNo, successUrl)
                    : paymentApi.ChargeByAlipayPc("文章打赏", amount, orderNo, successUrl));
            }
            if (channel == "weixin")
            {
                var notifyUrl = Main.FilesApi.GetApiHttpUrl(nameof(ApiWeixinNotify), orderNo);
                var url       = HttpUtility.UrlEncode(paymentApi.ChargeByWeixin("文章打赏", amount, orderNo, notifyUrl));
                var qrCodeUrl =
                    $"{Main.FilesApi.GetApiHttpUrl(nameof(ApiQrCode))}?qrcode={url}";
                return(new
                {
                    qrCodeUrl,
                    orderNo
                });
            }
            if (channel == "jdpay")
            {
                return(paymentApi.ChargeByJdpay("文章打赏", amount, orderNo, successUrl));
            }

            return(null);
        }
Ejemplo n.º 13
0
 public ActionResult Payment([FromBody] PaymentApi paymentApi)
 {
     if (paymentApi == null)
     {
         return(Json(new ResultsJson(new Message(CodeMessage.PostNull, "PostNull"), null)));
     }
     return(Json(Global.BUSS.BussResults(ApiType.PaymentApi,
                                         paymentApi.token,
                                         paymentApi.method,
                                         paymentApi.param)));
 }
Ejemplo n.º 14
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var requestObj = new CreatePaymentRequest();

            var v2PaymentsClientReferenceInformationObj = new V2paymentsClientReferenceInformation
            {
                Code = "TC45572-1"
            };

            requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj;

            var v2PaymentsOrderInformationObj = new V2paymentsOrderInformation();

            var v2PaymentsOrderInformationAmountDetailsObj = new V2paymentsOrderInformationAmountDetails
            {
                TotalAmount = "5432",
                Currency    = "USD"
            };

            v2PaymentsOrderInformationObj.AmountDetails = v2PaymentsOrderInformationAmountDetailsObj;

            requestObj.OrderInformation = v2PaymentsOrderInformationObj;

            var v2PaymentsPaymentInformationObj = new V2paymentsPaymentInformation();

            var customerObj = new V2paymentsPaymentInformationCustomer
            {
                CustomerId = "5303162577043192705841"
            };

            v2PaymentsPaymentInformationObj.Customer = customerObj;

            requestObj.PaymentInformation = v2PaymentsPaymentInformationObj;

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/pts/v2/payments",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new PaymentApi(configurationSwagger);
                var result = apiInstance.CreatePayment(requestObj);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
Ejemplo n.º 15
0
 public Gateway(ClientContext _context)
 {
     context         = _context;
     authApi         = new AuthenticationApi(context.Config);
     orderApi        = new OrderApi(context.Config);
     payApi          = new PaymentApi(context.Config);
     verifyApi       = new VerificationApi(context.Config);
     currencyApi     = new CurrencyConversionApi(context.Config);
     fraudApi        = new FraudDetectApi(context.Config);
     paySchedulesApi = new PaymentSchedulesApi(context.Config);
     payTokenApi     = new PaymentTokenApi(context.Config);
     payUrlApi       = new PaymentURLApi(context.Config);
     infoApi         = new InformationLookupApi(context.Config);
 }
Ejemplo n.º 16
0
        public void SetUp()
        {
            MockRepository  = new MockRepository(MockBehavior.Strict);
            SetupMockLogger = MockRepository.Create <ILogger <PaymentsSetup> >(MockBehavior.Loose);
            ApiMockLogger   = MockRepository.Create <ILogger <PaymentApi> >(MockBehavior.Loose);
            MockPaymentApi  = MockRepository.Create <IPaymentApi>(MockBehavior.Loose);

            MockRepository = new MockRepository(MockBehavior.Strict)
            {
                DefaultValue = DefaultValue.Empty
            };


            instance = new PaymentApi(ApiMockLogger.Object);
        }
Ejemplo n.º 17
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType   = "GET",
                RequestTarget = "/pts/v2/payments/5319754772076048103525"
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new PaymentApi(configurationSwagger);
                var result = apiInstance.GetPayment("5319754772076048103525");
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
Ejemplo n.º 18
0
        public static HttpResponseMessage ApiPayWeixinNotify(IRequest context, string orderNo)
        {
            var response = new HttpResponseMessage();

            var paymentApi = new PaymentApi(context.GetQueryInt("siteId"));

            bool   isPaied;
            string responseXml;

            paymentApi.NotifyByWeixin(HttpContext.Current.Request, out isPaied, out responseXml);
            if (isPaied)
            {
                OrderDao.UpdateIsPaied(orderNo);
            }

            response.Content = new StringContent(responseXml);
            response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/xml");
            response.StatusCode = HttpStatusCode.OK;

            return(response);
        }
Ejemplo n.º 19
0
        private async void btnBuyUnlimited_Click(object sender, EventArgs e)
        {
            var dr = MessageBox.Show("To unlock the feature limitation of GW2MH-R you need to pay 5€, do you want to buy now?", "Unlock Feature Limits", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dr == DialogResult.Yes)
            {
                Cursor = Cursors.WaitCursor;

                var paymentCreateResponse = await PaymentApi.CreatePayment(LoginResponse.name);

                if (paymentCreateResponse.success)
                {
                    Process.Start(paymentCreateResponse.approvalLink);
                }
                else
                {
                    MessageBox.Show(paymentCreateResponse.error_message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                Cursor = Cursors.Default;
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 后台编辑表单绑定时的处理
        /// </summary>
        public void OnFormBind(PaymentApiEditForm form, PaymentApi bindFrom)
        {
            var templateManager = Application.Ioc.Resolve <TemplateManager>();
            var webhookUrl      = HttpManager.CurrentContext.Request.Host + "/payment/pingpp/webhook";

            form.Form.Fields.Insert(0, new FormField(new AlertHtmlFieldAttribute("Alert", "danger"))
            {
                Value = new T("Please sure you set the webhook url [{0}] on Ping++", webhookUrl)
            });
            var apiData = bindFrom.ExtraData.GetOrDefault <ApiData>("ApiData") ?? new ApiData();

            ApiDataEditing.TradeSecretKey       = apiData.TradeSecretKey;
            ApiDataEditing.PingppAppId          = apiData.PingppAppId;
            ApiDataEditing.PingppRsaPublicKey   = apiData.PingppRsaPublicKey;
            ApiDataEditing.PartnerRsaPrivateKey = apiData.PartnerRsaPrivateKey;
            ApiDataEditing.ReturnDomain         = apiData.ReturnDomain;
            ApiDataEditing.PaymentChannels      = apiData.PaymentChannels.ToList();
            ApiDataEditing.WeChatOpenId         = apiData.WeChatOpenId;
            ApiDataEditing.WeChatNoCredit       = apiData.WeChatNoCredit;
            ApiDataEditing.FqlChildMerchantId   = apiData.FqlChildMerchantId;
            ApiDataEditing.BfbRequireLogin      = apiData.BfbRequireLogin;
        }
        /// <summary>
        /// 获取支付时使用的Html
        /// 交易不存在等错误发生时返回错误信息
        /// </summary>
        public virtual HtmlString GetPaymentHtml(long transactionId)
        {
            // 获取交易和支付接口
            PaymentTransaction transaction = null;
            PaymentApi         api         = null;

            UnitOfWork.ReadData <PaymentTransaction>(r => {
                transaction = r.GetById(transactionId);
                api         = transaction == null ? null : transaction.Api;
                var _       = api == null ? null : api.Type;           // 在数据库连接关闭前抓取类型
            });
            // 检查交易和接口是否存在
            if (transaction == null)
            {
                return(BuildErrorHtml(new T("Payment transaction not found")));
            }
            else if (api == null)
            {
                return(BuildErrorHtml(new T("Payment api not exist")));
            }
            // 检查当前登录用户是否可以支付
            var result = transaction.Check(c => c.IsPayerLoggedIn);

            if (!result.First)
            {
                return(BuildErrorHtml(result.Second));
            }
            result = transaction.Check(c => c.IsPayable);
            if (!result.First)
            {
                return(BuildErrorHtml(result.Second));
            }
            // 调用接口处理器生成支付html
            var html     = new HtmlString("No Result");
            var handlers = api.GetHandlers();

            handlers.ForEach(h => h.GetPaymentHtml(transaction, ref html));
            return(html);
        }
Ejemplo n.º 22
0
        private async Task <bool> PayCreditCardAsync(decimal price, params string[] paymentParameters)
        {
            if (paymentParameters == null)
            {
                throw new ArgumentNullException(nameof(paymentParameters));
            }
            if (price <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(price));
            }

            try
            {
                var ccNumber       = new CreditCardNumber(paymentParameters[2]);
                var expDate        = new ExpirationDate(int.Parse(paymentParameters[3]), int.Parse(paymentParameters[4]));
                var validationCode = new CardValidationCode(paymentParameters[5]);

                var creditCard = new CreditCard(paymentParameters[1] + " " + paymentParameters[0],
                                                ccNumber,
                                                expDate,
                                                validationCode);

                var paymentApi = new PaymentApi(paymentParameters[6]);

                var result = await paymentApi.CreateTransactionAsync(price, creditCard, paymentParameters[0]);

                if (result.Equals(PaymentResult.PaymentSuccessful))
                {
                    return(true);
                }
            }
            catch (Exception)
            {
                return(false);
            }

            return(false);
        }
Ejemplo n.º 23
0
        public IHttpActionResult GetConfig()
        {
            var request = Context.AuthenticatedRequest;
            var siteId  = request.GetQueryInt("siteId");
            var type    = request.GetQueryString("type");
            var apiUrl  = Context.Environment.ApiUrl;

            if (!request.IsAdminLoggin || !request.AdminPermissions.HasSitePermissions(siteId, Main.PluginId))
            {
                return(Unauthorized());
            }

            var paymentApi = new PaymentApi(siteId);

            var redirectUrl    = string.Empty;
            var wxPayQrCodeUrl = string.Empty;
            var wxPayOrderNo   = string.Empty;

            if (Utils.EqualsIgnoreCase(type, "AliPay"))
            {
                redirectUrl = paymentApi.ChargeByAliPay("测试", 0.01M, Utils.GetShortGuid(), "https://www.alipay.com");
            }
            else if (Utils.EqualsIgnoreCase(type, "WxPay"))
            {
                wxPayOrderNo = Utils.GetShortGuid();
                var notifyUrl = UrlUtils.GetWxPayNotifyUrl(apiUrl, wxPayOrderNo, siteId);
                var url       = HttpUtility.UrlEncode(paymentApi.ChargeByWxPay("测试", 0.01M, wxPayOrderNo, notifyUrl));
                wxPayQrCodeUrl = UrlUtils.GetWxPayQrCodeUrl(apiUrl, url);
            }

            return(Ok(new
            {
                Value = redirectUrl,
                WxPayQrCodeUrl = wxPayQrCodeUrl,
                WxPayOrderNo = wxPayOrderNo
            }));
        }
Ejemplo n.º 24
0
        public static HttpResponseMessage ApiWeixinNotify(IRequest request, string orderNo)
        {
            var response = new HttpResponseMessage();

            var siteId     = request.GetQueryInt("siteId");
            var paymentApi = new PaymentApi(siteId);

            bool   isPaied;
            string responseXml;

            paymentApi.NotifyByWeixin(HttpContext.Current.Request, out isPaied, out responseXml);
            //var filePath = Path.Combine(Main.PhysicalApplicationPath, "log.txt");
            //File.WriteAllText(filePath, responseXml);
            if (isPaied)
            {
                RecordDao.UpdateIsPaied(orderNo);
            }

            response.Content = new StringContent(responseXml);
            response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/xml");
            response.StatusCode = HttpStatusCode.OK;

            return(response);
        }
Ejemplo n.º 25
0
        private async void FrmMain_Load(object sender, EventArgs e)
        {
            ttDefault.SetToolTip(numBaseSpeedMultiplier, "If Speedhack is enabled, this defines the speed in percent how fast your character is moving.");
            ttDefault.SetToolTip(numExtSpeedMultiplier, "If Speedhack is enabled and Left Shift is pressed, then it multiplies your speed using this value.");
            ttDefault.SetToolTip(cbAntiKick, "Every 5 seconds, W and S is being sent to the game to keep you ingame.");

#if DEBUG
            DevTools.Visible = true;
#endif

            if (await PaymentApi.PaymentDetails(LoginResponse.name))
            {
                numBaseSpeedMultiplier.Maximum = 999999;
                numExtSpeedMultiplier.Maximum  = 999999;
                btnRemoteTP.Enabled            = true;
                ttDefault.SetToolTip(btnRemoteTP, "Get your items and money remotely from trading post.");
            }
            else
            {
                btnBuyUnlimited.Visible = true;
                btnRemoteTP.Enabled     = false;
                ttDefault.SetToolTip(btnRemoteTP, "Buy GW2MH-R Feature Limit Unlock to unlock this feature.");
            }
        }
Ejemplo n.º 26
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var requestObj = new CreatePaymentRequest();

            var v2PaymentsClientReferenceInformationObj = new V2paymentsClientReferenceInformation
            {
                Code = "TC45555-1"
            };

            requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj;

            var consumerAuthenticationInformationObj = new V2paymentsConsumerAuthenticationInformation
            {
                Cavv = "EHuWW9PiBkWvqE5juRwDzAUFBAk=",
                UcafCollectionIndicator = "2",
                UcafAuthenticationData  = "EHuWW9PiBkWvqE5juRwDzAUFBAk"
            };

            requestObj.ConsumerAuthenticationInformation = consumerAuthenticationInformationObj;

            var v2PaymentsProcessingInformationObj = new V2paymentsProcessingInformation
            {
                CommerceIndicator = "spa"
            };

            requestObj.ProcessingInformation = v2PaymentsProcessingInformationObj;

            var v2PaymentsOrderInformationObj = new V2paymentsOrderInformation();

            var v2PaymentsOrderInformationBillToObj = new V2paymentsOrderInformationBillTo
            {
                Country            = "SG",
                LastName           = "Deo",
                Address2           = "test",
                Address1           = "201 S. Division St.",
                PostalCode         = "48104-2201",
                Locality           = "Ann Arbor",
                AdministrativeArea = "MI",
                FirstName          = "John",
                PhoneNumber        = "999999999",
                District           = "MI",
                BuildingNumber     = "123",
                Company            = "Visa",
                Email = "*****@*****.**"
            };

            v2PaymentsOrderInformationObj.BillTo = v2PaymentsOrderInformationBillToObj;

            var amountDetailsObj = new V2paymentsOrderInformationAmountDetails
            {
                TotalAmount = "2016.05",
                Currency    = "USD"
            };

            v2PaymentsOrderInformationObj.AmountDetails = amountDetailsObj;

            requestObj.OrderInformation = v2PaymentsOrderInformationObj;

            var v2PaymentsPaymentInformationObj = new V2paymentsPaymentInformation();

            var v2PaymentsPaymentInformationCardObj = new V2paymentsPaymentInformationCard
            {
                ExpirationYear  = "2031",
                Number          = "5641821111166669",
                SecurityCode    = "123",
                ExpirationMonth = "12",
                Type            = "042"
            };

            v2PaymentsPaymentInformationObj.Card = v2PaymentsPaymentInformationCardObj;

            requestObj.PaymentInformation = v2PaymentsPaymentInformationObj;

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/pts/v2/payments",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new PaymentApi(configurationSwagger);
                var result = apiInstance.CreatePayment(requestObj);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
Ejemplo n.º 27
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var requestObj = new CreatePaymentRequest();

            var v2PaymentsClientReferenceInformationObj = new V2paymentsClientReferenceInformation
            {
                Code = "TC50171_7"
            };

            requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj;

            var v2PaymentsProcessingInformationObj = new V2paymentsProcessingInformation
            {
                CommerceIndicator = "recurring"
            };

            requestObj.ProcessingInformation = v2PaymentsProcessingInformationObj;

            var v2PaymentsAggregatorInformationObj = new V2paymentsAggregatorInformation();

            var v2PaymentsAggregatorInformationSubMerchantObj = new V2paymentsAggregatorInformationSubMerchant
            {
                CardAcceptorId     = "1234567890",
                Country            = "US",
                PhoneNumber        = "650-432-0000",
                Address1           = "900 Metro Center",
                PostalCode         = "94404-2775",
                Locality           = "Foster City",
                Name               = "Visa Inc",
                AdministrativeArea = "CA",
                Region             = "PEN",
                Email              = "*****@*****.**"
            };

            v2PaymentsAggregatorInformationObj.SubMerchant = v2PaymentsAggregatorInformationSubMerchantObj;

            v2PaymentsAggregatorInformationObj.Name         = "V-Internatio";
            v2PaymentsAggregatorInformationObj.AggregatorId = "123456789";
            requestObj.AggregatorInformation = v2PaymentsAggregatorInformationObj;

            var v2PaymentsOrderInformationObj = new V2paymentsOrderInformation();

            var v2PaymentsOrderInformationBillToObj = new V2paymentsOrderInformationBillTo
            {
                Country            = "US",
                LastName           = "Deo",
                Address2           = "Address 2",
                Address1           = "201 S. Division St.",
                PostalCode         = "48104-2201",
                Locality           = "Ann Arbor",
                AdministrativeArea = "MI",
                FirstName          = "John",
                PhoneNumber        = "999999999",
                District           = "MI",
                BuildingNumber     = "123",
                Company            = "Visa",
                Email = "*****@*****.**"
            };

            v2PaymentsOrderInformationObj.BillTo = v2PaymentsOrderInformationBillToObj;

            var amountDetailsObj = new V2paymentsOrderInformationAmountDetails
            {
                TotalAmount = "106.00",
                Currency    = "USD"
            };

            v2PaymentsOrderInformationObj.AmountDetails = amountDetailsObj;

            requestObj.OrderInformation = v2PaymentsOrderInformationObj;

            var v2PaymentsPaymentInformationObj = new V2paymentsPaymentInformation();

            var v2PaymentsPaymentInformationCardObj = new V2paymentsPaymentInformationCard
            {
                ExpirationYear  = "2031",
                Number          = "5555555555554444",
                SecurityCode    = "123",
                ExpirationMonth = "12",
                Type            = "002"
            };

            v2PaymentsPaymentInformationObj.Card = v2PaymentsPaymentInformationCardObj;

            requestObj.PaymentInformation = v2PaymentsPaymentInformationObj;

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/pts/v2/payments",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new PaymentApi(configurationSwagger);
                var result = apiInstance.CreatePayment(requestObj);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
Ejemplo n.º 28
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var requestObj = new CreatePaymentRequest();

            var v2PaymentsClientReferenceInformationObj = new V2paymentsClientReferenceInformation
            {
                Code = "TC_MPOS_Paymentech_3"
            };

            requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj;

            var v2PaymentsProcessingInformationObj = new V2paymentsProcessingInformation
            {
                CommerceIndicator = "internet"
            };

            requestObj.ProcessingInformation = v2PaymentsProcessingInformationObj;

            var v2PaymentsOrderInformationObj = new V2paymentsOrderInformation();

            var v2PaymentsOrderInformationBillToObj = new V2paymentsOrderInformationBillTo
            {
                Country            = "US",
                FirstName          = "John",
                LastName           = "Deo",
                PhoneNumber        = "6504327113",
                Address1           = "901 Metro Center Blvd",
                PostalCode         = "94404",
                Locality           = "Foster City",
                AdministrativeArea = "CA",
                Email = "*****@*****.**"
            };

            v2PaymentsOrderInformationObj.BillTo = v2PaymentsOrderInformationBillToObj;

            var amountDetailsObj = new V2paymentsOrderInformationAmountDetails
            {
                TotalAmount = "100",
                Currency    = "USD"
            };

            v2PaymentsOrderInformationObj.AmountDetails = amountDetailsObj;

            requestObj.OrderInformation = v2PaymentsOrderInformationObj;

            var v2PaymentsPaymentInformationObj = new V2paymentsPaymentInformation();

            var tokenizedCardObj = new V2paymentsPaymentInformationTokenizedCard
            {
                ExpirationYear  = "2031",
                Number          = "4111111111111111",
                ExpirationMonth = "12",
                TransactionType = "1"
            };

            v2PaymentsPaymentInformationObj.TokenizedCard = tokenizedCardObj;

            requestObj.PaymentInformation = v2PaymentsPaymentInformationObj;

            var consumerAuthenticationInformationObj = new V2paymentsConsumerAuthenticationInformation
            {
                Cavv = "AAABCSIIAAAAAAACcwgAEMCoNh+=",
                Xid  = "T1Y0OVcxMVJJdkI0WFlBcXptUzE="
            };

            requestObj.ConsumerAuthenticationInformation = consumerAuthenticationInformationObj;

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/pts/v2/payments",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new PaymentApi(configurationSwagger);
                var result = apiInstance.CreatePayment(requestObj);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
Ejemplo n.º 29
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var requestObj = new CreatePaymentRequest();

            var v2PaymentsClientReferenceInformationObj = new V2paymentsClientReferenceInformation
            {
                Code = "1234567890"
            };

            requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj;

            var v2PaymentsDeviceInformationObj = new V2paymentsDeviceInformation
            {
                IpAddress = "66.185.179.2"
            };

            requestObj.DeviceInformation = v2PaymentsDeviceInformationObj;

            var v2PaymentsProcessingInformationObj = new V2paymentsProcessingInformation
            {
                Capture = true
            };

            requestObj.ProcessingInformation = v2PaymentsProcessingInformationObj;

            var v2PaymentsOrderInformationObj = new V2paymentsOrderInformation();

            var v2PaymentsOrderInformationBillToObj = new V2paymentsOrderInformationBillTo
            {
                Country            = "US",
                FirstName          = "John",
                LastName           = "Deo",
                PhoneNumber        = "6504327113",
                Address2           = "Desk M3-5573",
                Address1           = "901 Metro Center Blvd",
                PostalCode         = "94404",
                Locality           = "Foster City",
                Company            = "Visa",
                AdministrativeArea = "CA",
                Email = "*****@*****.**"
            };

            v2PaymentsOrderInformationObj.BillTo = v2PaymentsOrderInformationBillToObj;

            var v2PaymentsOrderInformationAmountDetailsObj = new V2paymentsOrderInformationAmountDetails
            {
                TotalAmount = "2201",
                Currency    = "USD"
            };

            v2PaymentsOrderInformationObj.AmountDetails = v2PaymentsOrderInformationAmountDetailsObj;

            requestObj.OrderInformation = v2PaymentsOrderInformationObj;

            var v2PaymentsPaymentInformationObj = new V2paymentsPaymentInformation();

            var v2PaymentsPaymentInformationCardObj = new V2paymentsPaymentInformationCard
            {
                ExpirationYear  = "2031",
                Number          = "4111111111111111",
                SecurityCode    = "123",
                ExpirationMonth = "12"
            };

            v2PaymentsPaymentInformationObj.Card = v2PaymentsPaymentInformationCardObj;

            requestObj.PaymentInformation = v2PaymentsPaymentInformationObj;

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/pts/v2/payments",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new PaymentApi(configurationSwagger);
                var result = apiInstance.CreatePayment(requestObj);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
Ejemplo n.º 30
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var requestObj = new CreatePaymentRequest();

            var v2PaymentsClientReferenceInformationObj = new V2paymentsClientReferenceInformation
            {
                Code = "33557799"
            };

            requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj;

            var v2PaymentsPointOfSaleInformationObj = new V2paymentsPointOfSaleInformation
            {
                TerminalId  = "terminal",
                CardPresent = true
            };

            var emvObj = new V2paymentsPointOfSaleInformationEmv
            {
                CardSequenceNumber = "123",
                Tags =
                    "9C01019A031207109F33036040209F1A0207849F370482766E409F3602001F82025C009F2608EF7753429A5D16B19F100706010A03A00000950580000400009F02060000000700009F6E0482766E409F5B04123456789F2701809F3403AB12349F0902AB129F4104AB1234AB9F0702AB129F0610123456789012345678901234567890AB9F030200005F2A0207849F7C031234569F350123"
            };

            v2PaymentsPointOfSaleInformationObj.Emv = emvObj;

            v2PaymentsPointOfSaleInformationObj.EntryMode          = "QRCode";
            v2PaymentsPointOfSaleInformationObj.TerminalCapability = 4;
            requestObj.PointOfSaleInformation = v2PaymentsPointOfSaleInformationObj;

            var v2PaymentsProcessingInformationObj = new V2paymentsProcessingInformation
            {
                CommerceIndicator = "retail",
                PaymentSolution   = "012"
            };

            requestObj.ProcessingInformation = v2PaymentsProcessingInformationObj;

            var v2PaymentsOrderInformationObj = new V2paymentsOrderInformation();

            var v2PaymentsOrderInformationBillToObj = new V2paymentsOrderInformationBillTo
            {
                Country            = "US",
                LastName           = "Deo",
                Address2           = "test",
                Address1           = "201 S. Division St.",
                PostalCode         = "48104-2201",
                Locality           = "Ann Arbor",
                AdministrativeArea = "MI",
                FirstName          = "John",
                PhoneNumber        = "999999999",
                District           = "MI",
                BuildingNumber     = "123",
                Company            = "Visa",
                Email = "*****@*****.**"
            };

            v2PaymentsOrderInformationObj.BillTo = v2PaymentsOrderInformationBillToObj;

            var amountDetailsObj = new V2paymentsOrderInformationAmountDetails
            {
                TotalAmount = "100.00",
                Currency    = "USD"
            };

            v2PaymentsOrderInformationObj.AmountDetails = amountDetailsObj;

            requestObj.OrderInformation = v2PaymentsOrderInformationObj;

            var v2PaymentsPaymentInformationObj = new V2paymentsPaymentInformation();

            var tokenizedCardObj = new V2paymentsPaymentInformationTokenizedCard
            {
                TransactionType = "1",
                RequestorId     = "12345678901"
            };

            v2PaymentsPaymentInformationObj.TokenizedCard = tokenizedCardObj;

            var v2PaymentsPaymentInformationCardObj = new V2paymentsPaymentInformationCard
            {
                Type = "001"
            };

            // v2paymentsPaymentInformationCardObj.TrackData = ";4111111111111111=21121019761186800000?";
            v2PaymentsPaymentInformationObj.Card = v2PaymentsPaymentInformationCardObj;

            requestObj.PaymentInformation = v2PaymentsPaymentInformationObj;

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/pts/v2/payments",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new PaymentApi(configurationSwagger);
                var result = apiInstance.CreatePayment(requestObj);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }