diff --git a/Cargo.toml b/Cargo.toml index 2994bc2..4e5f6a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "paypal-rs" -version = "0.0.2" +version = "0.0.3" authors = ["Edgar "] description = "A library that wraps the paypal api asynchronously." repository = "https://github.com/edg-l/paypal-rs/" diff --git a/src/lib.rs b/src/lib.rs index ce18d5a..e660637 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -76,18 +76,18 @@ pub enum Prefer { /// https://developer.paypal.com/docs/api/reference/api-requests/#paypal-auth-assertion #[derive(Debug, Default)] pub struct HeaderParams { - merchant_payer_id: Option, - client_metadata_id: Option, - partner_attribution_id: Option, - request_id: Option, - prefer: Option, - content_type: Option, + pub merchant_payer_id: Option, + pub client_metadata_id: Option, + pub partner_attribution_id: Option, + pub request_id: Option, + pub prefer: Option, + pub content_type: Option, } #[derive(Debug, Serialize)] struct AuthAssertionClaims { - iss: String, - payer_id: String, + pub iss: String, + pub payer_id: String, } impl Client { diff --git a/src/orders.rs b/src/orders.rs index 4d5e6f9..a3c9252 100644 --- a/src/orders.rs +++ b/src/orders.rs @@ -79,18 +79,18 @@ pub struct TaxInfo { pub struct Address { /// The first line of the address. For example, number or street. For example, 173 Drury Lane. /// Required for data entry and compliance and risk checks. Must contain the full address. - address_line_1: Option, + pub address_line_1: Option, /// The second line of the address. For example, suite or apartment number. - address_line_2: Option, + pub address_line_2: Option, /// A city, town, or village. Smaller than admin_area_level_1. - admin_area_2: Option, + pub admin_area_2: Option, /// The highest level sub-division in a country, which is usually a province, state, or ISO-3166-2 subdivision. /// Format for postal delivery. For example, CA and not California. - admin_area_1: Option, + pub admin_area_1: Option, /// The postal code, which is the zip code or equivalent. Typically required for countries with a postal code or an equivalent. - postal_code: Option, + pub postal_code: Option, /// The two-character [ISO 3166-1](https://developer.paypal.com/docs/api/reference/country-codes/) code that identifies the country or region. - country_code: String, + pub country_code: String, } /// The customer who approves and pays for the order. The customer is also known as the payer. @@ -118,13 +118,13 @@ pub struct Payer { #[derive(Debug)] pub struct Money { /// The [three-character ISO-4217 currency code](https://developer.paypal.com/docs/integration/direct/rest/currency-codes/) that identifies the currency. - currency_code: String, + pub currency_code: String, /// The value, which might be: /// - An integer for currencies like JPY that are not typically fractional. /// - A decimal fraction for currencies like TND that are subdivided into thousandths. /// /// For the required number of decimal places for a currency code, see [Currency Codes](https://developer.paypal.com/docs/api/reference/currency-codes/). - value: String, + pub value: String, } /// Breakdown provides details such as total item amount, total tax amount, shipping, handling, insurance, and discounts, if any. @@ -132,47 +132,47 @@ pub struct Money { pub struct Breakdown { /// The subtotal for all items. Required if the request includes purchase_units[].items[].unit_amount. /// Must equal the sum of (items[].unit_amount * items[].quantity) for all items. - item_total: Option, + pub item_total: Option, /// The shipping fee for all items within a given purchase_unit. - shipping: Option, + pub shipping: Option, /// The handling fee for all items within a given purchase_unit. - handling: Option, + pub handling: Option, /// The total tax for all items. Required if the request includes purchase_units.items.tax. Must equal the sum of (items[].tax * items[].quantity) for all items. - tax_total: Option, + pub tax_total: Option, /// The insurance fee for all items within a given purchase_unit. - insurance: Option, + pub insurance: Option, /// The shipping discount for all items within a given purchase_unit. - shipping_discount: Option, + pub shipping_discount: Option, /// The discount for all items within a given purchase_unit. - discount: Option, + pub discount: Option, } #[derive(Debug, Default)] pub struct Amount { /// The [three-character ISO-4217 currency code](https://developer.paypal.com/docs/integration/direct/rest/currency-codes/) that identifies the currency. - currency_code: String, + pub currency_code: String, /// The value, which might be: /// - An integer for currencies like JPY that are not typically fractional. /// - A decimal fraction for currencies like TND that are subdivided into thousandths. /// /// For the required number of decimal places for a currency code, see [Currency Codes](https://developer.paypal.com/docs/api/reference/currency-codes/). - value: String, + pub value: String, /// The breakdown of the amount. - breakdown: Option, + pub breakdown: Option, } #[derive(Debug, Default)] pub struct Payee { /// The email address of merchant. - email_address: Option, + pub email_address: Option, /// The encrypted PayPal account ID of the merchant. - merchant_id: Option, + pub merchant_id: Option, } #[derive(Debug)] pub struct PlatformFee { - amount: Money, - payee: Option, + pub amount: Money, + pub payee: Option, } #[derive(Debug)] @@ -194,9 +194,9 @@ impl Default for DisbursementMode { #[derive(Debug, Default)] pub struct PaymentInstruction { /// An array of various fees, commissions, tips, or donations. - platform_fees: Option>, + pub platform_fees: Option>, /// The funds that are held on behalf of the merchant. - disbursement_mode: Option + pub disbursement_mode: Option } #[derive(Debug)] @@ -217,34 +217,34 @@ impl Default for ItemCategoryType { #[derive(Debug, Default)] pub struct ShippingDetail { - name: Option, - address: Option
, + pub name: Option, + pub address: Option
, } #[derive(Debug)] pub struct Item { /// The item name or title. - name: String, + pub name: String, /// The item price or rate per unit. /// If you specify unit_amount, purchase_units[].amount.breakdown.item_total is required. Must equal unit_amount * quantity for all items. - unit_amount: Money, + pub unit_amount: Money, /// The item tax for each unit. If tax is specified, purchase_units[].amount.breakdown.tax_total is required. Must equal tax * quantity for all items. - tax: Option, + pub tax: Option, /// The item quantity. Must be a whole number. - quantity: String, + pub quantity: String, /// The detailed item description. - description: Option, + pub description: Option, /// The stock keeping unit (SKU) for the item. - sku: Option, + pub sku: Option, /// The item category type - category: Option, + pub category: Option, } #[derive(Debug, Default)] pub struct PurchaseUnitRequest { /// The API caller-provided external ID for the purchase unit. Required for multiple purchase units when you must update the order through PATCH. /// If you omit this value and the order contains only one purchase unit, PayPal sets this value to default. - reference_id: Option, + pub reference_id: Option, /// The total order amount with an optional breakdown that provides details, such as the total item amount, /// total tax amount, shipping, handling, insurance, and discounts, if any. /// @@ -252,29 +252,29 @@ pub struct PurchaseUnitRequest { /// /// The amount must be a positive number. For listed of supported currencies and decimal precision, /// see the PayPal REST APIs [Currency Codes](https://developer.paypal.com/docs/integration/direct/rest/currency-codes/). - amount: Amount, + pub amount: Amount, /// The merchant who receives payment for this transaction. - payee: Option, + pub payee: Option, /// Any additional payment instructions for PayPal Commerce Platform customers. /// Enables features for the PayPal Commerce Platform, such as delayed disbursement and collection of a platform fee. /// Applies during order creation for captured payments or during capture of authorized payments. - payment_instruction: Option, + pub payment_instruction: Option, /// The purchase description. - description: Option, + pub description: Option, /// The API caller-provided external ID. Used to reconcile client transactions with PayPal transactions. /// Appears in transaction and settlement reports but is not visible to the payer. - custom_id: Option, + pub custom_id: Option, /// The API caller-provided external invoice number for this order. /// Appears in both the payer's transaction history and the emails that the payer receives. - invoice_id: Option, + pub invoice_id: Option, /// The soft descriptor is the dynamic text used to construct the statement descriptor that appears on a payer's card statement. /// /// More info here: https://developer.paypal.com/docs/api/orders/v2/#definition-purchase_unit_request - soft_descriptor: Option, + pub soft_descriptor: Option, /// An array of items that the customer purchases from the merchant. - items: Option>, + pub items: Option>, /// The name and address of the person to whom to ship the items. - shipping: Option, + pub shipping: Option, } /// The type of landing page to show on the PayPal site for customer checkout. @@ -350,43 +350,43 @@ impl Default for PayeePreferred { #[derive(Debug, Default)] pub struct PaymentMethod { - payer_selected: Option, - payer_prefered: Option, + pub payer_selected: Option, + pub payer_prefered: Option, } #[derive(Debug, Default)] pub struct ApplicationContext { /// The label that overrides the business name in the PayPal account on the PayPal site. - brand_name: Option, + pub brand_name: Option, /// The BCP 47-formatted locale of pages that the PayPal payment experience shows. PayPal supports a five-character code. /// /// For example, da-DK, he-IL, id-ID, ja-JP, no-NO, pt-BR, ru-RU, sv-SE, th-TH, zh-CN, zh-HK, or zh-TW. - locale: Option, + pub locale: Option, /// The type of landing page to show on the PayPal site for customer checkout - landing_page: Option, + pub landing_page: Option, /// The shipping preference - shipping_preference: Option, + pub shipping_preference: Option, /// Configures a Continue or Pay Now checkout flow. - user_action: Option, + pub user_action: Option, /// The customer and merchant payment preferences. - payment_method: Option, + pub payment_method: Option, /// The URL where the customer is redirected after the customer approves the payment. - return_url: Option, + pub return_url: Option, /// The URL where the customer is redirected after the customer cancels the payment. - cancel_url: Option, + pub cancel_url: Option, } #[derive(Debug, Default)] pub struct OrderPayload { /// The intent to either capture payment immediately or authorize a payment for an order after order creation. - intent: Intent, + pub intent: Intent, /// The customer who approves and pays for the order. The customer is also known as the payer. - payer: Option, + pub payer: Option, /// An array of purchase units. Each purchase unit establishes a contract between a payer and the payee. /// Each purchase unit represents either a full or partial order that the payer intends to purchase from the payee. - purchase_units: Vec, + pub purchase_units: Vec, /// Customize the payer experience during the approval process for the payment with PayPal. - application_context: Option, + pub application_context: Option, } // TODO: Finish order https://developer.paypal.com/docs/api/orders/v2/