This repository has been archived by the owner on Dec 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 156
Checkout workflow
Valeriy Naida edited this page Dec 20, 2018
·
6 revisions
- Create empty cart [DONE]
mutation {
createEmptyCart
}
Response:
{
"data": {
"createEmptyCart": "vpLKDPvz0F2P2J3ksx97ZcSHUA95a8PX"
}
}
- Add Product to Cart [DONE]
mutation {
addSimpleProductsToCart(
input: {
cart_id: "vpLKDPvz0F2P2J3ksx97ZcSHUA95a8PX",
cartItems: [
{
data: {
sku: "Simple-1",
qty: 2
}
}
]
}
) {
cart {
items {
id
qty
product {
sku
}
}
}
}
}
Response:
{
"data": {
"addSimpleProductsToCart": {
"cart": {
"items": [
{
"id": "1",
"qty": 2,
"product": {
"sku": "Simple-1"
}
}
]
}
}
}
}
- Set Shipping Address [DONE]
mutation {
setShippingAddressesOnCart(
input: {
cart_id: "vpLKDPvz0F2P2J3ksx97ZcSHUA95a8PX"
shipping_addresses: [
{
address: {
firstname: "test firstname"
lastname: "test lastname"
company: "test company"
street: ["test street 1", "test street 2"]
city: "test city"
region: "test region"
postcode: "887766"
country_code: "US"
telephone: "88776655"
save_in_address_book: false
}
}
]
}
) {
cart {
shipping_addresses {
postcode
selected_shipping_method {
carrier_code
method_code
carrier_title
method_title
}
available_shipping_methods {
carrier_code
method_code
carrier_title
method_title
}
}
}
}
}
Response:
{
"data": {
"setShippingAddressesOnCart": {
"cart": {
"shipping_addresses": [
{
"postcode": "887766",
"selected_shipping_method": {
"carrier_code": null
"method_code": null
"carrier_title": null
"method_title": null
},
"available_shipping_methods": [
{
"carrier_code": 'freeshipping'
"method_code": 'freeshipping'
"carrier_title": 'Free Shipping'
"method_title": 'Free Shipping'
},
{
"carrier_code": 'ups'
"method_code": 'GND'
"carrier_title": 'United Parcel Service'
"method_title": 'Ground'
},
{
"carrier_code": 'ups'
"method_code": '1DP'
"carrier_title": 'Next Day Air'
"method_title": 'Next Day Air Saver'
}
]
}
]
}
}
}
}
- Set Shipping Method
mutation {
setShippingMethodOnCart (
input: {
cart_id: "vpLKDPvz0F2P2J3ksx97ZcSHUA95a8PX"
shipping_addresses: [
{
cart_address_id: 25 (???)
shipping_method: {
carrier_code: ups
method_code: GND
ups_data {
// One of way to set additional data
}
}
}
]
}
) {
cart {
shipping_addresses {
postcode
selected_shipping_method {
carrier_code
method_code
}
}
billing_address {
postcode
}
selected_payment_method {
code
title
}
available_payment_methods {
code
title
}
}
}
}
Response:
{
"data": {
"setShippingMethodOnCart": {
"cart": {
"shipping_addresses": [
{
"postcode": "887766",
"selected_shipping_method": {
"carrier_code": ups
"method_code": GND
},
}
]
},
"selected_payment_method": {
"code": null
"title": null
}
"available_payment_methods": [
{
"code": 'banktransfer'
"title": 'Bank Transfer Payment'
},
{
"code": 'checkmo'
"title": 'Check / Money order'
}
],
billing_address: {
"postcode": 887766,
}
}
}
}
- Set Billing Address
mutation {
setBillingAddressOnCart (
input: {
cart_id: "vpLKDPvz0F2P2J3ksx97ZcSHUA95a8PX"
address: {
firstname: "test firstname"
lastname: "test lastname"
company: "test company"
street: ["test street 1", "test street 2"]
city: "test city"
region: "test region"
postcode: "887766"
country_code: "US"
telephone: "88776655"
save_in_address_book: false
}
}
) {
cart {
shipping_addresses {
postcode
selected_shipping_method {
carrier_code
method_code
carrier_title
method_title
}
available_shipping_methods {
carrier_code
method_code
carrier_title
method_title
}
}
billing_address {
postcode
}
}
}
}
Response:
{
"data": {
"setBillingAddressOnCart": {
"cart": {
"shipping_addresses": [
{
"postcode": "887766",
"selected_shipping_method": {
"carrier_code": null
"method_code": null
"carrier_title": null
"method_title": null
},
"available_shipping_methods": [
{
"carrier_code": 'freeshipping'
"method_code": 'freeshipping'
"carrier_title": 'Free Shipping'
"method_title": 'Free Shipping'
},
{
"carrier_code": 'ups'
"method_code": 'GND'
"carrier_title": 'United Parcel Service'
"method_title": 'Ground'
},
{
"carrier_code": 'ups'
"method_code": '1DP'
"carrier_title": 'United Parcel Service'
"method_title": 'Next Day Air Saver'
}
]
}
]
billing_address: {
"postcode": 887766,
}
}
}
}
}
- Set Payment Method
mutation {
setPaymentMethodOnCart (
input: {
cart_id: "vpLKDPvz0F2P2J3ksx97ZcSHUA95a8PX"
payment_method: {
code: checkmo
checkmo_data: {
// One of way to set additional data
}
}
}
) {
cart {
shipping_addresses {
postcode
selected_shipping_method {
carrier_code
method_code
}
}
billing_address {
postcode
}
selected_payment_method {
code
}
}
}
}
Response:
{
"data": {
"setPaymentMethodOnCart": {
"cart": {
"shipping_addresses": [
{
"postcode": "887766",
"selected_shipping_method": {
"carrier_code": ups
"method_code": GND
},
},
]
billing_address: {
"postcode": 887766,
}
},
"selected_payment_method": {
"code": 'checkmo'
}
}
}
}
- Place order
mutation {
placeOrder (
input: {
cart_id: "vpLKDPvz0F2P2J3ksx97ZcSHUA95a8PX"
) {
order {
order_id
}
}
Response:
{
"data": {
"placeOrder": {
"order": {
"order_id": 000000001
}
}
}
}
- Roadmap
- ZenHub task board (requires GitHub sign-in)
- Weekly calls:
- Thursday, 15:00 UTC
- Video conference link - https://bluejeans.com/180764326
- Recordings - https://goo.gl/5Q7QAw
- Slack: #graphql (Use http://tinyurl.com/engcom-slack to register)