Skip to content
This repository was archived by the owner on Dec 19, 2019. It is now read-only.

Commit

Permalink
GraphQL-293: [Payment methods] Set Payment Method on Cart
Browse files Browse the repository at this point in the history
  • Loading branch information
naydav committed Feb 26, 2019
1 parent f4f62ea commit 495c540
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value

return [
'code' => $payment->getMethod(),
'po_number' => $payment->getPoNumber(),
'purchase_order_number' => $payment->getPoNumber(),
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
throw new GraphQlInputException(__('Required parameter payment "code" is missing'));
}

$poNumber = $this->arrayManager->get('input/payment_method/po_number', $args);
if (!$poNumber) {
throw new GraphQlInputException(__('Required parameter payment "po_number" is missing'));
}
$poNumber = $this->arrayManager->get('input/payment_method/purchase_order_number', $args);

$cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId());
$payment = $this->paymentFactory->create([
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/QuoteGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ input SetPaymentMethodOnCartInput {

input PaymentMethodInput {
code: String! @doc(description:"Payment method code")
po_number: String! @doc(description:"Purchase order number")
purchase_order_number: String @doc(description:"Purchase order number")
additional_data: PaymentMethodAdditionalDataInput
}

Expand Down Expand Up @@ -203,7 +203,7 @@ type AvailablePaymentMethod {

type SelectedPaymentMethod {
code: String @doc(description: "The payment method code")
po_number: String @doc(description: "The purchase order number.")
purchase_order_number: String @doc(description: "The purchase order number.")
additional_data: SelectedPaymentMethodAdditionalData
}

Expand Down

0 comments on commit 495c540

Please sign in to comment.