Quickbooks SDK Deposit not populating payee on main deposit - quickbooks

I am creating a program using the QBFC13 that is supposed to create a deposit from an other current asset type of account to a bank account. However, when the depositadd method is executed the payee doesn't get filled in on the bank account. How do i get the Payee information filled out?
I dont have a high enough reputation to post pictures so this is a link to the picture of the field i need filled out: http://i.stack.imgur.com/nqWOh.jpg
Here is my current code:
Public Sub CreateDeposit()
On Error GoTo Errs
Dim depositadd As IDepositAdd
depositadd = msgSetRequest.AppendDepositAddRq()
depositadd.DepositToAccountRef.FullName.SetValue("checking")
depositadd.Memo.SetValue("newdeposit test")
depositadd.TxnDate.SetValue(Date.Today)
Dim depositLineAdd As IDepositLineAdd
depositLineAdd = depositadd.DepositLineAddList.Append()
depositLineAdd.ORDepositLineAdd.DepositInfo.AccountRef.ListID.SetValue("1EE0000-943382783")
depositLineAdd.ORDepositLineAdd.DepositInfo.EntityRef.ListID.SetValue("80002534-1335362979")
depositLineAdd.ORDepositLineAdd.DepositInfo.Amount.SetValue(150.0)
depositLineAdd.ORDepositLineAdd.DepositInfo.Memo.SetValue("test memo lineitem")
' send the request to QB
Dim msgSetResponse As IMsgSetResponse
msgSetResponse = qbSessionManager.DoRequests(msgSetRequest)
' check to make sure we have objects to access first
' and that there are responses in the list
If (msgSetResponse Is Nothing) Or _
(msgSetResponse.ResponseList Is Nothing) Or _
(msgSetResponse.ResponseList.Count <= 0) Then
Exit Sub
End If
' Start parsing the response list
Dim responseList As IResponseList
responseList = msgSetResponse.ResponseList
MsgBox(msgSetRequest.ToXMLString())
' go thru each response and process the response.
' this example will only have one response in the list
' so we will look at index=0
Dim response As IResponse
response = responseList.GetAt(1)
If (Not response Is Nothing) Then
If response.StatusCode <> "0" Then
MsgBox("DepositFunds unexpexcted Error - " & vbCrLf & "StatusCode = " & response.StatusCode & vbCrLf & vbCrLf & response.StatusMessage)
Else
MsgBox("The funds were successfully deposited in Checking")
MsgBox(msgSetResponse.ToXMLString())
End If
End If
Exit Sub
Errs:
MsgBox("HRESULT = " & Err.Number & " (" & Hex(Err.Number) & ") " & vbCrLf & vbCrLf & Err.Description, _
MsgBoxStyle.Critical, _
"Error in DepositFunds")
End Sub

This actually isn't an SDK issue, as it's how QuickBooks was designed. Because a deposit transaction in QuickBooks can contain multiple lines, the bank register won't show any names even if there's just one line. You can manually go to the bank register and add the name, but there's not a way to do it through the SDK. It's a two step process to even do it in QuickBooks, where you create the deposit, then go and edit it in the register.
If you need to have this information show from transaction using the SDK, then you might have to use Journal Entries instead of a Deposit transaction.

Related

Google ads API - REST API

Hope you all are doing well. I am new working with Google ads api. I have to retrieve information regarding keywords i.e how many people searched certain keywords , how many clicks and so on... so I have created a manager account on Google ads and under that I have created client account. In client account I have added keywords under keyword planner and I am getting all information mentioned above but I want to get it through REST API in python.
I have everything needed to access API:
(Developer token
login_customer_id
Client ID
Client Secret
refresh token) I have given this information in the .yaml file. and I assume login_customer_id is the manager account id.
Below is the code to access all the keywords information. here I have given the client_idfrom which I want to access keywords information.
import argparse
import sys
from google.ads.googleads.client import GoogleAdsClient
from google.ads.googleads.errors import GoogleAdsException
def main(client, customer_id):
ga_service = client.get_service("GoogleAdsService")
query = """
SELECT
campaign.id,
campaign.name,
ad_group.id,
ad_group.name,
ad_group_criterion.criterion_id,
ad_group_criterion.keyword.text,
ad_group_criterion.keyword.match_type,
metrics.impressions,
metrics.clicks,
metrics.cost_micros
FROM keyword_view WHERE segments.date DURING LAST_7_DAYS
AND campaign.advertising_channel_type = 'SEARCH'
AND ad_group.status = 'ENABLED'
AND ad_group_criterion.status IN ('ENABLED', 'PAUSED')
ORDER BY metrics.impressions DESC
LIMIT 50"""
# Issues a search request using streaming.
search_request = client.get_type("SearchGoogleAdsStreamRequest")
search_request.customer_id = customer_id
search_request.query = query
response = ga_service.search_stream(search_request)
for batch in response:
for row in batch.results:
campaign = row.campaign
ad_group = row.ad_group
criterion = row.ad_group_criterion
metrics = row.metrics
print(
f'Keyword text "{criterion.keyword.text}" with '
f'match type "{criterion.keyword.match_type.name}" '
f"and ID {criterion.criterion_id} in "
f'ad group "{ad_group.name}" '
f'with ID "{ad_group.id}" '
f'in campaign "{campaign.name}" '
f"with ID {campaign.id} "
f"had {metrics.impressions} impression(s), "
f"{metrics.clicks} click(s), and "
f"{metrics.cost_micros} cost (in micros) during "
"the last 7 days."
)
# [END get_keyword_stats]
if name == "main":
googleads_client=GoogleAdsClient.load_from_storage("C:\Users\AnoshpaBansari\PycharmProjects\GoogleAPI\src\creds\googleads.yaml")
parser = argparse.ArgumentParser(
description=("Retrieves a campaign's negative keywords.")
)
# The following argument(s) should be provided to run the example.
#parser.add_argument(
# "-c",
# "--customer_id",
# type=str,
#required=True,
#help="The Google Ads customer ID.",
#)
#args = parser.parse_args()
try:
main(googleads_client, "----------")
except GoogleAdsException as ex:
print(
f'Request with ID "{ex.request_id}" failed with status '
f'"{ex.error.code().name}" and includes the following errors:'
)
for error in ex.failure.errors:
print(f'\tError with message "{error.message}".')
if error.location:
for field_path_element in error.location.field_path_elements:
print(f"\t\tOn field: {field_path_element.field_name}")
sys.exit(1)
but when I run the code I receive this error. I don't know what I am doing wrong.. Can anyone please help?
enter image description here
You must login in Google Ads Manager accounts, go Tools & Settings > API Center and accept the API terms and conditions.

How to get a List of Objects that a user can access using ACLs related tables

I'm designing a system that has a lot of requirements around user management/permissions, so I decided to use Spring Security ACL to manage the permissions at the Domain Objects level.
Although, using ACLs to maintain the relations between Users and Entities force us to rely on that to present the data on the UI.
The PostFilter solution that is provided by Spring Security does a good job filtering the objects that a User can/cannot see but it has a big performance issue when we're dealing with an entity that has hundreds/thousands of entries, because we need to load everything from the database and then discard the objects that user isn't allowed to "see".
That problem is described here - SEC-2409 - but it'll take some time until the feature is available. So, I'm trying to find a workaround to use Spring Security ACL but avoid the performance issue.
I thought about implementing some code to retrieve the Objects that a User can access (after the authentication process) and keep that information available to be used on every request to allow the developers to use that info to perform the queries and not relying on the PostFilter.
In order to implement that, I'm trying to find a way to retrieve the list of permissions for a given principal/granted authority but I'm not able to find a way to do that with the available AclService implementations.
Example: aclService.getObjectIdentityList(<sid>,<acl_class>)
Note: The method should use the inheritance structure and include all the ObjectIdentities that are inherited from a parent entry
Any suggestion to get the data or another approach to solve this problem?
UPDATE
I already found a way to retrieve the List of objects that a User can access.
List<ObjectIdentity> childObjects = aclService.findChildren(objectIdentity);
Map<ObjectIdentity, Acl> result = aclService.readAclsById(childObjects, sids);
And this approach work for us, because we just have a few entities which the access is controlled by ACLs, so we can construct the list of ObjectsIdentities that a User has access.
Although, the Map that is being return, is returning all the ACLs for the ObjectIdentities that are being passed and then I need to check the if the user has access to each ObjectIdentity that is being returned.
Do you have an easy way to do this or to simplify all of this logic?
The current approach to handling larger data sets is to update your query to include the currently logged in user within your query. For example, you can use Spring Security and Spring Data integration to update your query to refer to the current user:
#Query("select d from MyDomain d where d.owner = #{principal.name}")
Obviously this is not ideal because you need to manage the permissions manually. Once we resolve SEC-2409 Spring can do a lot of the heavy lifting for you automatically.
I ran into this question from needing a solution to deal with the lack of SEC-2409. Looking at JdbcAclService.findChildren() lead me to this
private final String FIND_OBJECTS_WITH_ACCESS = ""+
"SELECT " +
" obj.object_id_identity AS obj_id, " +
" class.class AS class " +
"FROM " +
" acl_object_identity obj, " +
" acl_class class, " +
" acl_entry entry " +
"WHERE " +
" obj.object_id_class = class.id " +
" and entry.granting = true " +
" and entry.acl_object_identity = obj.id " +
" and entry.sid = (SELECT id FROM acl_sid WHERE sid = ?) " +
" and obj.object_id_class = (SELECT id FROM acl_class WHERE acl_class.class = ?) " +
"GROUP BY " +
" obj.object_id_identity, " +
" class.class ";
public List<ObjectIdentity> getObjectsWithAccess(Class clazz, String sid) {
Object[] args = { sid, clazz.getName() };
List<ObjectIdentity> objects = _jdbcTemplate.query(FIND_OBJECTS_WITH_ACCESS, args, getRowMapper());
return objects.size() == 0 ? null : objects;
}
private RowMapper<ObjectIdentity> getRowMapper() {
return (rs, rowNum) -> {
String javaType = rs.getString("class");
Long identifier = rs.getLong("obj_id");
return new ObjectIdentityImpl(javaType, identifier);
};
}

How to sign a quickbooks online API request in ColdFusion 9?

In my CF app, I've used the CF OAuth code at riaforge to get request token and access token from QuickBooks Online and it works fine.
After I tried to make a QBO API call by starting to build the http headers of the call (I followed the instructions on the section "HTTP Authorization Header" here: Implement OAuth in Your App). Then built the http header based on the methods of the code at riaforge because it worked. In addition, I've respected the order of the parameters given by Intuit in the previous link).
When I launched the API Call, I received the response: "signature_invalid"
I really want directions on how to sign the QBO online API Call with CF 9 if I have ready the 6 header parameters:
oauth_token
oauth_nonce
oauth_consumer_key
oauth_signature_method
oauth_timestamp
oauth_version
(But if possible a working code would be better)
Thank you in advance for your time and help
this is what I use for generating the signature and header for the request token, simple additions are used for the other signatures you'll need along the way.
paramsStr = "oauth_callback=" & encodeData(CALL_BACK_URL) & "&" & "oauth_consumer_key=" & sConsumerKey & "&" & "oauth_nonce=" & session.nonce & "&" & "oauth_signature_method=" & SIGNMETHOD & "&" & "oauth_timestamp=" & TIMESTAMP & "&" & "oauth_version=" & VERSION;
signStr = "POST&" & encodeData(REQUEST_TOKEN_URL) & "&" & encodeData(paramsStr);
signature = computeHMACSignature(signStr, sConsumerSecret & "&");
authHeader = 'OAuth ' & createHeaderElement("oauth_consumer_key", trim(sConsumerKey)) & ", " & createHeaderElement("oauth_nonce", trim(session.nonce)) & "," & createHeaderElement("oauth_signature_method", trim(signmethod)) & ", " & createHeaderElement("oauth_signature", trim(signature)) & ", " & createHeaderElement("oauth_timestamp", trim(TIMESTAMP)) & ", " & createHeaderElement("oauth_version", trim(VERSION)) & ", " & createHeaderElement("oauth_callback", trim(CALL_BACK_URL));

QuickBooks SyncStatus Issue

we are using QuickBooks desktop edition, facing a strange issue with QuickBooks Sales Receipt - Syncronised status and State code wrireBack Messages, Problem detail is as below in steps,
First we are fetching QuickBooks Sales Receipts with provided idSet
Dim salesReceiptQuery = New Intuit.Ipp.Data.Qbd.SalesReceiptQuery() With {.Item1 = idset, _
.Item1ElementName = Item1ChoiceType4.TransactionIdSet, _
.IncludeTagElements = New String() {"SalesReceipt/Synchronized"}}
Dim salesReceipts As System.Collections.ObjectModel.ReadOnlyCollection(Of Intuit.Ipp.Data.Qbd.SalesReceipt) = Nothing
Try
salesReceipts = salesReceiptQuery.ExecuteQuery(Of Intuit.Ipp.Data.Qbd.SalesReceipt)(QBContext)
Catch ex As Exception
Trace.WriteLine("SyncWatchDog Task - Exception: " & ex.Message)
End Try
then we loop withe result to check "salesReceipt.Synchronized = True", here we are getting some Sales Recepipt with "salesReceipt.Synchronized = False".
Second step is we take all Sales Recept Id with "salesReceipt.Synchronized = False", and query Quickbooks with below code,
Dim syncStatusRequest As New Intuit.Ipp.Data.Qbd.SyncStatusRequest() With {.NgIdSet = list.GetNgIdSetArray}
Dim syncStatusResponse = DataServices.GetSyncStatus(syncStatusRequest)
Here when we loop over syncStatusResponce to get "syncStatus.StateCode", we are getting
STATECODE =1 ,
STATEDESC=Synchronized,
DESCRIPTION=(successful). Object created in QuickBooks. Equivalent to StateCode 8 (for object created in Data Services)
and
MESSAGECODE=40,
MESSAGEDESC=WRTB success,
DESCRIPTION:The requests sent from Data Services to the QuickBooks company file were successfully synched into the company file.
we are not able to understand if Sales Receipt is salesReceipt.Synchronized = False, what is meaning of StateCode 1 and MessageCode 40.
Please suggest the solution,
Thanks & Regards,
Reshma D.
You can try to retrieve objects in a sync error state, by specifying the ErroredObjectsOnly="true" attribute.
If you get any object in the response, then try to see the sync status of those error-ed objects using status API,otherwise(success) call GetAll API on SalesReceipt to see if you are getting all those objects(as by default it returns objects which were successfully created).
Ref - https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v2/0500_quickbooks_windows/0600_object_reference/syncstatus
You can ApiExplorer tool to test this use case.
Link - https://developer.intuit.com/apiexplorer?apiname=V2QBD
Can you query some other retrieved records too retrieved from salesReceipt.Synchronized = False?
Check if they also have StateCode 1.
It might be an issue with the Synchronized filter not working and retrieving all data.

error 10009 when refunding an authorized transaction

I have a paypal transaction which is authorized then captured. I want to refund it using .net code of refundtransaction I have the following error:
You can not refund this type of transaction
Public Function RefundTransactionCode(ByVal refundType__1 As String, ByVal transactionId As String, ByVal amount As String, ByVal note As String, ByRef resp As RefundTransactionResponseType) As AckCodeType
Dim caller As New CallerServices()
Dim profile As IAPIProfile = ProfileFactory.createSignatureAPIProfile()
'
' WARNING: Do not embed plaintext credentials in your application code.
' Doing so is insecure and against best practices.
' Your API credentials must be handled securely. Please consider
' encrypting them for use in any production environment, and ensure
' that only authorized individuals may view or modify them.
'
' Set up your API credentials, PayPal end point, and API version.
profile.APIUsername = AppSettings("APIUsername")
profile.APIPassword = AppSettings("APIPassword")
profile.APISignature = AppSettings("APISignature")
profile.Environment = AppSettings("Environment")
caller.APIProfile = profile
' Create the request object.
Dim concreteRequest As New RefundTransactionRequestType()
concreteRequest.Version = "51.0"
' Add request-specific fields to the request.
' If (amount IsNot Nothing AndAlso amount.Length > 0) AndAlso (refundType__1.Equals("Partial")) Then
Dim amtType As New BasicAmountType()
amtType.Value = amount
amtType.currencyID = CurrencyCodeType.CAD
concreteRequest.Amount = amtType
concreteRequest.RefundType = RefundType.Full
' Else
'MsgBox(0)
'concreteRequest.RefundType = RefundType.Full
' End If
concreteRequest.RefundTypeSpecified = True
concreteRequest.TransactionID = transactionId
concreteRequest.Memo = note
' Execute the API operation and obtain the response.
' Dim pp_response As New RefundTransactionResponseType()
resp = DirectCast(caller.[Call]("RefundTransaction", concreteRequest), RefundTransactionResponseType)
Return resp.Ack
End Function
I would advise finding the transaction in your PayPal account and looking at it. It is probably an Authorization, Order, Pending transaction, or some other type of transaction.
You can only refund a capture/sale, that was sent to the account you are sending the API on behalf of*, that hasn't already been refunded.
*
Third party API calls, where you use 'subject' in your API parameters along with your username, password, and signature/certificate, are you sending API calls on behalf of the 'subject's account.
First party API calls are where you do not send subject, and only use your own API user,pass, and sig/cert

Resources