Skip to content

Instantly share code, notes, and snippets.

@jstoiko
Created July 10, 2019 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jstoiko/e5bd13fc1ef6b7952f2854acc03be2eb to your computer and use it in GitHub Desktop.
Save jstoiko/e5bd13fc1ef6b7952f2854acc03be2eb to your computer and use it in GitHub Desktop.
#%RAML 1.0 Library
uses:
data_model: ../data_model.yaml
(data_model.context): ../../data_model/checkouts/schema.yaml
types:
Money:
(data_model.model): Money
(data_model.mode): read-write
properties:
amount:
type: number
minimum: 0.0
currency:
type: string
enum:
- USD
- EUR
- GBP
example:
amount: 3.0
currency: EUR
(data_model.example): |
{
"@context": {
"sorg": "http://schema.org/"
},
"@type": "sorg:MonetaryValue",
"sorg:amount": 3.0,
"sorg:currency": "EUR"
}
ShoppingCartWrite:
(data_model.model): ShoppingCart
(data_model.mode): write
properties:
presentmentCurrencyCode: string
lineItems?: CheckoutLineItem[]
ShoppingCartRead:
(data_model.model): ShoppingCart
(data_model.mode): read
properties:
shoppingcartId: string
lineItems: CheckoutLineItem[]
subtotalPrice: Money
totalPrice: Money
totalTax: Money
CheckoutLineItem:
(data_model.model): CheckoutLineItem
(data_model.mode): read-write
properties:
variantId: string
quantity: integer
CheckoutCreate:
(data_model.model): Checkout
(data_model.mode): write
properties:
allowPartialAddresses: boolean
email: string
note?: string
presentmentCurrencyCode: string
lineItems?:
CheckoutLineItem[]
shippingAddress:
MailingAddressRead
CheckoutRead:
(data_model.model): Checkout
(data_model.mode): read
type: CheckoutCreate
properties:
checkoutId: string
ready: boolean
requiresShipping: boolean
subtotalPrice: Money
taxExempt: boolean
taxesIncluded: boolean
totalPrice: Money
totalTax: Money
updateAt: datetime
webUrl: string
order: Order
orderStatusUrl: string
createdAt: datetime
updatedAt: datetime
completed: datetime
lineItems:
CheckoutLineItem[]
MailingAddressWrite:
(data_model.model): MailingAddress
(data_model.mode): write
properties:
address1: string
address2: string
city: string
company: string
country: string
firstName: string
lastName: string
phone: string
province: string
zip: string
MailingAddressRead:
(data_model.model): MailingAddress
(data_model.mode): read
type: MailingAddressWrite
properties:
mailingAddressIdentifier: string
countryCode: string
formatted: string
formattedArea: string
latitude: number
longitude: number
name: string
provinceCode: string
ShippingRateRead:
(data_model.model): ShippingRate
(data_model.mode): read-write
properties:
handle: string
price: string
title: string
ShippingRateWrite:
(data_model.model): ShippingRate
(data_model.mode): read-write
properties:
handle: string
PaymentWrite:
(data_model.model): Payment
(data_model.mode): write
properties:
amount: number
currency: string
checkoutId: string
creditCardToken: string
PaymentRead:
(data_model.model): Payment
(data_model.mode): write
type: PaymentWrite
properties:
paymentId: string
Order:
(data_model.model): Order
(data_model.mode): read-write
properties:
orderId: string
name: string
orderNumber: integer
email: string
phone: string
shippingAddress: MailingAddressRead
statusUrl: string
subtotalPrice: Money
totalPrice: Money
totalTax: Money
customerLocale: string
customerUrl: string
processedAt: datetime
createdAt: datetime
successfulFulfillments:
Fulfillment[]
example:
orderId: 7749303-fc
name: sample order
orderNumber: 88374
email: client@gmail.com
phone: "+4455279303"
shippingAddress:
mailingAddressIdentifier: 664hfj394h34h
address1: Finchley Road 453
address2: Kings Court Flat C
city: London
company: none
country: United Kingdom
countryCode: UK
firstName: John
lastName: Wadus
phone: "+4455279303"
province: Greater London
provinceCode: uk_gl
formatted: |
Finchley Road 453
Kings Court Flat C
NW3 8CD
London
UK
formattedArea: |
London, UK
latitude: 51.5468
longitude: -0.1801
name: home address
zip: NW3 8CD
statusUrl: http://myorder.com/order#
subtotalPrice:
amount: 30.4
currency: GBP
totalPrice:
amount: 33.4
currency: GBP
totalTax:
amount: 3.0
currency: GBP
customerLocale: en-gb
customerUrl: http://myorder.com/customer#
processedAt: 2015-03-04T20:45:03Z
createdAt: 2015-03-04T20:45:01Z
successfulFulfillments: []
(datamodel.example): |
{
"@context": {
"sorg": "http://schema.org/",
"data": "http://a.ml/vocabds/data#"
},
"@type": "sorg:Order",
"sorg:identifier": "7749303-fc",
"sorg:name": "sample order",
"sorg:orderNumber": 88374,
"sorg:email": "client@gmail.com",
"sorg:telephone": "+4455279303",
"sorg:deliveryAddress": {
"@type": "sorg:PostalAddress",
"sorg:identifier": "664hfj394h34h",
"sorg:streetAddress": "Finchley Road 453",
"data:address2": "Kings Court Flat C",
"sorg:addressLocality": "London",
"data:company": "none",
"sorg:addressCountry": "United Kingdom",
"data:countryCode": "UK",
"sorg:givenName": "John",
"sorg:familyName": "Wadus",
"sorg:telephone": "+4455279303",
"sorg:addressRegion": "Greater London",
"data:provinceCode": "uk_gl",
"data:formatted": "Finchley Road 453\nKings Court Flat C\nNW3 8CD\nLondon\nUK",
"data:formattedArea": "London, UK",
"sorg:latitude": 51.5468,
"sorg:longitude": -0.1801,
"sorg:name": "home address",
"sorg:postalCode": "NW3 8CD"
},
"sorg:url": "http://myorder.com/order#",
"sorg:subtotalPrice": {
"@type": "sorg:MonetaryValue",
"sorg:amount": 30.4,
"sorg:currency": "GBP"
},
"sorg:totalPrice": {
"@type": "sorg:MonetaryValue",
"sorg:amount": 33.4,
"sorg:currency": "GBP"
},
"sorg:totalTax": {
"@type": "sorg:MonetaryValue",
"sorg:amount": 3.0,
"sorg:currency": "GBP"
},
"data:customerLocale": "en-gb",
"data:customerUrl": "http://myorder.com/customer#",
"data:processedAt": "2015-03-04T20:45:03Z",
"sorg:orderDate": "2015-03-04T20:45:01Z",
"sorg:orderDelivery": []
}
Fulfillment:
(data_model.model): Fulfillment
(data_model.mode): read-write
properties:
trackingCompany: string
fulfillmentTrackingInfo:
items:
properties:
number: string
url: string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment