Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
 
Answered
Pre-validate Transaction Limits

Is there a way to determine the exact transaction limit that a user currently has available so that we can validate up front whether or not an "exceeded transaction limit" error will be generated? My goal is to perform "on submit" validation before executing the AddFundsTransfer* functions.

Thanks in advance,
Shawn McConnell

Posted 3 years ago
Votes Newest

Answers 4


Hi Shawn,

To find more information regarding user transactions via the SDK:

We have a Policy Data DBObject that would allow you to retrieve such information (see https://docs.q2developer.com/api_references/q2_sdk/db/db_objects/policy_data.html). More specifically, you will be interested in the GeneratedTransactionRights node that gets returned from the get function which will provide more detail on a given user's transaction limits.

If you are doing this through Caliper API:

Our Get Policy Data endpoint (https://docs.q2api.com/docs/q2-caliper-api/6ba6279e5c36c-get-policy-data) will return the values you are looking for. For more information on the response, please visit our Update Policy Data endpoint (https://docs.q2api.com/docs/q2-caliper-api/284cd2b67ad31-update-policy-data).

Thank you,
Solène

Posted 3 years ago

Solene,

Thanks for your response! So, is the GeneratedTransactionRights node detailed enough to tell me what limit amount is still available? i.e. Daily Limit is 15k, Member has already transferred 14k, so I would be able to see that 1k is still available to be transferred.

Thanks in advance,
Shawn

Posted 3 years ago

I was able to access the GeneratedTransactionRights node, but it looks like it only provides the limit settings, but I'm looking for how much is still available to be transacted for the current day, etc.

Here is the code for future reference:

from q2_sdk.hq.db import policy_data

policy = await policy_data.PolicyData.get(self, policy_data.Entity.User, self.online_user.user_id)
self.logger.info("GeneratedTransactionRights > ExternalTransfer: " + str(policy.User.GeneratedTransactionRights[9]))

Logging Results:
GeneratedTransactionRights > ExternalTransfer: GeneratedTransactionRights(PolicyIdentifier='U-15', TransactionTypeID=13, ShortName='ExternalTransfer', GroupID=None, CustomerID=None, UserID=15, UserRoleID=None, CompanyID=None, Enabled=True, Authorize=True, Cancel=True, Create=True, CreateRestricted=False, Update=True, View=1, LimitPerTransaction=999999.99, LimitPerDay=999999.99, LimitPerMonth=999999.99, LimitPerAcctPerDay=999999.99, CountPerDay=999, CountPerMonth=999, CountPerAcctPerDay=999, DualApprovalLimit=-1.0, TokenRequiredLimit=-1.0, DraftLimit=0.0, SourceAccounts=None, DestinationAccounts=None)

Posted 3 years ago

Hi Shawn,

Thank you for the clarification. In that case, you may be interested in the GetAccountDetailsByIDWithUserLogon hq endpoint (https://docs.q2developer.com/api_references/hq_api/q2_api/GetAccountDetailsByIdWithUserLogon.html?highlight=available%20balance) which will take in a host account id and a user id and return account details including the available balance.

Please let me know if you have additional questions.

Thank you,

Solène

Posted 3 years ago
111 Views
4 Answers
3 years ago
3 years ago