-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes for orders #62
Merged
Merged
Fixes for orders #62
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here's a dump of my order created payload for reference: {
"type": "orders",
"id": "...",
"attributes": {
"store_id": 50882,
"customer_id": ...,
"identifier": "3d4fb652-1b16-44b8-9330-01ae5d46d1ee",
"order_number": 508829,
"user_name": "Caleb Porzio",
"user_email": "...",
"currency": "USD",
"currency_rate": "1.00000000",
"tax_name": null,
"tax_rate": "0.00",
"status": "paid",
"status_formatted": "Paid",
"refunded": false,
"refunded_at": null,
"subtotal": 8900,
"discount_total": 0,
"tax": 0,
"total": 8900,
"subtotal_usd": 8900,
"discount_total_usd": 0,
"tax_usd": 0,
"total_usd": 8900,
"subtotal_formatted": "$89.00",
"discount_total_formatted": "$0.00",
"tax_formatted": "$0.00",
"total_formatted": "$89.00",
"first_order_item": {
"id": 1564670,
"order_id": 1602320,
"product_id": 131530,
"variant_id": 154371,
"price_id": 152412,
"product_name": "Basic",
"variant_name": "Default",
"price": 8900,
"created_at": "2023-11-19T19:06:28.000000Z",
"updated_at": "2023-11-19T19:06:28.000000Z",
"test_mode": true
},
"urls": {
"receipt": "..."
},
"created_at": "2023-11-19T19:06:23.000000Z",
"updated_at": "2023-11-19T19:06:28.000000Z",
"test_mode": true
},
"relationships": {
"store": {
"links": {
"related": "https://api.lemonsqueezy.com/v1/orders/1602320/store",
"self": "https://api.lemonsqueezy.com/v1/orders/1602320/relationships/store"
}
},
"customer": {
"links": {
"related": "https://api.lemonsqueezy.com/v1/orders/1602320/customer",
"self": "https://api.lemonsqueezy.com/v1/orders/1602320/relationships/customer"
}
},
"order-items": {
"links": {
"related": "https://api.lemonsqueezy.com/v1/orders/1602320/order-items",
"self": "https://api.lemonsqueezy.com/v1/orders/1602320/relationships/order-items"
}
},
"subscriptions": {
"links": {
"related": "https://api.lemonsqueezy.com/v1/orders/1602320/subscriptions",
"self": "https://api.lemonsqueezy.com/v1/orders/1602320/relationships/subscriptions"
}
},
"license-keys": {
"links": {
"related": "https://api.lemonsqueezy.com/v1/orders/1602320/license-keys",
"self": "https://api.lemonsqueezy.com/v1/orders/1602320/relationships/license-keys"
}
},
"discount-redemptions": {
"links": {
"related": "https://api.lemonsqueezy.com/v1/orders/1602320/discount-redemptions",
"self": "https://api.lemonsqueezy.com/v1/orders/1602320/relationships/discount-redemptions"
}
}
},
"links": {
"self": "https://api.lemonsqueezy.com/v1/orders/1602320"
}
} |
Hah, some stupid mistakes on my end 😅 sorry about that. Thanks for the PR! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following fixes:
static::
toOrder::
)identifier
field from the payloadtax_name
a nullable field because it was coming back "null" for me$payload['data']['attributes']['first_order_item']
I didn't add any tests because there's no precedent for webhook tests. Might be something to consider: tests with payload stubs to simulate handling new orders and subscriptions...
I do not intend for this PR to be merged (unless you want). This is more like a log of what got it all working for me locally for your reference.
Thanks for all your hard work on this!