fix(router): disable openapi examples (#2648)

This commit is contained in:
Sai Harsha Vardhan
2023-10-22 12:59:34 +05:30
committed by GitHub
parent 83f0062aad
commit b39bdbf0c2
2 changed files with 49 additions and 74 deletions

View File

@ -13,12 +13,12 @@ use crate::{
payment_methods::{Oss, PaymentMethodRetrieve}, payment_methods::{Oss, PaymentMethodRetrieve},
payments::{self, PaymentRedirectFlow}, payments::{self, PaymentRedirectFlow},
}, },
openapi::examples::{ // openapi::examples::{
PAYMENTS_CREATE, PAYMENTS_CREATE_MINIMUM_FIELDS, PAYMENTS_CREATE_WITH_ADDRESS, // PAYMENTS_CREATE, PAYMENTS_CREATE_MINIMUM_FIELDS, PAYMENTS_CREATE_WITH_ADDRESS,
PAYMENTS_CREATE_WITH_CUSTOMER_DATA, PAYMENTS_CREATE_WITH_FORCED_3DS, // PAYMENTS_CREATE_WITH_CUSTOMER_DATA, PAYMENTS_CREATE_WITH_FORCED_3DS,
PAYMENTS_CREATE_WITH_MANUAL_CAPTURE, PAYMENTS_CREATE_WITH_NOON_ORDER_CATETORY, // PAYMENTS_CREATE_WITH_MANUAL_CAPTURE, PAYMENTS_CREATE_WITH_NOON_ORDER_CATETORY,
PAYMENTS_CREATE_WITH_ORDER_DETAILS, // PAYMENTS_CREATE_WITH_ORDER_DETAILS,
}, // },
routes::lock_utils, routes::lock_utils,
services::{api, authentication as auth}, services::{api, authentication as auth},
types::{ types::{
@ -36,48 +36,49 @@ use crate::{
path = "/payments", path = "/payments",
request_body( request_body(
content = PaymentsCreateRequest, content = PaymentsCreateRequest,
examples( // examples(
( // (
"Create a payment with minimul fields" = ( // "Create a payment with minimul fields" = (
value = json!(PAYMENTS_CREATE_MINIMUM_FIELDS) // value = json!(PAYMENTS_CREATE_MINIMUM_FIELDS)
) // )
), // ),
( // (
"Create a manual capture payment" = ( // "Create a manual capture payment" = (
value = json!(PAYMENTS_CREATE_WITH_MANUAL_CAPTURE) // value = json!(PAYMENTS_CREATE_WITH_MANUAL_CAPTURE)
) // )
), // ),
( // (
"Create a payment with address" = ( // "Create a payment with address" = (
value = json!(PAYMENTS_CREATE_WITH_ADDRESS) // value = json!(PAYMENTS_CREATE_WITH_ADDRESS)
) // )
), // ),
( // (
"Create a payment with customer details" = ( // "Create a payment with customer details" = (
value = json!(PAYMENTS_CREATE_WITH_CUSTOMER_DATA) // value = json!(PAYMENTS_CREATE_WITH_CUSTOMER_DATA)
) // )
), // ),
( // (
"Create a 3DS payment" = ( // "Create a 3DS payment" = (
value = json!(PAYMENTS_CREATE_WITH_FORCED_3DS) // value = json!(PAYMENTS_CREATE_WITH_FORCED_3DS)
) // )
), // ),
( // (
"Create a payment" = ( // "Create a payment" = (
value = json!(PAYMENTS_CREATE) // value = json!(PAYMENTS_CREATE)
) // )
), // ),
( // (
"Create a payment with order details" = ( // "Create a payment with order details" = (
value = json!(PAYMENTS_CREATE_WITH_ORDER_DETAILS) // value = json!(PAYMENTS_CREATE_WITH_ORDER_DETAILS)
) // )
), // ),
( // (
"Create a payment with order category for noon" = ( // "Create a payment with order category for noon" = (
value = json!(PAYMENTS_CREATE_WITH_NOON_ORDER_CATETORY) // value = json!(PAYMENTS_CREATE_WITH_NOON_ORDER_CATETORY)
) // )
), // ),
)), // )
),
responses( responses(
(status = 200, description = "Payment created", body = PaymentsResponse), (status = 200, description = "Payment created", body = PaymentsResponse),
(status = 400, description = "Missing Mandatory fields") (status = 400, description = "Missing Mandatory fields")

View File

@ -1063,32 +1063,6 @@
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/PaymentsCreateRequest" "$ref": "#/components/schemas/PaymentsCreateRequest"
},
"examples": {
"Create a 3DS payment": {
"value": "{\n \"amount\": 6540,\n \"currency\": \"USD\",\n \"authentication_type\" : \"three_ds\"\n }"
},
"Create a manual capture payment": {
"value": "{\n \"amount\": 6540,\n \"currency\": \"USD\",\n \"capture_method\":\"manual\"\n }"
},
"Create a payment": {
"value": "{\n \"amount\": 6540,\n \"currency\": \"USD\",\n \"payment_id\": \"abcdefghijklmnopqrstuvwxyz\",\n \"customer\": {\n \"id\":\"cus_abcdefgh\",\n \"name\":\"John Dough\",\n \"phone\":\"9999999999\",\n \"email\":\"john@example.com\"\n },\n \"description\": \"Its my first payment request\",\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"some-value\",\n \"udf2\": \"some-value\"\n }\n }"
},
"Create a payment with address": {
"value": "{\n \"amount\": 6540,\n \"currency\": \"USD\",\n \"customer\": {\n \"id\" : \"cus_abcdefgh\"\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"joseph\",\n \"last_name\": \"Doe\"\n },\n \"phone\": {\n \"number\": \"8056594427\",\n \"country_code\": \"+91\"\n }\n }\n }"
},
"Create a payment with customer details": {
"value": "{\n \"amount\": 6540,\n \"currency\": \"USD\",\n \"customer\": {\n \"id\":\"cus_abcdefgh\",\n \"name\":\"John Dough\",\n \"phone\":\"9999999999\",\n \"email\":\"john@example.com\"\n }\n }"
},
"Create a payment with minimul fields": {
"value": "{\n \"amount\": 6540,\n \"currency\": \"USD\",\n }"
},
"Create a payment with order category for noon": {
"value": "{\n \"amount\": 6540,\n \"currency\": \"USD\",\n \"connector_metadata\": {\n \"noon\": {\n \"order_category\":\"shoes\"\n }\n }\n }"
},
"Create a payment with order details": {
"value": "{\n \"amount\": 6540,\n \"currency\": \"USD\",\n \"order_details\": [\n {\n \"product_name\": \"Apple iPhone 15\",\n \"quantity\": 1,\n \"amount\" : 6540\n }\n ]\n }"
}
} }
} }
}, },