Exemplo n.º 1
0
 public static void profileTransAuthOnlyType(profileTransAuthOnlyType request)
 {
     if (null != request)
     {
         lineItemType(request.lineItems);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Authorizes 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>A string representing the approval code</returns>
        public IGatewayResponse Authorize(Order order)
        {
            var req = new createCustomerProfileTransactionRequest();

            var trans = new profileTransAuthOnlyType();

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

            //order information
            trans.order                     = new orderExType();
            trans.order.description         = order.Description;
            trans.order.invoiceNumber       = order.InvoiceNumber;
            trans.order.purchaseOrderNumber = order.PONumber;

            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;
            req.extraOptions     = order.ExtraOptions;

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

            return(new GatewayResponse(response.directResponse.Split(',')));
        }
 public static void profileTransAuthOnlyType(profileTransAuthOnlyType argument)
 {
     if (null != argument)
     {
         profileTransOrderType(argument);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Authorizes 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>A string representing the approval code</returns>
        public IGatewayResponse Authorize(Order order)
        {
            var req = new createCustomerProfileTransactionRequest();

            var trans = new profileTransAuthOnlyType();

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

            //order information
            trans.order = new orderExType();
            trans.order.description = order.Description;
            trans.order.invoiceNumber = order.InvoiceNumber;
            trans.order.purchaseOrderNumber = order.PONumber;

            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(','));
        }
 public static void profileTransAuthOnlyType(profileTransAuthOnlyType request)
 {
     if (null != request)
     {
         lineItemType(request.lineItems);
     }
 }