release 0.2 even if not all features are implemented

This commit is contained in:
Edgar 2022-07-05 08:16:07 +02:00
parent 93108ed17f
commit 76c169781c
No known key found for this signature in database
GPG key ID: 8731E6C0166EAA85
5 changed files with 104 additions and 19 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "paypal-rs"
version = "0.2.0-alpha.7"
version = "0.2.0"
authors = ["Edgar <git@edgarluque.com>"]
description = "A library that wraps the paypal api asynchronously."
repository = "https://github.com/edg-l/paypal-rs/"

View file

@ -9,9 +9,7 @@
A rust library that wraps the [paypal api](https://developer.paypal.com/docs/api) asynchronously in a strongly typed manner.
Crate: https://crates.io/crates/paypal-rs
Documentation: https://docs.rs/paypal-rs
If there is a missing endpoint that you need, you may try to implement the [Endpoint](endpoint::Endpoint) and pass it to [Client::execute](client::Client::execute)
Currently in early development.
@ -43,7 +41,7 @@ async fn main() {
let create_order = CreateOrder::new(order);
let _order_created = client
.execute(create_order).await.unwrap();
.execute(&create_order).await.unwrap();
}
```
@ -60,7 +58,21 @@ You need the enviroment variables PAYPAL_CLIENTID and PAYPAL_SECRET to be set.
- - [x] Show order details
- - [x] Authorize payment for order
- - [x] Capture payment for order
- [ ] Invoicing API - 0.2.0
- [x] Invoicing API - 0.2.0
- - [x] Generate Invoice number
- - [x] Create Draft Invoice
- - [x] Show Invoice Details (Get Invoice)
- - [x] List Invoices
- - [x] Delete Invoice
- - [x] Update Invoice
- - [x] Cancel Invoice
- - [x] Send Invoice
- - [ ] Send Invoice Reminder
- - [ ] List Templates
- - [ ] Create Template
- - [ ] Delete Template
- - [ ] Fully Update Template
- - [ ] Show Template Template
- [ ] Payments API - 0.3.0
- [ ] Tracking API - 0.4.0
- [ ] Subscriptions API - 0.5.0

View file

@ -13,7 +13,7 @@ use serde::Serialize;
use crate::{
data::{
invoice::{CancelReason, Invoice, InvoiceList, InvoicePayload},
invoice::{CancelReason, Invoice, InvoiceList, InvoicePayload, SendInvoicePayload},
orders::InvoiceNumber,
},
endpoint::Endpoint,
@ -286,6 +286,45 @@ impl Endpoint for CancelInvoice {
}
}
/// Cancels a sent invoice, by ID, and, optionally, sends a notification about the cancellation to the payer, merchant, and CC: emails.
#[derive(Debug, Clone)]
pub struct SendInvoice {
/// The invoice id.
pub invoice_id: String,
/// The payload.
pub payload: SendInvoicePayload,
}
impl SendInvoice {
/// New constructor.
pub fn new(invoice_id: impl ToString, payload: SendInvoicePayload) -> Self {
Self {
invoice_id: invoice_id.to_string(),
payload,
}
}
}
impl Endpoint for SendInvoice {
type Query = ();
type Body = SendInvoicePayload;
type Response = ();
fn relative_path(&self) -> Cow<str> {
Cow::Owned(format!("/v2/invoicing/invoices/{}/send", self.invoice_id))
}
fn method(&self) -> reqwest::Method {
reqwest::Method::POST
}
fn body(&self) -> Option<Self::Body> {
Some(self.payload.clone())
}
}
/*
impl super::Client {

View file

@ -656,7 +656,7 @@ pub const QR_ACTION_PAY: &str = "pay";
pub const QR_ACTION_DETAILS: &str = "details";
/// QR creation parameters
#[derive(Debug, Serialize, Deserialize, Default)]
#[derive(Debug, Serialize, Deserialize, Default, Clone, Builder)]
pub struct QRCodeParams {
/// The width, in pixels, of the QR code image. Value is from 150 to 500.
pub width: i32,
@ -670,15 +670,35 @@ pub struct QRCodeParams {
/// Used to record a payment.
#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Default)]
#[derive(Debug, Serialize, Deserialize, Default, Clone, Builder)]
pub struct RecordPaymentPayload {
payment_id: Option<String>,
payment_date: Option<chrono::DateTime<chrono::Utc>>,
method: PaymentMethod,
note: Option<String>,
amount: Amount,
shipping_info: Option<ContactInformation>,
/// The payment id.
pub payment_id: Option<String>,
/// The payment date
pub payment_date: Option<chrono::DateTime<chrono::Utc>>,
/// The payment method.
pub method: PaymentMethod,
/// A note.
pub note: Option<String>,
/// The amount.
pub amount: Amount,
/// The shipping info.
pub shipping_info: Option<ContactInformation>,
}
/// Send Invoice Payload
#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Default, Builder, Clone)]
pub struct SendInvoicePayload {
/// An array of one or more CC: emails to which notifications are sent.
/// If you omit this parameter, a notification is sent to all CC: email addresses that are part of the invoice.
pub additional_recipients: Option<Vec<String>>,
/// A note to the payer.
pub note: Option<String>,
/// Indicates whether to send a copy of the email to the merchant.
pub send_to_invoicer: Option<bool>,
/// Indicates whether to send a copy of the email to the recipient.
pub send_to_recipient: Option<bool>,
/// The subject of the email that is sent as a notification to the recipient.
pub subject: Option<String>,
}

View file

@ -57,7 +57,21 @@
//! - - [x] Show order details
//! - - [x] Authorize payment for order
//! - - [x] Capture payment for order
//! - [ ] Invoicing API - 0.2.0
//! - [x] Invoicing API - 0.2.0
//! - - [x] Generate Invoice number
//! - - [x] Create Draft Invoice
//! - - [x] Show Invoice Details (Get Invoice)
//! - - [x] List Invoices
//! - - [x] Delete Invoice
//! - - [x] Update Invoice
//! - - [x] Cancel Invoice
//! - - [x] Send Invoice
//! - - [ ] Send Invoice Reminder
//! - - [ ] List Templates
//! - - [ ] Create Template
//! - - [ ] Delete Template
//! - - [ ] Fully Update Template
//! - - [ ] Show Template Template
//! - [ ] Payments API - 0.3.0
//! - [ ] Tracking API - 0.4.0
//! - [ ] Subscriptions API - 0.5.0