fix error
This commit is contained in:
parent
32b9f74994
commit
f526eec695
|
@ -1,11 +1,4 @@
|
|||
use paypal_rs::{
|
||||
Client,
|
||||
HeaderParams,
|
||||
Prefer,
|
||||
invoice::*,
|
||||
common::*,
|
||||
errors::*,
|
||||
};
|
||||
use paypal_rs::{common::*, errors::*, invoice::*, Client, HeaderParams, Prefer};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), ResponseError> {
|
||||
|
@ -41,13 +34,12 @@ async fn main() -> Result<(), ResponseError> {
|
|||
email_address: Some("merchant@example.com".to_owned()),
|
||||
additional_notes: None,
|
||||
}),
|
||||
items: vec![
|
||||
Item {
|
||||
items: vec![Item {
|
||||
id: None,
|
||||
name: "My item".to_owned(),
|
||||
unit_amount: Money {
|
||||
currency_code: Currency::EUR,
|
||||
value: "10.0".to_owned()
|
||||
value: "10.0".to_owned(),
|
||||
},
|
||||
quantity: "1".to_owned(),
|
||||
discount: None,
|
||||
|
@ -59,17 +51,16 @@ async fn main() -> Result<(), ResponseError> {
|
|||
amount: None,
|
||||
}),
|
||||
unit_of_measure: Some(UnitOfMeasure::Quantity),
|
||||
}
|
||||
],
|
||||
}],
|
||||
..Default::default()
|
||||
};
|
||||
match client.create_draft_invoice(payload, HeaderParams::default()).await {
|
||||
Ok(r) => {
|
||||
println!("{:#?}", r);
|
||||
},
|
||||
}
|
||||
Err(ResponseError::HttpError(e)) => {
|
||||
println!("{}", e);
|
||||
},
|
||||
}
|
||||
Err(e) => {
|
||||
println!("{:#?}", e);
|
||||
}
|
||||
|
|
|
@ -690,9 +690,9 @@ impl super::Client {
|
|||
let res = build.json(&invoice).send().await?;
|
||||
|
||||
if res.status().is_success() {
|
||||
println!("{:#?}", res.text().await?);
|
||||
//let x = res.json::<Invoice>().await?;
|
||||
Ok(())
|
||||
//println!("{:#?}", res.text().await?);
|
||||
let inv = res.json::<Invoice>().await?;
|
||||
Ok(inv)
|
||||
} else {
|
||||
Err(res.json::<PaypalError>().await?.into())
|
||||
}
|
||||
|
@ -913,4 +913,3 @@ mod tests {
|
|||
println!("{:?}", list);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue