Skip to content

Commit

Permalink
Docs: Api reference docs update for Payments - Create (#4955)
Browse files Browse the repository at this point in the history
Co-authored-by: Gorakhnath Yadav <gorakhnath.yadav@Gorakhnath-Yadav-J9J2YJH1J2.local>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: Sanchith Hegde <22217505+SanchithHegde@users.noreply.github.com>
  • Loading branch information
4 people authored Jun 28, 2024
1 parent f03dc7a commit f55cae2
Show file tree
Hide file tree
Showing 9 changed files with 743 additions and 228 deletions.
849 changes: 656 additions & 193 deletions api-reference/openapi_spec.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion crates/api_models/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -857,9 +857,11 @@ pub struct ToggleAllKVResponse {
#[schema(example = true)]
pub kv_enabled: bool,
}

/// Merchant connector details used to make payments.
#[derive(Debug, Clone, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct MerchantConnectorDetailsWrap {
/// Creds Identifier is to uniquely identify the credentials. Do not send any sensitive info in this field. And do not send the string "null".
/// Creds Identifier is to uniquely identify the credentials. Do not send any sensitive info, like encoded_data in this field. And do not send the string "null".
pub creds_identifier: String,
/// Merchant connector details type type. Base64 Encode the credentials and send it in this type and send as a string.
#[schema(value_type = Option<MerchantConnectorDetails>, example = r#"{
Expand Down
1 change: 1 addition & 0 deletions crates/api_models/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ mod test {
}
}

/// Denotes the retry action
#[derive(
Debug,
serde::Deserialize,
Expand Down
1 change: 1 addition & 0 deletions crates/api_models/src/ephemeral_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use common_utils::id_type;
use serde;
use utoipa::ToSchema;

/// ephemeral_key for the customer_id mentioned
#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, Eq, PartialEq, ToSchema)]
pub struct EphemeralKeyCreateResponse {
/// customer_id to which this ephemeral key belongs to
Expand Down
1 change: 1 addition & 0 deletions crates/api_models/src/mandates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ pub struct MandateListConstraints {
pub created_time_gte: Option<PrimitiveDateTime>,
}

/// Details required for recurring payment
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
#[serde(tag = "type", content = "data", rename_all = "snake_case")]
pub enum RecurringDetails {
Expand Down
98 changes: 67 additions & 31 deletions crates/api_models/src/payments.rs

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions crates/common_enums/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub mod diesel_exports {
};
}

/// The status of the attempt
#[derive(
Clone,
Copy,
Expand Down Expand Up @@ -205,6 +206,7 @@ impl AttemptStatus {
}
}

/// Pass this parameter to force 3DS or non 3DS auth for this payment. Some connectors will still force 3DS auth even in case of passing 'no_three_ds' here and vice versa. Default value is 'no_three_ds' if not set
#[derive(
Clone,
Copy,
Expand Down Expand Up @@ -232,6 +234,7 @@ pub enum AuthenticationType {
NoThreeDs,
}

/// The status of the capture
#[derive(
Clone,
Copy,
Expand Down Expand Up @@ -308,6 +311,7 @@ pub enum BlocklistDataKind {
ExtendedCardBin,
}

/// Default value if not passed is set to 'automatic' which results in Auth and Capture in one single API request. Pass 'manual' or 'manual_multiple' in case you want do a separate Auth and Capture by first authorizing and placing a hold on your customer's funds so that you can use the Payments/Capture endpoint later to capture the authorized amount. Pass 'manual' if you want to only capture the amount later once or 'manual_multiple' if you want to capture the funds multiple times later. Both 'manual' and 'manual_multiple' are only supported by a specific list of processors
#[derive(
Clone,
Copy,
Expand Down Expand Up @@ -1164,6 +1168,7 @@ pub enum MerchantStorageScheme {
RedisKv,
}

/// The status of the current payment that was made
#[derive(
Clone,
Copy,
Expand Down Expand Up @@ -1197,6 +1202,7 @@ pub enum IntentStatus {
PartiallyCapturedAndCapturable,
}

/// Indicates that you intend to make future payments with this Payment’s payment method. Providing this parameter will attach the payment method to the Customer, if present, after the Payment is confirmed and any required actions from the user are complete.
#[derive(
Clone,
Copy,
Expand Down Expand Up @@ -1251,6 +1257,7 @@ pub enum PaymentMethodIssuerCode {
JpBacs,
}

/// Payment Method Status
#[derive(
Clone,
Copy,
Expand Down Expand Up @@ -1603,6 +1610,7 @@ pub enum CardNetwork {
Maestro,
}

/// Stage of the dispute
#[derive(
Clone,
Copy,
Expand All @@ -1627,6 +1635,7 @@ pub enum DisputeStage {
PreArbitration,
}

/// Status of the dispute
#[derive(
Clone,
Debug,
Expand Down Expand Up @@ -2499,6 +2508,7 @@ pub enum RoleScope {
Organization,
}

/// Indicates the transaction status
#[derive(
Clone,
Default,
Expand Down
1 change: 1 addition & 0 deletions crates/openapi/src/openapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::PaymentsUpdateRequest,
api_models::payments::PaymentsConfirmRequest,
api_models::payments::PaymentsResponse,
api_models::payments::PaymentsCreateResponseOpenApi,
api_models::payments::PaymentsStartRequest,
api_models::payments::PaymentRetrieveBody,
api_models::payments::PaymentsRetrieveRequest,
Expand Down
6 changes: 3 additions & 3 deletions crates/openapi/src/routes/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
),
),
responses(
(status = 200, description = "Payment created", body = PaymentsResponse),
(status = 200, description = "Payment created", body = PaymentsCreateResponseOpenApi),
(status = 400, description = "Missing Mandatory fields")
),
tag = "Payments",
Expand Down Expand Up @@ -268,7 +268,7 @@ pub fn payments_retrieve() {}
)
),
responses(
(status = 200, description = "Payment updated", body = PaymentsResponse),
(status = 200, description = "Payment updated", body = PaymentsCreateResponseOpenApi),
(status = 400, description = "Missing mandatory fields")
),
tag = "Payments",
Expand Down Expand Up @@ -326,7 +326,7 @@ pub fn payments_update() {}
)
),
responses(
(status = 200, description = "Payment confirmed", body = PaymentsResponse),
(status = 200, description = "Payment confirmed", body = PaymentsCreateResponseOpenApi),
(status = 400, description = "Missing mandatory fields")
),
tag = "Payments",
Expand Down

0 comments on commit f55cae2

Please sign in to comment.