Why in the Journal Transaction screen is the Post Period value being ignored by the REST API? - acumatica

I'm trying to use the REST API to create a record in the Journal Transactions screen. The problem I'm running into is that if the Transaction Date I'm using is before the Post Period, I don't want the Post Period to default to the period of the Transaction Date. In the UI, I can force the Post Period to be after the period of the Transaction Date, but it seems in the REST API, it ignores me setting the Post Period and defaults to the Period of the Transaction Date - and if that period is closed, it gives me an error.
Is this a bug that is known, or am I doing something wrong?
Here's a snippet of my JSON string - not sure that this matters, just wanted to show I was actually setting the Post Period field AFTER setting the transaction date....
{
"Module": {
"value": "GL"
},
"TransactionDate": {
"value": "10/31/2022 11:00:00 PM"
},
"PostPeriod": {
"value": "012023"
},
"Ledger": {
"value": "ACTUAL"
},
"Description": {
"value": "ID: 7731"
},
"ControlTotal": {
"value": "5842.32"
}
}
Thanks...

Related

Acumatica MoveEntry API not generating lot number

Has anyone here used the PUT /MoveEntry call successfully before? I can make the call to create the record, but I was expecting the API to populate the lot number and it is not. It does by UI, but not by API. Is there a trick that I'm missing?
Update 1:
PUT /MoveEntry
{
"Hold": {
"value": true
},
"Details": [
{
"OrderType": {
"value": "RO"
},
"ProductionNbr": {
"value": "RO0000001"
},
"Quantity": {
"value": 1
},
"Location": {
"value": "PRODRECPT"
},
"Warehouse": {
"value": "ABBOTSFORD"
}
}
]
}
It always records the document successfully, but never has the lot number.
Could it be a lot class configuration issue?
Update 2:
Acu support agrees this looks like a defect and has passed the case on to Acu development.
I would take a look at the Numbering Sequence called AMBatch as that is the one that seems to be used by default for me on the Move Entry screen.
After working with Acu Support, it came back the API requires the "OperationNbr" field to be populated with the Bill of Materials operation number. Then the lot number is generated as expected.

Forge-Get Item Path along with custom attributes in BIM360 document

Two Requirements are needed:
Get item path of the document in a BIM360 document management.
Get all custom attributes for that item.
For Req. 1, an api exists to fetch and for getting custom attributes, another api exists and data can be retrived.
Is there a way to get both the requirements in a single api call instead of using two.
In case of large number of records, api to retrieve item path is taking more than an hour for fetching 19000+ records and token gets expired though refesh token is used, while custom attribute api processes data in batches of 50, which completes it in 5 minutes only.
Please suggest.
Batch-Get Custom Attributes is for the additional attributes of Document Management specific. While path in project is a general information with Data Management.
The Data Management API provides some endpoints in a format of command, which can ask the backend to process the data for bunch of items.
https://forge.autodesk.com/en/docs/data/v2/reference/http/ListItems/
This command will retrieve metadata for up to 50 specified items one time. It also supports the flag includePathInProject, but the usage is tricky and API document does not indicate it. In the response, it will tell the pathInProject of these items. It may save more time than iteration.
{
"jsonapi": {
"version": "1.0"
},
"data": {
"type": "commands",
"attributes": {
"extension": {
"type": "commands:autodesk.core:ListItems",
"version": "1.0.0" ,
"data":{
"includePathInProject":true
}
}
},
"relationships": {
"resources": {
"data": [
{
"type": "items",
"id": "urn:adsk.wipprod:dm.lineage:vkLfPabPTealtEYoXU6m7w"
},
{
"type": "items",
"id": "urn:adsk.wipprod:dm.lineage:bcg7gqZ6RfG4BoipBe3VEQ"
}
]
}
}
}
}
Get item path of the document in a BIM360 document management.
Is this question about getting the hiarchy of the item? e.g. rootfolder>>subfolder>>item ? With the endpoint, by specifying the query param includePathInProject=true, it will return the relative path of the item (pathInProject) in the folder structure.
https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-items-item_id-GET/
"data": {
"type": "items",
"id": "urn:adsk.wipprod:dm.lineage:xxx",
"attributes": {
"displayName": "my-issue-att.png",
"createTime": "2021-03-12T04:51:01.0000000Z",
"createUserId": "xxx",
"createUserName": "Xiaodong Liang",
"lastModifiedTime": "2021-03-12T04:51:02.0000000Z",
"lastModifiedUserId": "200902260532621",
"lastModifiedUserName": "Xiaodong Liang",
"hidden": false,
"reserved": false,
"extension": {
"type": "items:autodesk.bim360:File",
"version": "1.0",
"schema": {
"href": "https://developer.api.autodesk.com/schema/v1/versions/items:autodesk.bim360:File-1.0"
},
"data": {
"sourceFileName": "my-issue-att.png"
}
},
"pathInProject": "/Project Files"
}
or if you may iterate by the data of parent
"parent": {
"data": {
"type": "folders",
"id": "urn:adsk.wipprod:fs.folder:co.sdfedf8wef"
},
"links": {
"related": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/items/urn:adsk.wipprod:dm.lineage:hC6k4hndRWaeIVhIjvHu8w/parent"
}
}
},
Get all custom attributes for that item. For Req. 1, an api exists to fetch and for getting custom attributes, another api exists and data can be retrived. Is there a way to get both the requirements in a single api call instead of using two. In case of large number of records, api to retrieve item path is taking more than an hour for fetching 19000+ records and token gets expired though refesh token is used, while custom attribute api processes data in batches of 50, which completes it in 5 minutes only. Please suggest.*
Let me try to understand the question better. Firstly, two things: Custom Attributes Definitions, and Custom Attributes Values(with the documents). Could you clarify what are they with 19000+ records?
If Custom Attributes Definitions, the API to fetch them is
https://forge.autodesk.com/en/docs/bim360/v1/reference/http/document-management-custom-attribute-definitions-GET/
It supports to set limit of each call. i.e. the max limit of one call is 200, which means you can fetch 19000+ records by 95 times, while each time calling should be quick (with my experience < 10 seconds). Totally around 15 minutes, instead of more than 1 hour..
Or at your side, each call with 200 records will take much time?
If Custom Attributes Values, the API to fetch them is
https://forge.autodesk.com/en/docs/bim360/v1/reference/http/document-management-versionsbatch-get-POST/
as you know, 50 records each time. And it seems it is pretty quick at your side with 5 minutes only if fetch the values of 19000+ records?

How can I setup taxes and make them included in the subscription price paypal sdk

So I live in europe and we are obligated to have taxes already included in the price displayed to the user and I was wondering how I could do this with Paypal sdk.
My billing_plan_attributes:
billing_plan_attributes = {
"name": request.args['name'],
"description": request.args['description'],
"merchant_preferences": {
"auto_bill_amount": "yes",
"cancel_url": "https://ruby-eu.com/profile/settings/paypal/cancel/token",
"initial_fail_amount_action": "continue",
"max_fail_attempts": "1",
"return_url": 'https://ruby-eu.com/profile/settings/paypal/subscribe/execute',
"setup_fee": {
"currency": request.args['currency'],
"value": request.args['setup_fee']
}
},
"payment_definitions": [
{
"amount": {
"currency": request.args['currency'],
"value": request.args['amount']
},
"cycles": request.args['cycles'],
"frequency": request.args['frequency'],
"frequency_interval": request.args['frequency_interval'],
"name": request.args['payment_name'],
"type": request.args['payment_type'],
}
],
"type": request.args['type']
}
I tried adding
"taxes": {
"percentage": "23",
"inclusive": True
}
inside merchant_preferences, payment_defenitions and under type but when I run it they return
Problem while creating a new plan: Incoming JSON request does not map to API request
and I don't know how could I fix this issue.
In case you're wondering if the problem is somewhere else I removed the taxes from the JSON and run and it worked.
First of all know that the depcrecated billing plan object in the Python SDK does NOT correspond to the new plans object in the new Subscriptions API. If you want to use the Subscriptions API (and you probably should), you need to integrate with direct HTTPS API calls, NOT any of the old SDKs. Basically, look at the CURL calls you see here: https://developer.paypal.com/docs/subscriptions/integrate/ ... and implement their equivalents from Python.
The billing plans objects of the Subscriptions API do support the syntax you were trying to add, so my guess is that is where you got it from: https://developer.paypal.com/docs/api/subscriptions/v1/#plans_create

Stripe testing subscription Lumen 5.1

Im running Stripe in test mode.
I've created a Yearly billing plan for 100GBP amount, with a 7 days trial ( directly onto Stripe dashboard. )
However, to test the webhooks i've hardcoded the trial_end:
$trialEnd = new DateTime();
$trialEnd->setTimestamp(time()+120);
$user = Users::find($this->user()['user_id']);
$user->subscription($stripe_plan['stripe_plan'])->trialFor($trialEnd)->create($data['stripeToken'], [
'email' => $this->user()['email']
]);
$user->save();
Basically all goes well, but into stripe dashboard the first invoice for 0 GBP is shown, and after one minute i get the Subscription will end in a minute event. After all, the subscription become Active ( from Trialing ) state.
All the webhooks and even the first subscription add reponse i get the trial ends period instead subscription ends.
How can i get the subscription_ends_at timestamp ?
All webhook requests are having the following timestamps:
{
"id": "evt_18baRrIzJLF7fe6PMDPYD0NM",
"object": "event",
"api_version": "2016-07-06",
"created": 1469558315,
"data": {
"object": {
"id": "sub_8tNBbqy0AmSk8p",
"object": "subscription",
"application_fee_percent": null,
"cancel_at_period_end": false,
"canceled_at": null,
"created": 1469558268,
"current_period_end": 1469558384,
"current_period_start": 1469558268,
"customer": "cus_8tNB1tWYw3Jw7L",
"discount": null,
"ended_at": null,
"livemode": false,
"metadata": {
},
"plan": {
"id": "yearly_200",
"object": "plan",
"amount": 20000,
"created": 1469545724,
"currency": "gbp",
"interval": "year",
"interval_count": 1,
"livemode": false,
"metadata": {
},
"name": "Full Club Membership - Pay Anually",
"statement_descriptor": "FULL MEMBERSHIP",
"trial_period_days": 7
},
"quantity": 1,
"start": 1469558268,
"status": "trialing",
"tax_percent": null,
"trial_end": 1469558384,
"trial_start": 1469558268
}
},
"livemode": false,
"pending_webhooks": 1,
"request": null,
"type": "customer.subscription.trial_will_end"
}
So if you look at trial_start and trial_end is same with current_period_start and current_period_end.
I've though initially that if this is the current period.. fine, but after trial expires the current period shouldn't be trials one.
There is any method to take the subscription_ends_at field from Stripe api ? And also, after the trial period ends, shouldn't send a invoice with the real amount ?
Also, i created a subscription plan with no trial period. That plan after a client subscribed, i get the correct timestamps.
Thanks in advance!
It looks like you figured it out. Basically, the delay comes from the fact that when the timestamp passes for your trial expiration, your request to create a new Invoice on that billing cycle gets added to a queue. Typically the queue will create the new invoice ~immediately, but it can sometimes go several minutes before triggering.
The first Invoice will always have timestamps for the current_period_* that map to the trial_period_* ones. Whereas, the second Invoice (that shows up with the invoice.created-event) will have the accurate timestamps for the billing period.
Oh, now i understand .. i will explain maybe will help someone :D.
Basically if a subscription got a trial period when you subscribe you will get a invoice for 0. Then, even if you set the trial to expire in 2 minutes with the request , the first payment will occur in about 10 minutes :D ( with that payment (if you set a webhook url) you will get a "type": "customer.subscription.updated" event who will contain all desired informations. At that time you can update your subscription_ends_at .
I didn't wait 10 minutes to see if the new invoice will be triggered.. and created -> removed -> recreated -> removed and so on for 4 hours with different tests.

Get session using start time and end time in google fit

When I tried to get the sessions based on start and end time, I can get only the named sessions(like Morning walking in the image) but not other sessions. Can any one tell me why this kind of data's not fetched.
API:
https://www.googleapis.com/fitness/v1/users/me/sessions?startTime=2016-03-08T00:00:00.000Z&endTime=2016-03-08T22:00:00.000Z&access_token=*******
Not only this date but also for all the date, I have gets only the named sessions.
Response:
{
"session": [
{
"id": "b514327692edd309:activemode:walking:1457414580406",
"name": "Morning walking",
"startTimeMillis": "1457414580406",
"endTimeMillis": "1457414781711",
"modifiedTimeMillis": "1457415751927",
"application": {
"packageName": "com.google.android.apps.fitness"
},
"activityType": 7
}
]
}

Resources