public ResponseObject ChargeAndCapture(TransactionFields request)
        {
            var requestParams = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>(Constants.Status, request.Status),
                new KeyValuePair <string, string>(Constants.TerminalId, request.TerminalId),
                new KeyValuePair <string, string>(Constants.Action, request.Action),
                new KeyValuePair <string, string>(Constants.AmountBase, request.AmountBase.ToString()),
                new KeyValuePair <string, string>(Constants.AmountShipping, request.AmountShipping.ToString()),
                new KeyValuePair <string, string>(Constants.AmountTip, request.AmountTip.ToString()),
                new KeyValuePair <string, string>(Constants.AmountReject, request.AmountReject.ToString()),
                new KeyValuePair <string, string>(Constants.AmountSurcharge, request.AmountSurcharge.ToString()),
                new KeyValuePair <string, string>(Constants.BillingIdentifier, request.BillingContact.BillingIdentifier),
                new KeyValuePair <string, string>(Constants.BillingFirstName, request.BillingContact.BillingFirstName),
                new KeyValuePair <string, string>(Constants.BillingMiddleName, request.BillingContact.BillingMiddleName),
                new KeyValuePair <string, string>(Constants.BillingLastName, request.BillingContact.BillingLastName),
                new KeyValuePair <string, string>(Constants.BillingCompanyName, request.BillingContact.BillingCompanyName),
                new KeyValuePair <string, string>(Constants.BillingJobTitle, request.BillingContact.BillingJobTitle),
                new KeyValuePair <string, string>(Constants.BillingPhone, request.BillingContact.BillingPhone),
                new KeyValuePair <string, string>(Constants.BillingPhone2, request.BillingContact.BillingPhone2),
                new KeyValuePair <string, string>(Constants.BillingAddress, request.BillingContact.BillingAddress),
                new KeyValuePair <string, string>(Constants.BillingCity, request.BillingContact.BillingCity),
                new KeyValuePair <string, string>(Constants.BillingState, request.BillingContact.BillingState),
                new KeyValuePair <string, string>(Constants.BillingZip, request.BillingContact.BillingZip),
                new KeyValuePair <string, string>(Constants.BillingCountry, request.BillingContact.BillingCountry),
                new KeyValuePair <string, string>(Constants.BillingEmail, request.BillingContact.BillingEmail),
                new KeyValuePair <string, string>(Constants.BillingWebsite, request.BillingContact.BillingWebsite),
                new KeyValuePair <string, string>(Constants.CardNumber, request.CreditCard.CardNumber),
                new KeyValuePair <string, string>(Constants.CardExpMonth, request.CreditCard.CardExpMonth),
                new KeyValuePair <string, string>(Constants.CardExpYear, request.CreditCard.CardExpYear),
                new KeyValuePair <string, string>(Constants.CardCvv, request.CreditCard.CardCvv),
            };

            var content = FormatRequestParameters(requestParams);

            return(Execute(content));
        }
示例#2
0
    public static string TransactionFieldModel(Transaction transaction)
    {
        TransactionFields fields = new TransactionFields
        {
            local_id = new LocalId {
                stringValue = transaction.user_local
            },
            initial_amount = new Amount {
                doubleValue = transaction.initial_amount
            },
            final_amount = new Amount {
                doubleValue = transaction.final_amount
            },
            type = new TransactionType {
                stringValue = transaction.type
            },
            id = new TransactionId {
                stringValue = transaction.id
            },
            time = new TimeField {
                stringValue = transaction.time
            }
        };

        transactionRootObject rootObject = new transactionRootObject
        {
            fields = fields
        };

        fsData data;

        serializer.TrySerialize(typeof(transactionRootObject), rootObject, out data).AssertSuccessWithoutWarnings();

        string post_data = data.ToString();

        return(post_data);
    }