示例#1
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));
        }
示例#2
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
                       ));
        }