Merge pull request #2 from twistedfall/model-update

Update models to correspond to the actual PayPal responses
This commit is contained in:
Edgar 2022-01-24 08:29:54 +01:00 committed by GitHub
commit e06a411295
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -273,14 +273,21 @@ pub enum AuthorizationStatus {
Pending, Pending,
} }
/// Details about the status of the authorization. /// Authorization status reason.
#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)] #[derive(Debug, Serialize, Deserialize, Eq, PartialEq)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum AuthorizationStatusDetails { pub enum AuthorizationStatusDetailsReason {
/// Authorization is pending manual review. /// Authorization is pending manual review.
PendingReview, PendingReview,
} }
/// Details about the status of the authorization.
#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)]
pub struct AuthorizationStatusDetails {
/// The reason why the authorized status is PENDING.
pub reason: AuthorizationStatusDetailsReason,
}
/// A payment authorization. /// A payment authorization.
#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)] #[derive(Debug, Serialize, Deserialize, Eq, PartialEq)]
pub struct AuthorizationWithData { pub struct AuthorizationWithData {
@ -306,10 +313,10 @@ pub enum CaptureStatus {
Refunded, Refunded,
} }
/// Details about the captured payment status. /// Capture status reason.
#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)] #[derive(Debug, Serialize, Deserialize, Eq, PartialEq)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum CaptureStatusDetails { pub enum CaptureStatusDetailsReason {
/// The payer initiated a dispute for this captured payment with PayPal. /// The payer initiated a dispute for this captured payment with PayPal.
BuyerComplaint, BuyerComplaint,
/// The captured funds were reversed in response to the payer disputing this captured payment with /// The captured funds were reversed in response to the payer disputing this captured payment with
@ -338,6 +345,13 @@ pub enum CaptureStatusDetails {
VerificationRequired, VerificationRequired,
} }
/// Details about the captured payment status.
#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)]
pub struct CaptureStatusDetails {
/// The reason why the captured payment status is PENDING or DENIED.
pub reason: CaptureStatusDetailsReason,
}
/// A captured payment. /// A captured payment.
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)] #[derive(Debug, Serialize, Deserialize, Eq, PartialEq)]
@ -360,14 +374,21 @@ pub enum RefundStatus {
Completed, Completed,
} }
/// The reason why the refund has the PENDING or FAILED status. /// Refund status reason.
#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)] #[derive(Debug, Serialize, Deserialize, Eq, PartialEq)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum RefundStatusDetails { pub enum RefundStatusDetailsReason {
/// The customer's account is funded through an eCheck, which has not yet cleared. /// The customer's account is funded through an eCheck, which has not yet cleared.
Echeck, Echeck,
} }
/// Details about the status of the refund.
#[derive(Debug, Serialize, Deserialize)]
pub struct RefundStatusDetails {
/// The reason why the refund has the PENDING or FAILED status.
pub reason: RefundStatusDetailsReason,
}
/// A refund /// A refund
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
pub struct Refund { pub struct Refund {