Skip to content

adding in hooks and model for Purchases#21

Open
IDSeal wants to merge 2 commits into
Ontraport:masterfrom
IDSeal:ID-112
Open

adding in hooks and model for Purchases#21
IDSeal wants to merge 2 commits into
Ontraport:masterfrom
IDSeal:ID-112

Conversation

@IDSeal
Copy link
Copy Markdown

@IDSeal IDSeal commented Aug 1, 2019

Adding in base wrappers for Purchases, which according to the API (https://api.ontraport.com/live/#!/Purchases/getPurchases) only has GET endpoints available.

I cloned most of this from the Transaction wrappers.

@IDSeal
Copy link
Copy Markdown
Author

IDSeal commented Aug 1, 2019

Use Case: This stemmed from the need to retrieve dlm for Transactions in order to differentiate Paid vs Refunded. It appears Transactions do not provide the dlm (which was needed so we can determine when a Transaction was Refunded), it appears that Purchases do.

So I patched in a Purchases wrapper in order to get dlm for Refunds, and then match Transaction based on invoice_id. This appears to work, but having Transactions return dlm would be more ideal.

If this could get pulled in so it can be updated and distro'd via Composer, that would be super awesome!

Let me know if any changes are needed.

@evanjarrett
Copy link
Copy Markdown

You can always use the generic endpoint and pass in an objectID in order to retrieve models we don't have built out yet. This way you don't have to patch in your own code, or wait for us to implement it.
Objects->retrieveSingle(array("objectID" = ObjectType::PURCHASE, "id" => $id));
https://github.com/Ontraport/SDK-PHP/blob/master/src/Objects.php#L49-L55

We will look into getting this PR implemented, and what it will take to add dlm for new transactions.

Thanks!

@IDSeal
Copy link
Copy Markdown
Author

IDSeal commented Aug 1, 2019

Hey @00firestar00,
Thank you for the quick response!

That's very useful! I'll test around with using the generic endpoint :)

Also, that would be fantastic if dlm was added to Transactions! And possibly conversely, if zip was added to Purchases (for tax purposes), that would be very useful if the schema's allow for it.

Much appreciated

@evanjarrett
Copy link
Copy Markdown

Purchases don't contain any shipping information. That information will be on either the transaction, or the open order.

@IDSeal
Copy link
Copy Markdown
Author

IDSeal commented Aug 1, 2019

Gotcha, worth a try haha.

~ "Give a mouse a cookie"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants