public void GetAccount()
        {
            GetAccountCall api = new GetAccountCall(this.apiContext);

            api.AccountHistorySelection = AccountHistorySelectionCodeType.LastInvoice;

            /*
             * System.DateTime calTo = System.DateTime.Instance;
             * System.DateTime calFrom = (System.DateTime)calTo.clone();
             * calFrom.add(System.DateTime.DATE, -1);
             * TimeFilter tf = new TimeFilter(calFrom, calTo);
             * api.ViewPeriod = tf;
             */
            // Pagination
            PaginationType pt = new PaginationType();

            pt.EntriesPerPage          = 0;    // No details will be returned.
            pt.EntriesPerPageSpecified = true;
            pt.PageNumber          = 1;
            pt.PageNumberSpecified = true;
            api.Pagination         = pt;
            ApiException gotException = null;

            try
            {
                api.GetAccount(AccountHistorySelectionCodeType.LastInvoice);
            }
            catch (ApiException e)
            {
                gotException = e;
            }
            Assert.IsTrue(gotException == null || gotException.containsErrorCode("20154"));
        }
        //
        // GetAccount
        //  http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/GetAccount.html
        //
        public static string GetAccount(AccountType account)
        {
            if (account.SellerApiContext == null)
            {
                return(null);
            }

            GetAccountCall getAccountApiCall = new GetAccountCall(account.SellerApiContext);

            DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnSummary };
            getAccountApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels);

            getAccountApiCall.AccountEntrySortType = AccountEntrySortTypeCodeType.AccountEntryCreatedTimeAscending;
            //  AccountHistorySelection
            //      - BetweenSpecifiedDates, BeginDate/EndDate must be used.
            //      - CustomCode
            //      - LastInvoice
            //      - SpecifiedInvoice, InvoiceDate must be used.
            getAccountApiCall.AccountHistorySelection = AccountHistorySelectionCodeType.LastInvoice;
            getAccountApiCall.BeginDate                 = new System.DateTime(2012, 10, 30);
            getAccountApiCall.EndDate                   = DateTime.Now;
            getAccountApiCall.ExcludeBalance            = false;
            getAccountApiCall.ExcludeSummary            = false;
            getAccountApiCall.Pagination                = new eBay.Service.Core.Soap.PaginationType();
            getAccountApiCall.Pagination.PageNumber     = 1;
            getAccountApiCall.Pagination.EntriesPerPage = 10;
            getAccountApiCall.Version                   = "705";
            getAccountApiCall.StartTimeFilter           = new eBay.Service.Core.Soap.TimeFilter();
            getAccountApiCall.StartTimeFilter.TimeFrom  = new System.DateTime(2012, 10, 30);
            getAccountApiCall.StartTimeFilter.TimeTo    = DateTime.Now;

            //AccountHistorySelectionCodeType accountHistorySelectionCodeType = AccountHistorySelectionCodeType.BetweenSpecifiedDates;
            getAccountApiCall.GetAccount(AccountHistorySelectionCodeType.LastInvoice);

            AccountEntriesType accountEntriesType = getAccountApiCall.AccountEntries;
            AccountSummaryType accountSummary     = getAccountApiCall.AccountSummary;

            return(null);
        }
Exemple #3
0
        private void CallGetAccount(int PageNumber)
        {
            try
            {
                LstAccountEntries.Items.Clear();
                TxtAccState.Text             = "";
                TxtBillingCycleDate.Text     = "";
                TxtLastAmountPaid.Text       = "";
                TxtAccBalance.Text           = "";
                TxtPayMethod.Text            = "";
                TxtAmountPastDue.Text        = "";
                TxtPastDue.Text              = "";
                TxtCreditCardInfo.Text       = "";
                TxtCreditCardExpiration.Text = "";
                TxtCreditCardModifyDate.Text = "";
                TxtAccountID.Text            = "";
                TxtLastPaymentDate.Text      = "";
                TxtEntriesPerPage.Text       = "";
                TxtPageNumber.Text           = "";
                TxtTotalNumberOfPages.Text   = "";

                GetAccountCall apicall = new GetAccountCall(Context);

                AccountHistorySelectionCodeType ahselect = AccountHistorySelectionCodeType.CustomCode;
                if (OptLastInvoice.Checked == true)
                {
                    ahselect = AccountHistorySelectionCodeType.LastInvoice;
                }
                else if (OptInvoiceDate.Checked == true)
                {
                    ahselect            = AccountHistorySelectionCodeType.SpecifiedInvoice;
                    apicall.InvoiceDate = DatePickInvoice.Value;
                }
                else if (OptRange.Checked == true)
                {
                    ahselect = AccountHistorySelectionCodeType.BetweenSpecifiedDates;
                    apicall.StartTimeFilter = new TimeFilter(DatePickFrom.Value, DatePickTo.Value);
                }

                apicall.Pagination            = new PaginationType();
                apicall.Pagination.PageNumber = PageNumber;

                //apicall.ApiRequest.ExcludeSummary = true;
                //apicall.ApiRequest.Pagination.EntriesPerPage = 1;
                AccountEntryTypeCollection entrylist = apicall.GetAccount(ahselect);

                TxtAccountID.Text = apicall.AccountID;
                if (apicall.AccountSummary != null)
                {
                    AccountSummaryType Summary = apicall.AccountSummary;
                    TxtAccState.Text         = Summary.AccountState.ToString();
                    TxtBillingCycleDate.Text = Summary.BillingCycleDate.ToString();
                    TxtLastAmountPaid.Text   = Summary.LastAmountPaid.Value.ToString();
                    TxtAccBalance.Text       = Summary.CurrentBalance.Value.ToString();
                    TxtPayMethod.Text        = Summary.PaymentMethod.ToString();
                    TxtAmountPastDue.Text    = Summary.AmountPastDue.Value.ToString();
                    TxtPastDue.Text          = Summary.PastDue.ToString();
                    TxtCreditCardInfo.Text   = Summary.CreditCardInfo;
                    if (Summary.CreditCardExpirationSpecified)
                    {
                        TxtCreditCardExpiration.Text = Summary.CreditCardExpiration.ToString();
                    }

                    if (Summary.CreditCardModifyDateSpecified)
                    {
                        TxtCreditCardModifyDate.Text = Summary.CreditCardModifyDate.ToString();
                    }

                    if (Summary.LastPaymentDateSpecified)
                    {
                        TxtLastPaymentDate.Text = Summary.LastPaymentDate.ToString();
                    }

                    /*	Summary.InvoiceBalance;
                     *      Summary.InvoiceCredit;
                     *      Summary.InvoiceDate;
                     *      Summary.InvoiceNewFee;
                     *      Summary.InvoicePayment;
                     */
                    TxtEntriesPerPage.Text     = apicall.ApiResponse.EntriesPerPage.ToString();
                    TxtPageNumber.Text         = apicall.ApiResponse.PageNumber.ToString();
                    TxtTotalNumberOfPages.Text = apicall.ApiResponse.PaginationResult.TotalNumberOfPages.ToString();
                }

                if (TxtPageNumber.Text.Length > 0 && Int32.Parse(TxtPageNumber.Text) < Int32.Parse(TxtTotalNumberOfPages.Text))
                {
                    BtnNextPage.Visible = true;
                }
                ;


                if (entrylist == null)
                {
                    return;
                }

                foreach (AccountEntryType entry in entrylist)
                {
                    string[] listparams = new string[9];
                    listparams[0] = entry.RefNumber;
                    listparams[1] = entry.AccountDetailsEntryType.ToString();
                    listparams[2] = entry.ItemID;
                    listparams[3] = entry.Description;
                    if (entry.NetDetailAmount != null)
                    {
                        listparams[4] = entry.NetDetailAmount.Value.ToString();
                    }

                    if (entry.GrossDetailAmount != null)
                    {
                        listparams[5] = entry.GrossDetailAmount.Value.ToString();
                    }
                    listparams[6] = entry.VATPercent.ToString();
                    listparams[7] = entry.Balance.Value.ToString();
                    listparams[8] = entry.Date.ToString();

                    ListViewItem vi = new ListViewItem(listparams);
                    this.LstAccountEntries.Items.Add(vi);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }