public async Task <IEvent> Execute(CreateTransactionAuthorize order)
        {
            using (var client = new HttpClient())
            {
                //TODO: MOCK CIELO
                var input = new CreateTransactionInput();

                if (order.TransactionAuthorize.Gateway.Payment.Amount.Equals("99"))
                {
                    return(new PaymentDenied("99"));
                }

                string json = JsonConvert.SerializeObject(input);

                var requestData = new StringContent(json, Encoding.UTF8, "application/json");

                var response = await client.PostAsync(String.Format("http://gateway.stone.com.br"), requestData);

                // CreateTransactionResult result = null;
                // if (response.IsSuccessStatusCode)
                // result = await response.Content.ReadAsAsync<CreateTransactionResult>();

                if (order.TransactionAuthorize.Gateway.Payment.Amount.Equals("99"))
                {
                    return(new PaymentDenied("1"));
                }

                return(new PaymentSuccess(Guid.NewGuid().ToString()));
            }
        }
예제 #2
0
        public async Task <IEvent> Execute(CreateTransactionAuthorize order)
        {
            using (var client = new HttpClient())
            {
                //TODO: MOCK CIELO
                var input = new CreateTransactionInput();
                input.Customer.Name   = order.TransactionAuthorize.Gateway.Billing.Name;
                input.MerchantOrderId = order.TransactionAuthorize.Verification.MerchantId;
                input.Payment.Amount  = Convert.ToInt32(order.TransactionAuthorize.Gateway.Payment.Amount);
                input.Payment.CreditCard.CardNumber = order.TransactionAuthorize.Gateway.Payment.CardNumber;

                if (order.TransactionAuthorize.Gateway.Payment.Amount.Equals("99"))
                {
                    return(new PaymentDenied("99"));
                }

                string json = JsonConvert.SerializeObject(input);

                var requestData = new StringContent(json, Encoding.UTF8, "application/json");

                var response = await client.PostAsync(String.Format("https://developercielo.github.io/manual/cielo-ecommerce#requisi%C3%A7%C3%A3o"), requestData);

                // CreateTransactionResult result = null;
                // if (response.IsSuccessStatusCode)
                // result = await response.Content.ReadAsAsync<CreateTransactionResult>();

                return(new PaymentSuccess(Guid.NewGuid().ToString()));
            }
        }
        public IHttpActionResult CreateTransaction([FromBody] CreateTransactionInput input)
        {
            _multichainServices.SetRequset(this);
            var result = _multichainServices.CreateTransaction(input);

            return(Ok(result));
        }
예제 #4
0
        public object CreateTransaction(CreateTransactionInput input)
        {
            if (!AuthAccountWithBearerToken(input.AddressFrom))
            {
                return(Properties.Resources.AccountNotFound);
            }

            var result = transactionManager.CreateRawSendFrom(
                addressFrom: input.AddressFrom,
                addressTo: input.AddressTo,
                assetname: input.AssetName,
                qty: input.Qty
                );

            return(result);
        }