diff --git a/app/GraphQL/Souk/Mutations/Orders/DraftOrderManagementMutation.php b/app/GraphQL/Souk/Mutations/Orders/DraftOrderManagementMutation.php new file mode 100644 index 000000000..cf54d65f7 --- /dev/null +++ b/app/GraphQL/Souk/Mutations/Orders/DraftOrderManagementMutation.php @@ -0,0 +1,41 @@ +user(); + + print_R($request); + $customer = $request['input']['customer']; + $customer['contacts'] = [ + [ + 'contact' => $request['input']['email'], + 'contacts_types_id' => ContactTypeEnum::EMAIL->value, + 'weight' => 0 + ] + ]; + + print_r($customer); die(); + + + return []; + } + + +} diff --git a/graphql/schemas/Souk/order.graphql b/graphql/schemas/Souk/order.graphql index 1d39b38b5..07f5d5df6 100644 --- a/graphql/schemas/Souk/order.graphql +++ b/graphql/schemas/Souk/order.graphql @@ -59,7 +59,7 @@ type OrderItem { updated_at: String } -input CreditCard { +input CreditCardInput { name: String! number: String! exp_month: Int! @@ -67,7 +67,7 @@ input CreditCard { cvv: Int! } -input CreditCardBilling { +input CreditCardBillingInput { address: String! address2: String city: String! @@ -78,24 +78,27 @@ input CreditCardBilling { input CartOrderInput { cartId: ID! + email: String! customer: PeopleInput - payment: CreditCard! - billing: CreditCardBilling + billing: CreditCardBillingInput + address: AddressInput + note: String } input OrderInput { customer: PeopleInput! - billing: CreditCardBilling + billing: CreditCardBillingInput address: AddressInput! } input DraftOrderInput { email: String! customer: PeopleInput! - billing: CreditCardBilling + billing: CreditCardBillingInput address: AddressInput items: [OrderLineItemInput!]! note: String + metadata: Mixed } input OrderLineItemInput { @@ -103,6 +106,13 @@ input OrderLineItemInput { quantity: Int! } +input PaymentInput { + orderId: ID! + paymentMethod: String! + creditCard: CreditCardInput + billing: CreditCardBillingInput +} + extend type Mutation @guard { # @deprecated(reason: "Use createOrderFromCart instead") createOrder(input: OrderInput!): Mixed! @@ -111,12 +121,16 @@ extend type Mutation @guard { ) createDraftOrder(input: DraftOrderInput!): Mixed! @field( - resolver: "App\\GraphQL\\Souk\\Mutations\\Orders\\OrderManagementMutation@create" + resolver: "App\\GraphQL\\Souk\\Mutations\\Orders\\DraftOrderManagementMutation@create" ) createOrderFromCart(input: CartOrderInput!): Mixed! @field( resolver: "App\\GraphQL\\Souk\\Mutations\\Orders\\OrderManagementMutation@create" ) + #assignPaymentToOrder(input: PaymentInput!): Mixed! + # @field( + # resolver: "App\\GraphQL\\Souk\\Mutations\\Orders\\OrderManagementMutation@assignPaymentToOrder" + # ) } extend type Query @guard {