createOrder method

Future createOrder(
  1. CreateOrderRequest order
)

Implementation

Future createOrder(CreateOrderRequest order) async {
  String createOrderGql = """ mutation createOrder(\$order: OrderInput) {
            createOrder(order: \$order) {
              _id
              shippingFees
              totalAmount
              orderType
              _id
              orderDate
              orderId
              bookingId
              shippingFees
              history {
                action
                type
                customerView
                date
              }
              price {
                totalPrice
                totalGstPrice
                totalWithOutGstPrice
                totalWithOutSCGstPrice
                totalMrp
                resellerPrice
              }
              paymentStatus
              billingAddress {
                contactName
                companyName
                emailId
                mobileNumber
                address
                city
                state
                pincode
              }
              shippingAddress {
                contactName
                companyName
                emailId
                mobileNumber
                address
                city
                state
                pincode
              }
              user {
                contactName
                mobileNumber
                emailId
                userId
              }
              subTotal
              totalGst
              totalAmount
              orderStatus
              orderItem {
                quantity
                comments
                variant
                variantValue
                price
                piece
                igst
                cgst
                sgst
                pack {
                  categoryId
                  packSKU
                  packName
                  moq
                  packVariant
                  packImage
                  packId
                }
                set {
                  setCode
                  setId
                  sku {
                    setSkuPrice
                    setQuantity
                    skuId
                    sku
                    styleCode
                    variationType
                    b2cSellingPrice
                    b2bSellingPrice
                    mrp
                    discount
                    productName
                    INTsku
                    sizeAttributeSettingId
                    sizeAttributeSettingFieldValueId
                    colorAttributeSettingId
                    colorAttributeSettingFieldValueId
                    sizeAttributeName
                    colorAttributeName
                    sizeAttributeFieldValue
                    colorAttributeFieldValue
                    gstTypeId
                    gstValue
                  }
                }
              }
            }
          }


        """;
  GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration();
  GraphQLClient _client = graphQLConfiguration.clientToQuery();
  final vble = {"order": order};
  QueryResult result = await _client.mutate(
    MutationOptions(
      document: gql(createOrderGql),
      variables: vble,
    ),
  );
  print(result);
  if (!result.hasException) {
    var createOrder = result.data!['createOrder'];
    if (createOrder != null && createOrder["_id"] != null) {
      orderCreated = createOrderResponseFromJson(createOrder);
    }
  }
  return orderCreated;
}