Created
September 19, 2023 09:47
-
-
Save hnestmann/a20f39d144cd69a287b62cf7baf685d5 to your computer and use it in GitHub Desktop.
Salesforcce Order Management Sample Request
This file contains hidden or 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
| { | |
| "allOrNone": true, | |
| "compositeRequest": [ | |
| { | |
| "method": "POST", | |
| "url": "/services/data/v58.0/sobjects/Order", | |
| "referenceId": "refOrder", | |
| "body": { | |
| "Pricebook2Id": "01sHn000001aU8VIAU", | |
| "Name": "Derek Emmett Brown", | |
| "Status": "Draft", | |
| "EffectiveDate": "{{today}}", | |
| "OrderReferenceNumber": "DB{{DemoTestOrderNumber}}", | |
| "BillingStreet": "175 Wyassup Rd", | |
| "BillingCity": "North Stonington", | |
| "BillingState": "CT", | |
| "BillingPostalCode": "06359", | |
| "BillingCountry": "US", | |
| "BillingPhoneNumber": "5616990145", | |
| "OrderedDate": "{{now}}", | |
| "BillingEmailAddress": "derek.brown@salesforce.com", | |
| "AccountId": "001Hn00001vNDjfIAG", | |
| "SalesChannelId": "0bIHn000000Cw1FMAS", | |
| "ExternalAppId__c":"CompositeAPI" | |
| } | |
| }, | |
| { | |
| "method": "POST", | |
| "url": "/services/data/v53.0/sobjects/PaymentGroup", | |
| "referenceId": "refPaymentGroup", | |
| "body": { | |
| "SourceObjectId": "@{refOrder.id}" | |
| } | |
| }, | |
| { | |
| "method": "POST", | |
| "url": "/services/data/v53.0/composite/sobjects", | |
| "referenceId": "refGroup0", | |
| "body": { | |
| "allOrNone": true, | |
| "records": [ | |
| { | |
| "attributes": { | |
| "type": "DigitalWallet" | |
| }, | |
| "Type":"MOCKPAYMENT", | |
| "Status": "Active", | |
| "AccountId": "001Hn00001vNDjfIAG", | |
| "ProcessingMode": "External" | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "method": "POST", | |
| "url": "/services/data/v53.0/composite/sobjects", | |
| "referenceId": "refGroup1", | |
| "body": { | |
| "allOrNone": true, | |
| "records": [ | |
| { | |
| "attributes": { | |
| "type": "OrderDeliveryGroup" | |
| }, | |
| "EmailAddress": "derek.brown@salesforce.com", | |
| "DeliverToCity": "North Stonington", | |
| "DeliverToCountry": "US", | |
| "DeliverToName": "Derek Brown", | |
| "DeliverToPostalCode": "06359", | |
| "DeliverToState": "CT", | |
| "DeliverToStreet": "175 Wyassup Rd", | |
| "PhoneNumber": "5616990145", | |
| "OrderDeliveryMethodId": "2DmHn000000gMdoKAE", | |
| "OrderId": "@{refOrder.id}" | |
| }, | |
| { | |
| "attributes": { | |
| "type": "PaymentAuthorization" | |
| }, | |
| "Amount": 38.46, | |
| "ProcessingMode": "External", | |
| "Status": "Processed", | |
| "PaymentGroupId": "@{refPaymentGroup.id}", | |
| "AccountId": "001Hn00001vNDjfIAG", | |
| "PaymentMethodId": "@{refGroup0[0].id}", | |
| "PaymentGatewayId": "0b0Hn000000cB5UIAU" | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "method": "POST", | |
| "url": "/services/data/v53.0/composite/sobjects", | |
| "referenceId": "refGroup2", | |
| "body": { | |
| "allOrNone": true, | |
| "records": [ | |
| { | |
| "attributes": { | |
| "type": "OrderItem" | |
| }, | |
| "Description": "A-100 - Small Turbine", | |
| "Type": "Order Product", | |
| "Quantity": 1, | |
| "TotalLineAmount": 15.99, | |
| "LineNumber": 1, | |
| "UnitPrice": 15.99, | |
| "OrderId": "@{refOrder.id}", | |
| "OrderDeliveryGroupId": "@{refGroup1[0].id}", | |
| "PricebookEntryId": "01uHn00000gV8eiIAC", | |
| "Product2Id": "01tHn00000USk7BIAT", | |
| "ReservedAtLocationId":"0ghHn000000PB4gIAG" | |
| }, | |
| { | |
| "attributes": { | |
| "type": "OrderItem" | |
| }, | |
| "Description": "A-1000 - Large Turbine", | |
| "Type": "Order Product", | |
| "Quantity": 1, | |
| "TotalLineAmount": 17.90, | |
| "LineNumber": 2, | |
| "UnitPrice": 17.90, | |
| "OrderId": "@{refOrder.id}", | |
| "OrderDeliveryGroupId": "@{refGroup1[0].id}", | |
| "PricebookEntryId": "01uHn00000gV8ejIAC", | |
| "Product2Id": "01tHn00000USk7CIAT", | |
| "ReservedAtLocationId":"0ghHn000000PB4gIAG" | |
| }, | |
| { | |
| "attributes": { | |
| "type": "OrderItem" | |
| }, | |
| "Description": "Shipping", | |
| "Product2Id": "01tHn00000USk7qIAD", | |
| "Type": "Delivery Charge", | |
| "Quantity": 1, | |
| "TotalLineAmount": 5.00, | |
| "LineNumber": 1000, | |
| "UnitPrice": 5.00, | |
| "PricebookEntryId": "01uHn00000d9fugIAA", | |
| "OrderId": "@{refOrder.id}", | |
| "OrderDeliveryGroupId": "@{refGroup1[0].id}" | |
| }, | |
| { | |
| "attributes": { | |
| "type": "PaymentGatewayLog" | |
| }, | |
| "InteractionStatus": "Success", | |
| "InteractionType": "Authorization", | |
| "ReferencedEntityId": "@{refGroup1[1].id}" | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "method": "POST", | |
| "url": "/services/data/v53.0/composite/sobjects", | |
| "referenceId": "refGroup3", | |
| "body": { | |
| "allOrNone": true, | |
| "records": [ | |
| { | |
| "attributes": { | |
| "type": "OrderItemTaxLineItem" | |
| }, | |
| "Name": "Product1 - Tax", | |
| "Type": "Estimated", | |
| "Amount": 1.60, | |
| "Rate": 0.1, | |
| "TaxEffectiveDate":"{{now}}", | |
| "OrderItemId": "@{refGroup2[0].id}" | |
| }, | |
| { | |
| "attributes": { | |
| "type": "OrderItemTaxLineItem" | |
| }, | |
| "Name": "Product2 - Tax", | |
| "Type": "Estimated", | |
| "Amount": 1.79, | |
| "Rate": 0.1, | |
| "TaxEffectiveDate":"{{now}}", | |
| "OrderItemId": "@{refGroup2[1].id}" | |
| }, | |
| { | |
| "attributes": { | |
| "type": "OrderItemTaxLineItem" | |
| }, | |
| "Name": "DeliveryCharge - Tax", | |
| "Type": "Estimated", | |
| "Amount": 0.5, | |
| "Rate": 0.05, | |
| "TaxEffectiveDate":"{{now}}", | |
| "OrderItemId": "@{refGroup2[2].id}" | |
| }, | |
| { | |
| "attributes": { | |
| "type": "OrderItemAdjustmentLineItem" | |
| }, | |
| "Name": "Discount 2$off", | |
| "Amount": -2.00, | |
| "OrderItemId": "@{refGroup2[0].id}" | |
| }, | |
| { | |
| "attributes": { | |
| "type": "OrderItemAdjustmentLineItem" | |
| }, | |
| "Name": "Discount 2 - 2$OrderAmount", | |
| "Amount": -2.0, | |
| "OrderItemId": "@{refGroup2[1].id}" | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "method": "POST", | |
| "url": "/services/data/v51.0/composite/sobjects", | |
| "referenceId": "refGroup4", | |
| "body": { | |
| "allOrNone": true, | |
| "records": [ | |
| { | |
| "attributes": { | |
| "type": "OrderItemTaxLineItem" | |
| }, | |
| "Name": "Discount - Adjustment Tax", | |
| "Type": "Estimated", | |
| "Amount": -0.15, | |
| "Rate": 0.1, | |
| "TaxEffectiveDate": "{{now}}", | |
| "OrderItemId": "@{refGroup2[0].id}", | |
| "OrderItemAdjustmentLineItemId": "@{refGroup3[3].id}" | |
| }, | |
| { | |
| "attributes": { | |
| "type": "OrderItemTaxLineItem" | |
| }, | |
| "Name": "Discount 2 - Adjustment Tax", | |
| "Type": "Estimated", | |
| "Amount": -0.17, | |
| "Rate": 0.1, | |
| "TaxEffectiveDate": "{{now}}", | |
| "OrderItemId": "@{refGroup2[1].id}", | |
| "OrderItemAdjustmentLineItemId": "@{refGroup3[4].id}" | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "method": "PATCH", | |
| "url": "/services/data/v53.0/sobjects/Order/@{refOrder.id}", | |
| "referenceId": "refUpdateOrder", | |
| "body": { | |
| "Status": "Activated" | |
| } | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment