Skip to content

Commit

Permalink
fix(webhook): add data
Browse files Browse the repository at this point in the history
  • Loading branch information
jackskelt committed May 31, 2024
1 parent df6d739 commit 9a77fe7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/webhooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ pub struct WebhookBody {
pub user_id: u64,
pub api_version: String,
pub action: String,
pub data: Option<WebhookData>,
}

#[derive(Deserialize, Debug)]
pub struct WebhookData {
pub id: Option<u64>,
}

impl WebhookBody {
Expand Down Expand Up @@ -125,6 +131,7 @@ mod webhook_tests {
user_id: 1234567890,
api_version: "v1".to_string(),
action: "payment.created".to_string(),
data: None,
};

assert!(body.valid_origin(
Expand All @@ -147,6 +154,7 @@ mod webhook_tests {
user_id: 1234567890,
api_version: "v1".to_string(),
action: "payment.created".to_string(),
data: None,
};

assert!(body.valid_origin(
Expand Down

0 comments on commit 9a77fe7

Please sign in to comment.