Example #1
0
        public ResultGetOperations GetOperation(string merchantTransactionId)
        {
            //Consulta del balance en la cuenta del usuario.
            string Hash        = "";
            string UniqueID    = Guid.NewGuid().ToString();
            string OperationId = merchantTransactionId;
            string StartDate   = null;
            string EndDate     = null;

            //Creamos una instancia del objeto APICredential
            APICredential Credential = new APICredential();

            Credential.APIPassword = ConfigurationManager.AppSettings["APIPassword"];
            Credential.APIUserName = "******";

            //preparamos la cadena de texto a utilizar en el hash
            Hash = merchantTransactionId + UniqueID + OperationId + StartDate + EndDate + Credential.APIPassword.ToString();

            DMCrypt CryptObject = new DMCrypt();

            Hash = CryptObject.GetHashMD5(Hash);
            DMAPISoapClient Client = new DMAPISoapClient();

            //consulta el servicio web
            return(Client.GetOperations(Credential, false, merchantTransactionId, OperationId, StartDate, EndDate, UniqueID, Hash));
        }
Example #2
0
        public ResultGetOperations GetOperation(string merchantTransactionId)
        {
            //Consulta del balance en la cuenta del usuario.
            string Hash = "";
            string UniqueID = Guid.NewGuid().ToString();
            string OperationId = merchantTransactionId;
            string StartDate = null;
            string EndDate = null;

            //Creamos una instancia del objeto APICredential
            APICredential Credential = new APICredential();

            Credential.APIPassword = ConfigurationManager.AppSettings["APIPassword"];
            Credential.APIUserName = "******";

            //preparamos la cadena de texto a utilizar en el hash
            Hash = merchantTransactionId + UniqueID + OperationId + StartDate + EndDate + Credential.APIPassword.ToString();

            DMCrypt CryptObject = new DMCrypt();

            Hash = CryptObject.GetHashMD5(Hash);
            DMAPISoapClient Client = new DMAPISoapClient();

            //consulta el servicio web
            return Client.GetOperations(Credential, false, merchantTransactionId, OperationId, StartDate, EndDate, UniqueID, Hash);
        }
        public APICredential GenerateAPIKey2FA(String validationToken, String smsCode, String keyDescription)
        {
            Endpoint p = ConnectionStrings.Endpoints["generateKey2FA"].Clone();

            p.Path = p.Path.Replace("{token}", validationToken);

            GenerateKeyRequest req = new GenerateKeyRequest();

            req.SMSCode        = smsCode;
            req.KeyDescription = keyDescription;

            GenerateAPIKeyResponse response = connection.Send <GenerateAPIKeyResponse>(p, req);

            if (response.Response == APIResponse.AUTHENTICATION_FAILED)
            {
                throw new InvalidCredentialsException(response.Message);
            }
            else if (response.Response == APIResponse.PIN_RESEND)
            {
                throw new PINRefreshException(response.Message);
            }
            else if (response.Response != APIResponse.SUCCESS)
            {
                throw new ActionFailedException(response.Response.ToString(), response.Message);
            }

            APICredential key = new APICredential();

            key.APIKey    = response.APIKey;
            key.APISecret = response.APISecret;

            return(key);
        }
        public APICredential GenerateAPIKey(String username, String password, String keyDescription)
        {
            Endpoint           p      = ConnectionStrings.Endpoints["generateKey"].Clone();
            GenerateKeyRequest keyReq = new GenerateKeyRequest();

            keyReq.Email          = username;
            keyReq.Password       = password;
            keyReq.KeyDescription = keyDescription;

            GenerateAPIKeyResponse response = connection.Send <GenerateAPIKeyResponse>(p, keyReq);

            if (response.Response == APIResponse.TWO_FA_REQUIRED)
            {
                throw new TwoFactorAuthException(response.Message);
            }
            else if (response.Response == APIResponse.AUTHENTICATION_FAILED)
            {
                throw new InvalidCredentialsException(response.Message);
            }
            else if (response.Response != APIResponse.SUCCESS)
            {
                throw new ActionFailedException(response.Response.ToString(), response.Message);
            }

            APICredential key = new APICredential();

            key.APIKey    = response.APIKey;
            key.APISecret = response.APISecret;

            return(key);
        }
        public APICredential FinishPINRegistration(String email, String pincode, String password, String secretQuestion, String answer, String firstName, String lastName, String keyDescription)
        {
            Endpoint p = ConnectionStrings.Endpoints["finishPINRegistration"].Clone();

            FinishRegistrationRequest req = new FinishRegistrationRequest();

            req.Email     = email;
            req.PinCode   = pincode;
            req.Password  = password;
            req.Question  = secretQuestion;
            req.Answer    = answer;
            req.FirstName = firstName;
            req.LastName  = lastName;

            StandardResponse response = connection.Send <StandardResponse>(p, req);

            if (response.Response == APIResponse.PASSWORD_COMPLEXITY)
            {
                throw new InsufficientPasswordComplexityException(response.Message);
            }
            else if (response.Response == APIResponse.TOKEN_EXPIRED)
            {
                throw new TokenExpiredException(response.Message);
            }
            else if (response.Response == APIResponse.PIN_RESEND)
            {
                throw new PINRefreshException(response.Message);
            }
            else if (response.Response == APIResponse.INVALID_TOKEN)
            {
                throw new InvalidTokenException(response.Message);
            }
            else if (response.Response != APIResponse.SUCCESS)
            {
                throw new ActionFailedException(response.Response.ToString(), response.Message);
            }

            p = ConnectionStrings.Endpoints["generateKey"].Clone();
            GenerateKeyRequest keyReq = new GenerateKeyRequest();

            keyReq.Email          = email;
            keyReq.Password       = password;
            keyReq.KeyDescription = keyDescription;

            GenerateAPIKeyResponse response2 = connection.Send <GenerateAPIKeyResponse>(p, keyReq);

            if (response2.Response != APIResponse.SUCCESS)
            {
                throw new ActionFailedException(response2.Response.ToString(), response2.Message);
            }

            APICredential key = new APICredential();

            key.APIKey    = response2.APIKey;
            key.APISecret = response2.APISecret;

            return(key);
        }
Example #6
0
        public APICredential OAuthGenerateAPIKey(string oauthToken, string keyDescription)
        {
            var p = ConnectionStrings.Endpoints["oauthRegistration"].Clone();

            p.Path = p.Path.Replace("{token}", oauthToken);

            var req = new FinishRegistrationRequest
            {
                KeyDescription = keyDescription
            };

            var response = _connection.Send <GenerateAPIKeyResponse>(p, req);

            switch (response.Response)
            {
            case APIResponse.USER_ALREADY_EXISTS:
                throw new DuplicateUserException(response.Message);

            case APIResponse.AUTH_FORBIDDEN:
                throw new RegistrationNotAllowedException(response.Message);

            case APIResponse.AUTHENTICATION_FAILED:
                throw new InvalidCredentialsException(response.Message);

            default:
            {
                if (response.Response != APIResponse.SUCCESS)
                {
                    throw new ActionFailedException(response.Response.ToString(), response.Message);
                }

                break;
            }
            }

            var key = new APICredential
            {
                APIKey    = response.APIKey,
                APISecret = response.APISecret
            };

            return(key);
        }
Example #7
0
        public APICredential GenerateAPIKey2FA(string validationToken, string smsCode, string keyDescription)
        {
            var p = ConnectionStrings.Endpoints["generateKey2FA"].Clone();

            p.Path = p.Path.Replace("{token}", validationToken);

            var req = new GenerateKeyRequest
            {
                SMSCode        = smsCode,
                KeyDescription = keyDescription
            };

            var response = _connection.Send <GenerateAPIKeyResponse>(p, req);

            switch (response.Response)
            {
            case APIResponse.AUTHENTICATION_FAILED:
                throw new InvalidCredentialsException(response.Message);

            case APIResponse.PIN_RESEND:
                throw new PINRefreshException(response.Message);

            default:
            {
                if (response.Response != APIResponse.SUCCESS)
                {
                    throw new ActionFailedException(response.Response.ToString(), response.Message);
                }

                break;
            }
            }

            var key = new APICredential
            {
                APIKey    = response.APIKey,
                APISecret = response.APISecret
            };

            return(key);
        }
Example #8
0
        public APICredential GenerateAPIKey(string username, string password, string keyDescription)
        {
            var p      = ConnectionStrings.Endpoints["generateKey"].Clone();
            var keyReq = new GenerateKeyRequest
            {
                Email          = username,
                Password       = password,
                KeyDescription = keyDescription
            };

            var response = _connection.Send <GenerateAPIKeyResponse>(p, keyReq);

            switch (response.Response)
            {
            case APIResponse.TWO_FA_REQUIRED:
                throw new TwoFactorAuthException(response.Message);

            case APIResponse.AUTHENTICATION_FAILED:
                throw new InvalidCredentialsException(response.Message);

            default:
            {
                if (response.Response != APIResponse.SUCCESS)
                {
                    throw new ActionFailedException(response.Response.ToString(), response.Message);
                }

                break;
            }
            }

            var key = new APICredential
            {
                APIKey    = response.APIKey,
                APISecret = response.APISecret
            };

            return(key);
        }
        public APICredential OAuthGenerateAPIKey(String oauthToken, String keyDescription)
        {
            Endpoint p = ConnectionStrings.Endpoints["oauthRegistration"].Clone();

            p.Path = p.Path.Replace("{token}", oauthToken);

            FinishRegistrationRequest req = new FinishRegistrationRequest();

            req.KeyDescription = keyDescription;

            GenerateAPIKeyResponse response = connection.Send <GenerateAPIKeyResponse>(p, req);

            if (response.Response == APIResponse.USER_ALREADY_EXISTS)
            {
                throw new DuplicateUserException(response.Message);
            }
            else if (response.Response == APIResponse.AUTH_FORBIDDEN)
            {
                throw new RegistrationNotAllowedException(response.Message);
            }
            else if (response.Response == APIResponse.AUTHENTICATION_FAILED)
            {
                throw new InvalidCredentialsException(response.Message);
            }
            else if (response.Response != APIResponse.SUCCESS)
            {
                throw new ActionFailedException(response.Response.ToString(), response.Message);
            }

            APICredential key = new APICredential();

            key.APIKey    = response.APIKey;
            key.APISecret = response.APISecret;

            return(key);
        }
Example #10
0
        public APICredential FinishPINRegistration(string email, string pincode, string password, string secretQuestion, string answer, string firstName, string lastName, string keyDescription)
        {
            var p = ConnectionStrings.Endpoints["finishPINRegistration"].Clone();

            var req = new FinishRegistrationRequest
            {
                Email     = email,
                PinCode   = pincode,
                Password  = password,
                Question  = secretQuestion,
                Answer    = answer,
                FirstName = firstName,
                LastName  = lastName
            };

            var response = _connection.Send <StandardResponse>(p, req);

            switch (response.Response)
            {
            case APIResponse.PASSWORD_COMPLEXITY:
                throw new InsufficientPasswordComplexityException(response.Message);

            case APIResponse.TOKEN_EXPIRED:
                throw new TokenExpiredException(response.Message);

            case APIResponse.PIN_RESEND:
                throw new PINRefreshException(response.Message);

            case APIResponse.INVALID_TOKEN:
                throw new InvalidTokenException(response.Message);

            default:
            {
                if (response.Response != APIResponse.SUCCESS)
                {
                    throw new ActionFailedException(response.Response.ToString(), response.Message);
                }

                break;
            }
            }

            p = ConnectionStrings.Endpoints["generateKey"].Clone();
            var keyReq = new GenerateKeyRequest
            {
                Email          = email,
                Password       = password,
                KeyDescription = keyDescription
            };

            var response2 = _connection.Send <GenerateAPIKeyResponse>(p, keyReq);

            if (response2.Response != APIResponse.SUCCESS)
            {
                throw new ActionFailedException(response2.Response.ToString(), response2.Message);
            }

            var key = new APICredential
            {
                APIKey    = response2.APIKey,
                APISecret = response2.APISecret
            };

            return(key);
        }
        /// <summary>
        ///     Refund: Realizar Reembolsos
        /// </summary>
        /// <param name="$APIPassword">Valor de seguridad para utilización de la API de DineroMail</param>
        /// <param name="$APIUserName">Usuario para la identificacion en la API de DineroMail</param>
        /// <param name="$Crypt">Indica si se envian los datos encriptados</param>
        /// <param name="$MerchantTransactionId">Identificador transacción, corresponde al identificador de transacción del Comerciente.</param>
        /// <param name="$UniqueMessageId">Identificador único de mensaje, no puede repetirse en futuras conexiones. (Autonumérico)</param>
        /// <param name="$RefundedMerchantTransactionId">Identificador transacción correspondiente a la reembolso</param>
        /// <param name="$Hash">Cadena a encriptar</param>
        /// <returns>
        ///     Estado de la Operación
        /// </returns>
        public string Refund()
        {
            String APIPassword           = "******";
            String APIUserName           = "******";
            bool   Crypt                 = false;
            String MerchantTransactionId = "14324234";
            String UniqueMessageId       = "7398234234997";
            String Currency              = "ARG";
            String Amount                = "10.40";
            String Subject               = "Subject";
            String Message               = "Message";
            String Hash = "";

            DMCrypt Crypto = new DMCrypt();

            // Creamos una instancia del objeto APICredential
            // La Credential es la tarjeta de acceso a la API de DineroMail
            APICredential Credential = new APICredential();

            Credential.APIUserName = APIUserName;
            Credential.APIPassword = APIPassword;

            // El >> Hash << es el cálculo MD5 de los valores
            // de los siguientes parámetros en orden especificado.
            Hash = MerchantTransactionId + UniqueMessageId + Currency + Amount + Subject + Message + APIPassword;
            Hash = Crypto.GetHashMD5(Hash);

            //si se desea enviar encriptado
            if (Crypt)
            {
                Crypto.Key            = Encoding.ASCII.GetBytes(Credential.APIPassword);
                MerchantTransactionId = Crypto.Encrypt(MerchantTransactionId);
                UniqueMessageId       = Crypto.Encrypt(UniqueMessageId);
                Currency        = Crypto.Encrypt(Currency);
                Amount          = Crypto.Encrypt(Amount);
                Subject         = Crypto.Encrypt(Subject);
                Message         = Crypto.Encrypt(Message);
                UniqueMessageId = Crypto.Encrypt(UniqueMessageId);
            }

            DMAPI ClientApi = new DMAPI();

            // Consultamos el servicio web
            // Llamamos al Metodo GetBalance de la API de DineroMail
            ResultRefund RefundResult = ClientApi.Refund(Credential,
                                                         Crypt,
                                                         MerchantTransactionId,
                                                         Currency,
                                                         Amount,
                                                         Subject,
                                                         Message,
                                                         UniqueMessageId,
                                                         Hash);

            //mostramos la respuesta de la operación en pantalla.
            String sResult = "Status: " + RefundResult.Status.ToString() + "<br>";

            sResult += "Message: " + RefundResult.Message.ToString() + "<br>";
            sResult += "MerchantTransactionId: " + RefundResult.MerchantTransactionId.ToString() + "<br>";
            sResult += "TransactionId: " + RefundResult.TransactionId.ToString() + "<br>";

            return(sResult);
        }
        // <summary>
        //      DoPaymentWithReference: "Realizar pago" de Botón o Carrito de compras, con códigos de barra.
        // </summary>
        // <param name="apiPassword">Valor de seguridad para utilización de la API de DineroMail</param>
        // <param name="apiUserName">Usuario para la identificacion en la API de DineroMail</param>
        // <param name="crypt">Indica si se envian los datos encriptados</param>
        // <param name="merchantTransactionId">Identificador transacción, corresponde al identificador de transacción del Comerciente.</param>
        // <param name="uniqueMessageId">Identificador único de mensaje, no puede repetirse en futuras conexiones. (Autonumérico)</param>

        // <param name="provider">Identifica el proveedor con el cual se desea realizar el pago</param>
        // <param name="subject">Concepto o asunto del comprador hacia el vendedor</param>
        // <param name="message">Mensaje del comprador hacia el vendedor</param>

        // <param name="currency">Identificador de la moneda para el ítem</param>
        // <param name="amount">Importe del ítem</param>
        // <param name="code">Identificador generado por el comercio</param>
        // <param name="description">Descripción del ítem</param>
        // <param name="itemName">Nombre o titulo del ítem</param>
        // <param name="quantity">Cantidad de ítems a pagar</param>

        // <param name="address">Dirección del comprador</param>
        // <param name="city">Ciudad o provincia del comprador</param>
        // <param name="country">País del comprador</param>
        // <param name="email">Email del comprador</param>
        // <param name="name">Nombre del comprador</param>
        // <param name="lastName">Apellido del comprador</param>
        // <param name="phone">Teléfono del comprador</param>

        // <param name="ccAddress">Dirección del comprador</param>
        // <param name="ccAddressComplement">Dirección del comprador</param>
        // <param name="ccAddressNumber">Dirección del comprador</param>
        // <param name="ccCity">Ciudad o provincia del comprador</param>
        // <param name="ccCountry">País del comprador</param>
        // <param name="ccNeighborhood">Email del comprador</param>
        // <param name="ccState">Nombre del comprador</param>
        // <param name="ccZipCode">Apellido del comprador</param>
        // <param name="ccBankId">Teléfono del comprador</param>

        // <param name="ccCreditCardNumber">Dirección del comprador</param>
        // <param name="ccDocumentNumber">Dirección del comprador</param>
        // <param name="ccExpirationDate">Dirección del comprador</param>
        // <param name="ccHolder">Ciudad o provincia del comprador</param>
        // <param name="ccInstallment">País del comprador</param>
        // <param name="ccSecurityCode">Email del comprador</param>

        // <param name="hash">Cadena a encriptar</param>
        // <returns>
        //      BarcodeDigits, BarcodeImageUrl, VoucherUrl
        // </returns>
        private string _DoPaymentWithCreditCard()
        {
            String  apiPassword           = "******";
            String  apiUserName           = "******";
            Boolean crypt                 = true;
            String  merchantTransactionId = "1";
            String  uniqueMessageId       = "1";

            String provider = "AR_MASTER";
            String subject  = "Subject";
            String message  = "Message";

            String currency    = "BRL";
            String amount      = "10.40";
            String code        = "A001";
            String description = "Product A001";
            String itemName    = "LCD Monitor";
            String quantity    = "1";

            String address  = "123";
            String city     = "Brasilia";
            String country  = "Brasilia";
            String email    = "*****@*****.**";
            String name     = "Carlos";
            String lastName = "Lopez";
            String phone    = "12341234";

            String ccAddress           = "Street";
            String ccAddressComplement = "";
            String ccAddressNumber     = "123";
            String ccCity         = "";
            String ccCountry      = "";
            String ccNeighborhood = "";
            String ccState        = "";
            String ccZipCode      = "";
            Int32  ccBankId       = 0;

            String ccCreditCardNumber = "5114920090135851";
            String ccDocumentNumber   = "27000000";
            String ccExpirationDate   = "11/14";
            String ccHolder           = "test";
            String ccInstallment      = "1";
            String ccSecurityCode     = "111";

            String hash = "";

            ResultDoPaymentWithCreditCard result = new ResultDoPaymentWithCreditCard();
            DMCrypt Crypto    = new DMCrypt();
            DMAPI   ClientApi = new DMAPI();

            try {
                // Creamos una instancia del objeto APICredential
                // La Credential es la tarjeta de acceso a la API de DineroMail
                APICredential Credential = new APICredential();
                Credential.APIUserName = apiPassword;
                Credential.APIPassword = apiPassword;

                // El Hash es el cálculo MD5 de los valores
                // de los siguientes parámetros en orden especificado.
                String items      = amount + code + currency + description + itemName + quantity;
                String buyer      = name + lastName + email + address + phone + country + city;
                String creditCard = ccInstallment + ccCreditCardNumber + ccHolder + ccExpirationDate +
                                    ccSecurityCode + ccDocumentNumber + ccAddress + ccAddressNumber +
                                    ccAddressComplement + ccZipCode + ccNeighborhood + ccCity +
                                    ccState + ccCountry;

                hash = merchantTransactionId + uniqueMessageId + items + buyer + creditCard +
                       provider + subject + message + apiPassword;

                hash = Crypto.GetHashMD5(hash);

                if (crypt)
                {
                    // Los datos de la API viajarán con una encriptación del tipo TripleDES
                    Crypto.Key            = Encoding.ASCII.GetBytes(Credential.APIPassword);
                    merchantTransactionId = Crypto.Encrypt(merchantTransactionId);
                    uniqueMessageId       = Crypto.Encrypt(uniqueMessageId);
                    currency = Crypto.Encrypt(currency);
                    amount   = Crypto.Encrypt(amount);
                    provider = Crypto.Encrypt(provider);
                    subject  = Crypto.Encrypt(subject);
                    message  = Crypto.Encrypt(message);
                    currency = Crypto.Encrypt(currency);
                    amount   = Crypto.Encrypt(amount);
                    code     = Crypto.Encrypt(code);
                    itemName = Crypto.Encrypt(itemName);
                    quantity = Crypto.Encrypt(quantity);
                    address  = Crypto.Encrypt(address);
                    city     = Crypto.Encrypt(city);
                    country  = Crypto.Encrypt(country);
                    email    = Crypto.Encrypt(email);
                    name     = Crypto.Encrypt(name);
                    lastName = Crypto.Encrypt(lastName);
                    phone    = Crypto.Encrypt(phone);
                }

                Item oItem = new Item();
                oItem.Amount      = amount;
                oItem.Code        = code;
                oItem.Currency    = currency;
                oItem.Description = description;
                oItem.Name        = itemName;
                oItem.Quantity    = quantity;

                Item[] oItemList = { oItem };

                Buyer oBuyer = new Buyer();
                oBuyer.Address  = address;
                oBuyer.City     = city;
                oBuyer.Country  = country;
                oBuyer.Email    = email;
                oBuyer.LastName = lastName;
                oBuyer.Name     = name;
                oBuyer.Phone    = phone;

                CreditCard oCard = new CreditCard();
                oCard.Installment       = ccInstallment;
                oCard.CreditCardNumber  = ccCreditCardNumber;
                oCard.DocumentNumber    = ccDocumentNumber;
                oCard.Holder            = ccHolder;
                oCard.ExpirationDate    = ccExpirationDate;
                oCard.SecurityCode      = ccSecurityCode;
                oCard.Address           = ccAddress;
                oCard.AddressNumber     = ccAddressNumber;
                oCard.AddressComplement = ccAddressComplement;
                oCard.ZipCode           = ccZipCode;
                oCard.Neighborhood      = ccNeighborhood;
                oCard.City    = ccCity;
                oCard.State   = ccState;
                oCard.Country = ccCountry;
                oCard.BankId  = ccBankId;

                // La Credential es la tarjeta de acceso a la API de DineroMail
                APICredential credential = new APICredential();
                credential.APIUserName = apiUserName;
                credential.APIPassword = apiPassword;

                // Llamamos al Metodo doPaymentWithCreditCard de la API de DineroMail
                result = ClientApi.DoPaymentWithCreditCard(credential
                                                           , crypt
                                                           , merchantTransactionId
                                                           , oItemList
                                                           , oBuyer
                                                           , provider
                                                           , oCard
                                                           , subject
                                                           , message
                                                           , uniqueMessageId
                                                           , hash);

                // Mostramos en pantalla el resultado de la operación.
                string sResult = "MerchantTransactionId: " + result.MerchantTransactionId + "<br/>";
                sResult += "TransactionId: " + result.TransactionId + "<br/>";
                sResult += "Status: " + result.Status.ToString() + "<br/>";
                sResult += "Message: " + result.Message + "<br/>";
                sResult += "UniqueMessageId: " + result.UniqueMessageId + "<br/>";
                sResult += "VoucherUrl: " + result.VoucherUrl + "<br/>";

                return(sResult);
            } catch (Exception ex) {
                return(ex.Message);
            }
        }
        /// <summary>
        ///         GetPaymentTicket: Permite obtener un cupón de pago de cualquier proveedor de código de barras y lo asigna al comercio.
        /// </summary>
        /// <param name="$APIPassword">Valor de seguridad para utilización de la API de DineroMail</param>
        /// <param name="$APIUserName">Usuario para la identificacion en la API de DineroMail</param>
        /// <param name="$Crypt">Indica si se envian los datos encriptados</param>
        /// <param name="$MerchantTransactionId">Identificador transacción, corresponde al identificador de transacción del Comerciente.</param>
        /// <param name="$UniqueMessageId">Identificador único de mensaje, no puede repetirse en futuras conexiones. (Autonumérico)</param>
        /// <param name="$Provider">Identifica el proveedor con el cual se desea realizar el pago</param>
        /// <param name="$Currency">Identificador de la moneda para el importe a enviar</param>
        /// <param name="$Amount">Importe a enviar</param>
        /// <param name="$Hash">Cadena a encriptar</param>
        /// <returns>
        ///		Estado de la operación
        /// </returns>
        public string GetPaymentTicket()
        {
            DMCrypt Crypto = new DMCrypt();

            String APIPassword           = "******";
            String APIUserName           = "******";
            bool   Crypt                 = true;
            String MerchantTransactionId = "1";
            String UniqueMessageId       = "1";
            String Currency              = "USD";
            String Amount                = "10.55";
            String Provider              = "servipag";
            String Hash = "";

            // Creamos una instancia del objeto APICredential
            // La Credential es la tarjeta de acceso a la API de DineroMail
            APICredential Credential = new APICredential();

            Credential.APIPassword = APIPassword;
            Credential.APIUserName = APIUserName;

            // El >> Hash << es el cálculo MD5 de los valores
            // de los siguientes parámetros en orden especificado.
            Hash = MerchantTransactionId + UniqueMessageId + Currency + Amount + Provider + Credential.APIPassword;
            Hash = Crypto.GetHashMD5(Hash);

            //si se desea enviar encriptado
            if (Crypt)
            {
                Crypto.Key            = Encoding.ASCII.GetBytes(Credential.APIPassword);
                MerchantTransactionId = Crypto.Encrypt(MerchantTransactionId);
                UniqueMessageId       = Crypto.Encrypt(UniqueMessageId);
                Currency = Crypto.Encrypt(Currency);
                Amount   = Crypto.Encrypt(Amount);
                Provider = Crypto.Encrypt(Provider);
            }

            // Consultamos el servicio web
            // Llamamos al Metodo GetPaymentTicket de la API de DineroMail
            DMAPI Client = new DMAPI();
            ResultGetPaymentTicket PaymentTicketResult = Client.GetPaymentTicket(Credential
                                                                                 , Crypt
                                                                                 , Currency
                                                                                 , Amount
                                                                                 , Provider
                                                                                 , MerchantTransactionId
                                                                                 , UniqueMessageId
                                                                                 , Hash);

            //mostramos la respuesta de la operación en pantalla.
            string sResult = "Status: " + PaymentTicketResult.Status.ToString() + "<br>";

            sResult = sResult + "Message: " + PaymentTicketResult.Message.ToString() + "<br>";
            sResult = sResult + "MerchantTransactionId: " + PaymentTicketResult.MerchantTransactionId.ToString() + "<br>";
            sResult = sResult + "UniqueMessageId: " + PaymentTicketResult.UniqueMessageId.ToString() + "<br>";
            if (PaymentTicketResult.Status.ToString() == "COMPLETED")
            {
                sResult = sResult + "MerchantTransactionId: " + PaymentTicketResult.MerchantTransactionId.ToString() + "<br>";
                sResult = sResult + "TransactionId: " + PaymentTicketResult.TransactionId.ToString() + "<br>";
                sResult = sResult + "BarcodeDigits: " + PaymentTicketResult.BarcodeDigits + "<br>";
                sResult = sResult + "UrlImage: " + PaymentTicketResult.BarcodeImageUrl.ToString() + "<br>";
                sResult = sResult + "Voucher: " + PaymentTicketResult.VoucherUrl.ToString();
            }

            return(sResult);
        }