How to create QBO BillPayment - quickbooks

I am converting some V2 Desktop code to V3 online. I am having trouble with what was a ReceivePaymentAdd in V2. I looked at the conversion guide and it says to make the ReceivePaymentAdd a BillPayment. I tried but do not see how to add the AR reference and the customer reference. Do I create a Payment object then link the BillPayment somehow?
Here is the C++ V2 code I need to convert to C# V3. Thanks for any help!
CQBXface::ReceivePaymentAdd* pTrx = &QB.m_RecvPmtAdd;
pTrx->CustomerRef.sFullName = customerName;
pTrx->ARAccountRef.sFullName = acctName;
pTrx->DepositToAccountRef.sFullName = depositName;
pTrx->PaymentMethodRef.sFullName = payMethodName;
pTrx->sMemo = memo;
pTrx->sRefNumber = documentNum;
pTrx->sTotalAmount = amount;
pTrx->sTxnDate = transDate;

If the conversion guide really says that a v2 ReceivePayment is equivalent to a v3 BillPayment, then it is incorrect.
But, looking at the migration guide that's not what it says...
A Payment in v2 is equivalent to a Payment in v3. BillPayment is a completely separate and unrelated type of transaction.

Related

Setting a device target on google ads API

I'm trying to create a campaign that must target mobile devices only, using the google ads API client library in python. The documentation says that I have to modify the DeviceInfo criteria, but that attribute is immutable.
This is my code rn:
campaign_service = client.get_service("CampaignService")
campaign_criterion_service = client.get_service("CampaignCriterionService")
# Create the campaign criterion.
campaign_criterion_operation = client.get_type("CampaignCriterionOperation")
campaign_criterion = campaign_criterion_operation.create
campaign_criterion.campaign = campaign_service.campaign_path(
customer_id, campaign_id
)
campaign_criterion.device = client.enums.DeviceEnum.MOBILE
What am I missing?
For most of Enums you have to use the .type_ after the value you wanna set.
So you should use:
campaign_criterion.device.type_ = client.enums.DeviceEnum.MOBILE
A nice advice is to download library code and goes into reading that.

How do I find the Conversion Action ID for use in the Google Ads API?

I'm using the latest (v7) Google Ads API to upload offline conversions for Google Ads, using the Python Client Library. This is the standard code I'm using:
import os
from google.ads.googleads.client import GoogleAdsClient
client = GoogleAdsClient.load_from_env(version='v7')
def process_adwords_conversion(
conversion_date_time,
gclid,
conversion_action_id,
conversion_value
):
conversion_date_time = convert_datetime(conversion_date_time)
customer_id = os.environ['GOOGLE_ADS_LOGIN_CUSTOMER_ID']
click_conversion = client.get_type("ClickConversion")
conversion_action_service = client.get_service("ConversionActionService")
click_conversion.conversion_action = (
conversion_action_service.conversion_action_path(
customer_id, conversion_action_id
)
)
click_conversion.gclid = gclid
click_conversion.conversion_value = float(conversion_value)
click_conversion.conversion_date_time = conversion_date_time
click_conversion.currency_code = "USD"
conversion_upload_service = client.get_service("ConversionUploadService")
request = client.get_type("UploadClickConversionsRequest")
request.customer_id = customer_id
request.conversions = [click_conversion]
request.partial_failure = True
conversion_upload_response = (
conversion_upload_service.upload_click_conversions(
request=request,
)
)
uploaded_click_conversion = conversion_upload_response.results[0]
print(conversion_upload_response)
print(
f"Uploaded conversion that occurred at "
f'"{uploaded_click_conversion.conversion_date_time}" from '
f'Google Click ID "{uploaded_click_conversion.gclid}" '
f'to "{uploaded_click_conversion.conversion_action}"'
)
return False
I believe the code is fine, but I'm having problems locating the conversion_action_id value to use. In the Google Ads UI there's a screen listing the different Conversion Actions, with no sign of an ID anywhere. You can click on the name and get more details, but still no ID:
The conversion action detail screen in Google Ads UI
I've tried the following:
Using the ocid, ctId, euid, __u, uscid, __c, subid URL parameters from this detail page as the conversion_action_id. That always gives an error:
partial_failure_error {
code: 3
message: "This customer does not have an import conversion action that matches the conversion action provided., at conversions[0].conversion_action"
details {
type_url: "type.googleapis.com/google.ads.googleads.v7.errors.GoogleAdsFailure"
value: "\n\305\001\n\003\370\006\t\022dThis customer does not have an import conversion action that matches the conversion action provided.\0320*.customers/9603123598/conversionActions/6095821\"&\022\017\n\013conversions\030\000\022\023\n\021conversion_action"
}
}
Using the standard Google answer:
https://support.google.com/google-ads/thread/1449693/where-can-we-find-google-ads-conversion-ids?hl=en
Google suggests creating a new Conversion Action and obtaining the ID in the process. Unfortunately their instructions don't correspond to the current UI version, at least for me. The sequence I follow is:
Click the + icon on the Conversion Actions page
Select "Import" as the kind of conversion I want
Select "Other data sources or CRMs" then "Track conversions from clicks"
Click "Create and Continue"
I then get the screen:
Screen following Conversion Action creation
The recommended answer says:
The conversion action is now created and you are ready to set up the tag to add it to your website. You have three options and the recommended answer in this thread is discussing the Google Tag Manager option, which is the only option that uses the Conversion ID and Conversion Label. If you do not click on the Google Tag Manager option you will not be presented with the Conversion ID and Conversion Label.
Not so! What three options? The first "Learn more" link mentions the Google Tag Manager, but in the context of collecting the GCLID, which I already have. The "three options" mentioned in the official answer have gone. Clicking "done" simply takes me back to the Conversion Actions listing.
Using the REST API
I've tried authenticating and interrogating the endpoint:
https://googleads.googleapis.com/v7/customers/9603123598/conversionActions/
hoping that would give a list of conversion actions, but it doesn't. It just gives a 404.
Does anybody know a way of getting the Conversion Action ID, either from the UI or programmatically (via client library, REST or some other method)?
Thanks!
If you're using Python, you can list your conversions via next snippet:
ads: GoogleAdsServiceClient = client.get_service('GoogleAdsService')
pages = ads.search(query="SELECT conversion_action.id, conversion_action.name FROM conversion_action", customer_id='YOUR_MCC_ID')
for page in pages:
print(page.conversion_action)
You can also open conversion action in UI and locate &ctId=, that's the conversion action id.
I found this post with the solution how to get the Conversion Action ID:
(…) I found out that conversionActionId can be found also in Google
Ads panel. When you go to conversion action details, in URL there is
parameter "ctId=123456789" which represent conversion action id.
By the way, I tried something similar and it's still not working, but with this Conversion Action ID I get a different "Partial Failure" message, at least.
At least in Google Ads API (REST) v10,
it works if field conversionAction is set with value:
'customers/{customerId}/conversionActions/{ctId}'
customerId - without hyphens
ctId - conversion action id, as mentioned in above comments,
taken from GET parameters in Google Ads panel when specific conversion is opened.
Can also be found programmatically with API method.

Generate EC keypair for iOS in NativeScript plugin

Preamble: I am trying to create an elliptic curve key pair in my NativeScript plugin (thus I am forced to use Objective-C) for signing and verification purpose.
At first I want to say that the presented state below is the result of a lot of tries doing it in different ways (I am sitting on this for days, unfortunately) and I considered not only this approach. At the beginning of this project I simply followed the Apple docs and thought I will succeed easily. What a misbelief.
My requirements: to keep it easy I want to store the private key inside of the Keychain (Secure Enclave would be the next step), and calculate the public key via SecKeyCopyPublicKey after I retrieved the key via SecItemCopyMatching, like described in the Apple docs.
Status quo: the model for this originally came from the here. I never got it working with SecKeyCreateRandomKey thus I am trying to use SecKeyGeneratePair atm. What I currently implemented looks like this:
const privAttr: NSMutableDictionary<string, any> = NSMutableDictionary.new<string, any>();
privAttr.setObjectForKey("my.tag.sign.private", kSecAttrApplicationTag);
privAttr.setObjectForKey(kCFBooleanTrue, kSecAttrIsPermanent);
const pubAttr: NSMutableDictionary<string, any> = NSMutableDictionary.new<string, any>();
pubAttr.setObjectForKey("my.tag.sign.public", kSecAttrApplicationTag);
pubAttr.setObjectForKey(kCFBooleanTrue, kSecAttrIsPermanent);
const param: NSMutableDictionary<string, any> = NSMutableDictionary.new<string, any>();
param.setObjectForKey(kSecAttrKeyTypeECSECPrimeRandom, kSecAttrKeyType);
param.setObjectForKey(256, kSecAttrKeySizeInBits);
param.setObjectForKey(privAttr, kSecPrivateKeyAttrs);
param.setObjectForKey(pubAttr, kSecPublicKeyAttrs);
let pubKeyRef = new interop.Reference<any>();
let privKeyRef = new interop.Reference<any>();
const status = SecKeyGeneratePair(param, pubKeyRef, privKeyRef);
Currently I am getting an error -50. According to OSStatus.com this means that my given parameters are not valid at some point. I do not know what exactly is the problem.
My question: how can I generate a keypair where at least the private key is implicitely stored in the keychain and I successfully can retrieve the public key via SecKeyCopyPublicKey afterwards.
Thanks for any valuable hint and your help.
Cordially, David
After trying out several settings I found a solution for this. My answer is documented in the following GitHub issue.
Best regards,
David

Getting YouTube auto-transcript from API?

Is it possible to pull the auto (non-user) generated video transcripts from any of the YouTube APIs?
As of Aug 2019 the following method you to download transcripts:
Open in Browser
https://www.youtube.com/watch?v=[Video ID]
From Console type:
JSON.parse(ytplayer.config.args.player_response).captions.playerCaptionsTracklistRenderer.captionTracks[0].baseUrl
You may refer with this thread: How to get "transcript" in youtube-api v3
If you're authenticating with oAuth2, you could do a quick call to
this feed:
http://gdata.youtube.com/feeds/api/videos/[VIDEOID]/captiondata/[CAPTIONTRACKID]
to get the data you want. To retrieve a list of possible caption track
IDs with v2 of the API, you access this feed:
https://gdata.youtube.com/feeds/api/videos/[VIDEOID]/captions
That feed request also accepts some optional parameters, including
language, max-results, etc. For more details, along with a sample that
shows the returned format of the caption track list, see the
documentation at
https://developers.google.com/youtube/2.0/developers_guide_protocol_captions#Retrieve_Caption_Set
Also, here are some references which migh help:
https://www.quora.com/Is-there-any-way-to-download-the-YouTube-transcripts-that-are-generated-automatically
http://ccm.net/faq/40644-how-to-get-the-transcript-of-a-youtube-video
1 Install youtube-transcript-api (https://github.com/jdepoix/youtube-transcript-api), e.g.:
pip3 install youtube_transcript_api
2 Create youtube_transcript_api-wrapper.py with the following code (based partially on https://stackoverflow.com/a/65325576/2585501):
from youtube_transcript_api import YouTubeTranscriptApi
#srt = YouTubeTranscriptApi.get_transcript(video_id)
videoListName = "youtubeVideoIDlist.txt"
with open(videoListName) as f:
video_ids = f.read().splitlines()
transcript_list, unretrievable_videos = YouTubeTranscriptApi.get_transcripts(video_ids, continue_after_error=True)
for video_id in video_ids:
if video_id in transcript_list.keys():
print("\nvideo_id = ", video_id)
#print(transcript)
srt = transcript_list.get(video_id)
text_list = []
for i in srt:
text_list.append(i['text'])
text = ' '.join(text_list)
print(text)
3 Create youtubeVideoIDlist.txt containing a list of video_ids
4 python3 youtube_transcript_api-wrapper.py

Zapier Scripting - Error: Cannot find module 'moment'

I'm trying to use Moment.js library in Zapier. The documentation says that it's available. However, when I add this line:
var moment = require('moment');
I keep getting this error:
Bargle. We hit an error creating a run javascript. :-( Error:
Error: Cannot find module 'moment'
If I remove the declaration, I get ReferenceError: moment is not defined
moment is not available in https://zapier.com/help/code/ - maybe you are thinking of https://zapier.com/developer/documentation/v2/scripting/?
I can understand how one could confuse the two - but one is a simple code step in a Zap, the other is how partners developer applications on Zapier.
Moment library is available in Zapier, no need to call(require) it. Here's a snippet of code where I have used it.
var date;
if (outbound.Date === undefined) {
var d = moment();
var n = d.format();
date = n.split('.');
outbound.Date = date[0];
}

Resources