Add support for rgp-poll extension
This commit is contained in:
parent
82f9ef79ac
commit
65bf5f5595
|
@ -2,6 +2,7 @@
|
|||
//!
|
||||
//! As described in [RFC 3915](https://tools.ietf.org/html/rfc3915).
|
||||
|
||||
pub mod poll; // Technically a separate extension (different namespace, RFC)
|
||||
pub mod report;
|
||||
pub mod request;
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
//! https://www.verisign.com/assets/epp-sdk/verisign_epp-extension_rgp-poll_v00.html
|
||||
|
||||
use chrono::{DateTime, Utc};
|
||||
use instant_xml::FromXml;
|
||||
|
||||
/// RGP request status
|
||||
#[derive(Debug, FromXml)]
|
||||
#[xml(rename = "pollData", ns(XMLNS), rename_all = "camelCase")]
|
||||
pub struct RgpPollData {
|
||||
pub name: String,
|
||||
pub rgp_status: RgpStatus,
|
||||
pub req_date: DateTime<Utc>,
|
||||
pub report_due_date: DateTime<Utc>,
|
||||
}
|
||||
|
||||
/// Type that represents the `<rgpStatus>` tag for domain rgp restore request response
|
||||
#[derive(Debug, FromXml)]
|
||||
#[xml(rename = "rgpStatus", ns(XMLNS))]
|
||||
pub struct RgpStatus {
|
||||
/// The domain RGP status
|
||||
#[xml(rename = "s", attribute)]
|
||||
pub status: String,
|
||||
}
|
||||
|
||||
const XMLNS: &str = "http://www.verisign.com/epp/rgp-poll-1.0";
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::poll::{Poll, PollData};
|
||||
use crate::tests::response_from_file;
|
||||
|
||||
#[test]
|
||||
fn rgp_poll_data() {
|
||||
let object = response_from_file::<Poll>("response/poll/poll_rgp_restore.xml");
|
||||
let Some(PollData::RgpPoll(data)) = object.res_data() else {
|
||||
panic!("expected RgpPollData");
|
||||
};
|
||||
|
||||
assert_eq!(data.name, "EXAMPLE.COM");
|
||||
assert_eq!(data.rgp_status.status, "pendingRestore");
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ use instant_xml::{FromXml, ToXml};
|
|||
use crate::common::{NoExtension, EPP_XMLNS};
|
||||
use crate::domain::transfer::TransferData;
|
||||
use crate::extensions::low_balance::LowBalance;
|
||||
use crate::extensions::rgp::poll::RgpPollData;
|
||||
use crate::host::info::InfoData;
|
||||
use crate::request::{Command, Transaction};
|
||||
|
||||
|
@ -70,6 +71,8 @@ pub enum PollData {
|
|||
HostInfo(InfoData),
|
||||
/// Data under the `<lowbalance>` tag
|
||||
LowBalance(LowBalance),
|
||||
/// Data under the `<rgp-poll:pollData>` tag
|
||||
RgpPoll(RgpPollData),
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<response>
|
||||
<result code="1301">
|
||||
<msg>Command completed successfully; ack to dequeue</msg>
|
||||
</result>
|
||||
<msgQ count="1" id="178607543">
|
||||
<qDate>2024-05-27T07:00:13Z</qDate>
|
||||
<msg>Restore Request Pending</msg>
|
||||
</msgQ>
|
||||
<resData>
|
||||
<rgp-poll:pollData xmlns:rgp-poll="http://www.verisign.com/epp/rgp-poll-1.0">
|
||||
<rgp-poll:name>EXAMPLE.COM</rgp-poll:name>
|
||||
<rgp-poll:rgpStatus s="pendingRestore"/>
|
||||
<rgp-poll:reqDate>2024-05-22T21:17:58Z</rgp-poll:reqDate>
|
||||
<rgp-poll:reportDueDate>2024-05-29T21:17:58Z</rgp-poll:reportDueDate>
|
||||
</rgp-poll:pollData>
|
||||
</resData>
|
||||
<trID>
|
||||
<clTRID>c56ef937-d2b5-48fa-842f-73430072e84d</clTRID>
|
||||
<svTRID>11892404979-1716797141277</svTRID>
|
||||
</trID>
|
||||
</response>
|
||||
</epp>
|
Loading…
Reference in New Issue