Skip to content

Commit 495c540

Browse files
committed
GraphQL-293: [Payment methods] Set Payment Method on Cart
1 parent f4f62ea commit 495c540

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

app/code/Magento/QuoteGraphQl/Model/Resolver/SelectedPaymentMethod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
3636

3737
return [
3838
'code' => $payment->getMethod(),
39-
'po_number' => $payment->getPoNumber(),
39+
'purchase_order_number' => $payment->getPoNumber(),
4040
];
4141
}
4242
}

app/code/Magento/QuoteGraphQl/Model/Resolver/SetPaymentMethodOnCart.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
8181
throw new GraphQlInputException(__('Required parameter payment "code" is missing'));
8282
}
8383

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

8986
$cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId());
9087
$payment = $this->paymentFactory->create([

app/code/Magento/QuoteGraphQl/etc/schema.graphqls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ input SetPaymentMethodOnCartInput {
110110

111111
input PaymentMethodInput {
112112
code: String! @doc(description:"Payment method code")
113-
po_number: String! @doc(description:"Purchase order number")
113+
purchase_order_number: String @doc(description:"Purchase order number")
114114
additional_data: PaymentMethodAdditionalDataInput
115115
}
116116

@@ -203,7 +203,7 @@ type AvailablePaymentMethod {
203203

204204
type SelectedPaymentMethod {
205205
code: String @doc(description: "The payment method code")
206-
po_number: String @doc(description: "The purchase order number.")
206+
purchase_order_number: String @doc(description: "The purchase order number.")
207207
additional_data: SelectedPaymentMethodAdditionalData
208208
}
209209

0 commit comments

Comments
 (0)