Exemple #1
0
        public MoviPaymentResponse MoviPayment(MoviPaymentRequest movipaymentRequest)
        {
            Log(Logger.LogMessageType.Info, "->   -------------------- Comienza la ejecución del método MoviPin.MoviPayment", Logger.LoggingLevelType.Medium);
            MoviPaymentRequestInternal internalObject = new MoviPaymentRequestInternal()
            {
                Amount     = movipaymentRequest.Request.Amount,
                Type       = movipaymentRequest.Request.Type,
                DeviceType = movipaymentRequest.Request.DeviceType,
                SessionID  = movipaymentRequest.Request.SessionID,
                CouponID   = movipaymentRequest.Request.CouponID
            };
            MoviPaymentResponseInternal internalResponse = MoviPaymentInternal(internalObject);
            MoviPaymentResponse         response         = new MoviPaymentResponse();
            MoviPaymentResponseBody     responseBody     = new MoviPaymentResponseBody()
            {
                ResponseCode      = internalResponse.ResponseCode,
                ResponseMessage   = internalResponse.ResponseMessage,
                TransactionID     = internalResponse.TransactionID,
                Fee               = internalResponse.Fee,
                ResultNameSpace   = internalResponse.ResultNameSpace,
                ScheduleID        = internalResponse.ScheduleID,
                TransExtReference = internalResponse.TransExtReference
            };

            response.Response = responseBody;
            Log(Logger.LogMessageType.Info, "->   -------------------- Termina la ejecución del método MoviPin.MoviPayment", Logger.LoggingLevelType.Medium);
            return(response);
        }
        public override IMovilwayApiResponse PerformUtibaOperation(IMovilwayApiRequest requestObject, UMarketSCClient utibaClientProxy, String sessionID)
        {
            MoviPaymentRequestBody  request  = requestObject as MoviPaymentRequestBody;
            MoviPaymentResponseBody response = null;

            coupontransferRequestType couponTransferRequest = new coupontransferRequestType()
            {
                sessionid     = sessionID,
                device_type   = request.DeviceType,
                amount        = request.Amount,
                couponid      = request.MoviPin,
                type          = int.Parse(ConfigurationManager.AppSettings["CouponWalletType"]),
                typeSpecified = true
            };

            KeyValuePair[] keyValues;
            if (!String.IsNullOrEmpty(request.ProductId))
            {
                keyValues = new KeyValuePair[]
                {
                    new KeyValuePair()
                    {
                        key = "host_trans_ref", value = request.ExternalTransactionReference
                    },
                    new KeyValuePair()
                    {
                        key = "dollar_amount", value = request.DollarAmount.ToString()
                    },
                    new KeyValuePair()
                    {
                        key = "exchange_rate", value = request.ExchangeRate.ToString()
                    },
                    new KeyValuePair()
                    {
                        key = "product_id", value = request.ProductId
                    }
                }
            }
            ;
            else
            {
                keyValues = new KeyValuePair[]
                {
                    new KeyValuePair()
                    {
                        key = "host_trans_ref", value = request.ExternalTransactionReference
                    },
                    new KeyValuePair()
                    {
                        key = "dollar_amount", value = request.DollarAmount.ToString()
                    },
                    new KeyValuePair()
                    {
                        key = "exchange_rate", value = request.ExchangeRate.ToString()
                    }
                }
            };

            couponTransferRequest.extra_trans_data = keyValues;

            coupontransferResponse utibaCouponTransferResponse = utibaClientProxy.coupontransfer(new coupontransfer()
            {
                coupontransferRequestType = couponTransferRequest
            });

            if (utibaCouponTransferResponse != null)
            {
                response = new MoviPaymentResponseBody()
                {
                    ResponseCode    = Utils.BuildResponseCode(utibaCouponTransferResponse.coupontransferReturn.result, utibaCouponTransferResponse.coupontransferReturn.result_namespace),
                    ResponseMessage = utibaCouponTransferResponse.coupontransferReturn.result_message,
                    Fee             = utibaCouponTransferResponse.coupontransferReturn.fee,
                    TransactionID   = utibaCouponTransferResponse.coupontransferReturn.transid
                };
            }
            return(response);
        }
    }