Exemplo n.º 1
0
        /// <summary>
        /// Voids a previously authorized transaction
        /// </summary>
        /// <param name="profileID">The profile ID.</param>
        /// <param name="paymentProfileId">The payment profile id.</param>
        /// <param name="transactionId">The transaction id.</param>
        /// <param name="approvalCode">The approval code.</param>
        /// <returns></returns>
        public IGatewayResponse Void(string profileID, string paymentProfileId, string transactionId, string approvalCode)
        {
            var req = new createCustomerProfileTransactionRequest();

            var trans = new profileTransVoidType();
            trans.customerProfileId = profileID;
            trans.customerPaymentProfileId = paymentProfileId;
            trans.transId = transactionId;

            req.transaction = new profileTransactionType();
            req.transaction.Item = trans;

            var response = (createCustomerProfileTransactionResponse)_gateway.Send(req);
            return new GatewayResponse(response.directResponse.Split(','));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Captures the specified transaction.
        /// </summary>
        /// <param name="profileID">The profile ID.</param>
        /// <param name="paymentProfileId">The payment profile id.</param>
        /// <param name="shippingProfileId">The id of the shipping information to use for the transaction.</param>
        /// <param name="transId">The transaction id to mark to capture (settle).</param>
        /// <param name="amount">The decimal amount to capture.</param>
        /// <returns></returns>
        public IGatewayResponse PriorAuthCapture(string profileID, string paymentProfileId, string shippingProfileId, string transId, Decimal amount)
        {
            var req = new createCustomerProfileTransactionRequest();

            var trans = new profileTransPriorAuthCaptureType();
            if (!String.IsNullOrEmpty(profileID)) trans.customerProfileId = profileID;
            if (!String.IsNullOrEmpty(paymentProfileId)) trans.customerPaymentProfileId = paymentProfileId;
            //else trans.customerPaymentProfileId = null;
            if (!String.IsNullOrEmpty(transId)) trans.transId = transId;
            //else trans.transId = null;
            trans.amount = amount; // required.
            if (!String.IsNullOrEmpty(shippingProfileId)) trans.customerShippingAddressId = shippingProfileId;
            //else trans.customerShippingAddressId = null;

            req.transaction = new profileTransactionType();
            req.transaction.Item = trans;

            var response = (createCustomerProfileTransactionResponse)_gateway.Send(req);
            return new GatewayResponse(response.directResponse.Split(','));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Captures the specified transaction.
        /// </summary>
        /// <param name="profileID">The profile ID.</param>
        /// <param name="paymentProfileId">The payment profile id.</param>
        /// <param name="cardCode">The 3 or 4 digit card code in the signature space.</param>
        /// <param name="amount">The amount.</param>
        /// <param name="approvalCode">The approval code.</param>
        /// <returns></returns>
        public IGatewayResponse Capture(string profileID, string paymentProfileId, string cardCode, decimal amount, string approvalCode)
        {
            var req = new createCustomerProfileTransactionRequest();

            var trans = new profileTransCaptureOnlyType();
            trans.approvalCode = approvalCode;
            trans.customerProfileId = profileID;
            trans.amount = amount;
            if (!String.IsNullOrEmpty(cardCode)) trans.cardCode = cardCode;
            trans.customerPaymentProfileId = paymentProfileId;

            req.transaction = new profileTransactionType();
            req.transaction.Item = trans;

            var response = (createCustomerProfileTransactionResponse)_gateway.Send(req);
            return new GatewayResponse(response.directResponse.Split(','));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Authorizes and Captures a transaction using the supplied profile information, abstracted through an Order object. Using the Order
        /// you can add line items, specify shipping and tax, etc.
        /// </summary>
        /// <param name="order">The order.</param>
        /// <returns></returns>
        public IGatewayResponse AuthorizeAndCapture(Order order)
        {
            var req = new createCustomerProfileTransactionRequest();

            var trans = new profileTransAuthCaptureType();

            trans.customerProfileId = order.CustomerProfileID;
            trans.customerPaymentProfileId = order.PaymentProfileID;
            trans.amount = order.Total;

            if (!String.IsNullOrEmpty(order.ShippingAddressProfileID)) {
                trans.customerShippingAddressId = order.ShippingAddressProfileID;
            }

            if (order.SalesTaxAmount > 0)
                trans.tax = new extendedAmountType {
                    amount = order.SalesTaxAmount,
                    description = order.SalesTaxName,
                    name = order.SalesTaxName
                };

            if (order.ShippingAmount > 0)
                trans.shipping = new extendedAmountType {
                    amount = order.ShippingAmount,
                    description = order.ShippingName,
                    name = order.ShippingName
                };

            //line items
            if (order._lineItems.Count > 0) {
                trans.lineItems = order._lineItems.ToArray();
            }

            if (order.TaxExempt.HasValue) {
                trans.taxExempt = order.TaxExempt.Value;
                trans.taxExemptSpecified = true;
            }

            if (order.RecurringBilling.HasValue) {
                trans.recurringBilling = order.RecurringBilling.Value;
                trans.recurringBillingSpecified = true;
            }
            if(!String.IsNullOrEmpty(order.CardCode))
                trans.cardCode = order.CardCode;

            req.transaction = new profileTransactionType();
            req.transaction.Item = trans;

            var response = (createCustomerProfileTransactionResponse)_gateway.Send(req);

            return new GatewayResponse(response.directResponse.Split(','));
        }
        /// <summary>
        /// Refunds a transaction for the specified amount
        /// </summary>
        /// <param name="profileID">The profile ID.</param>
        /// <param name="paymentProfileId">The payment profile id.</param>
        /// <param name="transactionId">The transaction id.</param>
        /// <param name="amount">The amount.</param>
        /// <returns></returns>
        public IGatewayResponse Refund(string profileID, string paymentProfileId, string transactionId, decimal amount) {
            var req = new createCustomerProfileTransactionRequest();

            var trans = new profileTransRefundType();
            trans.amount = amount;
            trans.customerProfileId = profileID;
            trans.customerPaymentProfileId = paymentProfileId;
            trans.transId = transactionId;

            req.transaction = new profileTransactionType();
            req.transaction.Item = trans;

            var response = (createCustomerProfileTransactionResponse)_gateway.Send(req);
            return new GatewayResponse(response.directResponse.Split(','));
        }
Exemplo n.º 6
0
        public AuthorizeNet.APICore.createCustomerProfileTransactionResponse CreateProfileTransaction(AuthorizeNet.APICore.profileTransactionType transaction)
        {
            AuthorizeNet.APICore.createCustomerProfileTransactionRequest req = new AuthorizeNet.APICore.createCustomerProfileTransactionRequest();
            req.transaction = transaction;
            req.merchantAuthentication = MerchantAuthenticationType;
            AuthorizeNet.HttpXmlUtility util = new AuthorizeNet.HttpXmlUtility(ServiceMode, MerchantAuthenticationType.name, MerchantAuthenticationType.transactionKey);
            return (AuthorizeNet.APICore.createCustomerProfileTransactionResponse)util.Send(req);

        }