Esempio n. 1
0
        public async Task <PaymentResponse> AuthorizeSoapPayment(string paymentId, string paRes)
        {
            var authorizeRequest = new AuthenticateData(paymentId, paRes);

            var xmlData = XmlPreparer.Serialize(authorizeRequest);

            var(encryptedRc4OneTimeKeyByGatewayPem,
                encryptedPaymentDataByRc4OneTimeKey,
                signature) = await CryptData(xmlData);

            var result = await _ecomClient.AuthenticateAsync(new ecomPaymentType()
            {
                KEY       = encryptedRc4OneTimeKeyByGatewayPem,
                DATA      = encryptedPaymentDataByRc4OneTimeKey,
                KEY_INDEX = _keyIndex.ToString(),
                INTERFACE = _merchantId.ToString(),
                SIGNATURE = signature,
            });

            var verify = _signature.Verify(xmlData, signature);

            if (!verify)
            {
                throw new MedoroException("Signature validation failed");
            }

            var responseData = DecryptData(result.AuthenticateResponse1.DATA, result.AuthenticateResponse1.KEY);

            return(XmlPreparer.Deserialize <PaymentResponse>(responseData));
        }
Esempio n. 2
0
        public async Task <PaymentResponse> PaymentMode6(
            bool isAutoDeposit,
            string descriptor,
            object orderId,
            decimal amount,
            string currency,
            string orderDescription,
            string payerName,
            string payerAddress,
            string payerCity,
            string payerCountry,
            string payerZip,
            string payerPhone,
            string payerEmail,
            string notification,
            Card card        = null,
            int?frequency    = null,
            DateTime?endDate = null
            )
        {
            var paymentData = EcomFactory.CreatePaymentData(
                isAutoDeposit, 6, descriptor, orderId, amount, currency, orderDescription, payerName,
                payerAddress, payerCity, payerCountry, payerZip, payerPhone, payerEmail, notification, card, frequency,
                endDate);

            var xmlData = XmlPreparer.Serialize(paymentData);

            var(encryptedRc4OneTimeKeyByGatewayPem,
                encryptedPaymentDataByRc4OneTimeKey,
                signature) = await CryptData(xmlData);

            var result = await _ecomClient.PaymentAsync(new ecomPaymentType()
            {
                KEY       = encryptedRc4OneTimeKeyByGatewayPem,
                DATA      = encryptedPaymentDataByRc4OneTimeKey,
                KEY_INDEX = _keyIndex.ToString(),
                INTERFACE = _merchantId.ToString(),
                SIGNATURE = signature,
            });

            var verify = _signature.Verify(xmlData, signature);

            if (!verify)
            {
                throw new MedoroException("Signature validation failed");
            }

            var responseData = DecryptData(result.PaymentResponse1.DATA, result.PaymentResponse1.KEY);

            return(XmlPreparer.Deserialize <PaymentResponse>(responseData));
        }
Esempio n. 3
0
        public async Task <PaymentPayload> PaymentMode5(bool isAutoDeposit,
                                                        string descriptor,
                                                        object orderId,
                                                        decimal amount,
                                                        string currency,
                                                        string orderDescription,
                                                        string payerName,
                                                        string payerAddress,
                                                        string payerCity,
                                                        string payerCountry,
                                                        string payerZip,
                                                        string payerPhone,
                                                        string payerEmail,
                                                        string notification,
                                                        Card card        = null,
                                                        int?frequency    = null,
                                                        DateTime?endDate = null)
        {
            var paymentData = EcomFactory.CreatePaymentData(
                isAutoDeposit, 5, descriptor, orderId, amount, currency, orderDescription, payerName,
                payerAddress, payerCity, payerCountry, payerZip, payerPhone, payerEmail, notification, card, frequency,
                endDate);

            var xmlData = XmlPreparer.Serialize(paymentData);

            var(encryptedRc4OneTimeKeyByGatewayPem,
                encryptedPaymentDataByRc4OneTimeKey,
                signature) = await CryptData(xmlData);

            return(new PaymentPayload(
                       encryptedRc4OneTimeKeyByGatewayPem,
                       _keyIndex.ToString(),
                       encryptedPaymentDataByRc4OneTimeKey,
                       _merchantId.ToString(),
                       signature
                       ));
        }
Esempio n. 4
0
        public PaymentResponse AuthorizeFormPayment(string data, string key)
        {
            var responseData = DecryptData(data, key);

            return(XmlPreparer.Deserialize <PaymentResponse>(responseData));
        }