Closed (fixed)
Project:
Xero API
Version:
8.x-1.x-dev
Component:
Documentation
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
20 Aug 2018 at 00:25 UTC
Updated:
23 Nov 2019 at 14:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mradcliffeI have a small test module that I keep around locally to test get/post and dump out the results. Could be helpful for expanding the README to make any corrections. Though the post/form is using xero.form_builder (i.e. typed_widget before typed widget which I need to make stable at some point).
The ubercart example was probably written in 2014 and basically from the Drupal 7 example. It's a bit harder to do a Commerce example since it's a bit more complex. Maybe an example about how to structure data coming from commerce and what entities you may need to populate data (commerce_payment, commerce_order, profile)?
Comment #3
johnpitcairn commentedI'll be able to supply simple commerce example code that does approximately the same thing as the ubercart code from a
commerce_orderandprofile.Comment #4
Pascal- commentedOutdated documentation and examples make this module unusable for me.
I cannot figure out how to get it to run after several hours.
None of the documented or example code works.
The example provided above here does work, but is not enough to continue using the module.
I need at least an example on how to generate new data to post back to xero.
Comment #5
johnpitcairn commentedI got pulled off this for a few months, but the project is still on my client's integration radar so I do hope to get back to it.
@Pascal if it's Commerce 2 example code you need message me and I can provide what I have, which from memory was very basic proof of concept code to post contact/invoice data to Xero via a route and controller. Not at all production-ready or security checked so you would need to flesh it out.
Comment #6
mradcliffeHi @Pascal-,
It may help me to understand what type of data you're trying to send to Xero. The basic idea is to create the Typed Data data types, the ones this module provides, from TypedDataManager, and then use XeroQuery to post that data. Could you provide any more details about some of the code you tried and what your expectation was? Thank you.
There two things that help me when I'm trying to figure out if I messed up the data that I posted to Xero:
1. The error from Xero should be in the watchdog details.
2. Using a debugger, I can put a breakpoint at (XeroQuery.php line 506).
I haven't been able to work on Commerce Xero in a few months, but I did have that in a fairly good state for posting invoice or bank transaction data back to Xero. However it is still fairly brittle.
Comment #7
Pascal- commentedI was trying to create a new xero_invoice from scratch.
Here's how far I got:
is returning:
I then followed this issue: https://www.drupal.org/project/xero/issues/2913401
With led to the next error:
I no longer have the exact code, but the above should demonstrate my issues.
I also tried several other options, but to no success.
I just have no clue how to start building a typedDataManager object that has all the info the xero_invoice type requires, since I've never worked with typedDataManager before.
A simple working example would be sufficient.
Comment #8
mradcliffeI think you're using 8.x-1.1, which, although the stable release, is out-of-date based on Xero changes.
I've been testing and working with 8.x-1.2-alpha6 or greater with success for invoices, @_Pascal. I've been waiting for some feedback on commerce xero and making that stable before I release 1.2 as stable.
Small fix here, the "name" parameter is used when creating a child data type on a parent. It's not the plugin ID of the data type.
The following works given a newer release. This is what I am doing in Commerce Xero in #3023730: Implement invoice data type plugin, payment processor plugin.
Comment #9
Pascal- commentedThanks, will definitely test that later, currently working on something else.
But we will need to implement this in the future.
Comment #10
mradcliffeSwaps out the uc_xero_example module for xero_example module dependent on examples module. I wonder if I should require-dev drupal/examples?
I updated the README with a bit more as well, and then fixed some bugs in data types while I was at it. Also, wow, I started the drupal 8 port so long ago that hook_permissions was still in there. No wonder I added my own permission in commerce_xero :-)
Comment #12
mradcliffeReclosing for now.