From 9893f74314f5c6651ec3b5d6eb4df976636688e2 Mon Sep 17 00:00:00 2001 From: Alex Ro Date: Fri, 25 Oct 2019 16:05:54 -0400 Subject: [PATCH 1/2] updated "GetTransactionListResponse" to match current Auth.Net's "getTransactionListResponse". --- transaction_reporting.go | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/transaction_reporting.go b/transaction_reporting.go index 2b1b8a3..44e5af2 100644 --- a/transaction_reporting.go +++ b/transaction_reporting.go @@ -57,11 +57,11 @@ func (r UnsettledTransactionListResponse) List() []Transaction { } func (r *GetTransactionListResponse) List() []Transaction { - return r.GetTransactionList.Transactions.Transaction + return r.Transactions } func (r *GetTransactionListResponse) Count() int { - return r.GetTransactionList.TotalNumInResultSet + return r.TotalNumInResultSet } func (r Range) Transactions() (*GetTransactionListResponse, error) { @@ -77,7 +77,7 @@ func (r Range) Transactions() (*GetTransactionListResponse, error) { } response, err := SendRequest(jsoned) var dat GetTransactionListResponse - json.Unmarshal(response, &dat) + err = json.Unmarshal(response, &dat) return &dat, err } @@ -169,16 +169,14 @@ type GetTransactionList struct { } type GetTransactionListResponse struct { - GetTransactionList struct { - MessagesResponse - Transactions Transactions `json:"transactions"` - TotalNumInResultSet int `json:"totalNumInResultSet"` - } `json:"getTransactionListResponse"` + MessagesResponse + Transactions []Transaction `json:"transactions"` + TotalNumInResultSet int `json:"totalNumInResultSet"` } -type Transactions struct { - Transaction []Transaction `json:"transaction"` -} +//type Transactions struct { +// Transaction []Transaction `json:"transaction"` +//} type Transaction struct { TransID string `json:"transId"` From 12202fcaee7e50145b36427401ea262b3181ae76 Mon Sep 17 00:00:00 2001 From: Alex Ro Date: Tue, 29 Oct 2019 16:52:33 -0400 Subject: [PATCH 2/2] added extra fields in fullTransaction --- transaction_reporting.go | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/transaction_reporting.go b/transaction_reporting.go index 44e5af2..f7d70b4 100644 --- a/transaction_reporting.go +++ b/transaction_reporting.go @@ -214,6 +214,8 @@ type TransactionDetailsResponse struct { } type FullTransaction struct { + //artificially introduced. Never filled by AuthNet + PaymentType string TransID string `json:"transId"` SubmitTimeUTC time.Time `json:"submitTimeUTC"` SubmitTimeLocal string `json:"submitTimeLocal"` @@ -232,7 +234,8 @@ type FullTransaction struct { SettlementState string `json:"settlementState"` } `json:"batch"` Order struct { - InvoiceNumber string `json:"invoiceNumber"` + InvoiceNumber string `json:"invoiceNumber"` + InvoiceDescription string `json:"description"` } `json:"order"` RequestedAmountSpecified bool `json:"requestedAmountSpecified"` AuthAmount float64 `json:"authAmount"` @@ -247,10 +250,15 @@ type FullTransaction struct { RoutingNumber string `json:"routingNumber"` AccountNumber string `json:"accountNumber"` NameOnAccount string `json:"nameOnAccount"` - EcheckType int `json:"echeckType"` + EcheckType string `json:"echeckType"` EcheckTypeSpecified bool `json:"echeckTypeSpecified"` BankName interface{} `json:"bankName"` - } `json:"bankAccount"` + } `json:"bankAccount,omitempty"` + CreditCard struct { + CardNumber string `json:"cardNumber"` + ExpirationDate string `json:"expirationDate"` + CardType string `json:"cardType"` + } `json:"creditCard,omitempty"` } `json:"payment"` RecurringBilling bool `json:"recurringBilling"` RecurringBillingSpecified bool `json:"recurringBillingSpecified"` @@ -261,6 +269,14 @@ type FullTransaction struct { Code string `json:"code"` Description string `json:"description"` } `json:"returnedItems"` + Customer struct { + Type string `json:"type"` + Id string `json:"id"` + Email string `json:"email"` + } `json:"customer"` + BillTo struct { + Company string `json:"company,omitempty"` + } `json:"billTo"` } type GetUnsettledBatchTransactionListRequest struct {