I am trying to get Billing Accounts using BudgetOrderService interface.
I logged in with the manger account. And before creating budget order service instance, I set the client customer id in session. what am I doing wrong here?
BudgetOrderServiceInterface bos = adWordsServices.get(session, BudgetOrderServiceInterface.class);
BillingAccount accts[] = bos.getBillingAccounts();
System.out.println("accts ==>"+accts); -- this always returns null
if (accts != null) {
for (BillingAccount acct : accts) {
System.out.println("billing acct ==>" + acct);
}
}
int offset = 0;
SelectorBuilder selectorBuilder = new SelectorBuilder()
.fields(BudgetOrderField.BillingAccountId, BudgetOrderField.BillingAccountName,
BudgetOrderField.BudgetOrderName, BudgetOrderField.Id, BudgetOrderField.PoNumber,
BudgetOrderField.PrimaryBillingId, BudgetOrderField.SecondaryBillingId)
.in(BudgetOrderField.BillingAccountName, "Test Billing Account").offset(offset).limit(PAGE_SIZE);
BudgetOrderPage page;
do {
page = bos.get(selectorBuilder.build());
if (page.getEntries() != null) {
// Create account tree nodes for each customer.
for (BudgetOrder bo : page.getEntries()) {
System.out.println(bo.getBillingAccountId());
System.out.println(bo.getBillingAccountName());
System.out.println(bo.getBudgetOrderName());
System.out.println("------");
System.out.println(bo.getId());
System.out.println(bo.getPoNumber());
System.out.println(bo.getPrimaryBillingId());
System.out.println(bo.getSecondaryBillingId());
System.out.println(bo.getLastRequest());
System.out.println(bo.getStartDateTime());
System.out.println(bo.getEndDateTime());
System.out.println(bo.getSpendingLimit());
System.out.println(bo.getTotalAdjustments());
}
}
offset += PAGE_SIZE;
selectorBuilder.increaseOffsetBy(PAGE_SIZE);
} while (offset < page.getTotalNumEntries());
Can anyone help me to fix this? If required, I can send the MCC id and client customer id.