From 250180aedffe76f9a90e9158321d86cd4c0eb0dd Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Fri, 13 Jun 2025 17:13:23 +0530 Subject: [PATCH 01/56] [Automated] Update the toml files --- ballerina/Ballerina.toml | 4 +- ballerina/Dependencies.toml | 346 ++++++++++++++++++++++++++++++++++++ 2 files changed, 348 insertions(+), 2 deletions(-) create mode 100644 ballerina/Dependencies.toml diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index af98895..3a59352 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -5,8 +5,8 @@ name = "paypal.subscriptions" version = "1.0.0" license = ["Apache-2.0"] authors = ["Ballerina"] -keywords = [] -# icon = "icon.png" # TODO: update icon.png +keywords = [] # TODO: Add keywords +# icon = "icon.png" # TODO: Add icon repository = "https://github.com/ballerina-platform/module-ballerinax-paypal.subscriptions" [build-options] diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml new file mode 100644 index 0000000..a390fb3 --- /dev/null +++ b/ballerina/Dependencies.toml @@ -0,0 +1,346 @@ +# AUTO-GENERATED FILE. DO NOT MODIFY. + +# This file is auto-generated by Ballerina for managing dependency versions. +# It should not be modified by hand. + +[ballerina] +dependencies-toml-version = "2" +distribution-version = "2201.12.0" + +[[package]] +org = "ballerina" +name = "auth" +version = "2.14.0" +dependencies = [ + {org = "ballerina", name = "crypto"}, + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.array"}, + {org = "ballerina", name = "lang.string"}, + {org = "ballerina", name = "log"} +] + +[[package]] +org = "ballerina" +name = "cache" +version = "3.10.0" +dependencies = [ + {org = "ballerina", name = "constraint"}, + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "task"}, + {org = "ballerina", name = "time"} +] + +[[package]] +org = "ballerina" +name = "constraint" +version = "1.7.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] +modules = [ + {org = "ballerina", packageName = "constraint", moduleName = "constraint"} +] + +[[package]] +org = "ballerina" +name = "crypto" +version = "2.9.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "time"} +] + +[[package]] +org = "ballerina" +name = "data.jsondata" +version = "1.1.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.object"} +] +modules = [ + {org = "ballerina", packageName = "data.jsondata", moduleName = "data.jsondata"} +] + +[[package]] +org = "ballerina" +name = "file" +version = "1.12.0" +dependencies = [ + {org = "ballerina", name = "io"}, + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "os"}, + {org = "ballerina", name = "time"} +] + +[[package]] +org = "ballerina" +name = "http" +version = "2.14.1" +dependencies = [ + {org = "ballerina", name = "auth"}, + {org = "ballerina", name = "cache"}, + {org = "ballerina", name = "constraint"}, + {org = "ballerina", name = "crypto"}, + {org = "ballerina", name = "data.jsondata"}, + {org = "ballerina", name = "file"}, + {org = "ballerina", name = "io"}, + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "jwt"}, + {org = "ballerina", name = "lang.array"}, + {org = "ballerina", name = "lang.decimal"}, + {org = "ballerina", name = "lang.int"}, + {org = "ballerina", name = "lang.regexp"}, + {org = "ballerina", name = "lang.runtime"}, + {org = "ballerina", name = "lang.string"}, + {org = "ballerina", name = "lang.value"}, + {org = "ballerina", name = "log"}, + {org = "ballerina", name = "mime"}, + {org = "ballerina", name = "oauth2"}, + {org = "ballerina", name = "observe"}, + {org = "ballerina", name = "time"}, + {org = "ballerina", name = "url"} +] +modules = [ + {org = "ballerina", packageName = "http", moduleName = "http"}, + {org = "ballerina", packageName = "http", moduleName = "http.httpscerr"} +] + +[[package]] +org = "ballerina" +name = "io" +version = "1.8.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.value"} +] +modules = [ + {org = "ballerina", packageName = "io", moduleName = "io"} +] + +[[package]] +org = "ballerina" +name = "jballerina.java" +version = "0.0.0" + +[[package]] +org = "ballerina" +name = "jwt" +version = "2.15.0" +dependencies = [ + {org = "ballerina", name = "cache"}, + {org = "ballerina", name = "crypto"}, + {org = "ballerina", name = "io"}, + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.int"}, + {org = "ballerina", name = "lang.string"}, + {org = "ballerina", name = "log"}, + {org = "ballerina", name = "time"} +] + +[[package]] +org = "ballerina" +name = "lang.__internal" +version = "0.0.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.object"} +] + +[[package]] +org = "ballerina" +name = "lang.array" +version = "0.0.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.__internal"} +] + +[[package]] +org = "ballerina" +name = "lang.decimal" +version = "0.0.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] + +[[package]] +org = "ballerina" +name = "lang.error" +version = "0.0.0" +scope = "testOnly" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] + +[[package]] +org = "ballerina" +name = "lang.int" +version = "0.0.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.__internal"}, + {org = "ballerina", name = "lang.object"} +] + +[[package]] +org = "ballerina" +name = "lang.object" +version = "0.0.0" + +[[package]] +org = "ballerina" +name = "lang.regexp" +version = "0.0.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] + +[[package]] +org = "ballerina" +name = "lang.runtime" +version = "0.0.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] + +[[package]] +org = "ballerina" +name = "lang.string" +version = "0.0.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.regexp"} +] + +[[package]] +org = "ballerina" +name = "lang.value" +version = "0.0.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] + +[[package]] +org = "ballerina" +name = "log" +version = "2.12.0" +dependencies = [ + {org = "ballerina", name = "io"}, + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.value"}, + {org = "ballerina", name = "observe"} +] + +[[package]] +org = "ballerina" +name = "mime" +version = "2.12.0" +dependencies = [ + {org = "ballerina", name = "io"}, + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.int"}, + {org = "ballerina", name = "log"} +] + +[[package]] +org = "ballerina" +name = "oauth2" +version = "2.14.0" +dependencies = [ + {org = "ballerina", name = "cache"}, + {org = "ballerina", name = "crypto"}, + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "log"}, + {org = "ballerina", name = "time"}, + {org = "ballerina", name = "url"} +] + +[[package]] +org = "ballerina" +name = "observe" +version = "1.5.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] + +[[package]] +org = "ballerina" +name = "os" +version = "1.10.0" +dependencies = [ + {org = "ballerina", name = "io"}, + {org = "ballerina", name = "jballerina.java"} +] + +[[package]] +org = "ballerina" +name = "task" +version = "2.7.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "time"} +] + +[[package]] +org = "ballerina" +name = "test" +version = "0.0.0" +scope = "testOnly" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.array"}, + {org = "ballerina", name = "lang.error"} +] +modules = [ + {org = "ballerina", packageName = "test", moduleName = "test"} +] + +[[package]] +org = "ballerina" +name = "time" +version = "2.7.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] + +[[package]] +org = "ballerina" +name = "url" +version = "2.6.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] +modules = [ + {org = "ballerina", packageName = "url", moduleName = "url"} +] + +[[package]] +org = "ballerinai" +name = "observe" +version = "0.0.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "observe"} +] +modules = [ + {org = "ballerinai", packageName = "observe", moduleName = "observe"} +] + +[[package]] +org = "ballerinax" +name = "paypal.subscriptions" +version = "1.0.0" +dependencies = [ + {org = "ballerina", name = "constraint"}, + {org = "ballerina", name = "data.jsondata"}, + {org = "ballerina", name = "http"}, + {org = "ballerina", name = "io"}, + {org = "ballerina", name = "test"}, + {org = "ballerina", name = "url"}, + {org = "ballerinai", name = "observe"} +] +modules = [ + {org = "ballerinax", packageName = "paypal.subscriptions", moduleName = "paypal.subscriptions"} +] + From d117c23b737eff0561e44bfd9bf684fb805521a0 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Fri, 13 Jun 2025 17:14:06 +0530 Subject: [PATCH 02/56] added .env --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 32d4c58..7846546 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,5 @@ build # Ignore Docker env file docker.env + +.env From b53668e875a24a4706f333c0f35661e8c7be74fa Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Fri, 13 Jun 2025 17:14:50 +0530 Subject: [PATCH 03/56] paypal open API Specification added --- docs/spec/openapi.json | 7186 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 7186 insertions(+) create mode 100644 docs/spec/openapi.json diff --git a/docs/spec/openapi.json b/docs/spec/openapi.json new file mode 100644 index 0000000..f35965b --- /dev/null +++ b/docs/spec/openapi.json @@ -0,0 +1,7186 @@ +{ + "openapi" : "3.0.3", + "info" : { + "title" : "Subscriptions", + "description" : "You can use billing plans and subscriptions to create subscriptions that process recurring PayPal payments for physical or digital goods, or services. A plan includes pricing and billing cycle information that defines the amount and frequency of charge for a subscription. You can also define a fixed plan, such as a $5 basic plan or a volume- or graduated-based plan with pricing tiers based on the quantity purchased. For more information, see Subscriptions Overview.", + "contact" : { }, + "version" : "1.6" + }, + "externalDocs" : { + "url" : "https://developer.paypal.com/docs/api/subscriptions/v1/" + }, + "servers" : [ { + "url" : "https://api-m.sandbox.paypal.com/v1/billing", + "description" : "PayPal Sandbox Environment" + }, { + "url" : "https://api-m.paypal.com/v1/billing", + "description" : "PayPal Live Environment" + } ], + "tags" : [ { + "name" : "plans", + "description" : "Use the `/billing/plans` resource to create and manage plans." + }, { + "name" : "subscriptions", + "description" : "Use the `/billing/subscriptions` resource to create and manage subscriptions." + } ], + "paths" : { + "/plans" : { + "get" : { + "tags" : [ "plans" ], + "summary" : "List plans", + "description" : "Lists billing plans.", + "operationId" : "plans.list", + "parameters" : [ { + "$ref" : "#/components/parameters/prefer" + }, { + "$ref" : "#/components/parameters/product_id" + }, { + "$ref" : "#/components/parameters/plan_ids" + }, { + "$ref" : "#/components/parameters/page_size" + }, { + "$ref" : "#/components/parameters/page" + }, { + "$ref" : "#/components/parameters/total_required" + } ], + "responses" : { + "200" : { + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that lists billing plans", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/PlanCollection" + } + } + } + }, + "400" : { + "description" : "Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse400" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error404" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + }, + "post" : { + "tags" : [ "plans" ], + "summary" : "Create plan", + "description" : "Creates a plan that defines pricing and billing cycle details for subscriptions.", + "operationId" : "plans.create", + "parameters" : [ { + "$ref" : "#/components/parameters/prefer" + }, { + "$ref" : "#/components/parameters/paypal_request_id" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/PlanRequestPOST" + }, + "examples" : { + "plan_request_post" : { + "value" : { + "product_id" : "PROD-XXCD1234QWER65782", + "name" : "Video Streaming Service Plan", + "description" : "Video Streaming Service basic plan", + "status" : "ACTIVE", + "billing_cycles" : [ { + "frequency" : { + "interval_unit" : "MONTH", + "interval_count" : 1 + }, + "tenure_type" : "TRIAL", + "sequence" : 1, + "total_cycles" : 2, + "pricing_scheme" : { + "fixed_price" : { + "value" : "3", + "currency_code" : "USD" + } + } + }, { + "frequency" : { + "interval_unit" : "MONTH", + "interval_count" : 1 + }, + "tenure_type" : "TRIAL", + "sequence" : 2, + "total_cycles" : 3, + "pricing_scheme" : { + "fixed_price" : { + "value" : "6", + "currency_code" : "USD" + } + } + }, { + "frequency" : { + "interval_unit" : "MONTH", + "interval_count" : 1 + }, + "tenure_type" : "REGULAR", + "sequence" : 3, + "total_cycles" : 12, + "pricing_scheme" : { + "fixed_price" : { + "value" : "10", + "currency_code" : "USD" + } + } + } ], + "payment_preferences" : { + "auto_bill_outstanding" : true, + "setup_fee" : { + "value" : "10", + "currency_code" : "USD" + }, + "setup_fee_failure_action" : "CONTINUE", + "payment_failure_threshold" : 3 + }, + "taxes" : { + "percentage" : "10", + "inclusive" : false + } + } + } + } + } + } + }, + "responses" : { + "200" : { + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows billing plan details", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Plan" + }, + "examples" : { + "plan" : { + "value" : { + "id" : "P-5ML4271244454362WXNWU5NQ", + "product_id" : "PROD-XXCD1234QWER65782", + "name" : "Video Streaming Service Plan", + "description" : "Video Streaming Service basic plan", + "status" : "ACTIVE", + "billing_cycles" : [ { + "frequency" : { + "interval_unit" : "MONTH", + "interval_count" : 1 + }, + "tenure_type" : "TRIAL", + "sequence" : 1, + "total_cycles" : 2, + "pricing_scheme" : { + "fixed_price" : { + "value" : "3", + "currency_code" : "USD" + }, + "version" : 1, + "create_time" : "2020-05-27T12:13:51Z", + "update_time" : "2020-05-27T12:13:51Z" + } + }, { + "frequency" : { + "interval_unit" : "MONTH", + "interval_count" : 1 + }, + "tenure_type" : "TRIAL", + "sequence" : 2, + "total_cycles" : 3, + "pricing_scheme" : { + "fixed_price" : { + "currency_code" : "USD", + "value" : "6" + }, + "version" : 1, + "create_time" : "2020-05-27T12:13:51Z", + "update_time" : "2020-05-27T12:13:51Z" + } + }, { + "frequency" : { + "interval_unit" : "MONTH", + "interval_count" : 1 + }, + "tenure_type" : "REGULAR", + "sequence" : 3, + "total_cycles" : 12, + "pricing_scheme" : { + "fixed_price" : { + "currency_code" : "USD", + "value" : "10" + }, + "version" : 1, + "create_time" : "2020-05-27T12:13:51Z", + "update_time" : "2020-05-27T12:13:51Z" + } + } ], + "payment_preferences" : { + "auto_bill_outstanding" : true, + "setup_fee" : { + "value" : "10", + "currency_code" : "USD" + }, + "setup_fee_failure_action" : "CONTINUE", + "payment_failure_threshold" : 3 + }, + "taxes" : { + "percentage" : "10", + "inclusive" : false + }, + "create_time" : "2020-05-27T12:13:51Z", + "update_time" : "2020-05-27T12:13:51Z", + "links" : [ { + "href" : "https://api-m.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ", + "rel" : "self", + "method" : "GET" + }, { + "href" : "https://api-m.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ", + "rel" : "edit", + "method" : "PATCH" + }, { + "href" : "https://api-m.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ/deactivate", + "rel" : "deactivate", + "method" : "POST" + }, { + "href" : "https://api-m.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ/update-pricing-schemes", + "rel" : "edit", + "method" : "POST" + } ] + } + } + } + } + } + }, + "201" : { + "description" : "A successful request returns the HTTP `201 Created` status code and a JSON response body that shows billing plan details.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Plan" + } + } + } + }, + "400" : { + "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4001" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse422" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/plans/{id}" : { + "get" : { + "tags" : [ "plans" ], + "summary" : "Show plan details", + "description" : "Shows details for a plan, by ID.", + "operationId" : "plans.get", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "responses" : { + "200" : { + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows plan details", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Plan" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + }, + "patch" : { + "tags" : [ "plans" ], + "summary" : "Update plan", + "description" : "Updates a plan with the `CREATED` or `ACTIVE` status. For an `INACTIVE` plan, you can make only status updates.
You can patch these attributes and objects:
Attribute or objectOperations
descriptionreplace
payment_preferences.auto_bill_outstandingreplace
taxes.percentagereplace
payment_preferences.payment_failure_thresholdreplace
payment_preferences.setup_feereplace
payment_preferences.setup_fee_failure_actionreplace
namereplace
", + "operationId" : "plans.patch", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "requestBody" : { + "$ref" : "#/components/requestBodies/patch_request" + }, + "responses" : { + "204" : { + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + }, + "400" : { + "description" : "Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4002" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4221" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/plans/{id}/activate" : { + "post" : { + "tags" : [ "plans" ], + "summary" : "Activate plan", + "description" : "Activates a plan, by ID.", + "operationId" : "plans.activate", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "responses" : { + "204" : { + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4222" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/plans/{id}/deactivate" : { + "post" : { + "tags" : [ "plans" ], + "summary" : "Deactivate plan", + "description" : "Deactivates a plan, by ID.", + "operationId" : "plans.deactivate", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "responses" : { + "204" : { + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4223" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/plans/{id}/update-pricing-schemes" : { + "post" : { + "tags" : [ "plans" ], + "summary" : "Update pricing", + "description" : "Updates pricing for a plan. For example, you can update a regular billing cycle from $5 per month to $7 per month.", + "operationId" : "plans.update-pricing-schemes", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/UpdatePricingSchemesListRequest" + }, + "examples" : { + "update_pricing_schemes_list_request" : { + "value" : { + "pricing_schemes" : [ { + "billing_cycle_sequence" : 1, + "pricing_scheme" : { + "fixed_price" : { + "value" : "50", + "currency_code" : "USD" + } + } + }, { + "billing_cycle_sequence" : 2, + "pricing_scheme" : { + "fixed_price" : { + "value" : "100", + "currency_code" : "USD" + }, + "pricing_model" : "VOLUME", + "tiers" : [ { + "starting_quantity" : "1", + "ending_quantity" : "1000", + "amount" : { + "value" : "150", + "currency_code" : "USD" + } + }, { + "starting_quantity" : "1001", + "amount" : { + "value" : "250", + "currency_code" : "USD" + } + } ] + } + } ] + } + } + } + } + } + }, + "responses" : { + "204" : { + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + }, + "400" : { + "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4003" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4224" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/subscriptions" : { + "post" : { + "tags" : [ "subscriptions" ], + "summary" : "Create subscription", + "description" : "Creates a subscription.", + "operationId" : "subscriptions.create", + "parameters" : [ { + "$ref" : "#/components/parameters/prefer" + }, { + "$ref" : "#/components/parameters/paypal_request_id" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/SubscriptionRequestPost" + }, + "examples" : { + "subscription_request_post" : { + "value" : { + "plan_id" : "P-5ML4271244454362WXNWU5NQ", + "start_time" : "2018-11-01T00:00:00Z", + "quantity" : "20", + "shipping_amount" : { + "currency_code" : "USD", + "value" : "10.00" + }, + "subscriber" : { + "name" : { + "given_name" : "John", + "surname" : "Doe" + }, + "email_address" : "customer@example.com", + "shipping_address" : { + "name" : { + "full_name" : "John Doe" + }, + "address" : { + "address_line_1" : "2211 N First Street", + "address_line_2" : "Building 17", + "admin_area_2" : "San Jose", + "admin_area_1" : "CA", + "postal_code" : "95131", + "country_code" : "US" + } + } + }, + "application_context" : { + "brand_name" : "walmart", + "locale" : "en-US", + "shipping_preference" : "SET_PROVIDED_ADDRESS", + "user_action" : "SUBSCRIBE_NOW", + "payment_method" : { + "payer_selected" : "PAYPAL", + "payee_preferred" : "IMMEDIATE_PAYMENT_REQUIRED" + }, + "return_url" : "https://example.com/returnUrl", + "cancel_url" : "https://example.com/cancelUrl" + } + } + } + } + } + } + }, + "responses" : { + "200" : { + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Subscription" + }, + "examples" : { + "subscription" : { + "value" : { + "id" : "I-BW452GLLEP1G", + "status" : "APPROVAL_PENDING", + "status_update_time" : "2018-12-10T21:20:49Z", + "plan_id" : "P-5ML4271244454362WXNWU5NQ", + "plan_overridden" : false, + "start_time" : "2018-11-01T00:00:00Z", + "quantity" : "20", + "shipping_amount" : { + "currency_code" : "USD", + "value" : "10.00" + }, + "subscriber" : { + "name" : { + "given_name" : "John", + "surname" : "Doe" + }, + "email_address" : "customer@example.com", + "payer_id" : "2J6QB8YJQSJRJ", + "shipping_address" : { + "name" : { + "full_name" : "John Doe" + }, + "address" : { + "address_line_1" : "2211 N First Street", + "address_line_2" : "Building 17", + "admin_area_2" : "San Jose", + "admin_area_1" : "CA", + "postal_code" : "95131", + "country_code" : "US" + } + } + }, + "create_time" : "2018-12-10T21:20:49Z", + "links" : [ { + "href" : "https://www.paypal.com/webapps/billing/subscriptions?ba_token=BA-2M539689T3856352J", + "rel" : "approve", + "method" : "GET" + }, { + "href" : "https://api-m.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G", + "rel" : "edit", + "method" : "PATCH" + }, { + "href" : "https://api-m.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G", + "rel" : "self", + "method" : "GET" + } ] + } + } + } + } + } + }, + "201" : { + "description" : "A successful request returns the HTTP `201 Created` status code and a JSON response body that shows subscription details.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Subscription" + }, + "examples" : { + "subscription" : { + "value" : { + "id" : "I-BW452GLLEP1G", + "status" : "APPROVAL_PENDING", + "status_update_time" : "2018-12-10T21:20:49Z", + "plan_id" : "P-5ML4271244454362WXNWU5NQ", + "plan_overridden" : false, + "start_time" : "2018-11-01T00:00:00Z", + "quantity" : "20", + "shipping_amount" : { + "currency_code" : "USD", + "value" : "10.00" + }, + "subscriber" : { + "name" : { + "given_name" : "John", + "surname" : "Doe" + }, + "email_address" : "customer@example.com", + "payer_id" : "2J6QB8YJQSJRJ", + "shipping_address" : { + "name" : { + "full_name" : "John Doe" + }, + "address" : { + "address_line_1" : "2211 N First Street", + "address_line_2" : "Building 17", + "admin_area_2" : "San Jose", + "admin_area_1" : "CA", + "postal_code" : "95131", + "country_code" : "US" + } + } + }, + "create_time" : "2018-12-10T21:20:49Z", + "links" : [ { + "href" : "https://www.paypal.com/webapps/billing/subscriptions?ba_token=BA-2M539689T3856352J", + "rel" : "approve", + "method" : "GET" + }, { + "href" : "https://api-m.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G", + "rel" : "edit", + "method" : "PATCH" + }, { + "href" : "https://api-m.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G", + "rel" : "self", + "method" : "GET" + } ] + } + } + } + } + } + }, + "400" : { + "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4004" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4225" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/subscriptions/{id}" : { + "get" : { + "tags" : [ "subscriptions" ], + "summary" : "Show subscription details", + "description" : "Shows details for a subscription, by ID.", + "operationId" : "subscriptions.get", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + }, { + "$ref" : "#/components/parameters/fields" + } ], + "responses" : { + "200" : { + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Subscription" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + }, + "patch" : { + "tags" : [ "subscriptions" ], + "summary" : "Update subscription", + "description" : "Updates a subscription which could be in ACTIVE or SUSPENDED status. You can override plan level default attributes by providing customised values for plan path in the patch request.
  • You cannot update attributes that have already completed (Example - trial cycles can’t be updated if completed).
  • Once overridden, changes to plan resource will not impact subscription.
  • Any price update will not impact billing cycles within next 10 days (Applicable only for subscriptions funded by PayPal account).
Following are the fields eligible for patch.
Attribute or objectOperations
billing_info.outstanding_balancereplace
custom_idadd,replace
plan.billing_cycles[@sequence==n].
pricing_scheme.fixed_price
add,replace
plan.billing_cycles[@sequence==n].
pricing_scheme.tiers
replace
plan.billing_cycles[@sequence==n].
total_cycles
replace
plan.payment_preferences.
auto_bill_outstanding
replace
plan.payment_preferences.
payment_failure_threshold
replace
plan.taxes.inclusiveadd,replace
plan.taxes.percentageadd,replace
shipping_amountadd,replace
start_timereplace
subscriber.shipping_addressadd,replace
subscriber.payment_source (for subscriptions funded
by card payments)
replace
", + "operationId" : "subscriptions.patch", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "requestBody" : { + "$ref" : "#/components/requestBodies/patch_request" + }, + "responses" : { + "204" : { + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + }, + "400" : { + "description" : "Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4005" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4226" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/subscriptions/{id}/revise" : { + "post" : { + "tags" : [ "subscriptions" ], + "summary" : "Revise plan or quantity of subscription", + "description" : "Updates the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount`, `shipping_address` values for the subscription. This type of update requires the buyer's consent.", + "operationId" : "subscriptions.revise", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/SubscriptionReviseRequest" + }, + "examples" : { + "subscription_revise_request" : { + "value" : { + "plan_id" : "P-5ML4271244454362WXNWU5NQ", + "shipping_amount" : { + "currency_code" : "USD", + "value" : "10.00" + }, + "shipping_address" : { + "name" : { + "full_name" : "John Doe" + }, + "address" : { + "address_line_1" : "2211 N First Street", + "address_line_2" : "Building 17", + "admin_area_2" : "San Jose", + "admin_area_1" : "CA", + "postal_code" : "95131", + "country_code" : "US" + } + }, + "application_context" : { + "brand_name" : "walmart", + "locale" : "en-US", + "shipping_preference" : "SET_PROVIDED_ADDRESS", + "payment_method" : { + "payer_selected" : "PAYPAL", + "payee_preferred" : "IMMEDIATE_PAYMENT_REQUIRED" + }, + "return_url" : "https://example.com/returnUrl", + "cancel_url" : "https://example.com/cancelUrl" + } + } + } + } + } + } + }, + "responses" : { + "200" : { + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/SubscriptionReviseResponse" + }, + "examples" : { + "subscription_revise_response" : { + "value" : { + "plan_id" : "P-5ML4271244454362WXNWU5NQ", + "plan_overridden" : false, + "shipping_amount" : { + "currency_code" : "USD", + "value" : "10.00" + }, + "shipping_address" : { + "name" : { + "full_name" : "John Doe" + }, + "address" : { + "address_line_1" : "2211 N First Street", + "address_line_2" : "Building 17", + "admin_area_2" : "San Jose", + "admin_area_1" : "CA", + "postal_code" : "95131", + "country_code" : "US" + } + }, + "links" : [ { + "href" : "https://www.paypal.com/webapps/billing/subscriptions/update?ba_token=BA-2M539689T3856352J", + "rel" : "approve", + "method" : "GET" + }, { + "href" : "https://api-m.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G", + "rel" : "edit", + "method" : "PATCH" + }, { + "href" : "https://api-m.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G", + "rel" : "self", + "method" : "GET" + }, { + "href" : "https://api-m.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/cancel", + "rel" : "cancel", + "method" : "POST" + }, { + "href" : "https://api-m.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/suspend", + "rel" : "suspend", + "method" : "POST" + }, { + "href" : "https://api-m.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/capture", + "rel" : "capture", + "method" : "POST" + } ] + } + } + } + } + } + }, + "400" : { + "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4006" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4041" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4227" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/subscriptions/{id}/suspend" : { + "post" : { + "tags" : [ "subscriptions" ], + "summary" : "Suspend subscription", + "description" : "Suspends the subscription.", + "operationId" : "subscriptions.suspend", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/SubscriptionSuspendRequest" + }, + "examples" : { + "subscription_suspend_request" : { + "value" : { + "reason" : "Item out of stock" + } + } + } + } + } + }, + "responses" : { + "204" : { + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + }, + "400" : { + "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4007" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4228" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/subscriptions/{id}/cancel" : { + "post" : { + "tags" : [ "subscriptions" ], + "summary" : "Cancel subscription", + "description" : "Cancels the subscription.", + "operationId" : "subscriptions.cancel", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/SubscriptionCancelRequest" + }, + "examples" : { + "subscription_cancel_request" : { + "value" : { + "reason" : "Not satisfied with the service" + } + } + } + } + } + }, + "responses" : { + "204" : { + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + }, + "400" : { + "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4008" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4229" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/subscriptions/{id}/activate" : { + "post" : { + "tags" : [ "subscriptions" ], + "summary" : "Activate subscription", + "description" : "Activates the subscription.", + "operationId" : "subscriptions.activate", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/SubscriptionActivateRequest" + }, + "examples" : { + "subscription_activate_request" : { + "value" : { + "reason" : "Reactivating the subscription" + } + } + } + } + } + }, + "responses" : { + "204" : { + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + }, + "400" : { + "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4009" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse42210" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/subscriptions/{id}/capture" : { + "post" : { + "tags" : [ "subscriptions" ], + "summary" : "Capture authorized payment on subscription", + "description" : "Captures an authorized payment from the subscriber on the subscription.", + "operationId" : "subscriptions.capture", + "parameters" : [ { + "$ref" : "#/components/parameters/paypal_request_id" + }, { + "$ref" : "#/components/parameters/id" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/SubscriptionCaptureRequest" + }, + "examples" : { + "subscription_capture_request" : { + "value" : { + "note" : "Charging as the balance reached the limit", + "capture_type" : "OUTSTANDING_BALANCE", + "amount" : { + "currency_code" : "USD", + "value" : "100" + } + } + } + } + } + } + }, + "responses" : { + "200" : { + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Transaction" + } + } + } + }, + "202" : { + "description" : "Request Accepted." + }, + "400" : { + "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse40010" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse42211" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/subscriptions/{id}/transactions" : { + "get" : { + "tags" : [ "subscriptions" ], + "summary" : "List transactions for subscription", + "description" : "Lists transactions for a subscription.", + "operationId" : "subscriptions.transactions", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + }, { + "$ref" : "#/components/parameters/start_time" + }, { + "$ref" : "#/components/parameters/end_time" + } ], + "responses" : { + "200" : { + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/TransactionsList" + } + } + } + }, + "400" : { + "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse40011" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + } + }, + "components" : { + "schemas" : { + "Subscriptionssuspend422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED7" + }, { + "$ref" : "#/components/schemas/SUBSCRIPTIONSTATUSINVALID1" + } ] + }, + "ErrorLocation" : { + "type" : "string", + "description" : "The location of the field that caused the error. Value is `body`, `path`, or `query`", + "default" : "body", + "enum" : [ "body", "path", "query" ] + }, + "UpdatePricingSchemeRequest" : { + "title" : "Update Pricing Scheme", + "required" : [ "billing_cycle_sequence", "pricing_scheme" ], + "type" : "object", + "properties" : { + "billing_cycle_sequence" : { + "maximum" : 99, + "minimum" : 1, + "type" : "integer", + "description" : "The billing cycle sequence", + "x-ballerina-name" : "billingCycleSequence" + }, + "pricing_scheme" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PricingScheme" + } ], + "x-ballerina-name" : "pricingScheme" + } + }, + "description" : "The update pricing scheme request details" + }, + "CurrencyCode" : { + "maxLength" : 3, + "minLength" : 3, + "type" : "string", + "description" : "The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency", + "format" : "ppaas_common_currency_code_v2" + }, + "Planscreate400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDPARAMETERSYNTAX" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE1" + }, { + "$ref" : "#/components/schemas/MISSINGREQUIREDPARAMETER" + }, { + "$ref" : "#/components/schemas/INVALIDSTRINGMINLENGTH" + }, { + "$ref" : "#/components/schemas/INVALIDSTRINGMAXLENGTH" + }, { + "$ref" : "#/components/schemas/INVALIDINTEGERMINVALUE" + }, { + "$ref" : "#/components/schemas/INVALIDINTEGERMAXVALUE" + } ] + }, + "PhoneWithType" : { + "title" : "Phone With Type", + "required" : [ "phone_number" ], + "type" : "object", + "properties" : { + "phone_type" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PhoneType" + } ], + "x-ballerina-name" : "phoneType" + }, + "phone_number" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Phone" + } ], + "x-ballerina-name" : "phoneNumber" + } + }, + "description" : "The phone information" + }, + "Subscriptionspatch400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/UNSUPPORTEDPATCHOPERATION1" + }, { + "$ref" : "#/components/schemas/INVALIDPATCHPATH2" + }, { + "$ref" : "#/components/schemas/INVALIDPATCHPATH3" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERSYNTAX3" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE7" + }, { + "$ref" : "#/components/schemas/INVALIDSTRINGMAXLENGTH3" + }, { + "$ref" : "#/components/schemas/INVALIDSTRINGMINLENGTH1" + }, { + "$ref" : "#/components/schemas/INVALIDINTEGERMINVALUE2" + }, { + "$ref" : "#/components/schemas/INVALIDINTEGERMAXVALUE2" + }, { + "$ref" : "#/components/schemas/MISSINGREQUESTBODY1" + }, { + "$ref" : "#/components/schemas/MISSINGREQUIREDPARAMETER3" + } ] + }, + "Subscriptionstransactions400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDPARAMETERSYNTAX5" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE10" + }, { + "$ref" : "#/components/schemas/MISSINGREQUIREDPARAMETER6" + } ] + }, + "PricingScheme" : { + "title" : "Pricing Scheme", + "type" : "object", + "properties" : { + "tiers" : { + "maxItems" : 32, + "minItems" : 1, + "type" : "array", + "description" : "An array of pricing tiers which are used for billing volume/tiered plans. pricing_model field has to be specified", + "items" : { + "$ref" : "#/components/schemas/PricingTier" + } + }, + "update_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name" : "updateTime" + }, + "create_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name" : "createTime" + }, + "pricing_model" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The pricing model for tiered plan. The `tiers` parameter is required", + "enum" : [ "VOLUME", "TIERED" ], + "x-ballerina-name" : "pricingModel" + }, + "fixed_price" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name" : "fixedPrice" + }, + "version" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The version of the pricing scheme", + "readOnly" : true + } + }, + "description" : "The pricing scheme details" + }, + "SubscriptionsTransactions400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionstransactions400Details" + } + } + } + }, + "SubscriberAllOf2" : { + "properties" : { + "shipping_address" : { + "$ref" : "#/components/schemas/ShippingDetail" + }, + "payment_source" : { + "$ref" : "#/components/schemas/PaymentSourceResponse" + } + } + }, + "SubscriptionCancelRequest" : { + "title" : "Cancel Subscription Request", + "required" : [ "reason" ], + "type" : "object", + "properties" : { + "reason" : { + "maxLength" : 128, + "minLength" : 1, + "type" : "string", + "description" : "The reason for the cancellation of a subscription" + } + }, + "description" : "The cancel subscription request details" + }, + "SubscriptionAllOf2" : { + "properties" : { + "id" : { + "maxLength" : 50, + "minLength" : 3, + "type" : "string", + "description" : "The PayPal-generated ID for the subscription.", + "readOnly" : true + }, + "plan_id" : { + "maxLength" : 50, + "minLength" : 3, + "type" : "string", + "description" : "The ID of the plan." + }, + "start_time" : { + "$ref" : "#/components/schemas/DateTime" + }, + "quantity" : { + "maxLength" : 32, + "minLength" : 1, + "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", + "type" : "string", + "description" : "The quantity of the product in the subscription." + }, + "shipping_amount" : { + "$ref" : "#/components/schemas/Money" + }, + "subscriber" : { + "$ref" : "#/components/schemas/Subscriber" + }, + "billing_info" : { + "$ref" : "#/components/schemas/SubscriptionBillingInfo" + }, + "create_time" : { + "$ref" : "#/components/schemas/DateTime" + }, + "update_time" : { + "$ref" : "#/components/schemas/DateTime" + }, + "custom_id" : { + "maxLength" : 127, + "minLength" : 1, + "pattern" : "^[\\x20-\\x7E]+", + "type" : "string", + "description" : "The custom id for the subscription. Can be invoice id." + }, + "plan_overridden" : { + "type" : "boolean", + "description" : "Indicates whether the subscription has overridden any plan attributes.", + "readOnly" : true + }, + "plan" : { + "$ref" : "#/components/schemas/Plan" + }, + "links" : { + "type" : "array", + "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).", + "readOnly" : true, + "items" : { + "$ref" : "#/components/schemas/LinkDescription" + } + } + } + }, + "INVALIDQUANTITYSUPPORTED" : { + "title" : "INVALID_QUANTITY_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_QUANTITY_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Quantity is always supported for volume and tiered plans." ] + } + } + }, + "BillingCycle" : { + "title" : "Billing Cycle", + "required" : [ "frequency", "sequence", "tenure_type" ], + "type" : "object", + "properties" : { + "sequence" : { + "maximum" : 99, + "minimum" : 1, + "type" : "integer", + "description" : "The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle" + }, + "tenure_type" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The tenure type of the billing cycle. In case of a plan having trial cycle, only 2 trial cycles are allowed per plan", + "enum" : [ "REGULAR", "TRIAL" ], + "x-ballerina-name" : "tenureType" + }, + "total_cycles" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles)", + "default" : 1, + "x-ballerina-name" : "totalCycles" + }, + "pricing_scheme" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PricingScheme" + } ], + "x-ballerina-name" : "pricingScheme" + }, + "frequency" : { + "$ref" : "#/components/schemas/Frequency" + } + }, + "description" : "The billing cycle details" + }, + "InlineResponse42211" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/SubscriptionsCapture422" + } ] + }, + "InlineResponse42210" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/SubscriptionsActivate422" + } ] + }, + "INVALIDRESOURCEID1" : { + "title" : "INVALID_RESOURCE_ID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_RESOURCE_ID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Requested resource ID was not found." ] + } + } + }, + "PaymentPreferencesOverride" : { + "title" : "Payment Preferences Override", + "type" : "object", + "properties" : { + "setup_fee" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name" : "setupFee" + }, + "setup_fee_failure_action" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The action to take on the subscription if the initial payment for the setup fails", + "enum" : [ "CONTINUE", "CANCEL" ], + "x-ballerina-name" : "setupFeeFailureAction" + }, + "auto_bill_outstanding" : { + "type" : "boolean", + "description" : "Indicates whether to automatically bill the outstanding amount in the next billing cycle", + "x-ballerina-name" : "autoBillOutstanding" + }, + "payment_failure_threshold" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail", + "x-ballerina-name" : "paymentFailureThreshold" + } + }, + "description" : "The payment preferences to override at subscription level" + }, + "Subscriptionscreate422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED4" + }, { + "$ref" : "#/components/schemas/PLANSTATUSINVALID2" + }, { + "$ref" : "#/components/schemas/SUBSCRIPTIONCANNOTHAVEQUANTITY" + }, { + "$ref" : "#/components/schemas/CARDSUBSCRIPTIONSNOTENABLED" + }, { + "$ref" : "#/components/schemas/3DSCARDSNOTSUPPORTED" + }, { + "$ref" : "#/components/schemas/INVALIDBILLINGCYCLESEQUENCE3" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGSCHEME1" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERAMOUNT2" + }, { + "$ref" : "#/components/schemas/MISSINGPRICINGSCHEMETIERS2" + }, { + "$ref" : "#/components/schemas/OVERLAPPINGPRICINGSCHEMETIERS2" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGMODEL2" + }, { + "$ref" : "#/components/schemas/FIXEDPRICENOTSUPPORTED2" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERQUANTITY2" + }, { + "$ref" : "#/components/schemas/CURRENCYMISMATCH2" + } ] + }, + "UpdatePricingSchemesListRequest" : { + "title" : "Update Pricing Scheme Request", + "required" : [ "pricing_schemes" ], + "type" : "object", + "properties" : { + "pricing_schemes" : { + "maxItems" : 99, + "minItems" : 1, + "type" : "array", + "description" : "An array of pricing schemes", + "items" : { + "$ref" : "#/components/schemas/UpdatePricingSchemeRequest" + }, + "x-ballerina-name" : "pricingSchemes" + } + }, + "description" : "The update pricing scheme request details" + }, + "DateNoTime" : { + "maxLength" : 10, + "minLength" : 10, + "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$", + "type" : "string", + "description" : "The stand-alone date, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard `date_time` type. This regular expression does not validate all dates. For example, February 31 is valid and nothing is known about leap years", + "format" : "ppaas_date_notime_v2" + }, + "CURRENCYNOTSUPPORTEDFORRECEIVER" : { + "title" : "CURRENCY_NOT_SUPPORTED_FOR_RECEIVER", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "CURRENCY_NOT_SUPPORTED_FOR_RECEIVER" ] + }, + "description" : { + "type" : "string", + "enum" : [ "This currency cannot be accepted for this recipient’s account." ] + } + } + }, + "SubscriberRequest" : { + "title" : "Subscriber Request Information", + "type" : "object", + "description" : "The subscriber request information ", + "allOf" : [ { + "$ref" : "#/components/schemas/Payer" + }, { + "$ref" : "#/components/schemas/SubscriberRequestAllOf2" + } ] + }, + "CaptureStatus" : { + "title" : "Capture Status", + "type" : "object", + "properties" : { + "status_details" : { + "allOf" : [ { + "$ref" : "#/components/schemas/CaptureStatusDetails" + } ], + "x-ballerina-name" : "statusDetails" + }, + "status" : { + "type" : "string", + "description" : "The status of the captured payment", + "readOnly" : true, + "enum" : [ "COMPLETED", "DECLINED", "PARTIALLY_REFUNDED", "PENDING", "REFUNDED" ] + } + }, + "description" : "The status of a captured payment" + }, + "FailedPaymentDetails" : { + "title" : "Failed Payment Details", + "required" : [ "amount", "time" ], + "type" : "object", + "properties" : { + "reason_code" : { + "maxLength" : 120, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The reason code for the payment failure", + "readOnly" : true, + "enum" : [ "PAYMENT_DENIED", "INTERNAL_SERVER_ERROR", "PAYEE_ACCOUNT_RESTRICTED", "PAYER_ACCOUNT_RESTRICTED", "PAYER_CANNOT_PAY", "SENDING_LIMIT_EXCEEDED", "TRANSACTION_RECEIVING_LIMIT_EXCEEDED", "CURRENCY_MISMATCH" ], + "x-ballerina-name" : "reasonCode" + }, + "amount" : { + "$ref" : "#/components/schemas/Money" + }, + "next_payment_retry_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name" : "nextPaymentRetryTime" + }, + "time" : { + "$ref" : "#/components/schemas/DateTime" + } + }, + "description" : "The details for the failed payment of the subscription" + }, + "INVALIDBILLINGCYCLESEQUENCE1" : { + "title" : "INVALID_BILLING_CYCLE_SEQUENCE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_BILLING_CYCLE_SEQUENCE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Trial Billing cycle should precede regular billing cycle." ] + } + } + }, + "CARDSUBSCRIPTIONSNOTENABLED1" : { + "title" : "CARD_SUBSCRIPTIONS_NOT_ENABLED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "CARD_SUBSCRIPTIONS_NOT_ENABLED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The account is not setup to be able to process subscriptions funded by card payments. Please contact PayPal customer support." ] + } + } + }, + "INVALIDBILLINGCYCLESEQUENCE2" : { + "title" : "INVALID_BILLING_CYCLE_SEQUENCE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_BILLING_CYCLE_SEQUENCE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The provided billing cycle sequence is not available." ] + } + } + }, + "PlansupdatePricingSchemes422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/CURRENCYMISMATCH1" + }, { + "$ref" : "#/components/schemas/INVALIDBILLINGCYCLESEQUENCE2" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGSCHEME" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERAMOUNT1" + }, { + "$ref" : "#/components/schemas/MISSINGPRICINGSCHEMETIERS1" + }, { + "$ref" : "#/components/schemas/OVERLAPPINGPRICINGSCHEMETIERS1" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGMODEL1" + }, { + "$ref" : "#/components/schemas/FIXEDPRICENOTSUPPORTED1" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERQUANTITY1" + }, { + "$ref" : "#/components/schemas/PRICINGSCHEMEUPDATENOTALLOWED" + } ] + }, + "InlineResponse401" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error401" + }, { + "$ref" : "#/components/schemas/Unauthorized" + } ] + }, + "InlineResponse400" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/BadRequest" + } ] + }, + "ErrorDetails" : { + "title" : "Error Details", + "required" : [ "issue" ], + "type" : "object", + "properties" : { + "field" : { + "type" : "string", + "description" : "The field that caused the error. If this field is in the body, set this value to the field's JSON pointer value. Required for client-side errors" + }, + "issue" : { + "type" : "string", + "description" : "The unique, fine-grained application-level error code" + }, + "description" : { + "type" : "string", + "description" : "The human-readable description for an issue. The description can change over the lifetime of an API, so clients must not depend on this value" + }, + "location" : { + "$ref" : "#/components/schemas/ErrorLocation" + }, + "value" : { + "type" : "string", + "description" : "The value of the field that caused the error" + } + }, + "description" : "The error details. Required for client-side `4XX` errors" + }, + "InlineResponse403" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error403" + }, { + "$ref" : "#/components/schemas/Forbidden" + } ] + }, + "INVALIDACCOUNTSTATUS" : { + "title" : "INVALID_ACCOUNT_STATUS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_ACCOUNT_STATUS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Account validations failed for the user." ] + } + } + }, + "Subscriptionsrevise404Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDRESOURCEID1" + } ] + }, + "InlineResponse404" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error404" + }, { + "$ref" : "#/components/schemas/NotFound" + } ] + }, + "PlansPatch400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Planspatch400Details" + } + } + } + }, + "Subscriptionsrevise400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDPARAMETERSYNTAX4" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE8" + }, { + "$ref" : "#/components/schemas/INVALIDINTEGERMINVALUE3" + }, { + "$ref" : "#/components/schemas/INVALIDINTEGERMAXVALUE3" + }, { + "$ref" : "#/components/schemas/MISSINGREQUESTBODY2" + }, { + "$ref" : "#/components/schemas/MISSINGREQUIREDPARAMETER4" + } ] + }, + "INVALIDBILLINGCYCLESEQUENCE3" : { + "title" : "INVALID_BILLING_CYCLE_SEQUENCE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_BILLING_CYCLE_SEQUENCE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The provided billing cycle sequence is not available." ] + } + } + }, + "INVALIDBILLINGCYCLESEQUENCE4" : { + "title" : "INVALID_BILLING_CYCLE_SEQUENCE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_BILLING_CYCLE_SEQUENCE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The provided billing cycle sequence is not available." ] + } + } + }, + "MULTIPLEFREETRIALBILLINGCYCLESNOTSUPPORTED" : { + "title" : "MULTIPLE_FREE_TRIAL_BILLING_CYCLES_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MULTIPLE_FREE_TRIAL_BILLING_CYCLES_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Only one free trial billing cycle is allowed." ] + } + } + }, + "404Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDRESOURCEID" + } ] + }, + "INVALIDPRICINGTIERAMOUNT1" : { + "title" : "INVALID_PRICING_TIER_AMOUNT", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_AMOUNT" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Free tiers are not supported." ] + } + } + }, + "SUBSCRIBERACCOUNTRESTRICTED" : { + "title" : "SUBSCRIBER_ACCOUNT_RESTRICTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIBER_ACCOUNT_RESTRICTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Subscriber Account Restricted." ] + } + } + }, + "AddressDetails" : { + "title" : "Address Details", + "type" : "object", + "properties" : { + "building_name" : { + "maxLength" : 100, + "type" : "string", + "description" : "A named locations that represents the premise. Usually a building name or number or collection of buildings with a common name or number. For example, Craven House", + "x-ballerina-name" : "buildingName" + }, + "street_number" : { + "maxLength" : 100, + "type" : "string", + "description" : "The street number", + "x-ballerina-name" : "streetNumber" + }, + "street_type" : { + "maxLength" : 100, + "type" : "string", + "description" : "The street type. For example, avenue, boulevard, road, or expressway", + "x-ballerina-name" : "streetType" + }, + "sub_building" : { + "maxLength" : 100, + "type" : "string", + "description" : "The first-order entity below a named building or location that represents the sub-premises. Usually a single building within a collection of buildings with a common name. Can be a flat, story, floor, room, or apartment", + "x-ballerina-name" : "subBuilding" + }, + "delivery_service" : { + "maxLength" : 100, + "type" : "string", + "description" : "The delivery service. Post office box, bag number, or post office name", + "x-ballerina-name" : "deliveryService" + }, + "street_name" : { + "maxLength" : 100, + "type" : "string", + "description" : "The street name. Just `Drury` in `Drury Lane`", + "x-ballerina-name" : "streetName" + } + }, + "description" : "The non-portable additional address details that are sometimes needed for compliance, risk, or other scenarios where fine-grain address information might be needed. Not portable with common third party and open source. Redundant with core fields.
For example, `address_portable.address_line_1` is usually a combination of `address_details.street_number`, `street_name`, and `street_type`" + }, + "INVALIDPRICINGTIERAMOUNT2" : { + "title" : "INVALID_PRICING_TIER_AMOUNT", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_AMOUNT" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Free tiers are not supported." ] + } + } + }, + "PlansUpdatePricingSchemes422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PlansupdatePricingSchemes422Details" + } + } + } + }, + "CARDSUBSCRIPTIONSNOTENABLED" : { + "title" : "CARD_SUBSCRIPTIONS_NOT_ENABLED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "CARD_SUBSCRIPTIONS_NOT_ENABLED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The account is not setup to be able to process subscriptions funded by card payments. Please contact PayPal customer support." ] + } + } + }, + "INVALIDPRICINGTIERAMOUNT3" : { + "title" : "INVALID_PRICING_TIER_AMOUNT", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_AMOUNT" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Free tiers are not supported." ] + } + } + }, + "400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE" + } ] + }, + "INVALIDPRICINGTIERAMOUNT4" : { + "title" : "INVALID_PRICING_TIER_AMOUNT", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_AMOUNT" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Free tiers are not supported." ] + } + } + }, + "INVALIDPATCHPATH" : { + "title" : "INVALID_PATCH_PATH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PATCH_PATH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified field cannot be patched." ] + } + } + }, + "LastPaymentDetailsAllOf1" : { + "properties" : { + "amount" : { + "$ref" : "#/components/schemas/Money" + }, + "time" : { + "$ref" : "#/components/schemas/DateTime" + } + } + }, + "SubscriptionsSuspend400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionssuspend400Details" + } + } + } + }, + "MISSINGREGULARBILLINGCYCLE" : { + "title" : "MISSING_REGULAR_BILLING_CYCLE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REGULAR_BILLING_CYCLE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Plan should have at least one regular billing cycle." ] + } + } + }, + "SubscriptionBillingInfo" : { + "title" : "Subscription Billing Information", + "required" : [ "failed_payments_count", "outstanding_balance" ], + "type" : "object", + "properties" : { + "final_payment_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name" : "finalPaymentTime" + }, + "cycle_executions" : { + "maxItems" : 3, + "minItems" : 0, + "type" : "array", + "description" : "The trial and regular billing executions", + "readOnly" : true, + "items" : { + "$ref" : "#/components/schemas/CycleExecution" + }, + "x-ballerina-name" : "cycleExecutions" + }, + "failed_payments_count" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The number of consecutive payment failures. Resets to `0` after a successful payment. If this reaches the `payment_failure_threshold` value, the subscription updates to the `SUSPENDED` state", + "readOnly" : true, + "x-ballerina-name" : "failedPaymentsCount" + }, + "next_billing_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name" : "nextBillingTime" + }, + "last_failed_payment" : { + "allOf" : [ { + "$ref" : "#/components/schemas/FailedPaymentDetails" + } ], + "x-ballerina-name" : "lastFailedPayment" + }, + "outstanding_balance" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name" : "outstandingBalance" + }, + "last_payment" : { + "allOf" : [ { + "$ref" : "#/components/schemas/LastPaymentDetails" + } ], + "x-ballerina-name" : "lastPayment" + } + }, + "description" : "The billing details for the subscription. If the subscription was or is active, these fields are populated" + }, + "SubscriptionReviseRequest" : { + "title" : "Subscription Modify Plan Request", + "type" : "object", + "properties" : { + "shipping_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name" : "shippingAmount" + }, + "quantity" : { + "maxLength" : 32, + "minLength" : 1, + "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", + "type" : "string", + "description" : "The quantity of the product or service in the subscription" + }, + "application_context" : { + "allOf" : [ { + "$ref" : "#/components/schemas/ApplicationContext" + } ], + "x-ballerina-name" : "applicationContext" + }, + "shipping_address" : { + "allOf" : [ { + "$ref" : "#/components/schemas/ShippingDetail" + } ], + "x-ballerina-name" : "shippingAddress" + }, + "plan" : { + "$ref" : "#/components/schemas/PlanOverride" + }, + "plan_id" : { + "maxLength" : 50, + "minLength" : 3, + "type" : "string", + "description" : "The unique PayPal-generated ID for the plan", + "x-ballerina-name" : "planId" + } + }, + "description" : "The request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent" + }, + "INVALIDSTRINGMAXLENGTH" : { + "title" : "INVALID_STRING_MAX_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MAX_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too long." ] + } + } + }, + "PayeePaymentMethodPreference" : { + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "The merchant-preferred payment methods", + "default" : "UNRESTRICTED", + "enum" : [ "UNRESTRICTED", "IMMEDIATE_PAYMENT_REQUIRED" ] + }, + "Frequency" : { + "title" : "Billing Cycle Frequency", + "required" : [ "interval_unit" ], + "type" : "object", + "properties" : { + "interval_count" : { + "maximum" : 365, + "minimum" : 1, + "type" : "integer", + "description" : "The number of intervals after which a subscriber is billed. For example, if the `interval_unit` is `DAY` with an `interval_count` of `2`, the subscription is billed once every two days. The following table lists the maximum allowed values for the `interval_count` for each `interval_unit`:
Interval unitMaximum interval count
DAY365
WEEK52
MONTH12
YEAR1
", + "default" : 1, + "x-ballerina-name" : "intervalCount" + }, + "interval_unit" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The interval at which the subscription is charged or billed", + "enum" : [ "DAY", "WEEK", "MONTH", "YEAR" ], + "x-ballerina-name" : "intervalUnit" + } + }, + "description" : "The frequency of the billing cycle" + }, + "422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED" + }, { + "$ref" : "#/components/schemas/CURRENCYMISMATCH" + }, { + "$ref" : "#/components/schemas/MULTIPLEFREETRIALBILLINGCYCLESNOTSUPPORTED" + }, { + "$ref" : "#/components/schemas/MORETHANTWOTRIALBILLINGCYCLENOTSUPPORTED" + }, { + "$ref" : "#/components/schemas/MISSINGREGULARBILLINGCYCLE" + }, { + "$ref" : "#/components/schemas/MULTIPLEREGULARBILLINGCYCLESNOTSUPPORTED" + }, { + "$ref" : "#/components/schemas/INVALIDBILLINGCYCLESEQUENCE" + }, { + "$ref" : "#/components/schemas/INVALIDBILLINGCYCLESEQUENCE1" + }, { + "$ref" : "#/components/schemas/INVALIDTRIALBILLINGTOTALCYCLES" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERAMOUNT" + }, { + "$ref" : "#/components/schemas/MISSINGPRICINGSCHEMETIERS" + }, { + "$ref" : "#/components/schemas/OVERLAPPINGPRICINGSCHEMETIERS" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGMODEL" + }, { + "$ref" : "#/components/schemas/FIXEDPRICENOTSUPPORTED" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERQUANTITY" + }, { + "$ref" : "#/components/schemas/INVALIDQUANTITYSUPPORTED" + }, { + "$ref" : "#/components/schemas/CURRENCYNOTSUPPORTEDFORRECEIVER" + }, { + "$ref" : "#/components/schemas/INVALIDMETADATACUSTOMNOTE" + }, { + "$ref" : "#/components/schemas/INVALIDMETADATAINVOICEID" + } ] + }, + "Planspatch422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED1" + }, { + "$ref" : "#/components/schemas/PLANSTATUSINACTIVE" + } ] + }, + "CardResponseWithBillingAddress" : { + "title" : "Card Response with billing address and name", + "type" : "object", + "description" : "The payment card used to fund the payment. Card can be a credit or debit card", + "allOf" : [ { + "$ref" : "#/components/schemas/CardResponse" + }, { + "$ref" : "#/components/schemas/CardResponseWithBillingAddressAllOf2" + } ] + }, + "PlansupdatePricingSchemes400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE4" + }, { + "$ref" : "#/components/schemas/MISSINGREQUIREDPARAMETER1" + } ] + }, + "PayerAllOf2" : { + "properties" : { + "name" : { + "$ref" : "#/components/schemas/Name" + }, + "phone" : { + "$ref" : "#/components/schemas/PhoneWithType" + }, + "birth_date" : { + "$ref" : "#/components/schemas/DateNoTime" + }, + "tax_info" : { + "$ref" : "#/components/schemas/TaxInfo" + }, + "address" : { + "$ref" : "#/components/schemas/AddressPortable" + } + } + }, + "BillingCycleOverride" : { + "title" : "Billing Cycle Override", + "required" : [ "sequence" ], + "type" : "object", + "properties" : { + "sequence" : { + "maximum" : 99, + "minimum" : 1, + "type" : "integer", + "description" : "The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle" + }, + "total_cycles" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles)", + "x-ballerina-name" : "totalCycles" + }, + "pricing_scheme" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PricingScheme" + } ], + "x-ballerina-name" : "pricingScheme" + } + }, + "description" : "The billing cycle details to override at subscription level. The subscription billing cycle definition has to adhere to the plan billing cycle definition" + }, + "CycleExecution" : { + "title" : "Billing Cycle Execution Details", + "required" : [ "cycles_completed", "sequence", "tenure_type" ], + "type" : "object", + "properties" : { + "sequence" : { + "maximum" : 99, + "minimum" : 0, + "type" : "integer", + "description" : "The order in which to run this cycle among other billing cycles" + }, + "cycles_remaining" : { + "maximum" : 9999, + "minimum" : 0, + "type" : "integer", + "description" : "For a finite billing cycle, cycles_remaining is the number of remaining cycles. For an infinite billing cycle, cycles_remaining is set as 0", + "readOnly" : true, + "x-ballerina-name" : "cyclesRemaining" + }, + "tenure_type" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The type of the billing cycle", + "readOnly" : true, + "enum" : [ "REGULAR", "TRIAL" ], + "x-ballerina-name" : "tenureType" + }, + "cycles_completed" : { + "maximum" : 9999, + "minimum" : 0, + "type" : "integer", + "description" : "The number of billing cycles that have completed", + "readOnly" : true, + "x-ballerina-name" : "cyclesCompleted" + }, + "current_pricing_scheme_version" : { + "maximum" : 99, + "minimum" : 1, + "type" : "integer", + "description" : "The active pricing scheme version for the billing cycle", + "readOnly" : true, + "x-ballerina-name" : "currentPricingSchemeVersion" + }, + "total_cycles" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles)", + "readOnly" : true, + "x-ballerina-name" : "totalCycles" + } + }, + "description" : "The regular and trial execution details for a billing cycle" + }, + "INVALIDTRIALBILLINGTOTALCYCLES" : { + "title" : "INVALID_TRIAL_BILLING_TOTAL_CYCLES", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_TRIAL_BILLING_TOTAL_CYCLES" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Total cycles for trial billing must be greater than '0'." ] + } + } + }, + "Email" : { + "maxLength" : 254, + "pattern" : "(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])", + "type" : "string", + "description" : "The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
", + "format" : "merchant_common_email_address_v2" + }, + "AccountId" : { + "title" : "PayPal Account Identifier", + "maxLength" : 13, + "minLength" : 13, + "pattern" : "^[2-9A-HJ-NP-Z]{13}$", + "type" : "string", + "description" : "The account identifier for a PayPal account", + "format" : "ppaas_payer_id_v3" + }, + "Subscriptionsactivate422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED9" + }, { + "$ref" : "#/components/schemas/SUBSCRIPTIONSTATUSINVALID3" + }, { + "$ref" : "#/components/schemas/SUBSCRIPTIONCANNOTBEACTIVATED" + }, { + "$ref" : "#/components/schemas/SUBSCRIPTIONCANNOTBEACTIVATED1" + }, { + "$ref" : "#/components/schemas/SUBSCRIPTIONCANNOTBEACTIVATED2" + } ] + }, + "SubscriptionsCreate422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscreate422Details" + } + } + } + }, + "INVALIDPRICINGTIERAMOUNT" : { + "title" : "INVALID_PRICING_TIER_AMOUNT", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_AMOUNT" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Free tiers are not supported." ] + } + } + }, + "Name" : { + "title" : "Name", + "type" : "object", + "properties" : { + "full_name" : { + "maxLength" : 300, + "type" : "string", + "description" : "When the party is a person, the party's full name", + "x-ballerina-name" : "fullName" + }, + "prefix" : { + "maxLength" : 140, + "type" : "string", + "description" : "The prefix, or title, to the party's name" + }, + "surname" : { + "maxLength" : 140, + "type" : "string", + "description" : "When the party is a person, the party's surname or family name. Also known as the last name. Required when the party is a person. Use also to store multiple surnames including the matronymic, or mother's, surname" + }, + "given_name" : { + "maxLength" : 140, + "type" : "string", + "description" : "When the party is a person, the party's given, or first, name", + "x-ballerina-name" : "givenName" + }, + "middle_name" : { + "maxLength" : 140, + "type" : "string", + "description" : "When the party is a person, the party's middle name. Use also to store multiple middle names including the patronymic, or father's, middle name", + "x-ballerina-name" : "middleName" + }, + "suffix" : { + "maxLength" : 140, + "type" : "string", + "description" : "The suffix for the party's name" + }, + "alternate_full_name" : { + "maxLength" : 300, + "type" : "string", + "description" : "DEPRECATED. The party's alternate name. Can be a business name, nickname, or any other name that cannot be split into first, last name. Required when the party is a business", + "x-ballerina-name" : "alternateFullName" + } + }, + "description" : "The name of the party" + }, + "Enrolled" : { + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "Status of Authentication eligibility", + "enum" : [ "Y", "N", "U", "B" ] + }, + "BILLINGCYCLEEXECUTIONCOMPLETED" : { + "title" : "BILLING_CYCLE_EXECUTION_COMPLETED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "BILLING_CYCLE_EXECUTION_COMPLETED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Update cannot be performed on a billing cycle that has completed execution." ] + } + } + }, + "PaymentPreferences" : { + "title" : "Payment Preferences", + "type" : "object", + "properties" : { + "setup_fee" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name" : "setupFee" + }, + "setup_fee_failure_action" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The action to take on the subscription if the initial payment for the setup fails", + "default" : "CANCEL", + "enum" : [ "CONTINUE", "CANCEL" ], + "x-ballerina-name" : "setupFeeFailureAction" + }, + "auto_bill_outstanding" : { + "type" : "boolean", + "description" : "Indicates whether to automatically bill the outstanding amount in the next billing cycle", + "default" : true, + "x-ballerina-name" : "autoBillOutstanding" + }, + "payment_failure_threshold" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail", + "default" : 0, + "x-ballerina-name" : "paymentFailureThreshold" + } + }, + "description" : "The payment preferences for a subscription" + }, + "TransactionsList" : { + "title" : "List Transactions", + "type" : "object", + "properties" : { + "links" : { + "maxItems" : 10, + "minItems" : 1, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links)", + "readOnly" : true, + "items" : { + "$ref" : "#/components/schemas/LinkDescription" + } + }, + "total_pages" : { + "maximum" : 100000000, + "minimum" : 0, + "type" : "integer", + "description" : "The total number of pages", + "x-ballerina-name" : "totalPages" + }, + "transactions" : { + "maxItems" : 32767, + "minItems" : 0, + "type" : "array", + "description" : "An array of transactions", + "items" : { + "$ref" : "#/components/schemas/Transaction" + } + }, + "total_items" : { + "maximum" : 500000000, + "minimum" : 0, + "type" : "integer", + "description" : "The total number of items", + "x-ballerina-name" : "totalItems" + } + }, + "description" : "The list transactions for a subscription request details" + }, + "MULTIPLEREGULARBILLINGCYCLESNOTSUPPORTED" : { + "title" : "MULTIPLE_REGULAR_BILLING_CYCLES_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MULTIPLE_REGULAR_BILLING_CYCLES_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Only one regular billing cycle is allowed." ] + } + } + }, + "PlansPatch422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Planspatch422Details" + } + } + } + }, + "ApplicationContext" : { + "title" : "Application Context", + "required" : [ "cancel_url", "return_url" ], + "type" : "object", + "properties" : { + "user_action" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "Configures the label name to `Continue` or `Subscribe Now` for subscription consent experience", + "default" : "SUBSCRIBE_NOW", + "enum" : [ "CONTINUE", "SUBSCRIBE_NOW" ], + "x-ballerina-name" : "userAction" + }, + "return_url" : { + "maxLength" : 4000, + "minLength" : 10, + "type" : "string", + "description" : "The URL where the customer is redirected after the customer approves the payment", + "format" : "uri", + "x-ballerina-name" : "returnUrl" + }, + "brand_name" : { + "maxLength" : 127, + "minLength" : 1, + "type" : "string", + "description" : "The label that overrides the business name in the PayPal account on the PayPal site", + "x-ballerina-name" : "brandName" + }, + "locale" : { + "$ref" : "#/components/schemas/Language" + }, + "cancel_url" : { + "maxLength" : 4000, + "minLength" : 10, + "type" : "string", + "description" : "The URL where the customer is redirected after the customer cancels the payment", + "format" : "uri", + "x-ballerina-name" : "cancelUrl" + }, + "shipping_preference" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The location from which the shipping address is derived", + "default" : "GET_FROM_FILE", + "enum" : [ "GET_FROM_FILE", "NO_SHIPPING", "SET_PROVIDED_ADDRESS" ], + "x-ballerina-name" : "shippingPreference" + }, + "payment_method" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PaymentMethod" + } ], + "x-ballerina-name" : "paymentMethod" + } + }, + "description" : "The application context, which customizes the payer experience during the subscription approval process with PayPal" + }, + "Subscriber" : { + "title" : "Subscriber Response Information", + "type" : "object", + "description" : "The subscriber response information", + "allOf" : [ { + "$ref" : "#/components/schemas/Payer" + }, { + "$ref" : "#/components/schemas/SubscriberAllOf2" + } ] + }, + "AMOUNTGREATERTHANOUTSTANDINGBALANCE1" : { + "title" : "AMOUNT_GREATER_THAN_OUTSTANDING_BALANCE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "AMOUNT_GREATER_THAN_OUTSTANDING_BALANCE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The capture amount can not be greater than the current outstanding balance." ] + } + } + }, + "PaymentSourceResponse" : { + "title" : "Payment Source Response", + "type" : "object", + "properties" : { + "card" : { + "$ref" : "#/components/schemas/CardResponseWithBillingAddress" + } + }, + "description" : "The payment source used to fund the payment" + }, + "PlanOverride" : { + "title" : "Plan Override", + "type" : "object", + "properties" : { + "payment_preferences" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PaymentPreferencesOverride" + } ], + "x-ballerina-name" : "paymentPreferences" + }, + "billing_cycles" : { + "maxItems" : 12, + "minItems" : 1, + "type" : "array", + "description" : "An array of billing cycles for trial billing and regular billing. The subscription billing cycle definition has to adhere to the plan billing cycle definition", + "items" : { + "$ref" : "#/components/schemas/BillingCycleOverride" + }, + "x-ballerina-name" : "billingCycles" + }, + "taxes" : { + "$ref" : "#/components/schemas/TaxesOverride" + } + }, + "description" : "An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object" + }, + "INVALIDINTEGERMINVALUE" : { + "title" : "INVALID_INTEGER_MIN_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_INTEGER_MIN_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The integer value of a field is too small." ] + } + } + }, + "Subscriptionssuspend400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDSTRINGMAXLENGTH4" + } ] + }, + "SubscriptionReviseResponseAllOf2" : { + "properties" : { + "plan_overridden" : { + "type" : "boolean", + "description" : "Indicates whether the subscription has overridden any plan attributes.", + "readOnly" : true + }, + "links" : { + "type" : "array", + "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).", + "readOnly" : true, + "items" : { + "$ref" : "#/components/schemas/LinkDescription" + } + } + } + }, + "MISSINGREQUESTBODY2" : { + "title" : "MISSING_REQUEST_BODY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUEST_BODY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Request body is missing." ] + } + } + }, + "MISSINGREQUESTBODY1" : { + "title" : "MISSING_REQUEST_BODY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUEST_BODY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Request body is missing." ] + } + } + }, + "MISSINGREQUIREDPARAMETER" : { + "title" : "MISSING_REQUIRED_PARAMETER", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + }, + "description" : { + "type" : "string", + "enum" : [ "A required field is missing." ] + } + } + }, + "ThreeDSecureAuthenticationResponse" : { + "title" : "The 3D Secure Authentication Response", + "type" : "object", + "properties" : { + "authentication_status" : { + "allOf" : [ { + "$ref" : "#/components/schemas/ParesStatus" + } ], + "x-ballerina-name" : "authenticationStatus" + }, + "enrollment_status" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Enrolled" + } ], + "x-ballerina-name" : "enrollmentStatus" + } + }, + "description" : "Results of 3D Secure Authentication" + }, + "403Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/PERMISSIONDENIED" + } ] + }, + "401Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDACCOUNTSTATUS" + } ] + }, + "INVALIDPRICINGTIERQUANTITY" : { + "title" : "INVALID_PRICING_TIER_QUANTITY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_QUANTITY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier starting quantity must be less than ending quantity." ] + } + } + }, + "PRICINGSCHEMEUPDATENOTALLOWED" : { + "title" : "PRICING_SCHEME_UPDATE_NOT_ALLOWED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "PRICING_SCHEME_UPDATE_NOT_ALLOWED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Pricing scheme update is not allowed for the plan." ] + } + } + }, + "CURRENCYMISMATCH2" : { + "title" : "CURRENCY_MISMATCH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "CURRENCY_MISMATCH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The currency code is different from the plan's currency code." ] + } + } + }, + "CURRENCYMISMATCH1" : { + "title" : "CURRENCY_MISMATCH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "CURRENCY_MISMATCH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The currency code is different from the plan's currency code." ] + } + } + }, + "PatchRequest" : { + "title" : "Patch Request", + "type" : "array", + "description" : "An array of JSON patch objects to apply partial updates to resources", + "items" : { + "$ref" : "#/components/schemas/Patch" + } + }, + "CURRENCYMISMATCH5" : { + "title" : "CURRENCY_MISMATCH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "CURRENCY_MISMATCH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The currency code is different from the subscription's currency code." ] + } + } + }, + "CURRENCYMISMATCH4" : { + "title" : "CURRENCY_MISMATCH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "CURRENCY_MISMATCH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The currency code is different from the plan's currency code." ] + } + } + }, + "CURRENCYMISMATCH3" : { + "title" : "CURRENCY_MISMATCH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "CURRENCY_MISMATCH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The currency code is different from the subscription's currency code." ] + } + } + }, + "MISSINGREQUESTBODY3" : { + "title" : "MISSING_REQUEST_BODY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUEST_BODY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Request body is missing." ] + } + } + }, + "InlineResponse4041" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error404" + }, { + "$ref" : "#/components/schemas/SubscriptionsRevise404" + } ] + }, + "Subscriptionscancel422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED8" + }, { + "$ref" : "#/components/schemas/SUBSCRIPTIONSTATUSINVALID2" + } ] + }, + "CardResponse" : { + "title" : "Card Response", + "type" : "object", + "properties" : { + "authentication_result" : { + "allOf" : [ { + "$ref" : "#/components/schemas/AuthenticationResponse" + } ], + "x-ballerina-name" : "authenticationResult" + }, + "type" : { + "type" : "string", + "description" : "The payment card type", + "readOnly" : true, + "enum" : [ "CREDIT", "DEBIT", "PREPAID", "UNKNOWN" ] + }, + "last_digits" : { + "pattern" : "[0-9]{2,}", + "type" : "string", + "description" : "The last digits of the payment card", + "readOnly" : true, + "x-ballerina-name" : "lastDigits" + }, + "brand" : { + "$ref" : "#/components/schemas/CardBrand" + } + }, + "description" : "The payment card to use to fund a payment. Card can be a credit or debit card" + }, + "PlanRequestPOST" : { + "title" : "Create Plan Request", + "required" : [ "billing_cycles", "name", "payment_preferences", "product_id" ], + "type" : "object", + "properties" : { + "quantity_supported" : { + "type" : "boolean", + "description" : "Indicates whether you can subscribe to this plan by providing a quantity for the goods or service", + "default" : false, + "x-ballerina-name" : "quantitySupported" + }, + "payment_preferences" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PaymentPreferences" + } ], + "x-ballerina-name" : "paymentPreferences" + }, + "product_id" : { + "maxLength" : 50, + "minLength" : 6, + "type" : "string", + "description" : "The ID of the product created through Catalog Products API", + "x-ballerina-name" : "productId" + }, + "name" : { + "maxLength" : 127, + "minLength" : 1, + "type" : "string", + "description" : "The plan name" + }, + "billing_cycles" : { + "maxItems" : 12, + "minItems" : 1, + "type" : "array", + "description" : "An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle", + "items" : { + "$ref" : "#/components/schemas/BillingCycle" + }, + "x-ballerina-name" : "billingCycles" + }, + "description" : { + "maxLength" : 127, + "minLength" : 1, + "type" : "string", + "description" : "The detailed description of the plan" + }, + "taxes" : { + "$ref" : "#/components/schemas/Taxes" + }, + "status" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The initial state of the plan. Allowed input values are CREATED and ACTIVE", + "default" : "ACTIVE", + "enum" : [ "CREATED", "INACTIVE", "ACTIVE" ] + } + }, + "description" : "The create plan request details" + }, + "INVALIDINTEGERMAXVALUE2" : { + "title" : "INVALID_INTEGER_MAX_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_INTEGER_MAX_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The integer value of a field is too large." ] + } + } + }, + "Patch" : { + "title" : "Patch", + "required" : [ "op" ], + "type" : "object", + "properties" : { + "op" : { + "type" : "string", + "description" : "The operation", + "enum" : [ "add", "remove", "replace", "move", "copy", "test" ] + }, + "path" : { + "type" : "string", + "description" : "The JSON Pointer to the target document location at which to complete the operation" + }, + "from" : { + "type" : "string", + "description" : "The JSON Pointer to the target document location from which to move the value. Required for the move operation" + }, + "value" : { + "title" : "Patch Value", + "description" : "The value to apply. The remove operation does not require a value" + } + }, + "description" : "The JSON patch object to apply partial updates to resources" + }, + "INVALIDINTEGERMAXVALUE3" : { + "title" : "INVALID_INTEGER_MAX_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_INTEGER_MAX_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The integer value of a field is too large." ] + } + } + }, + "INVALIDINTEGERMAXVALUE1" : { + "title" : "INVALID_INTEGER_MAX_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_INTEGER_MAX_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The integer value of a field is too large." ] + } + } + }, + "SUBSCRIPTIONCANNOTHAVEQUANTITY" : { + "title" : "SUBSCRIPTION_CANNOT_HAVE_QUANTITY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIPTION_CANNOT_HAVE_QUANTITY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Subscription can't have quantity as the plan does not support quantity." ] + } + } + }, + "Subscriptionscancel400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDSTRINGMAXLENGTH5" + } ] + }, + "INVALIDPARAMETERVALUE10" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is invalid." ] + } + } + }, + "LinkDescription" : { + "title" : "Link Description", + "required" : [ "href", "rel" ], + "type" : "object", + "properties" : { + "method" : { + "type" : "string", + "description" : "The HTTP method required to make the related call", + "enum" : [ "GET", "POST", "PUT", "DELETE", "HEAD", "CONNECT", "OPTIONS", "PATCH" ] + }, + "rel" : { + "type" : "string", + "description" : "The [link relation type](https://tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](https://www.iana.org/assignments/link-relations/link-relations.xhtml)" + }, + "href" : { + "type" : "string", + "description" : "The complete target URL. To make the related call, combine the method with this [URI Template-formatted](https://tools.ietf.org/html/rfc6570) link. For pre-processing, include the `$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call" + } + }, + "description" : "The request-related [HATEOAS link](/docs/api/reference/api-responses/#hateoas-links) information" + }, + "SubscriptionsCreate400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscreate400Details" + } + } + } + }, + "ShippingDetail" : { + "title" : "Shipping Details", + "type" : "object", + "properties" : { + "address" : { + "$ref" : "#/components/schemas/AddressPortable" + }, + "name" : { + "$ref" : "#/components/schemas/Name" + }, + "type" : { + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "The method by which the payer wants to get their items from the payee e.g shipping, in-person pickup. Either type or options but not both may be present", + "enum" : [ "SHIPPING", "PICKUP_IN_PERSON" ] + } + }, + "description" : "The shipping details" + }, + "INVALIDMETADATAINVOICEID" : { + "title" : "INVALID_METADATA_INVOICE_ID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_METADATA_INVOICE_ID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Invoice id cannot exceed 127 characters." ] + } + } + }, + "INVALIDINTEGERMAXVALUE" : { + "title" : "INVALID_INTEGER_MAX_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_INTEGER_MAX_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The integer value of a field is too large." ] + } + } + }, + "PLANSTATUSINVALID2" : { + "title" : "PLAN_STATUS_INVALID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "PLAN_STATUS_INVALID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Invalid plan status for subscription creation; plan status should be active." ] + } + } + }, + "Subscriptionscapture422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED10" + }, { + "$ref" : "#/components/schemas/SUBSCRIBERACCOUNTLOCKED" + }, { + "$ref" : "#/components/schemas/SUBSCRIBERACCOUNTCLOSED" + }, { + "$ref" : "#/components/schemas/SUBSCRIBERACCOUNTRESTRICTED" + }, { + "$ref" : "#/components/schemas/SUBSCRIPTIONSTATUSINVALID4" + }, { + "$ref" : "#/components/schemas/ZEROOUTSTANDINGBALANCE" + }, { + "$ref" : "#/components/schemas/CURRENCYMISMATCH5" + }, { + "$ref" : "#/components/schemas/AMOUNTGREATERTHANOUTSTANDINGBALANCE1" + } ] + }, + "PlansCreate400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Planscreate400Details" + } + } + } + }, + "PLANSTATUSINVALID1" : { + "title" : "PLAN_STATUS_INVALID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "PLAN_STATUS_INVALID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Invalid plan status for deactivate action; plan status should be active." ] + } + } + }, + "LiabilityShift" : { + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "Liability shift indicator. The outcome of the issuer's authentication", + "enum" : [ "YES", "NO", "POSSIBLE", "UNKNOWN" ] + }, + "AmountWithBreakdown" : { + "title" : "Amount with Breakdown", + "required" : [ "gross_amount" ], + "type" : "object", + "properties" : { + "shipping_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name" : "shippingAmount" + }, + "tax_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name" : "taxAmount" + }, + "fee_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name" : "feeAmount" + }, + "total_item_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name" : "totalItemAmount" + }, + "gross_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name" : "grossAmount" + }, + "net_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name" : "netAmount" + } + }, + "description" : "The breakdown details for the amount. Includes the gross, tax, fee, and shipping amounts" + }, + "SUBSCRIBERACCOUNTLOCKED" : { + "title" : "SUBSCRIBER_ACCOUNT_LOCKED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIBER_ACCOUNT_LOCKED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Subscriber Account Locked." ] + } + } + }, + "Money" : { + "title" : "Money", + "required" : [ "currency_code", "value" ], + "type" : "object", + "properties" : { + "value" : { + "maxLength" : 32, + "pattern" : "^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$", + "type" : "string", + "description" : "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](/docs/integration/direct/rest/currency-codes/)" + }, + "currency_code" : { + "allOf" : [ { + "$ref" : "#/components/schemas/CurrencyCode" + } ], + "x-ballerina-name" : "currencyCode" + } + }, + "description" : "The currency and amount for a financial transaction, such as a balance or payment due" + }, + "UnprocessableEntity" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/422Details" + } + } + } + }, + "LastPaymentDetails" : { + "title" : "Last Payment Details", + "required" : [ "amount", "time" ], + "type" : "object", + "description" : "The details for the last payment", + "allOf" : [ { + "$ref" : "#/components/schemas/LastPaymentDetailsAllOf1" + } ] + }, + "Language" : { + "maxLength" : 10, + "minLength" : 2, + "pattern" : "^[a-z]{2}(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}))?$", + "type" : "string", + "description" : "The [language tag](https://tools.ietf.org/html/bcp47#section-2) for the language in which to localize the error-related strings, such as messages, issues, and suggested actions. The tag is made up of the [ISO 639-2 language code](https://www.loc.gov/standards/iso639-2/php/code_list.php), the optional [ISO-15924 script tag](https://www.unicode.org/iso15924/codelists.html), and the [ISO-3166 alpha-2 country code](/docs/integration/direct/rest/country-codes/)", + "format" : "ppaas_common_language_v3" + }, + "SubscriptionActivateRequest" : { + "title" : "Activate Subscription Request", + "type" : "object", + "properties" : { + "reason" : { + "maxLength" : 128, + "minLength" : 1, + "type" : "string", + "description" : "The reason for activation of a subscription. Required to reactivate the subscription" + } + }, + "description" : "The activate subscription request details" + }, + "Subscriptionscapture400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/MISSINGREQUESTBODY3" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE9" + }, { + "$ref" : "#/components/schemas/INVALIDSTRINGMAXLENGTH7" + }, { + "$ref" : "#/components/schemas/MISSINGREQUIREDPARAMETER5" + } ] + }, + "Plansactivate422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED2" + }, { + "$ref" : "#/components/schemas/PLANSTATUSINVALID" + } ] + }, + "SubscriberRequestAllOf2" : { + "properties" : { + "shipping_address" : { + "$ref" : "#/components/schemas/ShippingDetail" + }, + "payment_source" : { + "$ref" : "#/components/schemas/PaymentSource" + } + } + }, + "SUBSCRIPTIONCANNOTBEACTIVATED2" : { + "title" : "SUBSCRIPTION_CANNOT_BE_ACTIVATED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIPTION_CANNOT_BE_ACTIVATED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "This subscription should be activated by the merchant." ] + } + } + }, + "PricingTier" : { + "title" : "Pricing Tier", + "required" : [ "amount", "starting_quantity" ], + "type" : "object", + "properties" : { + "starting_quantity" : { + "maxLength" : 32, + "minLength" : 1, + "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", + "type" : "string", + "description" : "The starting quantity for the tier", + "x-ballerina-name" : "startingQuantity" + }, + "amount" : { + "$ref" : "#/components/schemas/Money" + }, + "ending_quantity" : { + "maxLength" : 32, + "minLength" : 1, + "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", + "type" : "string", + "description" : "The ending quantity for the tier. Optional for the last tier", + "x-ballerina-name" : "endingQuantity" + } + }, + "description" : "The pricing tier details" + }, + "PayerBase" : { + "title" : "Payer Base", + "type" : "object", + "properties" : { + "email_address" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Email" + } ], + "x-ballerina-name" : "emailAddress" + }, + "payer_id" : { + "allOf" : [ { + "$ref" : "#/components/schemas/AccountId" + } ], + "x-ballerina-name" : "payerId" + } + }, + "description" : "The customer who approves and pays for the order. The customer is also known as the payer" + }, + "InlineResponse40010" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/SubscriptionsCapture400" + } ] + }, + "INVALIDSTRINGMINLENGTH1" : { + "title" : "INVALID_STRING_MIN_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MIN_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too short." ] + } + } + }, + "INVALIDPRICINGSCHEME" : { + "title" : "INVALID_PRICING_SCHEME", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_SCHEME" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The new pricing scheme should be of the same type as that of the old one." ] + } + } + }, + "InlineResponse40011" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/SubscriptionsTransactions400" + } ] + }, + "SUBSCRIPTIONCANNOTBEACTIVATED1" : { + "title" : "SUBSCRIPTION_CANNOT_BE_ACTIVATED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIPTION_CANNOT_BE_ACTIVATED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "This subscription should be activated by the system." ] + } + } + }, + "INVALIDBILLINGTOTALCYCLES" : { + "title" : "INVALID_BILLING_TOTAL_CYCLES", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_BILLING_TOTAL_CYCLES" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The total cycles cannot be less than the number of billing cycles completed." ] + } + } + }, + "SUBSCRIPTIONSTATUSINVALID" : { + "title" : "SUBSCRIPTION_STATUS_INVALID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIPTION_STATUS_INVALID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Invalid subscription status for patch action; subscription status should be either active or suspended." ] + } + } + }, + "PLANSTATUSINVALID" : { + "title" : "PLAN_STATUS_INVALID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "PLAN_STATUS_INVALID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Invalid plan status for activate action; plan status should be either created or inactive." ] + } + } + }, + "INVALIDPRICINGTIERQUANTITY4" : { + "title" : "INVALID_PRICING_TIER_QUANTITY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_QUANTITY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier starting quantity must be less than ending quantity." ] + } + } + }, + "PlanCollection" : { + "title" : "Plan Collection", + "type" : "object", + "properties" : { + "plans" : { + "maxItems" : 32767, + "minItems" : 0, + "type" : "array", + "description" : "An array of plans", + "items" : { + "$ref" : "#/components/schemas/Plan" + } + }, + "links" : { + "maxItems" : 10, + "minItems" : 1, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links)", + "readOnly" : true, + "items" : { + "$ref" : "#/components/schemas/LinkDescription" + } + }, + "total_pages" : { + "maximum" : 100000000, + "minimum" : 0, + "type" : "integer", + "description" : "The total number of pages", + "x-ballerina-name" : "totalPages" + }, + "total_items" : { + "maximum" : 500000000, + "minimum" : 0, + "type" : "integer", + "description" : "The total number of items", + "x-ballerina-name" : "totalItems" + } + }, + "description" : "The list of plans with details" + }, + "ParesStatus" : { + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "Transactions status result identifier. The outcome of the issuer's authentication", + "enum" : [ "Y", "N", "U", "A", "C", "R", "D", "I" ] + }, + "SubscriptionsPatch422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionspatch422Details" + } + } + } + }, + "INVALIDPRICINGTIERQUANTITY1" : { + "title" : "INVALID_PRICING_TIER_QUANTITY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_QUANTITY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier starting quantity must be less than ending quantity." ] + } + } + }, + "INVALIDPRICINGTIERQUANTITY2" : { + "title" : "INVALID_PRICING_TIER_QUANTITY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_QUANTITY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier starting quantity must be less than ending quantity." ] + } + } + }, + "FIXEDPRICENOTSUPPORTED" : { + "title" : "FIXED_PRICE_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "FIXED_PRICE_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Fixed price is not supported for tiered pricing schemes." ] + } + } + }, + "INVALIDPRICINGTIERQUANTITY3" : { + "title" : "INVALID_PRICING_TIER_QUANTITY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_QUANTITY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier starting quantity must be less than ending quantity." ] + } + } + }, + "Error503" : { + "title" : "Service Unavailable Error", + "type" : "object", + "properties" : { + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "SERVICE_UNAVAILABLE" ] + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "Service Unavailable." ] + } + }, + "description" : "The server is temporarily unable to handle the request, for example, because of planned maintenance or downtime", + "example" : { + "name" : "SERVICE_UNAVAILABLE", + "message" : "Service Unavailable.", + "debug_id" : "90957fca61718", + "information_link" : "https://developer.paypal.com/docs/api/orders/v2/#error-SERVICE_UNAVAILABLE" + } + }, + "INVALIDPARAMETERSYNTAX" : { + "title" : "INVALID_PARAMETER_SYNTAX", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_SYNTAX" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field does not conform to the expected format." ] + } + } + }, + "UNSUPPORTEDPATCHOPERATION1" : { + "title" : "UNSUPPORTED_PATCH_OPERATION", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "UNSUPPORTED_PATCH_OPERATION" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified patch operation not supported for this field." ] + } + } + }, + "PaymentSource" : { + "title" : "Payment Source", + "type" : "object", + "properties" : { + "card" : { + "$ref" : "#/components/schemas/Card" + } + }, + "description" : "The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (https://www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions" + }, + "CardBrand" : { + "title" : "Card Brand", + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The card network or brand. Applies to credit, debit, gift, and payment cards", + "enum" : [ "VISA", "MASTERCARD", "DISCOVER", "AMEX", "SOLO", "JCB", "STAR", "DELTA", "SWITCH", "MAESTRO", "CB_NATIONALE", "CONFIGOGA", "CONFIDIS", "ELECTRON", "CETELEM", "CHINA_UNION_PAY" ] + }, + "NotFound" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/404Details" + } + } + } + }, + "Forbidden" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/403Details" + } + } + } + }, + "DateTime" : { + "maxLength" : 64, + "minLength" : 20, + "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$", + "type" : "string", + "description" : "The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
", + "format" : "ppaas_date_time_v3" + }, + "Unauthorized" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/401Details" + } + } + } + }, + "BadRequest" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/400Details" + } + } + } + }, + "MISSINGPRICINGSCHEMETIERS4" : { + "title" : "MISSING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier(s) are missing for some quantities." ] + } + } + }, + "TaxInfo" : { + "title" : "Tax Information", + "required" : [ "tax_id", "tax_id_type" ], + "type" : "object", + "properties" : { + "tax_id_type" : { + "type" : "string", + "description" : "The customer's tax ID type", + "enum" : [ "BR_CPF", "BR_CNPJ" ], + "x-ballerina-name" : "taxIdType" + }, + "tax_id" : { + "maxLength" : 14, + "type" : "string", + "description" : "The customer's tax ID value", + "x-ballerina-name" : "taxId" + } + }, + "description" : "The tax ID of the customer. The customer is also known as the payer. Both `tax_id` and `tax_id_type` are required" + }, + "MISSINGPRICINGSCHEMETIERS1" : { + "title" : "MISSING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier(s) are missing for some quantities." ] + } + } + }, + "MISSINGPRICINGSCHEMETIERS3" : { + "title" : "MISSING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier(s) are missing for some quantities." ] + } + } + }, + "INVALIDPARAMETERSYNTAX5" : { + "title" : "INVALID_PARAMETER_SYNTAX", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_SYNTAX" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field does not conform to the expected format." ] + } + } + }, + "SubscriptionRequestPost" : { + "title" : "Create Subscription Request", + "required" : [ "plan_id" ], + "type" : "object", + "properties" : { + "shipping_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name" : "shippingAmount" + }, + "start_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name" : "startTime" + }, + "quantity" : { + "maxLength" : 32, + "minLength" : 1, + "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", + "type" : "string", + "description" : "The quantity of the product in the subscription" + }, + "subscriber" : { + "$ref" : "#/components/schemas/SubscriberRequest" + }, + "custom_id" : { + "maxLength" : 127, + "minLength" : 1, + "pattern" : "^[\\x20-\\x7E]+", + "type" : "string", + "description" : "The custom id for the subscription. Can be invoice id", + "x-ballerina-name" : "customId" + }, + "application_context" : { + "allOf" : [ { + "$ref" : "#/components/schemas/ApplicationContext" + } ], + "x-ballerina-name" : "applicationContext" + }, + "plan" : { + "$ref" : "#/components/schemas/PlanOverride" + }, + "plan_id" : { + "maxLength" : 50, + "minLength" : 3, + "type" : "string", + "description" : "The ID of the plan", + "x-ballerina-name" : "planId" + }, + "auto_renewal" : { + "type" : "boolean", + "description" : "DEPRECATED. Indicates whether the subscription auto-renews after the billing cycles complete", + "deprecated" : true, + "default" : false, + "x-ballerina-name" : "autoRenewal" + } + }, + "description" : "The create subscription request details" + }, + "MISSINGPRICINGSCHEMETIERS2" : { + "title" : "MISSING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier(s) are missing for some quantities." ] + } + } + }, + "Subscription" : { + "title" : "Subscription", + "type" : "object", + "description" : "The subscription details", + "allOf" : [ { + "$ref" : "#/components/schemas/SubscriptionStatus" + }, { + "$ref" : "#/components/schemas/SubscriptionAllOf2" + } ] + }, + "Error500" : { + "title" : "Internal Server Error", + "type" : "object", + "properties" : { + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "INTERNAL_SERVER_ERROR" ] + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "An internal server error occurred." ] + } + }, + "description" : "This is either a system or application error, and generally indicates that although the client appeared to provide a correct request, something unexpected has gone wrong on the server", + "example" : { + "name" : "INTERNAL_SERVER_ERROR", + "message" : "An internal server error occurred.", + "debug_id" : "90957fca61718", + "links" : [ { + "href" : "https://developer.paypal.com/api/orders/v2/#error-INTERNAL_SERVER_ERROR", + "rel" : "information_link" + } ] + } + }, + "Subscriptionsactivate400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDSTRINGMAXLENGTH6" + } ] + }, + "INVALIDINTEGERMINVALUE3" : { + "title" : "INVALID_INTEGER_MIN_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_INTEGER_MIN_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The integer value of a field is too small." ] + } + } + }, + "INVALIDINTEGERMINVALUE2" : { + "title" : "INVALID_INTEGER_MIN_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_INTEGER_MIN_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The integer value of a field is too small." ] + } + } + }, + "CURRENCYMISMATCH" : { + "title" : "CURRENCY_MISMATCH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "CURRENCY_MISMATCH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "All currency codes in the request should be of similar value." ] + } + } + }, + "INVALIDPARAMETERSYNTAX3" : { + "title" : "INVALID_PARAMETER_SYNTAX", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_SYNTAX" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field does not conform to the expected format." ] + } + } + }, + "INVALIDPARAMETERSYNTAX4" : { + "title" : "INVALID_PARAMETER_SYNTAX", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_SYNTAX" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field does not conform to the expected format." ] + } + } + }, + "INVALIDPARAMETERSYNTAX1" : { + "title" : "INVALID_PARAMETER_SYNTAX", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_SYNTAX" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field does not conform to the expected format." ] + } + } + }, + "INVALIDINTEGERMINVALUE1" : { + "title" : "INVALID_INTEGER_MIN_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_INTEGER_MIN_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The integer value of a field is too small." ] + } + } + }, + "INVALIDPARAMETERSYNTAX2" : { + "title" : "INVALID_PARAMETER_SYNTAX", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_SYNTAX" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field does not conform to the expected format." ] + } + } + }, + "INVALIDRESOURCEID" : { + "title" : "INVALID_RESOURCE_ID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_RESOURCE_ID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Specified resource ID does not exist. Please check the resource ID and try again." ] + } + } + }, + "FIXEDPRICENOTSUPPORTED4" : { + "title" : "FIXED_PRICE_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "FIXED_PRICE_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Fixed price is not supported for tiered pricing schemes." ] + } + } + }, + "PLANPRODUCTNOTCOMPATIBLE" : { + "title" : "PLAN_PRODUCT_NOT_COMPATIBLE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "PLAN_PRODUCT_NOT_COMPATIBLE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The old and the new plans should be for the same product." ] + } + } + }, + "FIXEDPRICENOTSUPPORTED2" : { + "title" : "FIXED_PRICE_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "FIXED_PRICE_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Fixed price is not supported for tiered pricing schemes." ] + } + } + }, + "FIXEDPRICENOTSUPPORTED3" : { + "title" : "FIXED_PRICE_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "FIXED_PRICE_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Fixed price is not supported for tiered pricing schemes." ] + } + } + }, + "EmailAddress" : { + "maxLength" : 254, + "minLength" : 3, + "pattern" : "^.+@[^\"\\-].+$", + "type" : "string", + "description" : "The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
", + "format" : "ppaas_common_email_address_v2" + }, + "FIXEDPRICENOTSUPPORTED1" : { + "title" : "FIXED_PRICE_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "FIXED_PRICE_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Fixed price is not supported for tiered pricing schemes." ] + } + } + }, + "Card" : { + "title" : "Card", + "required" : [ "expiry", "number" ], + "type" : "object", + "properties" : { + "number" : { + "maxLength" : 19, + "minLength" : 13, + "type" : "string", + "description" : "The primary account number (PAN) for the payment card" + }, + "security_code" : { + "pattern" : "[0-9]{3,4}", + "type" : "string", + "description" : "The three- or four-digit security code of the card. Also known as the CVV, CVC, CVN, CVE, or CID. This parameter cannot be present in the request when `payment_initiator=MERCHANT`", + "x-ballerina-name" : "securityCode" + }, + "name" : { + "maxLength" : 300, + "type" : "string", + "description" : "The card holder's name as it appears on the card" + }, + "billing_address" : { + "allOf" : [ { + "$ref" : "#/components/schemas/AddressPortable" + } ], + "x-ballerina-name" : "billingAddress" + }, + "id" : { + "type" : "string", + "description" : "The PayPal-generated ID for the card", + "readOnly" : true + }, + "expiry" : { + "$ref" : "#/components/schemas/DateYearMonth" + }, + "card_type" : { + "allOf" : [ { + "$ref" : "#/components/schemas/CardBrand" + } ], + "x-ballerina-name" : "cardType" + }, + "last_digits" : { + "pattern" : "[0-9]{2,}", + "type" : "string", + "description" : "The last digits of the payment card", + "readOnly" : true, + "x-ballerina-name" : "lastDigits" + } + }, + "description" : "The payment card to use to fund a payment. Can be a credit or debit card" + }, + "InlineResponse4001" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/PlansCreate400" + } ] + }, + "InlineResponse4003" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/PlansUpdatePricingSchemes400" + } ] + }, + "InlineResponse4002" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/PlansPatch400" + } ] + }, + "InlineResponse4005" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/SubscriptionsPatch400" + } ] + }, + "InlineResponse4004" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/SubscriptionsCreate400" + } ] + }, + "InlineResponse4007" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/SubscriptionsSuspend400" + } ] + }, + "SubscriptionsPatch400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionspatch400Details" + } + } + } + }, + "InlineResponse4006" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/SubscriptionsRevise400" + } ] + }, + "InlineResponse4009" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/SubscriptionsActivate400" + } ] + }, + "InlineResponse4008" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/SubscriptionsCancel400" + } ] + }, + "Error404" : { + "title" : "Not found Error", + "type" : "object", + "properties" : { + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "RESOURCE_NOT_FOUND" ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "The specified resource does not exist." ] + } + }, + "description" : "The server has not found anything matching the request URI. This either means that the URI is incorrect or the resource is not available" + }, + "MISSINGREQUIREDPARAMETER5" : { + "title" : "MISSING_REQUIRED_PARAMETER", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + }, + "description" : { + "type" : "string", + "enum" : [ "A required field is missing." ] + } + } + }, + "Error409" : { + "title" : "Resource Conflict Error", + "type" : "object", + "properties" : { + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "RESOURCE_CONFLICT" ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "The server has detected a conflict while processing this request." ] + } + }, + "description" : "The server has detected a conflict while processing this request" + }, + "AMOUNTGREATERTHANOUTSTANDINGBALANCE" : { + "title" : "AMOUNT_GREATER_THAN_OUTSTANDING_BALANCE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "AMOUNT_GREATER_THAN_OUTSTANDING_BALANCE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The new outstanding balance cannot be greater than the current outstanding balance." ] + } + } + }, + "MISSINGREQUIREDPARAMETER4" : { + "title" : "MISSING_REQUIRED_PARAMETER", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + }, + "description" : { + "type" : "string", + "enum" : [ "A required field is missing." ] + } + } + }, + "Subscriptionsrevise422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED6" + }, { + "$ref" : "#/components/schemas/PLANPRODUCTNOTCOMPATIBLE" + }, { + "$ref" : "#/components/schemas/INVALIDBILLINGCYCLESEQUENCE4" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGSCHEME2" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERAMOUNT4" + }, { + "$ref" : "#/components/schemas/MISSINGPRICINGSCHEMETIERS4" + }, { + "$ref" : "#/components/schemas/OVERLAPPINGPRICINGSCHEMETIERS4" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGMODEL4" + }, { + "$ref" : "#/components/schemas/FIXEDPRICENOTSUPPORTED4" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERQUANTITY4" + }, { + "$ref" : "#/components/schemas/CURRENCYMISMATCH4" + } ] + }, + "SubscriptionsCancel400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscancel400Details" + } + } + } + }, + "MISSINGREQUIREDPARAMETER6" : { + "title" : "MISSING_REQUIRED_PARAMETER", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + }, + "description" : { + "type" : "string", + "enum" : [ "A required field is missing." ] + } + } + }, + "INVALIDMETADATACUSTOMNOTE" : { + "title" : "INVALID_METADATA_CUSTOM_NOTE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_METADATA_CUSTOM_NOTE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Merchant custom note cannot exceed 255 characters." ] + } + } + }, + "MISSINGREQUIREDPARAMETER1" : { + "title" : "MISSING_REQUIRED_PARAMETER", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + }, + "description" : { + "type" : "string", + "enum" : [ "A required field is missing." ] + } + } + }, + "MISSINGREQUIREDPARAMETER3" : { + "title" : "MISSING_REQUIRED_PARAMETER", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + }, + "description" : { + "type" : "string", + "enum" : [ "A required field is missing." ] + } + } + }, + "MISSINGREQUIREDPARAMETER2" : { + "title" : "MISSING_REQUIRED_PARAMETER", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + }, + "description" : { + "type" : "string", + "enum" : [ "A required field is missing." ] + } + } + }, + "Error400" : { + "title" : "Bad Request Error", + "type" : "object", + "properties" : { + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "INVALID_REQUEST" ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "Request is not well-formed, syntactically incorrect, or violates schema." ] + } + }, + "description" : "Request is not well-formed, syntactically incorrect, or violates schema" + }, + "Error401" : { + "title" : "Unauthorized Error", + "type" : "object", + "properties" : { + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "AUTHENTICATION_FAILURE" ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "Authentication failed due to missing authorization header, or invalid authentication credentials." ] + } + }, + "description" : "Authentication failed due to missing Authorization header, or invalid authentication credentials" + }, + "Error403" : { + "title" : "Not Authorized Error", + "type" : "object", + "properties" : { + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "NOT_AUTHORIZED" ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "Authorization failed due to insufficient permissions." ] + } + }, + "description" : "The client is not authorized to access this resource, although it may have valid credentials. " + }, + "Error415" : { + "title" : "Unsupported Media Type Error", + "type" : "object", + "properties" : { + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "UNSUPPORTED_MEDIA_TYPE" ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "The server does not support the request payload's media type." ] + } + }, + "description" : "The server does not support the request payload's media type" + }, + "PLANSTATUSINACTIVE" : { + "title" : "PLAN_STATUS_INACTIVE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "PLAN_STATUS_INACTIVE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Status update is the only patchable filed on an inactive plan." ] + } + } + }, + "Percentage" : { + "pattern" : "^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$", + "type" : "string", + "description" : "The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99`", + "format" : "ppaas_common_percentage_v2" + }, + "Planspatch400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/UNSUPPORTEDPATCHOPERATION" + }, { + "$ref" : "#/components/schemas/INVALIDPATCHPATH" + }, { + "$ref" : "#/components/schemas/INVALIDPATCHPATH1" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERSYNTAX1" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE2" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE3" + } ] + }, + "Plan" : { + "title" : "Plan", + "type" : "object", + "properties" : { + "quantity_supported" : { + "type" : "boolean", + "description" : "Indicates whether you can subscribe to this plan by providing a quantity for the goods or service", + "default" : false, + "x-ballerina-name" : "quantitySupported" + }, + "update_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name" : "updateTime" + }, + "create_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name" : "createTime" + }, + "payment_preferences" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PaymentPreferences" + } ], + "x-ballerina-name" : "paymentPreferences" + }, + "product_id" : { + "maxLength" : 50, + "minLength" : 6, + "type" : "string", + "description" : "The ID for the product", + "x-ballerina-name" : "productId" + }, + "name" : { + "maxLength" : 127, + "minLength" : 1, + "type" : "string", + "description" : "The plan name" + }, + "billing_cycles" : { + "maxItems" : 12, + "minItems" : 1, + "type" : "array", + "description" : "An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle", + "items" : { + "$ref" : "#/components/schemas/BillingCycle" + }, + "x-ballerina-name" : "billingCycles" + }, + "description" : { + "maxLength" : 127, + "minLength" : 1, + "type" : "string", + "description" : "The detailed description of the plan" + }, + "taxes" : { + "$ref" : "#/components/schemas/Taxes" + }, + "links" : { + "maxItems" : 10, + "minItems" : 1, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links)", + "readOnly" : true, + "items" : { + "$ref" : "#/components/schemas/LinkDescription" + } + }, + "id" : { + "maxLength" : 50, + "minLength" : 3, + "type" : "string", + "description" : "The unique PayPal-generated ID for the plan", + "readOnly" : true + }, + "status" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The plan status", + "enum" : [ "CREATED", "INACTIVE", "ACTIVE" ] + } + }, + "description" : "The plan details" + }, + "AuthenticationResponse" : { + "title" : "Authentication Response", + "type" : "object", + "properties" : { + "liability_shift" : { + "allOf" : [ { + "$ref" : "#/components/schemas/LiabilityShift" + } ], + "x-ballerina-name" : "liabilityShift" + }, + "three_d_secure" : { + "allOf" : [ { + "$ref" : "#/components/schemas/ThreeDSecureAuthenticationResponse" + } ], + "x-ballerina-name" : "threeDSecure" + } + }, + "description" : "Results of Authentication such as 3D Secure" + }, + "USERACCOUNTCLOSED7" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "USERACCOUNTCLOSED6" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "SUBSCRIPTIONSTATUSINVALID4" : { + "title" : "SUBSCRIPTION_STATUS_INVALID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIPTION_STATUS_INVALID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Invalid subscription status for capture action; subscription status should be active or suspended or expired." ] + } + } + }, + "USERACCOUNTCLOSED9" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "USERACCOUNTCLOSED8" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "SUBSCRIPTIONSTATUSINVALID1" : { + "title" : "SUBSCRIPTION_STATUS_INVALID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIPTION_STATUS_INVALID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Invalid subscription status for suspend action; subscription status should be active." ] + } + } + }, + "SUBSCRIPTIONSTATUSINVALID3" : { + "title" : "SUBSCRIPTION_STATUS_INVALID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIPTION_STATUS_INVALID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Invalid subscription status for activate action; subscription status should be suspended." ] + } + } + }, + "SUBSCRIPTIONSTATUSINVALID2" : { + "title" : "SUBSCRIPTION_STATUS_INVALID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIPTION_STATUS_INVALID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Invalid subscription status for cancel action; subscription status should be active or suspended." ] + } + } + }, + "USERACCOUNTCLOSED1" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "ZEROOUTSTANDINGBALANCE" : { + "title" : "ZERO_OUTSTANDING_BALANCE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "ZERO_OUTSTANDING_BALANCE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Current outstanding balance should be greater than zero." ] + } + } + }, + "USERACCOUNTCLOSED3" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "USERACCOUNTCLOSED2" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "3DSCARDSNOTSUPPORTED1" : { + "title" : "3DS_CARDS_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "3DS_CARDS_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Cards that require 3DS authentication not supported." ] + } + } + }, + "USERACCOUNTCLOSED" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "USERACCOUNTCLOSED5" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "USERACCOUNTCLOSED4" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "SubscriptionReviseResponse" : { + "title" : "Update Product Quantity in Subscription Response", + "type" : "object", + "description" : "The response to a request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent", + "allOf" : [ { + "$ref" : "#/components/schemas/SubscriptionReviseRequest" + }, { + "$ref" : "#/components/schemas/SubscriptionReviseResponseAllOf2" + } ] + }, + "SubscriptionsCancel422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscancel422Details" + } + } + } + }, + "InlineResponse422" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/UnprocessableEntity" + } ] + }, + "INVALIDPATCHPATH1" : { + "title" : "INVALID_PATCH_PATH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PATCH_PATH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Multiple operations on the same field are not allowed." ] + } + } + }, + "INVALIDPATCHPATH2" : { + "title" : "INVALID_PATCH_PATH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PATCH_PATH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified field cannot be patched." ] + } + } + }, + "INVALIDPATCHPATH3" : { + "title" : "INVALID_PATCH_PATH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PATCH_PATH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Multiple operations on the same field are not allowed." ] + } + } + }, + "SubscriptionsCapture400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscapture400Details" + } + } + } + }, + "TransactionAllOf2" : { + "properties" : { + "id" : { + "maxLength" : 50, + "minLength" : 3, + "type" : "string", + "description" : "The PayPal-generated transaction ID.", + "readOnly" : true + }, + "amount_with_breakdown" : { + "$ref" : "#/components/schemas/AmountWithBreakdown" + }, + "payer_name" : { + "$ref" : "#/components/schemas/Name" + }, + "payer_email" : { + "$ref" : "#/components/schemas/EmailAddress" + }, + "time" : { + "$ref" : "#/components/schemas/DateTime" + } + } + }, + "OVERLAPPINGPRICINGSCHEMETIERS" : { + "title" : "OVERLAPPING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "OVERLAPPING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified quantity overlaps with multiple pricing tiers." ] + } + } + }, + "3DSCARDSNOTSUPPORTED" : { + "title" : "3DS_CARDS_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "3DS_CARDS_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Cards that require 3DS authentication not supported." ] + } + } + }, + "CaptureStatusDetails" : { + "title" : "Capture Status Details", + "type" : "object", + "properties" : { + "reason" : { + "type" : "string", + "description" : "The reason why the captured payment status is `PENDING` or `DENIED`", + "enum" : [ "BUYER_COMPLAINT", "CHARGEBACK", "ECHECK", "INTERNATIONAL_WITHDRAWAL", "OTHER", "PENDING_REVIEW", "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION", "REFUNDED", "TRANSACTION_APPROVED_AWAITING_FUNDING", "UNILATERAL", "VERIFICATION_REQUIRED" ] + } + }, + "description" : "The details of the captured payment status" + }, + "ErrorDefault" : { + "description" : "The default error response", + "oneOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/Error401" + }, { + "$ref" : "#/components/schemas/Error403" + }, { + "$ref" : "#/components/schemas/Error404" + }, { + "$ref" : "#/components/schemas/Error409" + }, { + "$ref" : "#/components/schemas/Error415" + }, { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/Error500" + }, { + "$ref" : "#/components/schemas/Error503" + } ] + }, + "MISSINGPRICINGSCHEMETIERS" : { + "title" : "MISSING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier(s) are missing for some quantities." ] + } + } + }, + "DateYearMonth" : { + "maxLength" : 7, + "minLength" : 7, + "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])$", + "type" : "string", + "description" : "The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6)" + }, + "Error422" : { + "title" : "Unprocessable Entity Error", + "type" : "object", + "properties" : { + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "UNPROCESSABLE_ENTITY" ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "The requested action could not be performed, semantically incorrect, or failed business validation." ] + } + }, + "description" : "The requested action cannot be performed and may require interaction with APIs or processes outside of the current request. This is distinct from a 500 response in that there are no systemic problems limiting the API from performing the request" + }, + "MISSINGREQUESTBODY" : { + "title" : "MISSING_REQUEST_BODY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUEST_BODY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Request body is missing." ] + } + } + }, + "Subscriptionspatch422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED5" + }, { + "$ref" : "#/components/schemas/SUBSCRIPTIONSTATUSINVALID" + }, { + "$ref" : "#/components/schemas/CARDSUBSCRIPTIONSNOTENABLED1" + }, { + "$ref" : "#/components/schemas/3DSCARDSNOTSUPPORTED1" + }, { + "$ref" : "#/components/schemas/BILLINGCYCLEEXECUTIONCOMPLETED" + }, { + "$ref" : "#/components/schemas/AMOUNTGREATERTHANOUTSTANDINGBALANCE" + }, { + "$ref" : "#/components/schemas/INVALIDBILLINGTOTALCYCLES" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERAMOUNT3" + }, { + "$ref" : "#/components/schemas/MISSINGPRICINGSCHEMETIERS3" + }, { + "$ref" : "#/components/schemas/OVERLAPPINGPRICINGSCHEMETIERS3" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGMODEL3" + }, { + "$ref" : "#/components/schemas/FIXEDPRICENOTSUPPORTED3" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERQUANTITY3" + }, { + "$ref" : "#/components/schemas/INVALIDSTARTTIME" + }, { + "$ref" : "#/components/schemas/CURRENCYMISMATCH3" + } ] + }, + "Payer" : { + "title" : "Customer", + "type" : "object", + "description" : "The customer who approves and pays for the order. The customer is also known as the payer", + "format" : "payer_v1", + "allOf" : [ { + "$ref" : "#/components/schemas/PayerBase" + }, { + "$ref" : "#/components/schemas/PayerAllOf2" + } ] + }, + "PlansActivate422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Plansactivate422Details" + } + } + } + }, + "USERACCOUNTCLOSED10" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "INVALIDSTRINGMAXLENGTH1" : { + "title" : "INVALID_STRING_MAX_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MAX_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too long." ] + } + } + }, + "PlansDeactivate422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Plansdeactivate422Details" + } + } + } + }, + "Subscriptionscreate400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDPARAMETERSYNTAX2" + }, { + "$ref" : "#/components/schemas/INVALIDSTRINGMAXLENGTH1" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE5" + }, { + "$ref" : "#/components/schemas/INVALIDINTEGERMINVALUE1" + }, { + "$ref" : "#/components/schemas/INVALIDINTEGERMAXVALUE1" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE6" + }, { + "$ref" : "#/components/schemas/MISSINGREQUESTBODY" + }, { + "$ref" : "#/components/schemas/MISSINGREQUIREDPARAMETER2" + }, { + "$ref" : "#/components/schemas/INVALIDSTRINGMAXLENGTH2" + } ] + }, + "PlansUpdatePricingSchemes400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PlansupdatePricingSchemes400Details" + } + } + } + }, + "SUBSCRIPTIONCANNOTBEACTIVATED" : { + "title" : "SUBSCRIPTION_CANNOT_BE_ACTIVATED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIPTION_CANNOT_BE_ACTIVATED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Subscription cannot be activated after payment failure threshold has reached." ] + } + } + }, + "SubscriptionSuspendRequest" : { + "title" : "Suspend Subscription", + "required" : [ "reason" ], + "type" : "object", + "properties" : { + "reason" : { + "maxLength" : 128, + "minLength" : 1, + "type" : "string", + "description" : "The reason for suspenson of the subscription" + } + }, + "description" : "The suspend subscription request details" + }, + "AddressPortable" : { + "title" : "Portable Postal Address (Medium-Grained)", + "required" : [ "country_code" ], + "type" : "object", + "properties" : { + "country_code" : { + "allOf" : [ { + "$ref" : "#/components/schemas/CountryCode" + } ], + "x-ballerina-name" : "countryCode" + }, + "admin_area_1" : { + "maxLength" : 300, + "type" : "string", + "description" : "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`. Value, by country, is:
  • UK. A county.
  • US. A state.
  • Canada. A province.
  • Japan. A prefecture.
  • Switzerland. A kanton.
", + "x-ballerina-name" : "adminArea1" + }, + "address_line_1" : { + "maxLength" : 300, + "type" : "string", + "description" : "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", + "x-ballerina-name" : "addressLine1" + }, + "admin_area_3" : { + "maxLength" : 100, + "type" : "string", + "description" : "A sub-locality, suburb, neighborhood, or district. Smaller than `admin_area_level_2`. Value is:
  • Brazil. Suburb, bairro, or neighborhood.
  • India. Sub-locality or district. Street name information is not always available but a sub-locality or district can be a very small area.
", + "x-ballerina-name" : "adminArea3" + }, + "address_details" : { + "allOf" : [ { + "$ref" : "#/components/schemas/AddressDetails" + } ], + "x-ballerina-name" : "addressDetails" + }, + "admin_area_2" : { + "maxLength" : 120, + "type" : "string", + "description" : "A city, town, or village. Smaller than `admin_area_level_1`", + "x-ballerina-name" : "adminArea2" + }, + "address_line_3" : { + "maxLength" : 100, + "type" : "string", + "description" : "The third line of the address, if needed. For example, a street complement for Brazil, direction text, such as `next to Walmart`, or a landmark in an Indian address", + "x-ballerina-name" : "addressLine3" + }, + "address_line_2" : { + "maxLength" : 300, + "type" : "string", + "description" : "The second line of the address. For example, suite or apartment number", + "x-ballerina-name" : "addressLine2" + }, + "admin_area_4" : { + "maxLength" : 100, + "type" : "string", + "description" : "The neighborhood, ward, or district. Smaller than `admin_area_level_3` or `sub_locality`. Value is:
  • The postal sorting code for Guernsey and many French territories, such as French Guiana.
  • The fine-grained administrative levels in China.
", + "x-ballerina-name" : "adminArea4" + }, + "postal_code" : { + "maxLength" : 60, + "type" : "string", + "description" : "The postal code, which is the zip code or equivalent. Typically required for countries with a postal code or an equivalent. See [postal code](https://en.wikipedia.org/wiki/Postal_code)", + "x-ballerina-name" : "postalCode" + } + }, + "description" : "The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute)" + }, + "INVALIDPRICINGMODEL" : { + "title" : "INVALID_PRICING_MODEL", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_MODEL" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified pricing model is not supported for trial billing cycle." ] + } + } + }, + "INVALIDPARAMETERVALUE" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is invalid." ] + } + } + }, + "SubscriptionsSuspend422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionssuspend422Details" + } + } + } + }, + "SubscriptionsRevise404" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionsrevise404Details" + } + } + } + }, + "SubscriptionsActivate400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionsactivate400Details" + } + } + } + }, + "PhoneType" : { + "title" : "Phone Type", + "type" : "string", + "description" : "The phone type", + "enum" : [ "FAX", "HOME", "MOBILE", "OTHER", "PAGER" ] + }, + "Taxes" : { + "title" : "Taxes", + "required" : [ "percentage" ], + "type" : "object", + "properties" : { + "inclusive" : { + "type" : "boolean", + "description" : "Indicates whether the tax was already included in the billing amount", + "default" : true + }, + "percentage" : { + "$ref" : "#/components/schemas/Percentage" + } + }, + "description" : "The tax details" + }, + "Transaction" : { + "title" : "Transaction Details", + "required" : [ "amount_with_breakdown", "id", "time" ], + "type" : "object", + "description" : "The transaction details", + "allOf" : [ { + "$ref" : "#/components/schemas/CaptureStatus" + }, { + "$ref" : "#/components/schemas/TransactionAllOf2" + } ] + }, + "INVALIDSTRINGMAXLENGTH7" : { + "title" : "INVALID_STRING_MAX_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MAX_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too long." ] + } + } + }, + "PaymentMethod" : { + "title" : "Payment Method", + "type" : "object", + "properties" : { + "payer_selected" : { + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "The customer-selected payment method on the merchant site", + "default" : "PAYPAL", + "x-ballerina-name" : "payerSelected" + }, + "payee_preferred" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PayeePaymentMethodPreference" + } ], + "x-ballerina-name" : "payeePreferred" + }, + "standard_entry_class_code" : { + "maxLength" : 255, + "minLength" : 3, + "type" : "string", + "description" : "NACHA (the regulatory body governing the ACH network) requires that API callers (merchants, partners) obtain the consumer’s explicit authorization before initiating a transaction. To stay compliant, you’ll need to make sure that you retain a compliant authorization for each transaction that you originate to the ACH Network using this API. ACH transactions are categorized (using SEC codes) by how you capture authorization from the Receiver (the person whose bank account is being debited or credited). PayPal supports the following SEC codes", + "default" : "WEB", + "enum" : [ "TEL", "WEB", "CCD", "PPD" ], + "x-ballerina-name" : "standardEntryClassCode" + } + }, + "description" : "The customer and merchant payment preferences" + }, + "INVALIDSTRINGMAXLENGTH6" : { + "title" : "INVALID_STRING_MAX_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MAX_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too long." ] + } + } + }, + "INVALIDSTRINGMAXLENGTH3" : { + "title" : "INVALID_STRING_MAX_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MAX_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too long." ] + } + } + }, + "INVALIDSTRINGMAXLENGTH2" : { + "title" : "INVALID_STRING_MAX_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MAX_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too long." ] + } + } + }, + "SubscriptionsRevise400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionsrevise400Details" + } + } + } + }, + "INVALIDSTRINGMAXLENGTH5" : { + "title" : "INVALID_STRING_MAX_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MAX_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too long." ] + } + } + }, + "INVALIDSTRINGMAXLENGTH4" : { + "title" : "INVALID_STRING_MAX_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MAX_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too long." ] + } + } + }, + "PERMISSIONDENIED" : { + "title" : "PERMISSION_DENIED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "PERMISSION_DENIED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "You do not have permission to access or perform operations on this resource." ] + } + } + }, + "INVALIDPRICINGSCHEME1" : { + "title" : "INVALID_PRICING_SCHEME", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_SCHEME" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The override plan pricing scheme should be of the same type as that of the original plan." ] + } + } + }, + "ErrorLinkDescription" : { + "title" : "Link Description", + "required" : [ "href", "rel" ], + "type" : "object", + "properties" : { + "method" : { + "maxLength" : 6, + "minLength" : 3, + "pattern" : "^[A-Z]*$", + "type" : "string", + "description" : "The HTTP method required to make the related call", + "enum" : [ "GET", "POST", "PUT", "DELETE", "PATCH" ] + }, + "rel" : { + "maxLength" : 100, + "minLength" : 0, + "pattern" : "^.*$", + "type" : "string", + "description" : "The [link relation type](https://tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](https://www.iana.org/assignments/link-relations/link-relations.xhtml)" + }, + "href" : { + "maxLength" : 20000, + "minLength" : 0, + "pattern" : "^.*$", + "type" : "string", + "description" : "The complete target URL. To make the related call, combine the method with this [URI Template-formatted](https://tools.ietf.org/html/rfc6570) link. For pre-processing, include the `$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call" + } + }, + "description" : "The request-related [HATEOAS link](/api/rest/responses/#hateoas-links) information" + }, + "OVERLAPPINGPRICINGSCHEMETIERS3" : { + "title" : "OVERLAPPING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "OVERLAPPING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified quantity overlaps with multiple pricing tiers." ] + } + } + }, + "INVALIDPRICINGSCHEME2" : { + "title" : "INVALID_PRICING_SCHEME", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_SCHEME" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The override plan pricing scheme should be of the same type as that of the original plan." ] + } + } + }, + "OVERLAPPINGPRICINGSCHEMETIERS4" : { + "title" : "OVERLAPPING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "OVERLAPPING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified quantity overlaps with multiple pricing tiers." ] + } + } + }, + "OVERLAPPINGPRICINGSCHEMETIERS1" : { + "title" : "OVERLAPPING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "OVERLAPPING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified quantity overlaps with multiple pricing tiers." ] + } + } + }, + "OVERLAPPINGPRICINGSCHEMETIERS2" : { + "title" : "OVERLAPPING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "OVERLAPPING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified quantity overlaps with multiple pricing tiers." ] + } + } + }, + "Plansdeactivate422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED3" + }, { + "$ref" : "#/components/schemas/PLANSTATUSINVALID1" + } ] + }, + "SubscriptionsCapture422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscapture422Details" + } + } + } + }, + "TaxesOverride" : { + "title" : "Taxes Override", + "type" : "object", + "properties" : { + "inclusive" : { + "type" : "boolean", + "description" : "Indicates whether the tax was already included in the billing amount" + }, + "percentage" : { + "$ref" : "#/components/schemas/Percentage" + } + }, + "description" : "The tax details" + }, + "INVALIDPARAMETERVALUE2" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is invalid." ] + } + } + }, + "INVALIDPARAMETERVALUE1" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is invalid." ] + } + } + }, + "INVALIDBILLINGCYCLESEQUENCE" : { + "title" : "INVALID_BILLING_CYCLE_SEQUENCE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_BILLING_CYCLE_SEQUENCE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Billing cycle sequence should start with `1` and be consecutive." ] + } + } + }, + "INVALIDPARAMETERVALUE6" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Start time must be a valid future date and time." ] + } + } + }, + "INVALIDPARAMETERVALUE5" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is invalid." ] + } + } + }, + "Phone" : { + "title" : "Phone", + "required" : [ "country_code", "national_number" ], + "type" : "object", + "properties" : { + "country_code" : { + "maxLength" : 3, + "minLength" : 1, + "pattern" : "^[0-9]{1,3}?$", + "type" : "string", + "description" : "The country calling code (CC), in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the CC and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN)", + "x-ballerina-name" : "countryCode" + }, + "extension_number" : { + "maxLength" : 15, + "minLength" : 1, + "pattern" : "^[0-9]{1,15}?$", + "type" : "string", + "description" : "The extension number", + "x-ballerina-name" : "extensionNumber" + }, + "national_number" : { + "maxLength" : 14, + "minLength" : 1, + "pattern" : "^[0-9]{1,14}?$", + "type" : "string", + "description" : "The national number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the country calling code (CC) and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN)", + "x-ballerina-name" : "nationalNumber" + } + }, + "description" : "The phone number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en)" + }, + "INVALIDPARAMETERVALUE4" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is invalid." ] + } + } + }, + "INVALIDPARAMETERVALUE3" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The field is not eligible for '$value' patch operation." ] + } + } + }, + "INVALIDPARAMETERVALUE9" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is invalid." ] + } + } + }, + "INVALIDPARAMETERVALUE8" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is invalid." ] + } + } + }, + "INVALIDPARAMETERVALUE7" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is invalid." ] + } + } + }, + "CountryCode" : { + "maxLength" : 2, + "minLength" : 2, + "pattern" : "^([A-Z]{2}|C2)$", + "type" : "string", + "description" : "The [two-character ISO 3166-1 code](/docs/integration/direct/rest/country-codes/) that identifies the country or region.
Note: The country code for Great Britain is GB and not UK as used in the top-level domain names for that country. Use the `C2` country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border transactions.
", + "format" : "ppaas_common_country_code_v2" + }, + "UNSUPPORTEDPATCHOPERATION" : { + "title" : "UNSUPPORTED_PATCH_OPERATION", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "UNSUPPORTED_PATCH_OPERATION" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified patch operation not supported for this field." ] + } + } + }, + "INVALIDPRICINGMODEL2" : { + "title" : "INVALID_PRICING_MODEL", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_MODEL" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified pricing model is not supported for trial billing cycle." ] + } + } + }, + "INVALIDPRICINGMODEL3" : { + "title" : "INVALID_PRICING_MODEL", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_MODEL" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified pricing model is not supported for trial billing cycle." ] + } + } + }, + "INVALIDPRICINGMODEL4" : { + "title" : "INVALID_PRICING_MODEL", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_MODEL" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified pricing model is not supported for trial billing cycle." ] + } + } + }, + "MORETHANTWOTRIALBILLINGCYCLENOTSUPPORTED" : { + "title" : "MORE_THAN_TWO_TRIAL_BILLING_CYCLE_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MORE_THAN_TWO_TRIAL_BILLING_CYCLE_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Only two trial billing cycles are allowed." ] + } + } + }, + "INVALIDPRICINGMODEL1" : { + "title" : "INVALID_PRICING_MODEL", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_MODEL" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified pricing model is not supported for trial billing cycle." ] + } + } + }, + "SubscriptionCaptureRequest" : { + "title" : "Charge Amount from Subscriber", + "required" : [ "amount", "capture_type", "note" ], + "type" : "object", + "properties" : { + "note" : { + "maxLength" : 128, + "minLength" : 1, + "type" : "string", + "description" : "The reason or note for the subscription charge" + }, + "amount" : { + "$ref" : "#/components/schemas/Money" + }, + "capture_type" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The type of capture", + "enum" : [ "OUTSTANDING_BALANCE" ], + "x-ballerina-name" : "captureType" + } + }, + "description" : "The charge amount from the subscriber" + }, + "CardResponseWithBillingAddressAllOf2" : { + "properties" : { + "name" : { + "maxLength" : 300, + "minLength" : 2, + "type" : "string", + "description" : "The card holder's name as it appears on the card." + }, + "billing_address" : { + "$ref" : "#/components/schemas/AddressPortable" + }, + "expiry" : { + "$ref" : "#/components/schemas/DateYearMonth" + }, + "currency_code" : { + "$ref" : "#/components/schemas/CurrencyCode" + } + } + }, + "SUBSCRIBERACCOUNTCLOSED" : { + "title" : "SUBSCRIBER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIBER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Subscriber Account Closed." ] + } + } + }, + "SubscriptionsActivate422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionsactivate422Details" + } + } + } + }, + "INVALIDSTARTTIME" : { + "title" : "INVALID_START_TIME", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_START_TIME" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The start time cannot be updated for a subscription that has been activated." ] + } + } + }, + "SubscriptionStatus" : { + "title" : "Subscription Status", + "type" : "object", + "properties" : { + "status_change_note" : { + "maxLength" : 128, + "minLength" : 1, + "type" : "string", + "description" : "The reason or notes for the status of the subscription", + "x-ballerina-name" : "statusChangeNote" + }, + "status" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The status of the subscription", + "enum" : [ "APPROVAL_PENDING", "APPROVED", "ACTIVE", "SUSPENDED", "CANCELLED", "EXPIRED" ] + }, + "status_update_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name" : "statusUpdateTime" + } + }, + "description" : "The subscription status details" + }, + "InlineResponse4221" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/PlansPatch422" + } ] + }, + "INVALIDSTRINGMINLENGTH" : { + "title" : "INVALID_STRING_MIN_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MIN_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too short." ] + } + } + }, + "InlineResponse4224" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/PlansUpdatePricingSchemes422" + } ] + }, + "InlineResponse4225" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/SubscriptionsCreate422" + } ] + }, + "InlineResponse4222" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/PlansActivate422" + } ] + }, + "InlineResponse4223" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/PlansDeactivate422" + } ] + }, + "InlineResponse4228" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/SubscriptionsSuspend422" + } ] + }, + "SubscriptionsRevise422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionsrevise422Details" + } + } + } + }, + "InlineResponse4229" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/SubscriptionsCancel422" + } ] + }, + "InlineResponse4226" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/SubscriptionsPatch422" + } ] + }, + "InlineResponse4227" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/SubscriptionsRevise422" + } ] + } + }, + "responses" : { + "default" : { + "description" : "The default response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorDefault" + } + } + } + } + }, + "parameters" : { + "prefer" : { + "name" : "Prefer", + "in" : "header", + "description" : "The preferred server response upon successful completion of the request. Value is:
  • return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links.
  • return=representation. The server returns a complete resource representation, including the current state of the resource.
", + "required" : false, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string", + "default" : "return=minimal" + }, + "x-ballerina-name" : "prefer" + }, + "paypal_request_id" : { + "name" : "PayPal-Request-Id", + "in" : "header", + "description" : "The server stores keys for 72 hours", + "required" : false, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + }, + "x-ballerina-name" : "payPalRequestId" + }, + "product_id" : { + "name" : "product_id", + "in" : "query", + "description" : "Filters the response by a Product ID", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "maxLength" : 50, + "minLength" : 6, + "type" : "string" + }, + "x-ballerina-name" : "productId" + }, + "plan_ids" : { + "name" : "plan_ids", + "in" : "query", + "description" : "Filters the response by list of plan IDs. Filter supports upto 10 plan IDs", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "maximum" : 270, + "minimum" : 3, + "type" : "string" + }, + "x-ballerina-name" : "planIds" + }, + "page_size" : { + "name" : "page_size", + "in" : "query", + "description" : "The number of items to return in the response", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "maximum" : 20, + "minimum" : 1, + "type" : "integer", + "default" : 10 + }, + "x-ballerina-name" : "pageSize" + }, + "page" : { + "name" : "page", + "in" : "query", + "description" : "A non-zero integer which is the start index of the entire list of items to return in the response. The combination of `page=1` and `page_size=20` returns the first 20 items. The combination of `page=2` and `page_size=20` returns the next 20 items", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "maximum" : 100000, + "minimum" : 1, + "type" : "integer", + "default" : 1 + } + }, + "total_required" : { + "name" : "total_required", + "in" : "query", + "description" : "Indicates whether to show the total count in the response", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "boolean", + "default" : false + }, + "x-ballerina-name" : "totalRequired" + }, + "id" : { + "name" : "id", + "in" : "path", + "description" : "The ID of the subscription", + "required" : true, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + } + }, + "fields" : { + "name" : "fields", + "in" : "query", + "description" : "List of fields that are to be returned in the response. Possible value for fields are last_failed_payment and plan", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "maxLength" : 100, + "minLength" : 1, + "type" : "string" + } + }, + "start_time" : { + "name" : "start_time", + "in" : "query", + "description" : "The start time of the range of transactions to list", + "required" : true, + "style" : "form", + "explode" : true, + "schema" : { + "maxLength" : 64, + "minLength" : 20, + "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$", + "type" : "string", + "format" : "ppaas_date_time_v3" + }, + "x-ballerina-name" : "startTime" + }, + "end_time" : { + "name" : "end_time", + "in" : "query", + "description" : "The end time of the range of transactions to list", + "required" : true, + "style" : "form", + "explode" : true, + "schema" : { + "maxLength" : 64, + "minLength" : 20, + "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$", + "type" : "string", + "format" : "ppaas_date_time_v3" + }, + "x-ballerina-name" : "endTime" + } + }, + "requestBodies" : { + "patch_request" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/PatchRequest" + } + } + } + } + }, + "securitySchemes" : { + "Oauth2" : { + "type" : "oauth2", + "description" : "Oauth 2.0 authentication", + "flows" : { + "clientCredentials" : { + "tokenUrl" : "/v1/oauth2/token", + "scopes" : { + "https://uri.paypal.com/services/subscriptions" : "Manage plan & subscription" + } + } + } + } + } + } +} \ No newline at end of file From 99ccb4725bb337ea170618ddb7288a513cef3320 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Fri, 13 Jun 2025 17:17:01 +0530 Subject: [PATCH 04/56] Update sanitation document for OpenAPI specification: rename schemas for compliance and clarity --- docs/spec/sanitations.md | 48 ++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/docs/spec/sanitations.md b/docs/spec/sanitations.md index a2776b9..79d7653 100644 --- a/docs/spec/sanitations.md +++ b/docs/spec/sanitations.md @@ -1,24 +1,48 @@ -_Author_: \ -_Created_: \ -_Updated_: \ +_Author_: @RNViththagan \ +_Created_: 2025/06/13 \ +_Updated_: 2025/06/13 \ _Edition_: Swan Lake # Sanitation for OpenAPI specification -This document records the sanitation done on top of the official OpenAPI specification from Paypal Subscriptions. -The OpenAPI specification is obtained from (TODO: Add source link). -These changes are done in order to improve the overall usability, and as workarounds for some known language limitations. +This document records the sanitation done on top of the official OpenAPI specification from PayPal Subscriptions. The OpenAPI specification is obtained from [PayPal REST API Specifications](https://github.com/paypal/paypal-rest-api-specifications/blob/main/openapi/billing_subscriptions_v1.json). These changes are implemented after flattening and aligning the OpenAPI specification to enhance usability and address language limitations in the Ballerina OpenAPI tool. -[//]: # (TODO: Add sanitation details) -1. -2. -3. +1. **Renamed schema `Schema'400` to `BadRequest`**: + - **Original**: `Schema'400` + - **Updated**: `BadRequest` + - **Action**: Updated `$ref` values directly referencing this schema (e.g., `"$ref": "#/components/schemas/Schema'400"` to `"$ref": "#/components/schemas/BadRequest"`). + - **Reason**: The original schema name contained a single quote, which does not comply with the regular expression `^[a-zA-Z0-9\.\-_]+$`. Renaming improves compatibility with the Ballerina OpenAPI tool. + +2. **Renamed schema `Schema'401` to `Unauthorized`**: + - **Original**: `Schema'401` + - **Updated**: `Unauthorized` + - **Action**: Updated `$ref` values directly referencing this schema (e.g., `"$ref": "#/components/schemas/Schema'401"` to `"$ref": "#/components/schemas/Unauthorized"`). + - **Reason**: The original schema name contained a single quote, which does not comply with the regular expression `^[a-zA-Z0-9\.\-_]+$`. Renaming ensures compliance and clarity. + +3. **Renamed schema `Schema'403` to `Forbidden`**: + - **Original**: `Schema'403` + - **Updated**: `Forbidden` + - **Action**: Updated `$ref` values directly referencing this schema (e.g., `"$ref": "#/components/schemas/Schema'403"` to `"$ref": "#/components/schemas/Forbidden"`). + - **Reason**: The original schema name contained a single quote, which does not comply with the regular expression `^[a-zA-Z0-9\.\-_]+$`. Renaming enhances compatibility. + +4. **Renamed schema `Schema'404` to `NotFound`**: + - **Original**: `Schema'404` + - **Updated**: `NotFound` + - **Action**: Updated `$ref` values directly referencing this schema (e.g., `"$ref": "#/components/schemas/Schema'404"` to `"$ref": "#/components/schemas/NotFound"`). + - **Reason**: The original schema name contained a single quote, which does not comply with the regular expression `^[a-zA-Z0-9\.\-_]+$`. Renaming improves usability and compliance. + +5. **Renamed schema `Schema'422` to `UnprocessableEntity`**: + - **Original**: `Schema'422` + - **Updated**: `UnprocessableEntity` + - **Action**: Updated `$ref` values directly referencing this schema (e.g., `"$ref": "#/components/schemas/Schema'422"` to `"$ref": "#/components/schemas/UnprocessableEntity"`). + - **Reason**: The original schema name contained a single quote, which does not comply with the regular expression `^[a-zA-Z0-9\.\-_]+$`. Renaming ensures compliance and clarity. ## OpenAPI cli command The following command was used to generate the Ballerina client from the OpenAPI specification. The command should be executed from the repository root directory. ```bash -# TODO: Add OpenAPI CLI command used to generate the client +bal openapi -i docs/spec/openapi.yaml --mode client -o ballerina ``` -Note: The license year is hardcoded to 2024, change if necessary. + +Note: The license year is hardcoded to 2025, change if necessary. \ No newline at end of file From 9a93093322e15d6964b1bd2abb36f9703a5c554f Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 18 Jun 2025 13:21:27 +0530 Subject: [PATCH 05/56] Add utility functions for encoding and serialization in Ballerina --- ballerina/utils.bal | 203 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 ballerina/utils.bal diff --git a/ballerina/utils.bal b/ballerina/utils.bal new file mode 100644 index 0000000..859a6d2 --- /dev/null +++ b/ballerina/utils.bal @@ -0,0 +1,203 @@ +// AUTO-GENERATED FILE. DO NOT MODIFY. +// This file is auto-generated by the Ballerina OpenAPI tool. + +import ballerina/http; +import ballerina/url; + +type SimpleBasicType string|boolean|int|float|decimal; + +# Represents encoding mechanism details. +type Encoding record { + # Defines how multiple values are delimited + string style = FORM; + # Specifies whether arrays and objects should generate as separate fields + boolean explode = true; + # Specifies the custom content type + string contentType?; + # Specifies the custom headers + map headers?; +}; + +enum EncodingStyle { + DEEPOBJECT, FORM, SPACEDELIMITED, PIPEDELIMITED +} + +final Encoding & readonly defaultEncoding = {}; + +# Serialize the record according to the deepObject style. +# +# + parent - Parent record name +# + anyRecord - Record to be serialized +# + return - Serialized record as a string +isolated function getDeepObjectStyleRequest(string parent, record {} anyRecord) returns string { + string[] recordArray = []; + foreach [string, anydata] [key, value] in anyRecord.entries() { + if value is SimpleBasicType { + recordArray.push(parent + "[" + key + "]" + "=" + getEncodedUri(value.toString())); + } else if value is SimpleBasicType[] { + recordArray.push(getSerializedArray(parent + "[" + key + "]" + "[]", value, DEEPOBJECT, true)); + } else if value is record {} { + string nextParent = parent + "[" + key + "]"; + recordArray.push(getDeepObjectStyleRequest(nextParent, value)); + } else if value is record {}[] { + string nextParent = parent + "[" + key + "]"; + recordArray.push(getSerializedRecordArray(nextParent, value, DEEPOBJECT)); + } + recordArray.push("&"); + } + _ = recordArray.pop(); + return string:'join("", ...recordArray); +} + +# Serialize the record according to the form style. +# +# + parent - Parent record name +# + anyRecord - Record to be serialized +# + explode - Specifies whether arrays and objects should generate separate parameters +# + return - Serialized record as a string +isolated function getFormStyleRequest(string parent, record {} anyRecord, boolean explode = true) returns string { + string[] recordArray = []; + if explode { + foreach [string, anydata] [key, value] in anyRecord.entries() { + if value is SimpleBasicType { + recordArray.push(key, "=", getEncodedUri(value.toString())); + } else if value is SimpleBasicType[] { + recordArray.push(getSerializedArray(key, value, explode = explode)); + } else if value is record {} { + recordArray.push(getFormStyleRequest(parent, value, explode)); + } + recordArray.push("&"); + } + _ = recordArray.pop(); + } else { + foreach [string, anydata] [key, value] in anyRecord.entries() { + if value is SimpleBasicType { + recordArray.push(key, ",", getEncodedUri(value.toString())); + } else if value is SimpleBasicType[] { + recordArray.push(getSerializedArray(key, value, explode = false)); + } else if value is record {} { + recordArray.push(getFormStyleRequest(parent, value, explode)); + } + recordArray.push(","); + } + _ = recordArray.pop(); + } + return string:'join("", ...recordArray); +} + +# Serialize arrays. +# +# + arrayName - Name of the field with arrays +# + anyArray - Array to be serialized +# + style - Defines how multiple values are delimited +# + explode - Specifies whether arrays and objects should generate separate parameters +# + return - Serialized array as a string +isolated function getSerializedArray(string arrayName, anydata[] anyArray, string style = "form", boolean explode = true) returns string { + string key = arrayName; + string[] arrayValues = []; + if anyArray.length() > 0 { + if style == FORM && !explode { + arrayValues.push(key, "="); + foreach anydata i in anyArray { + arrayValues.push(getEncodedUri(i.toString()), ","); + } + } else if style == SPACEDELIMITED && !explode { + arrayValues.push(key, "="); + foreach anydata i in anyArray { + arrayValues.push(getEncodedUri(i.toString()), "%20"); + } + } else if style == PIPEDELIMITED && !explode { + arrayValues.push(key, "="); + foreach anydata i in anyArray { + arrayValues.push(getEncodedUri(i.toString()), "|"); + } + } else if style == DEEPOBJECT { + foreach anydata i in anyArray { + arrayValues.push(key, "[]", "=", getEncodedUri(i.toString()), "&"); + } + } else { + foreach anydata i in anyArray { + arrayValues.push(key, "=", getEncodedUri(i.toString()), "&"); + } + } + _ = arrayValues.pop(); + } + return string:'join("", ...arrayValues); +} + +# Serialize the array of records according to the form style. +# +# + parent - Parent record name +# + value - Array of records to be serialized +# + style - Defines how multiple values are delimited +# + explode - Specifies whether arrays and objects should generate separate parameters +# + return - Serialized record as a string +isolated function getSerializedRecordArray(string parent, record {}[] value, string style = FORM, boolean explode = true) returns string { + string[] serializedArray = []; + if style == DEEPOBJECT { + int arayIndex = 0; + foreach var recordItem in value { + serializedArray.push(getDeepObjectStyleRequest(parent + "[" + arayIndex.toString() + "]", recordItem), "&"); + arayIndex = arayIndex + 1; + } + } else { + if !explode { + serializedArray.push(parent, "="); + } + foreach var recordItem in value { + serializedArray.push(getFormStyleRequest(parent, recordItem, explode), ","); + } + } + _ = serializedArray.pop(); + return string:'join("", ...serializedArray); +} + +# Get Encoded URI for a given value. +# +# + value - Value to be encoded +# + return - Encoded string +isolated function getEncodedUri(anydata value) returns string { + string|error encoded = url:encode(value.toString(), "UTF8"); + if encoded is string { + return encoded; + } else { + return value.toString(); + } +} + +# Generate query path with query parameter. +# +# + queryParam - Query parameter map +# + encodingMap - Details on serialization mechanism +# + return - Returns generated Path or error at failure of client initialization +isolated function getPathForQueryParam(map queryParam, map encodingMap = {}) returns string|error { + map queriesMap = http:getQueryMap(queryParam); + string[] param = []; + if queriesMap.length() > 0 { + param.push("?"); + foreach var [key, value] in queriesMap.entries() { + if value is () { + _ = queriesMap.remove(key); + continue; + } + Encoding encodingData = encodingMap.hasKey(key) ? encodingMap.get(key) : defaultEncoding; + if value is SimpleBasicType { + param.push(key, "=", getEncodedUri(value.toString())); + } else if value is SimpleBasicType[] { + param.push(getSerializedArray(key, value, encodingData.style, encodingData.explode)); + } else if value is record {} { + if encodingData.style == DEEPOBJECT { + param.push(getDeepObjectStyleRequest(key, value)); + } else { + param.push(getFormStyleRequest(key, value, encodingData.explode)); + } + } else { + param.push(key, "=", value.toString()); + } + param.push("&"); + } + _ = param.pop(); + } + string restOfPath = string:'join("", ...param); + return restOfPath; +} From 87be740002a97374ce3dfce2e63067b0e85d87a9 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 18 Jun 2025 13:21:38 +0530 Subject: [PATCH 06/56] Implement PayPal subscription management functions in Ballerina client --- ballerina/client.bal | 234 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 219 insertions(+), 15 deletions(-) diff --git a/ballerina/client.bal b/ballerina/client.bal index c000777..a138bcb 100644 --- a/ballerina/client.bal +++ b/ballerina/client.bal @@ -1,15 +1,219 @@ -// Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). -// -// WSO2 LLC. licenses this file to you under the Apache License, -// Version 2.0 (the "License"); you may not use this file except -// in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. +// AUTO-GENERATED FILE. DO NOT MODIFY. +// This file is auto-generated by the Ballerina OpenAPI tool. + +import ballerina/data.jsondata; +import ballerina/http; + +# You can use billing plans and subscriptions to create subscriptions that process recurring PayPal payments for physical or digital goods, or services. A plan includes pricing and billing cycle information that defines the amount and frequency of charge for a subscription. You can also define a fixed plan, such as a $5 basic plan or a volume- or graduated-based plan with pricing tiers based on the quantity purchased. For more information, see Subscriptions Overview. +public isolated client class Client { + final http:Client clientEp; + + # Gets invoked to initialize the `connector`. + # + # + config - The configurations to be used when initializing the `connector` + # + serviceUrl - URL of the target service + # + return - An error if connector initialization failed + public isolated function init(ConnectionConfig config, string serviceUrl = "https://api-m.sandbox.paypal.com/v1/billing") returns error? { + http:ClientConfiguration httpClientConfig = {auth: config.auth, httpVersion: config.httpVersion, http1Settings: config.http1Settings, http2Settings: config.http2Settings, timeout: config.timeout, forwarded: config.forwarded, followRedirects: config.followRedirects, poolConfig: config.poolConfig, cache: config.cache, compression: config.compression, circuitBreaker: config.circuitBreaker, retryConfig: config.retryConfig, cookieConfig: config.cookieConfig, responseLimits: config.responseLimits, secureSocket: config.secureSocket, proxy: config.proxy, socketConfig: config.socketConfig, validation: config.validation, laxDataBinding: config.laxDataBinding}; + self.clientEp = check new (serviceUrl, httpClientConfig); + } + + # List plans + # + # + headers - Headers to be sent with the request + # + queries - Queries to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that lists billing plans + resource isolated function get plans(PlansListHeaders headers = {}, *PlansListQueries queries) returns PlanCollection|error { + string resourcePath = string `/plans`; + resourcePath = resourcePath + check getPathForQueryParam(queries); + map httpHeaders = http:getHeaderMap(headers); + return self.clientEp->get(resourcePath, httpHeaders); + } + + # Create plan + # + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows billing plan details + resource isolated function post plans(PlanRequestPOST payload, PlansCreateHeaders headers = {}) returns Plan|error { + string resourcePath = string `/plans`; + map httpHeaders = http:getHeaderMap(headers); + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, httpHeaders); + } + + # Show plan details + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows plan details + resource isolated function get plans/[string id](map headers = {}) returns Plan|error { + string resourcePath = string `/plans/${getEncodedUri(id)}`; + return self.clientEp->get(resourcePath, headers); + } + + # Update plan + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function patch plans/[string id](PatchRequest payload, map headers = {}) returns error? { + string resourcePath = string `/plans/${getEncodedUri(id)}`; + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->patch(resourcePath, request, headers); + } + + # Activate plan + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function post plans/[string id]/activate(map headers = {}) returns error? { + string resourcePath = string `/plans/${getEncodedUri(id)}/activate`; + http:Request request = new; + return self.clientEp->post(resourcePath, request, headers); + } + + # Deactivate plan + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function post plans/[string id]/deactivate(map headers = {}) returns error? { + string resourcePath = string `/plans/${getEncodedUri(id)}/deactivate`; + http:Request request = new; + return self.clientEp->post(resourcePath, request, headers); + } + + # Update pricing + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function post plans/[string id]/update\-pricing\-schemes(UpdatePricingSchemesListRequest payload, map headers = {}) returns error? { + string resourcePath = string `/plans/${getEncodedUri(id)}/update-pricing-schemes`; + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, headers); + } + + # Create subscription + # + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details + resource isolated function post subscriptions(SubscriptionRequestPost payload, SubscriptionsCreateHeaders headers = {}) returns Subscription|error { + string resourcePath = string `/subscriptions`; + map httpHeaders = http:getHeaderMap(headers); + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, httpHeaders); + } + + # Show subscription details + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + queries - Queries to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details + resource isolated function get subscriptions/[string id](map headers = {}, *SubscriptionsGetQueries queries) returns Subscription|error { + string resourcePath = string `/subscriptions/${getEncodedUri(id)}`; + resourcePath = resourcePath + check getPathForQueryParam(queries); + return self.clientEp->get(resourcePath, headers); + } + + # Update subscription + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function patch subscriptions/[string id](PatchRequest payload, map headers = {}) returns error? { + string resourcePath = string `/subscriptions/${getEncodedUri(id)}`; + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->patch(resourcePath, request, headers); + } + + # Revise plan or quantity of subscription + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details + resource isolated function post subscriptions/[string id]/revise(SubscriptionReviseRequest payload, map headers = {}) returns SubscriptionReviseResponse|error { + string resourcePath = string `/subscriptions/${getEncodedUri(id)}/revise`; + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, headers); + } + + # Suspend subscription + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function post subscriptions/[string id]/suspend(SubscriptionSuspendRequest payload, map headers = {}) returns error? { + string resourcePath = string `/subscriptions/${getEncodedUri(id)}/suspend`; + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, headers); + } + + # Cancel subscription + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function post subscriptions/[string id]/cancel(SubscriptionCancelRequest payload, map headers = {}) returns error? { + string resourcePath = string `/subscriptions/${getEncodedUri(id)}/cancel`; + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, headers); + } + + # Activate subscription + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function post subscriptions/[string id]/activate(SubscriptionActivateRequest payload, map headers = {}) returns error? { + string resourcePath = string `/subscriptions/${getEncodedUri(id)}/activate`; + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, headers); + } + + # Capture authorized payment on subscription + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details + resource isolated function post subscriptions/[string id]/capture(SubscriptionCaptureRequest payload, SubscriptionsCaptureHeaders headers = {}) returns Transaction|error? { + string resourcePath = string `/subscriptions/${getEncodedUri(id)}/capture`; + map httpHeaders = http:getHeaderMap(headers); + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, httpHeaders); + } + + # List transactions for subscription + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + queries - Queries to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details + resource isolated function get subscriptions/[string id]/transactions(map headers = {}, *SubscriptionsTransactionsQueries queries) returns TransactionsList|error { + string resourcePath = string `/subscriptions/${getEncodedUri(id)}/transactions`; + resourcePath = resourcePath + check getPathForQueryParam(queries); + return self.clientEp->get(resourcePath, headers); + } +} From 2a4cd1dafaa5349983b660b712311fab3a6280f4 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 18 Jun 2025 13:22:02 +0530 Subject: [PATCH 07/56] Implement feature X to enhance user experience and optimize performance --- ballerina/types.bal | 1006 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1006 insertions(+) create mode 100644 ballerina/types.bal diff --git a/ballerina/types.bal b/ballerina/types.bal new file mode 100644 index 0000000..24eb601 --- /dev/null +++ b/ballerina/types.bal @@ -0,0 +1,1006 @@ +// AUTO-GENERATED FILE. DO NOT MODIFY. +// This file is auto-generated by the Ballerina OpenAPI tool. + +import ballerina/constraint; +import ballerina/data.jsondata; +import ballerina/http; + +# OAuth2 Client Credentials Grant Configs +public type OAuth2ClientCredentialsGrantConfig record {| + *http:OAuth2ClientCredentialsGrantConfig; + # Token URL + string tokenUrl = "https://api-m.sandbox.paypal.com/v1/billing/v1/oauth2/token"; +|}; + +# The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
+@constraint:String {maxLength: 254} +public type Email string; + +# The account identifier for a PayPal account +@constraint:String {maxLength: 13, minLength: 13, pattern: re `^[2-9A-HJ-NP-Z]{13}$`} +public type AccountId string; + +# The response to a request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent +public type SubscriptionReviseResponse record { + *SubscriptionReviseRequest; + *SubscriptionReviseResponseAllOf2; +}; + +# The update pricing scheme request details +public type UpdatePricingSchemeRequest record { + # The billing cycle sequence + @jsondata:Name {value: "billing_cycle_sequence"} + int billingCycleSequence; + @jsondata:Name {value: "pricing_scheme"} + PricingScheme pricingScheme; +}; + +# The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (https://www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions +public type PaymentSource record { + # The payment card to use to fund a payment. Can be a credit or debit card + Card card?; +}; + +# The card network or brand. Applies to credit, debit, gift, and payment cards +public type CardBrand "VISA"|"MASTERCARD"|"DISCOVER"|"AMEX"|"SOLO"|"JCB"|"STAR"|"DELTA"|"SWITCH"|"MAESTRO"|"CB_NATIONALE"|"CONFIGOGA"|"CONFIDIS"|"ELECTRON"|"CETELEM"|"CHINA_UNION_PAY"; + +# The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+@constraint:String {maxLength: 64, minLength: 20, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$`} +public type DateTime string; + +public type TransactionAllOf2 record { + # The PayPal-generated transaction ID. + @constraint:String {maxLength: 50, minLength: 3} + string id?; + # The breakdown details for the amount. Includes the gross, tax, fee, and shipping amounts + AmountWithBreakdown amount_with_breakdown?; + # The name of the party + Name payer_name?; + # The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
+ EmailAddress payer_email?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ DateTime time?; +}; + +# The name of the party +public type Name record { + # When the party is a person, the party's full name + @jsondata:Name {value: "full_name"} + string fullName?; + # The prefix, or title, to the party's name + @constraint:String {maxLength: 140} + string prefix?; + # When the party is a person, the party's surname or family name. Also known as the last name. Required when the party is a person. Use also to store multiple surnames including the matronymic, or mother's, surname + @constraint:String {maxLength: 140} + string surname?; + # When the party is a person, the party's given, or first, name + @jsondata:Name {value: "given_name"} + string givenName?; + # When the party is a person, the party's middle name. Use also to store multiple middle names including the patronymic, or father's, middle name + @jsondata:Name {value: "middle_name"} + string middleName?; + # The suffix for the party's name + @constraint:String {maxLength: 140} + string suffix?; + # DEPRECATED. The party's alternate name. Can be a business name, nickname, or any other name that cannot be split into first, last name. Required when the party is a business + @jsondata:Name {value: "alternate_full_name"} + string alternateFullName?; +}; + +# The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency +@constraint:String {maxLength: 3, minLength: 3} +public type CurrencyCode string; + +# The payment preferences for a subscription +public type PaymentPreferences record { + @jsondata:Name {value: "setup_fee"} + Money setupFee?; + # The action to take on the subscription if the initial payment for the setup fails + @jsondata:Name {value: "setup_fee_failure_action"} + "CONTINUE"|"CANCEL" setupFeeFailureAction = "CANCEL"; + # Indicates whether to automatically bill the outstanding amount in the next billing cycle + @jsondata:Name {value: "auto_bill_outstanding"} + boolean autoBillOutstanding = true; + # The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail + @jsondata:Name {value: "payment_failure_threshold"} + int paymentFailureThreshold = 0; +}; + +# Status of Authentication eligibility +public type Enrolled "Y"|"N"|"U"|"B"; + +# The list transactions for a subscription request details +public type TransactionsList record { + # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links) + @constraint:Array {maxLength: 10, minLength: 1} + LinkDescription[] links?; + # The total number of pages + @jsondata:Name {value: "total_pages"} + int totalPages?; + # An array of transactions + @constraint:Array {maxLength: 32767} + Transaction[] transactions?; + # The total number of items + @jsondata:Name {value: "total_items"} + int totalItems?; +}; + +# The application context, which customizes the payer experience during the subscription approval process with PayPal +public type ApplicationContext record { + # Configures the label name to `Continue` or `Subscribe Now` for subscription consent experience + @jsondata:Name {value: "user_action"} + "CONTINUE"|"SUBSCRIBE_NOW" userAction = "SUBSCRIBE_NOW"; + # The URL where the customer is redirected after the customer approves the payment + @jsondata:Name {value: "return_url"} + string returnUrl; + # The label that overrides the business name in the PayPal account on the PayPal site + @jsondata:Name {value: "brand_name"} + string brandName?; + # The [language tag](https://tools.ietf.org/html/bcp47#section-2) for the language in which to localize the error-related strings, such as messages, issues, and suggested actions. The tag is made up of the [ISO 639-2 language code](https://www.loc.gov/standards/iso639-2/php/code_list.php), the optional [ISO-15924 script tag](https://www.unicode.org/iso15924/codelists.html), and the [ISO-3166 alpha-2 country code](/docs/integration/direct/rest/country-codes/) + Language locale?; + # The URL where the customer is redirected after the customer cancels the payment + @jsondata:Name {value: "cancel_url"} + string cancelUrl; + # The location from which the shipping address is derived + @jsondata:Name {value: "shipping_preference"} + "GET_FROM_FILE"|"NO_SHIPPING"|"SET_PROVIDED_ADDRESS" shippingPreference = "GET_FROM_FILE"; + @jsondata:Name {value: "payment_method"} + PaymentMethod paymentMethod?; +}; + +# The phone information +public type PhoneWithType record { + @jsondata:Name {value: "phone_type"} + PhoneType phoneType?; + @jsondata:Name {value: "phone_number"} + Phone phoneNumber; +}; + +# The details of the captured payment status +public type CaptureStatusDetails record { + # The reason why the captured payment status is `PENDING` or `DENIED` + "BUYER_COMPLAINT"|"CHARGEBACK"|"ECHECK"|"INTERNATIONAL_WITHDRAWAL"|"OTHER"|"PENDING_REVIEW"|"RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION"|"REFUNDED"|"TRANSACTION_APPROVED_AWAITING_FUNDING"|"UNILATERAL"|"VERIFICATION_REQUIRED" reason?; +}; + +# The subscriber response information +public type Subscriber record { + *Payer; + *SubscriberAllOf2; +}; + +# The tax ID of the customer. The customer is also known as the payer. Both `tax_id` and `tax_id_type` are required +public type TaxInfo record { + # The customer's tax ID type + @jsondata:Name {value: "tax_id_type"} + "BR_CPF"|"BR_CNPJ" taxIdType; + # The customer's tax ID value + @jsondata:Name {value: "tax_id"} + string taxId; +}; + +# The pricing scheme details +public type PricingScheme record { + # An array of pricing tiers which are used for billing volume/tiered plans. pricing_model field has to be specified + @constraint:Array {maxLength: 32, minLength: 1} + PricingTier[] tiers?; + @jsondata:Name {value: "update_time"} + DateTime updateTime?; + @jsondata:Name {value: "create_time"} + DateTime createTime?; + # The pricing model for tiered plan. The `tiers` parameter is required + @jsondata:Name {value: "pricing_model"} + "VOLUME"|"TIERED" pricingModel?; + @jsondata:Name {value: "fixed_price"} + Money fixedPrice?; + # The version of the pricing scheme + @constraint:Int {minValue: 0, maxValue: 999} + int version?; +}; + +# The payment source used to fund the payment +public type PaymentSourceResponse record { + # The payment card used to fund the payment. Card can be a credit or debit card + CardResponseWithBillingAddress card?; +}; + +# An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object +public type PlanOverride record { + @jsondata:Name {value: "payment_preferences"} + PaymentPreferencesOverride paymentPreferences?; + # An array of billing cycles for trial billing and regular billing. The subscription billing cycle definition has to adhere to the plan billing cycle definition + @jsondata:Name {value: "billing_cycles"} + BillingCycleOverride[] billingCycles?; + # The tax details + TaxesOverride taxes?; +}; + +# The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6) +@constraint:String {maxLength: 7, minLength: 7, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])$`} +public type DateYearMonth string; + +# The create subscription request details +public type SubscriptionRequestPost record { + @jsondata:Name {value: "shipping_amount"} + Money shippingAmount?; + @jsondata:Name {value: "start_time"} + DateTime startTime?; + # The quantity of the product in the subscription + @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} + string quantity?; + # The subscriber request information + SubscriberRequest subscriber?; + # The custom id for the subscription. Can be invoice id + @jsondata:Name {value: "custom_id"} + string customId?; + @jsondata:Name {value: "application_context"} + ApplicationContext applicationContext?; + # An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object + PlanOverride plan?; + # The ID of the plan + @jsondata:Name {value: "plan_id"} + string planId; + # DEPRECATED. Indicates whether the subscription auto-renews after the billing cycles complete + # + # # Deprecated + @jsondata:Name {value: "auto_renewal"} + @deprecated + boolean autoRenewal = false; +}; + +# Represents the Headers record for the operation: plans.create +public type PlansCreateHeaders record { + # The server stores keys for 72 hours + @http:Header {name: "PayPal-Request-Id"} + string payPalRequestId?; + # The preferred server response upon successful completion of the request. Value is:
  • return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links.
  • return=representation. The server returns a complete resource representation, including the current state of the resource.
+ @http:Header {name: "Prefer"} + string prefer = "return=minimal"; +}; + +public type SubscriberAllOf2 record { + # The shipping details + ShippingDetail shipping_address?; + # The payment source used to fund the payment + PaymentSourceResponse payment_source?; +}; + +# The subscription details +public type Subscription record { + *SubscriptionStatus; + *SubscriptionAllOf2; +}; + +# The cancel subscription request details +public type SubscriptionCancelRequest record { + # The reason for the cancellation of a subscription + @constraint:String {maxLength: 128, minLength: 1} + string reason; +}; + +# Represents the Queries record for the operation: subscriptions.get +public type SubscriptionsGetQueries record { + # List of fields that are to be returned in the response. Possible value for fields are last_failed_payment and plan + @constraint:String {maxLength: 100, minLength: 1} + string fields?; +}; + +# Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint. +@display {label: "Connection Config"} +public type ConnectionConfig record {| + # Configurations related to client authentication + OAuth2ClientCredentialsGrantConfig auth; + # The HTTP version understood by the client + http:HttpVersion httpVersion = http:HTTP_2_0; + # Configurations related to HTTP/1.x protocol + http:ClientHttp1Settings http1Settings = {}; + # Configurations related to HTTP/2 protocol + http:ClientHttp2Settings http2Settings = {}; + # The maximum time to wait (in seconds) for a response before closing the connection + decimal timeout = 30; + # The choice of setting `forwarded`/`x-forwarded` header + string forwarded = "disable"; + # Configurations associated with Redirection + http:FollowRedirects followRedirects?; + # Configurations associated with request pooling + http:PoolConfiguration poolConfig?; + # HTTP caching related configurations + http:CacheConfig cache = {}; + # Specifies the way of handling compression (`accept-encoding`) header + http:Compression compression = http:COMPRESSION_AUTO; + # Configurations associated with the behaviour of the Circuit Breaker + http:CircuitBreakerConfig circuitBreaker?; + # Configurations associated with retrying + http:RetryConfig retryConfig?; + # Configurations associated with cookies + http:CookieConfig cookieConfig?; + # Configurations associated with inbound response size limits + http:ResponseLimitConfigs responseLimits = {}; + # SSL/TLS-related options + http:ClientSecureSocket secureSocket?; + # Proxy server related options + http:ProxyConfig proxy?; + # Provides settings related to client socket configuration + http:ClientSocketConfig socketConfig = {}; + # Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default + boolean validation = true; + # Enables relaxed data binding on the client side. When enabled, `nil` values are treated as optional, + # and absent fields are handled as `nilable` types. Enabled by default. + boolean laxDataBinding = true; +|}; + +public type SubscriptionReviseResponseAllOf2 record { + # Indicates whether the subscription has overridden any plan attributes. + boolean plan_overridden?; + # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links). + LinkDescription[] links?; +}; + +# The customer who approves and pays for the order. The customer is also known as the payer +public type Payer record { + *PayerBase; + *PayerAllOf2; +}; + +public type SubscriptionAllOf2 record { + # The PayPal-generated ID for the subscription. + @constraint:String {maxLength: 50, minLength: 3} + string id?; + # The ID of the plan. + @constraint:String {maxLength: 50, minLength: 3} + string plan_id?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ DateTime start_time?; + # The quantity of the product in the subscription. + @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} + string quantity?; + # The currency and amount for a financial transaction, such as a balance or payment due + Money shipping_amount?; + # The subscriber response information + Subscriber subscriber?; + # The billing details for the subscription. If the subscription was or is active, these fields are populated + SubscriptionBillingInfo billing_info?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ DateTime create_time?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ DateTime update_time?; + # The custom id for the subscription. Can be invoice id. + @constraint:String {maxLength: 127, minLength: 1} + string custom_id?; + # Indicates whether the subscription has overridden any plan attributes. + boolean plan_overridden?; + # The plan details + Plan plan?; + # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links). + LinkDescription[] links?; +}; + +# The billing cycle details +public type BillingCycle record { + # The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle + @constraint:Int {minValue: 1, maxValue: 99} + int sequence; + # The tenure type of the billing cycle. In case of a plan having trial cycle, only 2 trial cycles are allowed per plan + @jsondata:Name {value: "tenure_type"} + "REGULAR"|"TRIAL" tenureType; + # The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles) + @jsondata:Name {value: "total_cycles"} + int totalCycles = 1; + @jsondata:Name {value: "pricing_scheme"} + PricingScheme pricingScheme?; + # The frequency of the billing cycle + Frequency frequency; +}; + +# Results of 3D Secure Authentication +public type ThreeDSecureAuthenticationResponse record { + @jsondata:Name {value: "authentication_status"} + ParesStatus authenticationStatus?; + @jsondata:Name {value: "enrollment_status"} + Enrolled enrollmentStatus?; +}; + +# The suspend subscription request details +public type SubscriptionSuspendRequest record { + # The reason for suspenson of the subscription + @constraint:String {maxLength: 128, minLength: 1} + string reason; +}; + +# An array of JSON patch objects to apply partial updates to resources +public type PatchRequest Patch[]; + +# The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute) +public type AddressPortable record { + @jsondata:Name {value: "country_code"} + CountryCode countryCode; + # 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`. Value, by country, is:
  • UK. A county.
  • US. A state.
  • Canada. A province.
  • Japan. A prefecture.
  • Switzerland. A kanton.
+ @jsondata:Name {value: "admin_area_1"} + string adminArea1?; + # 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 + @jsondata:Name {value: "address_line_1"} + string addressLine1?; + # A sub-locality, suburb, neighborhood, or district. Smaller than `admin_area_level_2`. Value is:
  • Brazil. Suburb, bairro, or neighborhood.
  • India. Sub-locality or district. Street name information is not always available but a sub-locality or district can be a very small area.
+ @jsondata:Name {value: "admin_area_3"} + string adminArea3?; + @jsondata:Name {value: "address_details"} + AddressDetails addressDetails?; + # A city, town, or village. Smaller than `admin_area_level_1` + @jsondata:Name {value: "admin_area_2"} + string adminArea2?; + # The third line of the address, if needed. For example, a street complement for Brazil, direction text, such as `next to Walmart`, or a landmark in an Indian address + @jsondata:Name {value: "address_line_3"} + string addressLine3?; + # The second line of the address. For example, suite or apartment number + @jsondata:Name {value: "address_line_2"} + string addressLine2?; + # The neighborhood, ward, or district. Smaller than `admin_area_level_3` or `sub_locality`. Value is:
  • The postal sorting code for Guernsey and many French territories, such as French Guiana.
  • The fine-grained administrative levels in China.
+ @jsondata:Name {value: "admin_area_4"} + string adminArea4?; + # The postal code, which is the zip code or equivalent. Typically required for countries with a postal code or an equivalent. See [postal code](https://en.wikipedia.org/wiki/Postal_code) + @jsondata:Name {value: "postal_code"} + string postalCode?; +}; + +# The payment preferences to override at subscription level +public type PaymentPreferencesOverride record { + @jsondata:Name {value: "setup_fee"} + Money setupFee?; + # The action to take on the subscription if the initial payment for the setup fails + @jsondata:Name {value: "setup_fee_failure_action"} + "CONTINUE"|"CANCEL" setupFeeFailureAction?; + # Indicates whether to automatically bill the outstanding amount in the next billing cycle + @jsondata:Name {value: "auto_bill_outstanding"} + boolean autoBillOutstanding?; + # The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail + @jsondata:Name {value: "payment_failure_threshold"} + int paymentFailureThreshold?; +}; + +# The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
+@constraint:String {maxLength: 254, minLength: 3, pattern: re `^.+@[^"\-].+$`} +public type EmailAddress string; + +# The payment card to use to fund a payment. Can be a credit or debit card +public type Card record { + # The primary account number (PAN) for the payment card + @constraint:String {maxLength: 19, minLength: 13} + string number; + # The three- or four-digit security code of the card. Also known as the CVV, CVC, CVN, CVE, or CID. This parameter cannot be present in the request when `payment_initiator=MERCHANT` + @jsondata:Name {value: "security_code"} + string securityCode?; + # The card holder's name as it appears on the card + @constraint:String {maxLength: 300} + string name?; + @jsondata:Name {value: "billing_address"} + AddressPortable billingAddress?; + # The PayPal-generated ID for the card + string id?; + # The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6) + DateYearMonth expiry; + @jsondata:Name {value: "card_type"} + CardBrand cardType?; + # The last digits of the payment card + @jsondata:Name {value: "last_digits"} + string lastDigits?; +}; + +# Represents the Headers record for the operation: subscriptions.create +public type SubscriptionsCreateHeaders record { + # The server stores keys for 72 hours + @http:Header {name: "PayPal-Request-Id"} + string payPalRequestId?; + # The preferred server response upon successful completion of the request. Value is:
  • return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links.
  • return=representation. The server returns a complete resource representation, including the current state of the resource.
+ @http:Header {name: "Prefer"} + string prefer = "return=minimal"; +}; + +# The tax details +public type Taxes record { + # Indicates whether the tax was already included in the billing amount + boolean inclusive = true; + # The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99` + Percentage percentage; +}; + +# The update pricing scheme request details +public type UpdatePricingSchemesListRequest record { + # An array of pricing schemes + @jsondata:Name {value: "pricing_schemes"} + UpdatePricingSchemeRequest[] pricingSchemes; +}; + +# The phone type +public type PhoneType "FAX"|"HOME"|"MOBILE"|"OTHER"|"PAGER"; + +# The transaction details +public type Transaction record { + *CaptureStatus; + *TransactionAllOf2; + DateTime time; + AmountWithBreakdown amount_with_breakdown; + string id; +}; + +# The payment card to use to fund a payment. Card can be a credit or debit card +public type CardResponse record { + @jsondata:Name {value: "authentication_result"} + AuthenticationResponse authenticationResult?; + # The payment card type + "CREDIT"|"DEBIT"|"PREPAID"|"UNKNOWN" 'type?; + # The last digits of the payment card + @jsondata:Name {value: "last_digits"} + string lastDigits?; + # The card network or brand. Applies to credit, debit, gift, and payment cards + CardBrand brand?; +}; + +# The create plan request details +public type PlanRequestPOST record { + # Indicates whether you can subscribe to this plan by providing a quantity for the goods or service + @jsondata:Name {value: "quantity_supported"} + boolean quantitySupported = false; + @jsondata:Name {value: "payment_preferences"} + PaymentPreferences paymentPreferences; + # The ID of the product created through Catalog Products API + @jsondata:Name {value: "product_id"} + string productId; + # The plan name + @constraint:String {maxLength: 127, minLength: 1} + string name; + # An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle + @jsondata:Name {value: "billing_cycles"} + BillingCycle[] billingCycles; + # The detailed description of the plan + @constraint:String {maxLength: 127, minLength: 1} + string description?; + # The tax details + Taxes taxes?; + # The initial state of the plan. Allowed input values are CREATED and ACTIVE + "CREATED"|"INACTIVE"|"ACTIVE" status = "ACTIVE"; +}; + +# The stand-alone date, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard `date_time` type. This regular expression does not validate all dates. For example, February 31 is valid and nothing is known about leap years +@constraint:String {maxLength: 10, minLength: 10, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$`} +public type DateNoTime string; + +# The customer and merchant payment preferences +public type PaymentMethod record { + # The customer-selected payment method on the merchant site + @jsondata:Name {value: "payer_selected"} + string payerSelected = "PAYPAL"; + @jsondata:Name {value: "payee_preferred"} + PayeePaymentMethodPreference payeePreferred?; + # NACHA (the regulatory body governing the ACH network) requires that API callers (merchants, partners) obtain the consumer’s explicit authorization before initiating a transaction. To stay compliant, you’ll need to make sure that you retain a compliant authorization for each transaction that you originate to the ACH Network using this API. ACH transactions are categorized (using SEC codes) by how you capture authorization from the Receiver (the person whose bank account is being debited or credited). PayPal supports the following SEC codes + @jsondata:Name {value: "standard_entry_class_code"} + "TEL"|"WEB"|"CCD"|"PPD" standardEntryClassCode = "WEB"; +}; + +# The subscriber request information +public type SubscriberRequest record { + *Payer; + *SubscriberRequestAllOf2; +}; + +# The status of a captured payment +public type CaptureStatus record { + @jsondata:Name {value: "status_details"} + CaptureStatusDetails statusDetails?; + # The status of the captured payment + "COMPLETED"|"DECLINED"|"PARTIALLY_REFUNDED"|"PENDING"|"REFUNDED" status?; +}; + +# The JSON patch object to apply partial updates to resources +public type Patch record { + # The operation + "add"|"remove"|"replace"|"move"|"copy"|"test" op; + # The JSON Pointer to the target document location at which to complete the operation + string path?; + # The JSON Pointer to the target document location from which to move the value. Required for the move operation + string 'from?; + # The value to apply. The remove operation does not require a value + anydata value?; +}; + +# The details for the failed payment of the subscription +public type FailedPaymentDetails record { + # The reason code for the payment failure + @jsondata:Name {value: "reason_code"} + "PAYMENT_DENIED"|"INTERNAL_SERVER_ERROR"|"PAYEE_ACCOUNT_RESTRICTED"|"PAYER_ACCOUNT_RESTRICTED"|"PAYER_CANNOT_PAY"|"SENDING_LIMIT_EXCEEDED"|"TRANSACTION_RECEIVING_LIMIT_EXCEEDED"|"CURRENCY_MISMATCH" reasonCode?; + # The currency and amount for a financial transaction, such as a balance or payment due + Money amount; + @jsondata:Name {value: "next_payment_retry_time"} + DateTime nextPaymentRetryTime?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ DateTime time; +}; + +# The request-related [HATEOAS link](/docs/api/reference/api-responses/#hateoas-links) information +public type LinkDescription record { + # The HTTP method required to make the related call + "GET"|"POST"|"PUT"|"DELETE"|"HEAD"|"CONNECT"|"OPTIONS"|"PATCH" method?; + # The [link relation type](https://tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](https://www.iana.org/assignments/link-relations/link-relations.xhtml) + string rel; + # The complete target URL. To make the related call, combine the method with this [URI Template-formatted](https://tools.ietf.org/html/rfc6570) link. For pre-processing, include the `$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call + string href; +}; + +# The shipping details +public type ShippingDetail record { + # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute) + AddressPortable address?; + # The name of the party + Name name?; + # The method by which the payer wants to get their items from the payee e.g shipping, in-person pickup. Either type or options but not both may be present + "SHIPPING"|"PICKUP_IN_PERSON" 'type?; +}; + +# Represents the Queries record for the operation: subscriptions.transactions +public type SubscriptionsTransactionsQueries record { + # The start time of the range of transactions to list + @http:Query {name: "start_time"} + string startTime; + # The end time of the range of transactions to list + @http:Query {name: "end_time"} + string endTime; +}; + +# The tax details +public type TaxesOverride record { + # Indicates whether the tax was already included in the billing amount + boolean inclusive?; + # The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99` + Percentage percentage?; +}; + +# Liability shift indicator. The outcome of the issuer's authentication +public type LiabilityShift "YES"|"NO"|"POSSIBLE"|"UNKNOWN"; + +# The breakdown details for the amount. Includes the gross, tax, fee, and shipping amounts +public type AmountWithBreakdown record { + @jsondata:Name {value: "shipping_amount"} + Money shippingAmount?; + @jsondata:Name {value: "tax_amount"} + Money taxAmount?; + @jsondata:Name {value: "fee_amount"} + Money feeAmount?; + @jsondata:Name {value: "total_item_amount"} + Money totalItemAmount?; + @jsondata:Name {value: "gross_amount"} + Money grossAmount; + @jsondata:Name {value: "net_amount"} + Money netAmount?; +}; + +# The currency and amount for a financial transaction, such as a balance or payment due +public type Money record { + # 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](/docs/integration/direct/rest/currency-codes/) + @constraint:String {maxLength: 32, pattern: re `^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$`} + string value; + @jsondata:Name {value: "currency_code"} + CurrencyCode currencyCode; +}; + +# The [language tag](https://tools.ietf.org/html/bcp47#section-2) for the language in which to localize the error-related strings, such as messages, issues, and suggested actions. The tag is made up of the [ISO 639-2 language code](https://www.loc.gov/standards/iso639-2/php/code_list.php), the optional [ISO-15924 script tag](https://www.unicode.org/iso15924/codelists.html), and the [ISO-3166 alpha-2 country code](/docs/integration/direct/rest/country-codes/) +@constraint:String {maxLength: 10, minLength: 2, pattern: re `^[a-z]{2}(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}))?$`} +public type Language string; + +# The details for the last payment +public type LastPaymentDetails LastPaymentDetailsAllOf1; + +# The phone number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en) +public type Phone record { + # The country calling code (CC), in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the CC and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN) + @jsondata:Name {value: "country_code"} + string countryCode; + # The extension number + @jsondata:Name {value: "extension_number"} + string extensionNumber?; + # The national number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the country calling code (CC) and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN) + @jsondata:Name {value: "national_number"} + string nationalNumber; +}; + +# The activate subscription request details +public type SubscriptionActivateRequest record { + # The reason for activation of a subscription. Required to reactivate the subscription + @constraint:String {maxLength: 128, minLength: 1} + string reason?; +}; + +# Represents the Headers record for the operation: subscriptions.capture +public type SubscriptionsCaptureHeaders record { + # The server stores keys for 72 hours + @http:Header {name: "PayPal-Request-Id"} + string payPalRequestId?; +}; + +# The [two-character ISO 3166-1 code](/docs/integration/direct/rest/country-codes/) that identifies the country or region.
Note: The country code for Great Britain is GB and not UK as used in the top-level domain names for that country. Use the `C2` country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border transactions.
+@constraint:String {maxLength: 2, minLength: 2, pattern: re `^([A-Z]{2}|C2)$`} +public type CountryCode string; + +# The pricing tier details +public type PricingTier record { + # The starting quantity for the tier + @jsondata:Name {value: "starting_quantity"} + string startingQuantity; + # The currency and amount for a financial transaction, such as a balance or payment due + Money amount; + # The ending quantity for the tier. Optional for the last tier + @jsondata:Name {value: "ending_quantity"} + string endingQuantity?; +}; + +# The customer who approves and pays for the order. The customer is also known as the payer +public type PayerBase record { + @jsondata:Name {value: "email_address"} + Email emailAddress?; + @jsondata:Name {value: "payer_id"} + AccountId payerId?; +}; + +public type SubscriberRequestAllOf2 record { + # The shipping details + ShippingDetail shipping_address?; + # The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (https://www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions + PaymentSource payment_source?; +}; + +# The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99` +@constraint:String {pattern: re `^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$`} +public type Percentage string; + +# The non-portable additional address details that are sometimes needed for compliance, risk, or other scenarios where fine-grain address information might be needed. Not portable with common third party and open source. Redundant with core fields.
For example, `address_portable.address_line_1` is usually a combination of `address_details.street_number`, `street_name`, and `street_type` +public type AddressDetails record { + # A named locations that represents the premise. Usually a building name or number or collection of buildings with a common name or number. For example, Craven House + @jsondata:Name {value: "building_name"} + string buildingName?; + # The street number + @jsondata:Name {value: "street_number"} + string streetNumber?; + # The street type. For example, avenue, boulevard, road, or expressway + @jsondata:Name {value: "street_type"} + string streetType?; + # The first-order entity below a named building or location that represents the sub-premises. Usually a single building within a collection of buildings with a common name. Can be a flat, story, floor, room, or apartment + @jsondata:Name {value: "sub_building"} + string subBuilding?; + # The delivery service. Post office box, bag number, or post office name + @jsondata:Name {value: "delivery_service"} + string deliveryService?; + # The street name. Just `Drury` in `Drury Lane` + @jsondata:Name {value: "street_name"} + string streetName?; +}; + +# Represents the Queries record for the operation: plans.list +public type PlansListQueries record { + # Filters the response by a Product ID + @http:Query {name: "product_id"} + string productId?; + # Filters the response by list of plan IDs. Filter supports upto 10 plan IDs + @http:Query {name: "plan_ids"} + string planIds?; + # A non-zero integer which is the start index of the entire list of items to return in the response. The combination of `page=1` and `page_size=20` returns the first 20 items. The combination of `page=2` and `page_size=20` returns the next 20 items + @constraint:Int {minValue: 1, maxValue: 100000} + int page = 1; + # Indicates whether to show the total count in the response + @http:Query {name: "total_required"} + boolean totalRequired = false; + # The number of items to return in the response + @http:Query {name: "page_size"} + int pageSize = 10; +}; + +# Represents the Headers record for the operation: plans.list +public type PlansListHeaders record { + # The preferred server response upon successful completion of the request. Value is:
  • return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links.
  • return=representation. The server returns a complete resource representation, including the current state of the resource.
+ @http:Header {name: "Prefer"} + string prefer = "return=minimal"; +}; + +# The plan details +public type Plan record { + # Indicates whether you can subscribe to this plan by providing a quantity for the goods or service + @jsondata:Name {value: "quantity_supported"} + boolean quantitySupported = false; + @jsondata:Name {value: "update_time"} + DateTime updateTime?; + @jsondata:Name {value: "create_time"} + DateTime createTime?; + @jsondata:Name {value: "payment_preferences"} + PaymentPreferences paymentPreferences?; + # The ID for the product + @jsondata:Name {value: "product_id"} + string productId?; + # The plan name + @constraint:String {maxLength: 127, minLength: 1} + string name?; + # An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle + @jsondata:Name {value: "billing_cycles"} + BillingCycle[] billingCycles?; + # The detailed description of the plan + @constraint:String {maxLength: 127, minLength: 1} + string description?; + # The tax details + Taxes taxes?; + # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links) + @constraint:Array {maxLength: 10, minLength: 1} + LinkDescription[] links?; + # The unique PayPal-generated ID for the plan + @constraint:String {maxLength: 50, minLength: 3} + string id?; + # The plan status + "CREATED"|"INACTIVE"|"ACTIVE" status?; +}; + +# The charge amount from the subscriber +public type SubscriptionCaptureRequest record { + # The reason or note for the subscription charge + @constraint:String {maxLength: 128, minLength: 1} + string note; + # The currency and amount for a financial transaction, such as a balance or payment due + Money amount; + # The type of capture + @jsondata:Name {value: "capture_type"} + "OUTSTANDING_BALANCE" captureType; +}; + +# Results of Authentication such as 3D Secure +public type AuthenticationResponse record { + @jsondata:Name {value: "liability_shift"} + LiabilityShift liabilityShift?; + @jsondata:Name {value: "three_d_secure"} + ThreeDSecureAuthenticationResponse threeDSecure?; +}; + +public type CardResponseWithBillingAddressAllOf2 record { + # The card holder's name as it appears on the card. + @constraint:String {maxLength: 300, minLength: 2} + string name?; + # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute) + AddressPortable billing_address?; + # The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6) + DateYearMonth expiry?; + # The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency + CurrencyCode currency_code?; +}; + +public type LastPaymentDetailsAllOf1 record { + # The currency and amount for a financial transaction, such as a balance or payment due + Money amount?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ DateTime time?; +}; + +# The subscription status details +public type SubscriptionStatus record { + # The reason or notes for the status of the subscription + @jsondata:Name {value: "status_change_note"} + string statusChangeNote?; + # The status of the subscription + "APPROVAL_PENDING"|"APPROVED"|"ACTIVE"|"SUSPENDED"|"CANCELLED"|"EXPIRED" status?; + @jsondata:Name {value: "status_update_time"} + DateTime statusUpdateTime?; +}; + +# The billing details for the subscription. If the subscription was or is active, these fields are populated +public type SubscriptionBillingInfo record { + @jsondata:Name {value: "final_payment_time"} + DateTime finalPaymentTime?; + # The trial and regular billing executions + @jsondata:Name {value: "cycle_executions"} + CycleExecution[] cycleExecutions?; + # The number of consecutive payment failures. Resets to `0` after a successful payment. If this reaches the `payment_failure_threshold` value, the subscription updates to the `SUSPENDED` state + @jsondata:Name {value: "failed_payments_count"} + int failedPaymentsCount; + @jsondata:Name {value: "next_billing_time"} + DateTime nextBillingTime?; + @jsondata:Name {value: "last_failed_payment"} + FailedPaymentDetails lastFailedPayment?; + @jsondata:Name {value: "outstanding_balance"} + Money outstandingBalance; + @jsondata:Name {value: "last_payment"} + LastPaymentDetails lastPayment?; +}; + +# The list of plans with details +public type PlanCollection record { + # An array of plans + @constraint:Array {maxLength: 32767} + Plan[] plans?; + # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links) + @constraint:Array {maxLength: 10, minLength: 1} + LinkDescription[] links?; + # The total number of pages + @jsondata:Name {value: "total_pages"} + int totalPages?; + # The total number of items + @jsondata:Name {value: "total_items"} + int totalItems?; +}; + +# The request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent +public type SubscriptionReviseRequest record { + @jsondata:Name {value: "shipping_amount"} + Money shippingAmount?; + # The quantity of the product or service in the subscription + @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} + string quantity?; + @jsondata:Name {value: "application_context"} + ApplicationContext applicationContext?; + @jsondata:Name {value: "shipping_address"} + ShippingDetail shippingAddress?; + # An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object + PlanOverride plan?; + # The unique PayPal-generated ID for the plan + @jsondata:Name {value: "plan_id"} + string planId?; +}; + +# The frequency of the billing cycle +public type Frequency record { + # The number of intervals after which a subscriber is billed. For example, if the `interval_unit` is `DAY` with an `interval_count` of `2`, the subscription is billed once every two days. The following table lists the maximum allowed values for the `interval_count` for each `interval_unit`:
Interval unitMaximum interval count
DAY365
WEEK52
MONTH12
YEAR1
+ @jsondata:Name {value: "interval_count"} + int intervalCount = 1; + # The interval at which the subscription is charged or billed + @jsondata:Name {value: "interval_unit"} + "DAY"|"WEEK"|"MONTH"|"YEAR" intervalUnit; +}; + +# The merchant-preferred payment methods +public type PayeePaymentMethodPreference "UNRESTRICTED"|"IMMEDIATE_PAYMENT_REQUIRED"; + +# Transactions status result identifier. The outcome of the issuer's authentication +public type ParesStatus "Y"|"N"|"U"|"A"|"C"|"R"|"D"|"I"; + +# The payment card used to fund the payment. Card can be a credit or debit card +public type CardResponseWithBillingAddress record { + *CardResponse; + *CardResponseWithBillingAddressAllOf2; +}; + +public type PayerAllOf2 record { + # The name of the party + Name name?; + # The phone information + PhoneWithType phone?; + # The stand-alone date, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard `date_time` type. This regular expression does not validate all dates. For example, February 31 is valid and nothing is known about leap years + DateNoTime birth_date?; + # The tax ID of the customer. The customer is also known as the payer. Both `tax_id` and `tax_id_type` are required + TaxInfo tax_info?; + # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute) + AddressPortable address?; +}; + +# The billing cycle details to override at subscription level. The subscription billing cycle definition has to adhere to the plan billing cycle definition +public type BillingCycleOverride record { + # The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle + @constraint:Int {minValue: 1, maxValue: 99} + int sequence; + # The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles) + @jsondata:Name {value: "total_cycles"} + int totalCycles?; + @jsondata:Name {value: "pricing_scheme"} + PricingScheme pricingScheme?; +}; + +# The regular and trial execution details for a billing cycle +public type CycleExecution record { + # The order in which to run this cycle among other billing cycles + @constraint:Int {minValue: 0, maxValue: 99} + int sequence; + # For a finite billing cycle, cycles_remaining is the number of remaining cycles. For an infinite billing cycle, cycles_remaining is set as 0 + @jsondata:Name {value: "cycles_remaining"} + int cyclesRemaining?; + # The type of the billing cycle + @jsondata:Name {value: "tenure_type"} + "REGULAR"|"TRIAL" tenureType; + # The number of billing cycles that have completed + @jsondata:Name {value: "cycles_completed"} + int cyclesCompleted; + # The active pricing scheme version for the billing cycle + @jsondata:Name {value: "current_pricing_scheme_version"} + int currentPricingSchemeVersion?; + # The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles) + @jsondata:Name {value: "total_cycles"} + int totalCycles?; +}; From 75035680e5e0f34e5490466d02f4e94eed8ae5ef Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 18 Jun 2025 13:24:11 +0530 Subject: [PATCH 08/56] [Automated] Update the toml files --- ballerina/Dependencies.toml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index a390fb3..488faf7 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -5,7 +5,7 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.12.0" +distribution-version = "2201.12.6" [[package]] org = "ballerina" @@ -231,6 +231,9 @@ dependencies = [ {org = "ballerina", name = "lang.value"}, {org = "ballerina", name = "observe"} ] +modules = [ + {org = "ballerina", packageName = "log", moduleName = "log"} +] [[package]] org = "ballerina" @@ -303,6 +306,9 @@ version = "2.7.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] +modules = [ + {org = "ballerina", packageName = "time", moduleName = "time"} +] [[package]] org = "ballerina" @@ -336,7 +342,9 @@ dependencies = [ {org = "ballerina", name = "data.jsondata"}, {org = "ballerina", name = "http"}, {org = "ballerina", name = "io"}, + {org = "ballerina", name = "log"}, {org = "ballerina", name = "test"}, + {org = "ballerina", name = "time"}, {org = "ballerina", name = "url"}, {org = "ballerinai", name = "observe"} ] From 4acf2b078b6725c0bb132e684a7d1e620a67195d Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 18 Jun 2025 13:24:37 +0530 Subject: [PATCH 09/56] Add tests for PayPal subscription management functions --- ballerina/tests/tests.bal | 126 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 ballerina/tests/tests.bal diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal new file mode 100644 index 0000000..6016212 --- /dev/null +++ b/ballerina/tests/tests.bal @@ -0,0 +1,126 @@ +import ballerina/http; +import ballerina/io; +import ballerina/test; +import ballerina/time; + +// Define configurable variables +configurable string serviceUrl = isLiveServer ? "https://api-m.sandbox.paypal.com/v1/billing" : "http://localhost:9090/v1/billing"; +configurable string clientId = ?; +configurable string clientSecret = ?; + +ConnectionConfig config = { + auth: { + tokenUrl: "https://api-m.sandbox.paypal.com/v1/oauth2/token", + clientId: clientId, + clientSecret: clientSecret + } +}; + +final Client paypal = check initClient(); + +function initClient() returns Client|error { + // Log the service URL and credentials for debugging + io:println("API URL: " + serviceUrl); + //io:println("Client ID: " + clientId); + //io:println("Client Secret: " + clientSecret); + + return new Client(config, serviceUrl); +} + +# Test to list all plans +@test:Config { + groups: ["live_tests", "mock_tests"], + dependsOn: [testCreatePlan] +} +function testListPlans() returns error? { + PlanCollection response = check paypal->/plans.get(); + // io:println("List Plans Response: " + response.toString()); + test:assertTrue(response?.plans !is ()); + +} + +// Function to create a product +function createProduct() returns string|error { + // Generate timestamp for unique ID + time:Utc currentTime = time:utcNow(); + int timestamp = currentTime[0]; // This gives you Unix timestamp like 1750142621 + + // Create HTTP client for PayPal API + http:Client productClient = check new ("https://api-m.sandbox.paypal.com/v1/catalogs", config = { + auth: { + tokenUrl: "https://api-m.sandbox.paypal.com/v1/oauth2/token", + clientId: clientId, + clientSecret: clientSecret + } + }); + + // Make API call to create product + http:Response response = check productClient->/products.post({ + "id": timestamp.toString(), // Convert int to string + name: "T-Shirt", + "type": "PHYSICAL", + description: "Cotton XL", + category: "CLOTHING", + image_url: string `https://example.com/gallery/images/${timestamp}.jpg`, + home_url: string `https://example.com/catalog/${timestamp}.jpg` + }); + + json responseJson = check response.getJsonPayload(); + string productId = check responseJson.id; + // io:println("Created Product ID: " + productId); + return productId; +} + +# Test to create a new plan +@test:Config { + groups: ["live_tests", "mock_tests"] +} +function testCreatePlan() returns error? { + string productId = check createProduct(); + + PlanRequestPOST payload = { + productId: productId, + name: "Fresh Clean Tees Plan", + status: "ACTIVE", + billingCycles: [ + { + frequency: { + intervalUnit: "MONTH", + intervalCount: 1 + }, + tenureType: "TRIAL", + sequence: 1, + totalCycles: 1, + pricingScheme: { + fixedPrice: { + value: "1", + currencyCode: "USD" + } + } + }, + { + frequency: { + intervalUnit: "MONTH", + intervalCount: 1 + }, + tenureType: "REGULAR", + sequence: 2, + totalCycles: 12, + pricingScheme: { + fixedPrice: { + value: "44", + currencyCode: "USD" + } + } + } + ], + paymentPreferences: { + autoBillOutstanding: true, + setupFeeFailureAction: "CONTINUE", + paymentFailureThreshold: 3 + } + }; + Plan createdPlan = check paypal->/plans.post(payload); + //io:println("Created Plan: ", createdPlan.toString()); + test:assertTrue(createdPlan.id is string, "Created plan should have an ID"); +} From a3a2b81eee0bd76f0d8bc3da949eff3936f49635 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 18 Jun 2025 13:34:23 +0530 Subject: [PATCH 10/56] Implement mock service for billing plans with GET and POST endpoints --- ballerina/tests/mock_service.bal | 86 ++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 ballerina/tests/mock_service.bal diff --git a/ballerina/tests/mock_service.bal b/ballerina/tests/mock_service.bal new file mode 100644 index 0000000..f616ea2 --- /dev/null +++ b/ballerina/tests/mock_service.bal @@ -0,0 +1,86 @@ +import ballerina/http; +import ballerina/log; + +configurable boolean isLiveServer = ?; + +listener http:Listener httpListener = new (9090); + +http:Service mockService = service object { + + # List plans + # + # + return - A successful request returns the HTTP 200 OK status code with a JSON response body that lists billing plans + resource function get plans() returns PlanCollection|error { + return { + plans: [ + { + name: "Basic Plan", + id: "P-1234567890", + status: "ACTIVE", + "product_id": "PROD-1234567890", + "billing_cycles": [ + { + sequence: 1, + tenure_type: "REGULAR", + total_cycles: 0, + frequency: {interval_unit: "MONTH", interval_count: 1}, + pricing_scheme: {fixed_price: {currency_code: "USD", value: "10.00"}} + } + ], + "payment_preferences": { + auto_bill_outstanding: true, + setup_fee: {currency_code: "USD", value: "0.00"}, + setup_fee_failure_action: "CANCEL", + payment_failure_threshold: 3 + }, + "create_time": "2025-06-16T10:53:00Z", + links: [{href: "/v1/billing/plans/P-1234567890", rel: "self", method: "GET"}] + } + ], + "total_items": 1, + "total_pages": 1, + links: [{href: "/v1/billing/plans?page=1", rel: "self", method: "GET"}] + }; + } + + # Create plan + # + # + payload - The plan request payload + # + return - A successful request returns the HTTP 200 OK status code with a JSON response body that shows billing plan details + resource function post plans(@http:Payload PlanRequestPOST payload) returns Plan|error { + return { + name: payload.name, + id: "P-1234567890", + status: payload.status, + productId: payload.productId, + "billing_cycles": [ + { + sequence: 1, + tenure_type: "REGULAR", + total_cycles: 0, + frequency: {interval_unit: "MONTH", interval_count: 1}, + pricing_scheme: {fixed_price: {currency_code: "USD", value: "10.00"}} + } + ], + "payment_preferences": { + auto_bill_outstanding: true, + setup_fee: {currency_code: "USD", value: "0.00"}, + setup_fee_failure_action: "CANCEL", + payment_failure_threshold: 3 + }, + "create_time": "2025-06-16T10:53:00Z", + links: [{href: "/v1/billing/plans/P-1234567890", rel: "self", method: "GET"}] + }; + } + +}; + +function init() returns error? { + if isLiveServer { + log:printInfo("Skipping mock server initialization as the tests are running on live server"); + return; + } + log:printInfo("Initiating mock server"); + check httpListener.attach(mockService, "/v1/billing"); + check httpListener.'start(); +} From 1b60dc68b4fd655829ff0f9f924dbc9410662ecf Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 18 Jun 2025 13:38:33 +0530 Subject: [PATCH 11/56] Add temporary product ID return for non-live server in createProduct function --- ballerina/tests/tests.bal | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index 6016212..1fed4a9 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -41,6 +41,9 @@ function testListPlans() returns error? { // Function to create a product function createProduct() returns string|error { + if !isLiveServer { + return "PRD-TEMP"; + } // Generate timestamp for unique ID time:Utc currentTime = time:utcNow(); int timestamp = currentTime[0]; // This gives you Unix timestamp like 1750142621 From 243e4a5861ba412f5840592c57faf7a98d56c67e Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 18 Jun 2025 13:40:17 +0530 Subject: [PATCH 12/56] Fix JSON key formatting in createProduct function --- ballerina/tests/tests.bal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index 1fed4a9..b11b932 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -59,7 +59,7 @@ function createProduct() returns string|error { // Make API call to create product http:Response response = check productClient->/products.post({ - "id": timestamp.toString(), // Convert int to string + id: timestamp.toString(), // Convert int to string name: "T-Shirt", "type": "PHYSICAL", description: "Cotton XL", From c250c8403be2b9ec9434d70eb771caa1738c882b Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 18 Jun 2025 13:59:29 +0530 Subject: [PATCH 13/56] Add GET endpoint to retrieve billing plan details by ID --- ballerina/tests/mock_service.bal | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/ballerina/tests/mock_service.bal b/ballerina/tests/mock_service.bal index f616ea2..f111fe0 100644 --- a/ballerina/tests/mock_service.bal +++ b/ballerina/tests/mock_service.bal @@ -73,6 +73,35 @@ http:Service mockService = service object { }; } + # Get plan by ID + # + planId - The ID of the plan to retrieve + # + return - A successful request returns the HTTP 200 OK status code with a JSON response body that shows billing plan details + resource function get plans/[string planId]() returns Plan|error { + return { + name: "Basic Plan", + id: planId, // Return the same plan ID that was requested + status: "ACTIVE", + "product_id": "PROD-1234567890", + "billing_cycles": [ + { + sequence: 1, + tenure_type: "REGULAR", + total_cycles: 0, + frequency: {interval_unit: "MONTH", interval_count: 1}, + pricing_scheme: {fixed_price: {currency_code: "USD", value: "10.00"}} + } + ], + "payment_preferences": { + auto_bill_outstanding: true, + setup_fee: {currency_code: "USD", value: "0.00"}, + setup_fee_failure_action: "CANCEL", + payment_failure_threshold: 3 + }, + "create_time": "2025-06-16T10:53:00Z", + links: [{href: string `/v1/billing/plans/${planId}`, rel: "self", method: "GET"}] + }; + } + }; function init() returns error? { From 7e67d4962d95f6852de391cb817d11f004357305 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 18 Jun 2025 14:00:09 +0530 Subject: [PATCH 14/56] Add test for retrieving a specific billing plan by ID --- ballerina/tests/tests.bal | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index b11b932..19cc9f1 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -7,6 +7,7 @@ import ballerina/time; configurable string serviceUrl = isLiveServer ? "https://api-m.sandbox.paypal.com/v1/billing" : "http://localhost:9090/v1/billing"; configurable string clientId = ?; configurable string clientSecret = ?; +string testPlanId = ""; ConnectionConfig config = { auth: { @@ -126,4 +127,17 @@ function testCreatePlan() returns error? { Plan createdPlan = check paypal->/plans.post(payload); //io:println("Created Plan: ", createdPlan.toString()); test:assertTrue(createdPlan.id is string, "Created plan should have an ID"); + testPlanId = createdPlan.id; } + +# Test to get a specific plan +@test:Config { + groups: ["live_tests", "mock_tests"], + dependsOn: [testCreatePlan] +} +function testGetPlan() returns error? { + Plan plan = check paypal->/plans/[testPlanId].get(); + // io:println("Retrieved Plan: ", plan.toString()); + test:assertEquals(plan.id, testPlanId, "Retrieved plan ID should match the requested ID"); +} + From ddda3f9b613ee1cdc6d903be6e2c164f230c1a5c Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 18 Jun 2025 17:31:31 +0530 Subject: [PATCH 15/56] Update billing plan ID in post plans function and add patch plans endpoint --- ballerina/tests/mock_service.bal | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ballerina/tests/mock_service.bal b/ballerina/tests/mock_service.bal index f111fe0..990f84f 100644 --- a/ballerina/tests/mock_service.bal +++ b/ballerina/tests/mock_service.bal @@ -50,7 +50,7 @@ http:Service mockService = service object { resource function post plans(@http:Payload PlanRequestPOST payload) returns Plan|error { return { name: payload.name, - id: "P-1234567890", + id: "P-20250618", status: payload.status, productId: payload.productId, "billing_cycles": [ @@ -102,6 +102,17 @@ http:Service mockService = service object { }; } + # Update plan by ID + # + # + planId - The ID of the plan to update + # + payload - The plan request payload + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource function patch plans/[string planId](@http:Payload PatchRequest payload) returns http:Ok|error? { + log:printInfo("Mock service received patch request for plan ID: " + planId); + log:printInfo("Patch payload: " + payload.toString()); + return {}; + } + }; function init() returns error? { From 0fd8e95f0cc2fd9a6458fa22868e41dbfc7d54e2 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 18 Jun 2025 17:32:10 +0530 Subject: [PATCH 16/56] Add test for updating a billing plan with patch request --- ballerina/tests/tests.bal | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index 19cc9f1..7b9d340 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -141,3 +141,22 @@ function testGetPlan() returns error? { test:assertEquals(plan.id, testPlanId, "Retrieved plan ID should match the requested ID"); } +# Test to update a plan +@test:Config { + groups: ["live_tests", "mock_tests"], + dependsOn: [testCreatePlan] +} +function testUpdatePlan() returns error? { + PatchRequest payload = + [ + { + op: "replace", + path: "/name", + value: "Updated Fresh Clean Tees Plan" + } + ]; + + error? response = check paypal->/plans/[testPlanId].patch(payload); + test:assertTrue(response is (), "Response should be empty on successful patch"); +} + From b1a60a29db025759b31c1066b8819bc43d5cfa6e Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Thu, 19 Jun 2025 10:25:42 +0530 Subject: [PATCH 17/56] Add tests for plan activation, deactivation, and pricing scheme updates --- ballerina/tests/tests.bal | 70 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index 7b9d340..37bf8f3 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -2,6 +2,7 @@ import ballerina/http; import ballerina/io; import ballerina/test; import ballerina/time; +import ballerina/toml; // Define configurable variables configurable string serviceUrl = isLiveServer ? "https://api-m.sandbox.paypal.com/v1/billing" : "http://localhost:9090/v1/billing"; @@ -28,6 +29,8 @@ function initClient() returns Client|error { return new Client(config, serviceUrl); } +# # Test cases for PayPal Billing Plans API +# # Test to list all plans @test:Config { groups: ["live_tests", "mock_tests"], @@ -125,7 +128,7 @@ function testCreatePlan() returns error? { } }; Plan createdPlan = check paypal->/plans.post(payload); - //io:println("Created Plan: ", createdPlan.toString()); + io:println("Plan created successfully: ", createdPlan.id); test:assertTrue(createdPlan.id is string, "Created plan should have an ID"); testPlanId = createdPlan.id; } @@ -137,14 +140,16 @@ function testCreatePlan() returns error? { } function testGetPlan() returns error? { Plan plan = check paypal->/plans/[testPlanId].get(); - // io:println("Retrieved Plan: ", plan.toString()); test:assertEquals(plan.id, testPlanId, "Retrieved plan ID should match the requested ID"); + io:println("Retrieved Plan: ", plan.toString()); } # Test to update a plan @test:Config { groups: ["live_tests", "mock_tests"], - dependsOn: [testCreatePlan] + dependsOn: [testCreatePlan], + after: testGetPlan + } function testUpdatePlan() returns error? { PatchRequest payload = @@ -158,5 +163,64 @@ function testUpdatePlan() returns error? { error? response = check paypal->/plans/[testPlanId].patch(payload); test:assertTrue(response is (), "Response should be empty on successful patch"); + io:println("Plan updated successfully: " + testPlanId); +} + +# Test to deactivate a plan + +@test:Config { + groups: ["live_tests", "mock_tests"], + dependsOn: [testCreatePlan], + after: testGetPlan +} +function testDeactivatePlan() returns error? { + error? response = check paypal->/plans/[testPlanId]/deactivate.post(); + test:assertTrue(response is (), "Response should be empty on successful deactivation"); + io:println("Plan deactivated successfully: " + testPlanId); } +# Test to activate a plan +@test:Config { + groups: ["live_tests", "mock_tests"], + dependsOn: [testCreatePlan, testDeactivatePlan], + after: testGetPlan +} +function testActivatePlan() returns error? { + error? response = check paypal->/plans/[testPlanId]/activate.post(); + test:assertTrue(response is (), "Response should be empty on successful activation"); + io:println("Plan activated successfully: " + testPlanId); +} + +# Test to update pricing schemes +@test:Config { + groups: ["live_tests", "mock_tests"], + dependsOn: [testCreatePlan, testGetPlan], + after: testGetPlan +} +function testUpdatePricingSchemes() returns error? { + UpdatePricingSchemesListRequest payload = { + pricingSchemes: [ + { + billingCycleSequence: 1, + pricingScheme: { + fixedPrice: { + value: "120", + currencyCode: "USD" + } + } + }, + { + billingCycleSequence: 2, + pricingScheme: { + fixedPrice: { + value: "555", + currencyCode: "USD" + } + } + } + ] + }; + error? response = check paypal->/plans/[testPlanId]/update\-pricing\-schemes.post(payload); + test:assertTrue(response is (), "Response should be empty on successful update of pricing schemes"); + io:println("Pricing schemes updated successfully for plan: " + testPlanId); +} From a1b48cfd5795405033949b572ba915dd4fb4cd76 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Thu, 19 Jun 2025 10:57:10 +0530 Subject: [PATCH 18/56] Enhance mock service with activate, deactivate, and update pricing functions --- ballerina/tests/mock_service.bal | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/ballerina/tests/mock_service.bal b/ballerina/tests/mock_service.bal index 990f84f..be49794 100644 --- a/ballerina/tests/mock_service.bal +++ b/ballerina/tests/mock_service.bal @@ -44,7 +44,7 @@ http:Service mockService = service object { } # Create plan - # + # + payload - The plan request payload # + return - A successful request returns the HTTP 200 OK status code with a JSON response body that shows billing plan details resource function post plans(@http:Payload PlanRequestPOST payload) returns Plan|error { @@ -74,6 +74,7 @@ http:Service mockService = service object { } # Get plan by ID + # # + planId - The ID of the plan to retrieve # + return - A successful request returns the HTTP 200 OK status code with a JSON response body that shows billing plan details resource function get plans/[string planId]() returns Plan|error { @@ -103,7 +104,6 @@ http:Service mockService = service object { } # Update plan by ID - # # + planId - The ID of the plan to update # + payload - The plan request payload # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body @@ -113,6 +113,34 @@ http:Service mockService = service object { return {}; } + # Deactivate plan + # + # + id - The ID of the subscription + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource function post plans/[string id]/deactivate() returns http:Ok|error { + log:printInfo("Mock service received deactivate request for plan ID: " + id); + return {}; + } + + # Activate plan + # + # + id - The ID of the subscription + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource function post plans/[string id]/activate() returns http:Ok|error { + log:printInfo("Mock service received activate request for plan ID: " + id); + return {}; + } + + # Update pricing + # + # + id - The ID of the subscription + # + payload - The request payload containing the pricing schemes to update + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource function post plans/[string id]/update\-pricing\-schemes(@http:Payload UpdatePricingSchemesListRequest payload) returns http:Ok|error { + log:printInfo("Mock service received update pricing request for plan ID: " + id); + log:printInfo("Update pricing payload: " + payload.toString()); + return {}; + } }; function init() returns error? { From 28e6eaa1453e1e2bb1e0de5fb498ca5cba7f124f Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Thu, 19 Jun 2025 17:17:54 +0530 Subject: [PATCH 19/56] regenerated client.bal and types.bal without align the specification, with sanitaization --- ballerina/client.bal | 87 ++- ballerina/types.bal | 1543 +++++++++++++++++++++--------------------- 2 files changed, 801 insertions(+), 829 deletions(-) diff --git a/ballerina/client.bal b/ballerina/client.bal index a138bcb..82c4dbe 100644 --- a/ballerina/client.bal +++ b/ballerina/client.bal @@ -7,7 +7,6 @@ import ballerina/http; # You can use billing plans and subscriptions to create subscriptions that process recurring PayPal payments for physical or digital goods, or services. A plan includes pricing and billing cycle information that defines the amount and frequency of charge for a subscription. You can also define a fixed plan, such as a $5 basic plan or a volume- or graduated-based plan with pricing tiers based on the quantity purchased. For more information, see Subscriptions Overview. public isolated client class Client { final http:Client clientEp; - # Gets invoked to initialize the `connector`. # # + config - The configurations to be used when initializing the `connector` @@ -22,8 +21,8 @@ public isolated client class Client { # # + headers - Headers to be sent with the request # + queries - Queries to be sent with the request - # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that lists billing plans - resource isolated function get plans(PlansListHeaders headers = {}, *PlansListQueries queries) returns PlanCollection|error { + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that lists billing plans. + resource isolated function get plans(PlansListHeaders headers = {}, *PlansListQueries queries) returns plan_collection|error { string resourcePath = string `/plans`; resourcePath = resourcePath + check getPathForQueryParam(queries); map httpHeaders = http:getHeaderMap(headers); @@ -33,8 +32,8 @@ public isolated client class Client { # Create plan # # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows billing plan details - resource isolated function post plans(PlanRequestPOST payload, PlansCreateHeaders headers = {}) returns Plan|error { + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows billing plan details. + resource isolated function post plans(plan_request_POST payload, PlansCreateHeaders headers = {}) returns plan|error { string resourcePath = string `/plans`; map httpHeaders = http:getHeaderMap(headers); http:Request request = new; @@ -45,20 +44,20 @@ public isolated client class Client { # Show plan details # - # + id - The ID of the subscription + # + id - The ID of the subscription. # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows plan details - resource isolated function get plans/[string id](map headers = {}) returns Plan|error { + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows plan details. + resource isolated function get plans/[string id](map headers = {}) returns plan|error { string resourcePath = string `/plans/${getEncodedUri(id)}`; return self.clientEp->get(resourcePath, headers); } # Update plan # - # + id - The ID of the subscription + # + id - The ID of the subscription. # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body - resource isolated function patch plans/[string id](PatchRequest payload, map headers = {}) returns error? { + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. + resource isolated function patch plans/[string id](patch_request payload, map headers = {}) returns error? { string resourcePath = string `/plans/${getEncodedUri(id)}`; http:Request request = new; json jsonBody = jsondata:toJson(payload); @@ -68,9 +67,9 @@ public isolated client class Client { # Activate plan # - # + id - The ID of the subscription + # + id - The ID of the subscription. # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. resource isolated function post plans/[string id]/activate(map headers = {}) returns error? { string resourcePath = string `/plans/${getEncodedUri(id)}/activate`; http:Request request = new; @@ -79,9 +78,9 @@ public isolated client class Client { # Deactivate plan # - # + id - The ID of the subscription + # + id - The ID of the subscription. # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. resource isolated function post plans/[string id]/deactivate(map headers = {}) returns error? { string resourcePath = string `/plans/${getEncodedUri(id)}/deactivate`; http:Request request = new; @@ -90,10 +89,10 @@ public isolated client class Client { # Update pricing # - # + id - The ID of the subscription + # + id - The ID of the subscription. # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body - resource isolated function post plans/[string id]/update\-pricing\-schemes(UpdatePricingSchemesListRequest payload, map headers = {}) returns error? { + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. + resource isolated function post plans/[string id]/update\-pricing\-schemes(update_pricing_schemes_list_request payload, map headers = {}) returns error? { string resourcePath = string `/plans/${getEncodedUri(id)}/update-pricing-schemes`; http:Request request = new; json jsonBody = jsondata:toJson(payload); @@ -104,8 +103,8 @@ public isolated client class Client { # Create subscription # # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details - resource isolated function post subscriptions(SubscriptionRequestPost payload, SubscriptionsCreateHeaders headers = {}) returns Subscription|error { + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. + resource isolated function post subscriptions(subscription_request_post payload, SubscriptionsCreateHeaders headers = {}) returns subscription|error { string resourcePath = string `/subscriptions`; map httpHeaders = http:getHeaderMap(headers); http:Request request = new; @@ -116,11 +115,11 @@ public isolated client class Client { # Show subscription details # - # + id - The ID of the subscription + # + id - The ID of the subscription. # + headers - Headers to be sent with the request # + queries - Queries to be sent with the request - # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details - resource isolated function get subscriptions/[string id](map headers = {}, *SubscriptionsGetQueries queries) returns Subscription|error { + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. + resource isolated function get subscriptions/[string id](map headers = {}, *SubscriptionsGetQueries queries) returns subscription|error { string resourcePath = string `/subscriptions/${getEncodedUri(id)}`; resourcePath = resourcePath + check getPathForQueryParam(queries); return self.clientEp->get(resourcePath, headers); @@ -128,10 +127,10 @@ public isolated client class Client { # Update subscription # - # + id - The ID of the subscription + # + id - The ID of the subscription. # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body - resource isolated function patch subscriptions/[string id](PatchRequest payload, map headers = {}) returns error? { + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. + resource isolated function patch subscriptions/[string id](patch_request payload, map headers = {}) returns error? { string resourcePath = string `/subscriptions/${getEncodedUri(id)}`; http:Request request = new; json jsonBody = jsondata:toJson(payload); @@ -141,10 +140,10 @@ public isolated client class Client { # Revise plan or quantity of subscription # - # + id - The ID of the subscription + # + id - The ID of the subscription. # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details - resource isolated function post subscriptions/[string id]/revise(SubscriptionReviseRequest payload, map headers = {}) returns SubscriptionReviseResponse|error { + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. + resource isolated function post subscriptions/[string id]/revise(subscription_revise_request payload, map headers = {}) returns subscription_revise_response|error { string resourcePath = string `/subscriptions/${getEncodedUri(id)}/revise`; http:Request request = new; json jsonBody = jsondata:toJson(payload); @@ -154,10 +153,10 @@ public isolated client class Client { # Suspend subscription # - # + id - The ID of the subscription + # + id - The ID of the subscription. # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body - resource isolated function post subscriptions/[string id]/suspend(SubscriptionSuspendRequest payload, map headers = {}) returns error? { + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. + resource isolated function post subscriptions/[string id]/suspend(subscription_suspend_request payload, map headers = {}) returns error? { string resourcePath = string `/subscriptions/${getEncodedUri(id)}/suspend`; http:Request request = new; json jsonBody = jsondata:toJson(payload); @@ -167,10 +166,10 @@ public isolated client class Client { # Cancel subscription # - # + id - The ID of the subscription + # + id - The ID of the subscription. # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body - resource isolated function post subscriptions/[string id]/cancel(SubscriptionCancelRequest payload, map headers = {}) returns error? { + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. + resource isolated function post subscriptions/[string id]/cancel(subscription_cancel_request payload, map headers = {}) returns error? { string resourcePath = string `/subscriptions/${getEncodedUri(id)}/cancel`; http:Request request = new; json jsonBody = jsondata:toJson(payload); @@ -180,10 +179,10 @@ public isolated client class Client { # Activate subscription # - # + id - The ID of the subscription + # + id - The ID of the subscription. # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body - resource isolated function post subscriptions/[string id]/activate(SubscriptionActivateRequest payload, map headers = {}) returns error? { + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. + resource isolated function post subscriptions/[string id]/activate(subscription_activate_request payload, map headers = {}) returns error? { string resourcePath = string `/subscriptions/${getEncodedUri(id)}/activate`; http:Request request = new; json jsonBody = jsondata:toJson(payload); @@ -193,10 +192,10 @@ public isolated client class Client { # Capture authorized payment on subscription # - # + id - The ID of the subscription + # + id - The ID of the subscription. # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details - resource isolated function post subscriptions/[string id]/capture(SubscriptionCaptureRequest payload, SubscriptionsCaptureHeaders headers = {}) returns Transaction|error? { + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. + resource isolated function post subscriptions/[string id]/capture(subscription_capture_request payload, SubscriptionsCaptureHeaders headers = {}) returns 'transaction|error? { string resourcePath = string `/subscriptions/${getEncodedUri(id)}/capture`; map httpHeaders = http:getHeaderMap(headers); http:Request request = new; @@ -207,11 +206,11 @@ public isolated client class Client { # List transactions for subscription # - # + id - The ID of the subscription + # + id - The ID of the subscription. # + headers - Headers to be sent with the request # + queries - Queries to be sent with the request - # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details - resource isolated function get subscriptions/[string id]/transactions(map headers = {}, *SubscriptionsTransactionsQueries queries) returns TransactionsList|error { + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. + resource isolated function get subscriptions/[string id]/transactions(map headers = {}, *SubscriptionsTransactionsQueries queries) returns transactions_list|error { string resourcePath = string `/subscriptions/${getEncodedUri(id)}/transactions`; resourcePath = resourcePath + check getPathForQueryParam(queries); return self.clientEp->get(resourcePath, headers); diff --git a/ballerina/types.bal b/ballerina/types.bal index 24eb601..e107464 100644 --- a/ballerina/types.bal +++ b/ballerina/types.bal @@ -2,7 +2,6 @@ // This file is auto-generated by the Ballerina OpenAPI tool. import ballerina/constraint; -import ballerina/data.jsondata; import ballerina/http; # OAuth2 Client Credentials Grant Configs @@ -12,278 +11,261 @@ public type OAuth2ClientCredentialsGrantConfig record {| string tokenUrl = "https://api-m.sandbox.paypal.com/v1/billing/v1/oauth2/token"; |}; -# The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
-@constraint:String {maxLength: 254} -public type Email string; - -# The account identifier for a PayPal account -@constraint:String {maxLength: 13, minLength: 13, pattern: re `^[2-9A-HJ-NP-Z]{13}$`} -public type AccountId string; +# Results of 3D Secure Authentication. +public type three_d_secure_authentication_response record { + # Transactions status result identifier. The outcome of the issuer's authentication. + pares_status authentication_status?; + # Status of Authentication eligibility. + enrolled enrollment_status?; +}; -# The response to a request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent -public type SubscriptionReviseResponse record { - *SubscriptionReviseRequest; - *SubscriptionReviseResponseAllOf2; +# The activate subscription request details. +public type subscription_activate_request record { + # The reason for activation of a subscription. Required to reactivate the subscription. + @constraint:String {maxLength: 128, minLength: 1} + string reason?; }; -# The update pricing scheme request details -public type UpdatePricingSchemeRequest record { - # The billing cycle sequence - @jsondata:Name {value: "billing_cycle_sequence"} - int billingCycleSequence; - @jsondata:Name {value: "pricing_scheme"} - PricingScheme pricingScheme; +# The tax details. +public type taxes record { + # The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99`. + percentage percentage; + # Indicates whether the tax was already included in the billing amount. + boolean inclusive = true; }; -# The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (https://www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions -public type PaymentSource record { - # The payment card to use to fund a payment. Can be a credit or debit card - Card card?; +# The payment card used to fund the payment. Card can be a credit or debit card. +public type card_response_with_billing_address record { + *card_response; + *CardResponseWithBillingAddressAllOf2; }; -# The card network or brand. Applies to credit, debit, gift, and payment cards -public type CardBrand "VISA"|"MASTERCARD"|"DISCOVER"|"AMEX"|"SOLO"|"JCB"|"STAR"|"DELTA"|"SWITCH"|"MAESTRO"|"CB_NATIONALE"|"CONFIGOGA"|"CONFIDIS"|"ELECTRON"|"CETELEM"|"CHINA_UNION_PAY"; +# The [language tag](https://tools.ietf.org/html/bcp47#section-2) for the language in which to localize the error-related strings, such as messages, issues, and suggested actions. The tag is made up of the [ISO 639-2 language code](https://www.loc.gov/standards/iso639-2/php/code_list.php), the optional [ISO-15924 script tag](https://www.unicode.org/iso15924/codelists.html), and the [ISO-3166 alpha-2 country code](/docs/integration/direct/rest/country-codes/). +@constraint:String {maxLength: 10, minLength: 2, pattern: re `^[a-z]{2}(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}))?$`} +public type language string; -# The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
-@constraint:String {maxLength: 64, minLength: 20, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$`} -public type DateTime string; +# The request-related [HATEOAS link](/docs/api/reference/api-responses/#hateoas-links) information. +public type link_description record { + # The complete target URL. To make the related call, combine the method with this [URI Template-formatted](https://tools.ietf.org/html/rfc6570) link. For pre-processing, include the `$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call. + string href; + # The [link relation type](https://tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](https://www.iana.org/assignments/link-relations/link-relations.xhtml). + string rel; + # The HTTP method required to make the related call. + "GET"|"POST"|"PUT"|"DELETE"|"HEAD"|"CONNECT"|"OPTIONS"|"PATCH" method?; +}; + +# The customer who approves and pays for the order. The customer is also known as the payer. +public type payer record { + *payer_base; + *PayerAllOf2; +}; public type TransactionAllOf2 record { # The PayPal-generated transaction ID. @constraint:String {maxLength: 50, minLength: 3} string id?; - # The breakdown details for the amount. Includes the gross, tax, fee, and shipping amounts - AmountWithBreakdown amount_with_breakdown?; - # The name of the party - Name payer_name?; + # The breakdown details for the amount. Includes the gross, tax, fee, and shipping amounts. + amount_with_breakdown amount_with_breakdown?; + # The name of the party. + name payer_name?; # The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
- EmailAddress payer_email?; + email_address payer_email?; # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- DateTime time?; + date_time time?; }; -# The name of the party -public type Name record { - # When the party is a person, the party's full name - @jsondata:Name {value: "full_name"} - string fullName?; - # The prefix, or title, to the party's name - @constraint:String {maxLength: 140} - string prefix?; - # When the party is a person, the party's surname or family name. Also known as the last name. Required when the party is a person. Use also to store multiple surnames including the matronymic, or mother's, surname - @constraint:String {maxLength: 140} - string surname?; - # When the party is a person, the party's given, or first, name - @jsondata:Name {value: "given_name"} - string givenName?; - # When the party is a person, the party's middle name. Use also to store multiple middle names including the patronymic, or father's, middle name - @jsondata:Name {value: "middle_name"} - string middleName?; - # The suffix for the party's name - @constraint:String {maxLength: 140} - string suffix?; - # DEPRECATED. The party's alternate name. Can be a business name, nickname, or any other name that cannot be split into first, last name. Required when the party is a business - @jsondata:Name {value: "alternate_full_name"} - string alternateFullName?; -}; - -# The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency -@constraint:String {maxLength: 3, minLength: 3} -public type CurrencyCode string; - -# The payment preferences for a subscription -public type PaymentPreferences record { - @jsondata:Name {value: "setup_fee"} - Money setupFee?; - # The action to take on the subscription if the initial payment for the setup fails - @jsondata:Name {value: "setup_fee_failure_action"} - "CONTINUE"|"CANCEL" setupFeeFailureAction = "CANCEL"; - # Indicates whether to automatically bill the outstanding amount in the next billing cycle - @jsondata:Name {value: "auto_bill_outstanding"} - boolean autoBillOutstanding = true; - # The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail - @jsondata:Name {value: "payment_failure_threshold"} - int paymentFailureThreshold = 0; -}; - -# Status of Authentication eligibility -public type Enrolled "Y"|"N"|"U"|"B"; - -# The list transactions for a subscription request details -public type TransactionsList record { - # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links) - @constraint:Array {maxLength: 10, minLength: 1} - LinkDescription[] links?; - # The total number of pages - @jsondata:Name {value: "total_pages"} - int totalPages?; - # An array of transactions - @constraint:Array {maxLength: 32767} - Transaction[] transactions?; - # The total number of items - @jsondata:Name {value: "total_items"} - int totalItems?; -}; - -# The application context, which customizes the payer experience during the subscription approval process with PayPal -public type ApplicationContext record { - # Configures the label name to `Continue` or `Subscribe Now` for subscription consent experience - @jsondata:Name {value: "user_action"} - "CONTINUE"|"SUBSCRIBE_NOW" userAction = "SUBSCRIBE_NOW"; - # The URL where the customer is redirected after the customer approves the payment - @jsondata:Name {value: "return_url"} - string returnUrl; - # The label that overrides the business name in the PayPal account on the PayPal site - @jsondata:Name {value: "brand_name"} - string brandName?; - # The [language tag](https://tools.ietf.org/html/bcp47#section-2) for the language in which to localize the error-related strings, such as messages, issues, and suggested actions. The tag is made up of the [ISO 639-2 language code](https://www.loc.gov/standards/iso639-2/php/code_list.php), the optional [ISO-15924 script tag](https://www.unicode.org/iso15924/codelists.html), and the [ISO-3166 alpha-2 country code](/docs/integration/direct/rest/country-codes/) - Language locale?; - # The URL where the customer is redirected after the customer cancels the payment - @jsondata:Name {value: "cancel_url"} - string cancelUrl; - # The location from which the shipping address is derived - @jsondata:Name {value: "shipping_preference"} - "GET_FROM_FILE"|"NO_SHIPPING"|"SET_PROVIDED_ADDRESS" shippingPreference = "GET_FROM_FILE"; - @jsondata:Name {value: "payment_method"} - PaymentMethod paymentMethod?; -}; - -# The phone information -public type PhoneWithType record { - @jsondata:Name {value: "phone_type"} - PhoneType phoneType?; - @jsondata:Name {value: "phone_number"} - Phone phoneNumber; -}; - -# The details of the captured payment status -public type CaptureStatusDetails record { - # The reason why the captured payment status is `PENDING` or `DENIED` - "BUYER_COMPLAINT"|"CHARGEBACK"|"ECHECK"|"INTERNATIONAL_WITHDRAWAL"|"OTHER"|"PENDING_REVIEW"|"RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION"|"REFUNDED"|"TRANSACTION_APPROVED_AWAITING_FUNDING"|"UNILATERAL"|"VERIFICATION_REQUIRED" reason?; +# The frequency of the billing cycle. +public type frequency record { + # The interval at which the subscription is charged or billed. + "DAY"|"WEEK"|"MONTH"|"YEAR" interval_unit; + # The number of intervals after which a subscriber is billed. For example, if the `interval_unit` is `DAY` with an `interval_count` of `2`, the subscription is billed once every two days. The following table lists the maximum allowed values for the `interval_count` for each `interval_unit`:
Interval unitMaximum interval count
DAY365
WEEK52
MONTH12
YEAR1
+ @constraint:Int {minValue: 1, maxValue: 365} + int interval_count = 1; +}; + +# The payment card to use to fund a payment. Card can be a credit or debit card. +public type card_response record { + # The last digits of the payment card. + @constraint:String {pattern: re `[0-9]{2,}`} + string last_digits?; + # The card network or brand. Applies to credit, debit, gift, and payment cards. + card_brand brand?; + # The payment card type. + "CREDIT"|"DEBIT"|"PREPAID"|"UNKNOWN" 'type?; + # Results of Authentication such as 3D Secure. + authentication_response authentication_result?; }; -# The subscriber response information -public type Subscriber record { - *Payer; - *SubscriberAllOf2; +# The JSON patch object to apply partial updates to resources. +public type patch record { + # The operation. + "add"|"remove"|"replace"|"move"|"copy"|"test" op; + # The JSON Pointer to the target document location at which to complete the operation. + string path?; + # The value to apply. The remove operation does not require a value. + anydata value?; + # The JSON Pointer to the target document location from which to move the value. Required for the move operation. + string 'from?; }; -# The tax ID of the customer. The customer is also known as the payer. Both `tax_id` and `tax_id_type` are required -public type TaxInfo record { - # The customer's tax ID type - @jsondata:Name {value: "tax_id_type"} - "BR_CPF"|"BR_CNPJ" taxIdType; - # The customer's tax ID value - @jsondata:Name {value: "tax_id"} - string taxId; -}; +# The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+@constraint:String {maxLength: 64, minLength: 20, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$`} +public type date_time string; -# The pricing scheme details -public type PricingScheme record { - # An array of pricing tiers which are used for billing volume/tiered plans. pricing_model field has to be specified - @constraint:Array {maxLength: 32, minLength: 1} - PricingTier[] tiers?; - @jsondata:Name {value: "update_time"} - DateTime updateTime?; - @jsondata:Name {value: "create_time"} - DateTime createTime?; - # The pricing model for tiered plan. The `tiers` parameter is required - @jsondata:Name {value: "pricing_model"} - "VOLUME"|"TIERED" pricingModel?; - @jsondata:Name {value: "fixed_price"} - Money fixedPrice?; - # The version of the pricing scheme +# The billing cycle details to override at subscription level. The subscription billing cycle definition has to adhere to the plan billing cycle definition. +public type billing_cycle_override record { + # The pricing scheme details. + pricing_scheme pricing_scheme?; + # The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle. + @constraint:Int {minValue: 1, maxValue: 99} + int sequence; + # The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles). @constraint:Int {minValue: 0, maxValue: 999} - int version?; + int total_cycles?; }; -# The payment source used to fund the payment -public type PaymentSourceResponse record { - # The payment card used to fund the payment. Card can be a credit or debit card - CardResponseWithBillingAddress card?; -}; +# The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99`. +@constraint:String {pattern: re `^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$`} +public type percentage string; -# An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object -public type PlanOverride record { - @jsondata:Name {value: "payment_preferences"} - PaymentPreferencesOverride paymentPreferences?; - # An array of billing cycles for trial billing and regular billing. The subscription billing cycle definition has to adhere to the plan billing cycle definition - @jsondata:Name {value: "billing_cycles"} - BillingCycleOverride[] billingCycles?; - # The tax details - TaxesOverride taxes?; +# The subscription status details. +public type subscription_status record { + # The status of the subscription. + "APPROVAL_PENDING"|"APPROVED"|"ACTIVE"|"SUSPENDED"|"CANCELLED"|"EXPIRED" status?; + # The reason or notes for the status of the subscription. + @constraint:String {maxLength: 128, minLength: 1} + string status_change_note?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ date_time status_update_time?; }; -# The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6) -@constraint:String {maxLength: 7, minLength: 7, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])$`} -public type DateYearMonth string; - -# The create subscription request details -public type SubscriptionRequestPost record { - @jsondata:Name {value: "shipping_amount"} - Money shippingAmount?; - @jsondata:Name {value: "start_time"} - DateTime startTime?; - # The quantity of the product in the subscription +# The pricing tier details. +public type pricing_tier record { + # The starting quantity for the tier. @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} - string quantity?; - # The subscriber request information - SubscriberRequest subscriber?; - # The custom id for the subscription. Can be invoice id - @jsondata:Name {value: "custom_id"} - string customId?; - @jsondata:Name {value: "application_context"} - ApplicationContext applicationContext?; - # An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object - PlanOverride plan?; - # The ID of the plan - @jsondata:Name {value: "plan_id"} - string planId; - # DEPRECATED. Indicates whether the subscription auto-renews after the billing cycles complete - # - # # Deprecated - @jsondata:Name {value: "auto_renewal"} - @deprecated - boolean autoRenewal = false; + string starting_quantity; + # The ending quantity for the tier. Optional for the last tier. + @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} + string ending_quantity?; + # The currency and amount for a financial transaction, such as a balance or payment due. + money amount; +}; + +# The billing cycle details. +public type billing_cycle record { + # The pricing scheme details. + pricing_scheme pricing_scheme?; + # The frequency of the billing cycle. + frequency frequency; + # The tenure type of the billing cycle. In case of a plan having trial cycle, only 2 trial cycles are allowed per plan. + "REGULAR"|"TRIAL" tenure_type; + # The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle. + @constraint:Int {minValue: 1, maxValue: 99} + int sequence; + # The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles). + @constraint:Int {minValue: 0, maxValue: 999} + int total_cycles = 1; +}; + +# The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (https://www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions. +public type payment_source record { + # The payment card to use to fund a payment. Can be a credit or debit card. + card card?; }; # Represents the Headers record for the operation: plans.create public type PlansCreateHeaders record { - # The server stores keys for 72 hours - @http:Header {name: "PayPal-Request-Id"} - string payPalRequestId?; + # The server stores keys for 72 hours. + string PayPal\-Request\-Id?; # The preferred server response upon successful completion of the request. Value is:
  • return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links.
  • return=representation. The server returns a complete resource representation, including the current state of the resource.
- @http:Header {name: "Prefer"} - string prefer = "return=minimal"; + string Prefer = "return=minimal"; }; public type SubscriberAllOf2 record { - # The shipping details - ShippingDetail shipping_address?; - # The payment source used to fund the payment - PaymentSourceResponse payment_source?; + # The shipping details. + shipping_detail shipping_address?; + # The payment source used to fund the payment. + payment_source_response payment_source?; }; -# The subscription details -public type Subscription record { - *SubscriptionStatus; - *SubscriptionAllOf2; +# The plan details. +public type plan record { + # The unique PayPal-generated ID for the plan. + @constraint:String {maxLength: 50, minLength: 3} + string id?; + # The ID for the product. + @constraint:String {maxLength: 50, minLength: 6} + string product_id?; + # The plan name. + @constraint:String {maxLength: 127, minLength: 1} + string name?; + # The plan status. + "CREATED"|"INACTIVE"|"ACTIVE" status?; + # The detailed description of the plan. + @constraint:String {maxLength: 127, minLength: 1} + string description?; + # An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle. + @constraint:Array {maxLength: 12, minLength: 1} + billing_cycle[] billing_cycles?; + # The payment preferences for a subscription. + payment_preferences payment_preferences?; + # The tax details. + taxes taxes?; + # Indicates whether you can subscribe to this plan by providing a quantity for the goods or service. + boolean quantity_supported = false; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ date_time create_time?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ date_time update_time?; + # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links). + @constraint:Array {maxLength: 10, minLength: 1} + link_description[] links?; }; -# The cancel subscription request details -public type SubscriptionCancelRequest record { - # The reason for the cancellation of a subscription - @constraint:String {maxLength: 128, minLength: 1} - string reason; +# The phone information. +public type phone_with_type record { + # The phone type. + phone_type phone_type?; + # The phone number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). + phone phone_number; }; # Represents the Queries record for the operation: subscriptions.get public type SubscriptionsGetQueries record { - # List of fields that are to be returned in the response. Possible value for fields are last_failed_payment and plan + # List of fields that are to be returned in the response. Possible value for fields are last_failed_payment and plan. @constraint:String {maxLength: 100, minLength: 1} string fields?; }; +# The pricing scheme details. +public type pricing_scheme record { + # The version of the pricing scheme. + @constraint:Int {minValue: 0, maxValue: 999} + int version?; + # The currency and amount for a financial transaction, such as a balance or payment due. + money fixed_price?; + # The pricing model for tiered plan. The `tiers` parameter is required. + "VOLUME"|"TIERED" pricing_model?; + # An array of pricing tiers which are used for billing volume/tiered plans. pricing_model field has to be specified. + @constraint:Array {maxLength: 32, minLength: 1} + pricing_tier[] tiers?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ date_time create_time?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ date_time update_time?; +}; + +# The customer and merchant payment preferences. +public type payment_method record { + # The customer-selected payment method on the merchant site. + @constraint:String {minLength: 1, pattern: re `^[0-9A-Z_]+$`} + string payer_selected = "PAYPAL"; + # The merchant-preferred payment methods. + payee_payment_method_preference payee_preferred?; + # NACHA (the regulatory body governing the ACH network) requires that API callers (merchants, partners) obtain the consumer’s explicit authorization before initiating a transaction. To stay compliant, you’ll need to make sure that you retain a compliant authorization for each transaction that you originate to the ACH Network using this API. ACH transactions are categorized (using SEC codes) by how you capture authorization from the Receiver (the person whose bank account is being debited or credited). PayPal supports the following SEC codes. + "TEL"|"WEB"|"CCD"|"PPD" standard_entry_class_code = "WEB"; +}; + # Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint. @display {label: "Connection Config"} public type ConnectionConfig record {| @@ -332,13 +314,7 @@ public type SubscriptionReviseResponseAllOf2 record { # Indicates whether the subscription has overridden any plan attributes. boolean plan_overridden?; # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links). - LinkDescription[] links?; -}; - -# The customer who approves and pays for the order. The customer is also known as the payer -public type Payer record { - *PayerBase; - *PayerAllOf2; + link_description[] links?; }; public type SubscriptionAllOf2 record { @@ -349,658 +325,655 @@ public type SubscriptionAllOf2 record { @constraint:String {maxLength: 50, minLength: 3} string plan_id?; # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- DateTime start_time?; + date_time start_time?; # The quantity of the product in the subscription. @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} string quantity?; - # The currency and amount for a financial transaction, such as a balance or payment due - Money shipping_amount?; - # The subscriber response information - Subscriber subscriber?; - # The billing details for the subscription. If the subscription was or is active, these fields are populated - SubscriptionBillingInfo billing_info?; + # The currency and amount for a financial transaction, such as a balance or payment due. + money shipping_amount?; + # The subscriber response information. + subscriber subscriber?; + # The billing details for the subscription. If the subscription was or is active, these fields are populated. + subscription_billing_info billing_info?; # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- DateTime create_time?; + date_time create_time?; # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- DateTime update_time?; + date_time update_time?; # The custom id for the subscription. Can be invoice id. @constraint:String {maxLength: 127, minLength: 1} string custom_id?; # Indicates whether the subscription has overridden any plan attributes. boolean plan_overridden?; - # The plan details - Plan plan?; + # The plan details. + plan plan?; # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links). - LinkDescription[] links?; + link_description[] links?; }; -# The billing cycle details -public type BillingCycle record { - # The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle - @constraint:Int {minValue: 1, maxValue: 99} - int sequence; - # The tenure type of the billing cycle. In case of a plan having trial cycle, only 2 trial cycles are allowed per plan - @jsondata:Name {value: "tenure_type"} - "REGULAR"|"TRIAL" tenureType; - # The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles) - @jsondata:Name {value: "total_cycles"} - int totalCycles = 1; - @jsondata:Name {value: "pricing_scheme"} - PricingScheme pricingScheme?; - # The frequency of the billing cycle - Frequency frequency; -}; - -# Results of 3D Secure Authentication -public type ThreeDSecureAuthenticationResponse record { - @jsondata:Name {value: "authentication_status"} - ParesStatus authenticationStatus?; - @jsondata:Name {value: "enrollment_status"} - Enrolled enrollmentStatus?; -}; - -# The suspend subscription request details -public type SubscriptionSuspendRequest record { - # The reason for suspenson of the subscription +# The create plan request details. +public type plan_request_POST record { + # The ID of the product created through Catalog Products API. + @constraint:String {maxLength: 50, minLength: 6} + string product_id; + # The plan name. + @constraint:String {maxLength: 127, minLength: 1} + string name; + # The initial state of the plan. Allowed input values are CREATED and ACTIVE. + "CREATED"|"INACTIVE"|"ACTIVE" status = "ACTIVE"; + # The detailed description of the plan. + @constraint:String {maxLength: 127, minLength: 1} + string description?; + # An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle. + @constraint:Array {maxLength: 12, minLength: 1} + billing_cycle[] billing_cycles; + # The payment preferences for a subscription. + payment_preferences payment_preferences; + # The tax details. + taxes taxes?; + # Indicates whether you can subscribe to this plan by providing a quantity for the goods or service. + boolean quantity_supported = false; +}; + +# The phone type. +public type phone_type "FAX"|"HOME"|"MOBILE"|"OTHER"|"PAGER"; + +# The merchant-preferred payment methods. +public type payee_payment_method_preference "UNRESTRICTED"|"IMMEDIATE_PAYMENT_REQUIRED"; + +# The subscriber response information. +public type subscriber record { + *payer; + *SubscriberAllOf2; +}; + +# The suspend subscription request details. +public type subscription_suspend_request record { + # The reason for suspenson of the subscription. @constraint:String {maxLength: 128, minLength: 1} string reason; }; -# An array of JSON patch objects to apply partial updates to resources -public type PatchRequest Patch[]; +# The details for the last payment. +public type last_payment_details LastPaymentDetailsAllOf1; -# The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute) -public type AddressPortable record { - @jsondata:Name {value: "country_code"} - CountryCode countryCode; - # 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`. Value, by country, is:
  • UK. A county.
  • US. A state.
  • Canada. A province.
  • Japan. A prefecture.
  • Switzerland. A kanton.
- @jsondata:Name {value: "admin_area_1"} - string adminArea1?; - # 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 - @jsondata:Name {value: "address_line_1"} - string addressLine1?; - # A sub-locality, suburb, neighborhood, or district. Smaller than `admin_area_level_2`. Value is:
  • Brazil. Suburb, bairro, or neighborhood.
  • India. Sub-locality or district. Street name information is not always available but a sub-locality or district can be a very small area.
- @jsondata:Name {value: "admin_area_3"} - string adminArea3?; - @jsondata:Name {value: "address_details"} - AddressDetails addressDetails?; - # A city, town, or village. Smaller than `admin_area_level_1` - @jsondata:Name {value: "admin_area_2"} - string adminArea2?; - # The third line of the address, if needed. For example, a street complement for Brazil, direction text, such as `next to Walmart`, or a landmark in an Indian address - @jsondata:Name {value: "address_line_3"} - string addressLine3?; - # The second line of the address. For example, suite or apartment number - @jsondata:Name {value: "address_line_2"} - string addressLine2?; - # The neighborhood, ward, or district. Smaller than `admin_area_level_3` or `sub_locality`. Value is:
  • The postal sorting code for Guernsey and many French territories, such as French Guiana.
  • The fine-grained administrative levels in China.
- @jsondata:Name {value: "admin_area_4"} - string adminArea4?; - # The postal code, which is the zip code or equivalent. Typically required for countries with a postal code or an equivalent. See [postal code](https://en.wikipedia.org/wiki/Postal_code) - @jsondata:Name {value: "postal_code"} - string postalCode?; -}; - -# The payment preferences to override at subscription level -public type PaymentPreferencesOverride record { - @jsondata:Name {value: "setup_fee"} - Money setupFee?; - # The action to take on the subscription if the initial payment for the setup fails - @jsondata:Name {value: "setup_fee_failure_action"} - "CONTINUE"|"CANCEL" setupFeeFailureAction?; - # Indicates whether to automatically bill the outstanding amount in the next billing cycle - @jsondata:Name {value: "auto_bill_outstanding"} - boolean autoBillOutstanding?; - # The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail - @jsondata:Name {value: "payment_failure_threshold"} - int paymentFailureThreshold?; +# The request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent. +public type subscription_revise_request record { + # The unique PayPal-generated ID for the plan. + @constraint:String {maxLength: 50, minLength: 3} + string plan_id?; + # The quantity of the product or service in the subscription. + @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} + string quantity?; + # The currency and amount for a financial transaction, such as a balance or payment due. + money shipping_amount?; + # The shipping details. + shipping_detail shipping_address?; + # The application context, which customizes the payer experience during the subscription approval process with PayPal. + application_context application_context?; + # An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object. + plan_override plan?; +}; + +# The shipping details. +public type shipping_detail record { + # The name of the party. + name name?; + # The method by which the payer wants to get their items from the payee e.g shipping, in-person pickup. Either type or options but not both may be present. + "SHIPPING"|"PICKUP_IN_PERSON" 'type?; + # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute). + address_portable address?; }; -# The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
-@constraint:String {maxLength: 254, minLength: 3, pattern: re `^.+@[^"\-].+$`} -public type EmailAddress string; +# The response to a request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent. +public type subscription_revise_response record { + *subscription_revise_request; + *SubscriptionReviseResponseAllOf2; +}; -# The payment card to use to fund a payment. Can be a credit or debit card -public type Card record { - # The primary account number (PAN) for the payment card - @constraint:String {maxLength: 19, minLength: 13} - string number; - # The three- or four-digit security code of the card. Also known as the CVV, CVC, CVN, CVE, or CID. This parameter cannot be present in the request when `payment_initiator=MERCHANT` - @jsondata:Name {value: "security_code"} - string securityCode?; - # The card holder's name as it appears on the card - @constraint:String {maxLength: 300} - string name?; - @jsondata:Name {value: "billing_address"} - AddressPortable billingAddress?; - # The PayPal-generated ID for the card - string id?; - # The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6) - DateYearMonth expiry; - @jsondata:Name {value: "card_type"} - CardBrand cardType?; - # The last digits of the payment card - @jsondata:Name {value: "last_digits"} - string lastDigits?; +# The tax details. +public type taxes_override record { + # The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99`. + percentage percentage?; + # Indicates whether the tax was already included in the billing amount. + boolean inclusive?; +}; + +# The details of the captured payment status. +public type capture_status_details record { + # The reason why the captured payment status is `PENDING` or `DENIED`. + "BUYER_COMPLAINT"|"CHARGEBACK"|"ECHECK"|"INTERNATIONAL_WITHDRAWAL"|"OTHER"|"PENDING_REVIEW"|"RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION"|"REFUNDED"|"TRANSACTION_APPROVED_AWAITING_FUNDING"|"UNILATERAL"|"VERIFICATION_REQUIRED" reason?; }; +# The [two-character ISO 3166-1 code](/docs/integration/direct/rest/country-codes/) that identifies the country or region.
Note: The country code for Great Britain is GB and not UK as used in the top-level domain names for that country. Use the `C2` country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border transactions.
+@constraint:String {maxLength: 2, minLength: 2, pattern: re `^([A-Z]{2}|C2)$`} +public type country_code string; + # Represents the Headers record for the operation: subscriptions.create public type SubscriptionsCreateHeaders record { - # The server stores keys for 72 hours - @http:Header {name: "PayPal-Request-Id"} - string payPalRequestId?; + # The server stores keys for 72 hours. + string PayPal\-Request\-Id?; # The preferred server response upon successful completion of the request. Value is:
  • return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links.
  • return=representation. The server returns a complete resource representation, including the current state of the resource.
- @http:Header {name: "Prefer"} - string prefer = "return=minimal"; + string Prefer = "return=minimal"; +}; + +# The tax ID of the customer. The customer is also known as the payer. Both `tax_id` and `tax_id_type` are required. +public type tax_info record { + # The customer's tax ID value. + @constraint:String {maxLength: 14} + string tax_id; + # The customer's tax ID type. + "BR_CPF"|"BR_CNPJ" tax_id_type; +}; + +# The phone number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). +public type phone record { + # The country calling code (CC), in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the CC and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN). + @constraint:String {maxLength: 3, minLength: 1, pattern: re `^[0-9]{1,3}?$`} + string country_code; + # The national number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the country calling code (CC) and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN). + @constraint:String {maxLength: 14, minLength: 1, pattern: re `^[0-9]{1,14}?$`} + string national_number; + # The extension number. + @constraint:String {maxLength: 15, minLength: 1, pattern: re `^[0-9]{1,15}?$`} + string extension_number?; +}; + +# The billing details for the subscription. If the subscription was or is active, these fields are populated. +public type subscription_billing_info record { + # The currency and amount for a financial transaction, such as a balance or payment due. + money outstanding_balance; + # The trial and regular billing executions. + @constraint:Array {maxLength: 3} + cycle_execution[] cycle_executions?; + # The details for the last payment. + last_payment_details last_payment?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ date_time next_billing_time?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ date_time final_payment_time?; + # The number of consecutive payment failures. Resets to `0` after a successful payment. If this reaches the `payment_failure_threshold` value, the subscription updates to the `SUSPENDED` state. + @constraint:Int {minValue: 0, maxValue: 999} + int failed_payments_count; + # The details for the failed payment of the subscription. + failed_payment_details last_failed_payment?; }; -# The tax details -public type Taxes record { - # Indicates whether the tax was already included in the billing amount - boolean inclusive = true; - # The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99` - Percentage percentage; +# Results of Authentication such as 3D Secure. +public type authentication_response record { + # Liability shift indicator. The outcome of the issuer's authentication. + liability_shift liability_shift?; + # Results of 3D Secure Authentication. + three_d_secure_authentication_response three_d_secure?; }; -# The update pricing scheme request details -public type UpdatePricingSchemesListRequest record { - # An array of pricing schemes - @jsondata:Name {value: "pricing_schemes"} - UpdatePricingSchemeRequest[] pricingSchemes; +# The name of the party. +public type name record { + # The prefix, or title, to the party's name. + @constraint:String {maxLength: 140} + string prefix?; + # When the party is a person, the party's given, or first, name. + @constraint:String {maxLength: 140} + string given_name?; + # When the party is a person, the party's surname or family name. Also known as the last name. Required when the party is a person. Use also to store multiple surnames including the matronymic, or mother's, surname. + @constraint:String {maxLength: 140} + string surname?; + # When the party is a person, the party's middle name. Use also to store multiple middle names including the patronymic, or father's, middle name. + @constraint:String {maxLength: 140} + string middle_name?; + # The suffix for the party's name. + @constraint:String {maxLength: 140} + string suffix?; + # DEPRECATED. The party's alternate name. Can be a business name, nickname, or any other name that cannot be split into first, last name. Required when the party is a business. + @constraint:String {maxLength: 300} + string alternate_full_name?; + # When the party is a person, the party's full name. + @constraint:String {maxLength: 300} + string full_name?; }; -# The phone type -public type PhoneType "FAX"|"HOME"|"MOBILE"|"OTHER"|"PAGER"; +# The application context, which customizes the payer experience during the subscription approval process with PayPal. +public type application_context record { + # The label that overrides the business name in the PayPal account on the PayPal site. + @constraint:String {maxLength: 127, minLength: 1} + string brand_name?; + # The [language tag](https://tools.ietf.org/html/bcp47#section-2) for the language in which to localize the error-related strings, such as messages, issues, and suggested actions. The tag is made up of the [ISO 639-2 language code](https://www.loc.gov/standards/iso639-2/php/code_list.php), the optional [ISO-15924 script tag](https://www.unicode.org/iso15924/codelists.html), and the [ISO-3166 alpha-2 country code](/docs/integration/direct/rest/country-codes/). + language locale?; + # The location from which the shipping address is derived. + "GET_FROM_FILE"|"NO_SHIPPING"|"SET_PROVIDED_ADDRESS" shipping_preference = "GET_FROM_FILE"; + # Configures the label name to `Continue` or `Subscribe Now` for subscription consent experience. + "CONTINUE"|"SUBSCRIBE_NOW" user_action = "SUBSCRIBE_NOW"; + # The customer and merchant payment preferences. + payment_method payment_method?; + # The URL where the customer is redirected after the customer approves the payment. + @constraint:String {maxLength: 4000, minLength: 10} + string return_url; + # The URL where the customer is redirected after the customer cancels the payment. + @constraint:String {maxLength: 4000, minLength: 10} + string cancel_url; +}; + +# The update pricing scheme request details. +public type update_pricing_schemes_list_request record { + # An array of pricing schemes. + @constraint:Array {maxLength: 99, minLength: 1} + update_pricing_scheme_request[] pricing_schemes; +}; + +# The payment card to use to fund a payment. Can be a credit or debit card. +public type card record { + # The PayPal-generated ID for the card. + string id?; + # The card holder's name as it appears on the card. + @constraint:String {maxLength: 300} + string name?; + # The primary account number (PAN) for the payment card. + @constraint:String {maxLength: 19, minLength: 13} + string number; + # The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). + date_year_month expiry; + # The three- or four-digit security code of the card. Also known as the CVV, CVC, CVN, CVE, or CID. This parameter cannot be present in the request when `payment_initiator=MERCHANT`. + @constraint:String {pattern: re `[0-9]{3,4}`} + string security_code?; + # The last digits of the payment card. + @constraint:String {pattern: re `[0-9]{2,}`} + string last_digits?; + # The card network or brand. Applies to credit, debit, gift, and payment cards. + card_brand card_type?; + # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute). + address_portable billing_address?; +}; + +# The customer who approves and pays for the order. The customer is also known as the payer. +public type payer_base record { + # The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
+ email email_address?; + # The account identifier for a PayPal account. + account_id payer_id?; +}; -# The transaction details -public type Transaction record { - *CaptureStatus; - *TransactionAllOf2; - DateTime time; - AmountWithBreakdown amount_with_breakdown; - string id; +# The regular and trial execution details for a billing cycle. +public type cycle_execution record { + # The type of the billing cycle. + "REGULAR"|"TRIAL" tenure_type; + # The order in which to run this cycle among other billing cycles. + @constraint:Int {minValue: 0, maxValue: 99} + int sequence; + # The number of billing cycles that have completed. + @constraint:Int {minValue: 0, maxValue: 9999} + int cycles_completed; + # For a finite billing cycle, cycles_remaining is the number of remaining cycles. For an infinite billing cycle, cycles_remaining is set as 0. + @constraint:Int {minValue: 0, maxValue: 9999} + int cycles_remaining?; + # The active pricing scheme version for the billing cycle. + @constraint:Int {minValue: 1, maxValue: 99} + int current_pricing_scheme_version?; + # The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles). + @constraint:Int {minValue: 0, maxValue: 999} + int total_cycles?; +}; + +# The payment preferences for a subscription. +public type payment_preferences record { + # Indicates whether to automatically bill the outstanding amount in the next billing cycle. + boolean auto_bill_outstanding = true; + # The currency and amount for a financial transaction, such as a balance or payment due. + money setup_fee?; + # The action to take on the subscription if the initial payment for the setup fails. + "CONTINUE"|"CANCEL" setup_fee_failure_action = "CANCEL"; + # The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail. + @constraint:Int {minValue: 0, maxValue: 999} + int payment_failure_threshold = 0; }; -# The payment card to use to fund a payment. Card can be a credit or debit card -public type CardResponse record { - @jsondata:Name {value: "authentication_result"} - AuthenticationResponse authenticationResult?; - # The payment card type - "CREDIT"|"DEBIT"|"PREPAID"|"UNKNOWN" 'type?; - # The last digits of the payment card - @jsondata:Name {value: "last_digits"} - string lastDigits?; - # The card network or brand. Applies to credit, debit, gift, and payment cards - CardBrand brand?; -}; - -# The create plan request details -public type PlanRequestPOST record { - # Indicates whether you can subscribe to this plan by providing a quantity for the goods or service - @jsondata:Name {value: "quantity_supported"} - boolean quantitySupported = false; - @jsondata:Name {value: "payment_preferences"} - PaymentPreferences paymentPreferences; - # The ID of the product created through Catalog Products API - @jsondata:Name {value: "product_id"} - string productId; - # The plan name - @constraint:String {maxLength: 127, minLength: 1} - string name; - # An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle - @jsondata:Name {value: "billing_cycles"} - BillingCycle[] billingCycles; - # The detailed description of the plan - @constraint:String {maxLength: 127, minLength: 1} - string description?; - # The tax details - Taxes taxes?; - # The initial state of the plan. Allowed input values are CREATED and ACTIVE - "CREATED"|"INACTIVE"|"ACTIVE" status = "ACTIVE"; +# The charge amount from the subscriber. +public type subscription_capture_request record { + # The reason or note for the subscription charge. + @constraint:String {maxLength: 128, minLength: 1} + string note; + # The type of capture. + "OUTSTANDING_BALANCE" capture_type; + # The currency and amount for a financial transaction, such as a balance or payment due. + money amount; }; -# The stand-alone date, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard `date_time` type. This regular expression does not validate all dates. For example, February 31 is valid and nothing is known about leap years -@constraint:String {maxLength: 10, minLength: 10, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$`} -public type DateNoTime string; - -# The customer and merchant payment preferences -public type PaymentMethod record { - # The customer-selected payment method on the merchant site - @jsondata:Name {value: "payer_selected"} - string payerSelected = "PAYPAL"; - @jsondata:Name {value: "payee_preferred"} - PayeePaymentMethodPreference payeePreferred?; - # NACHA (the regulatory body governing the ACH network) requires that API callers (merchants, partners) obtain the consumer’s explicit authorization before initiating a transaction. To stay compliant, you’ll need to make sure that you retain a compliant authorization for each transaction that you originate to the ACH Network using this API. ACH transactions are categorized (using SEC codes) by how you capture authorization from the Receiver (the person whose bank account is being debited or credited). PayPal supports the following SEC codes - @jsondata:Name {value: "standard_entry_class_code"} - "TEL"|"WEB"|"CCD"|"PPD" standardEntryClassCode = "WEB"; -}; - -# The subscriber request information -public type SubscriberRequest record { - *Payer; - *SubscriberRequestAllOf2; +# The list transactions for a subscription request details. +public type transactions_list record { + # An array of transactions. + @constraint:Array {maxLength: 32767} + 'transaction[] transactions?; + # The total number of items. + @constraint:Int {minValue: 0, maxValue: 500000000} + int total_items?; + # The total number of pages. + @constraint:Int {minValue: 0, maxValue: 100000000} + int total_pages?; + # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links). + @constraint:Array {maxLength: 10, minLength: 1} + link_description[] links?; }; -# The status of a captured payment -public type CaptureStatus record { - @jsondata:Name {value: "status_details"} - CaptureStatusDetails statusDetails?; - # The status of the captured payment - "COMPLETED"|"DECLINED"|"PARTIALLY_REFUNDED"|"PENDING"|"REFUNDED" status?; +# The cancel subscription request details. +public type subscription_cancel_request record { + # The reason for the cancellation of a subscription. + @constraint:String {maxLength: 128, minLength: 1} + string reason; }; -# The JSON patch object to apply partial updates to resources -public type Patch record { - # The operation - "add"|"remove"|"replace"|"move"|"copy"|"test" op; - # The JSON Pointer to the target document location at which to complete the operation - string path?; - # The JSON Pointer to the target document location from which to move the value. Required for the move operation - string 'from?; - # The value to apply. The remove operation does not require a value - anydata value?; +# The subscription details. +public type subscription record { + *subscription_status; + *SubscriptionAllOf2; }; -# The details for the failed payment of the subscription -public type FailedPaymentDetails record { - # The reason code for the payment failure - @jsondata:Name {value: "reason_code"} - "PAYMENT_DENIED"|"INTERNAL_SERVER_ERROR"|"PAYEE_ACCOUNT_RESTRICTED"|"PAYER_ACCOUNT_RESTRICTED"|"PAYER_CANNOT_PAY"|"SENDING_LIMIT_EXCEEDED"|"TRANSACTION_RECEIVING_LIMIT_EXCEEDED"|"CURRENCY_MISMATCH" reasonCode?; - # The currency and amount for a financial transaction, such as a balance or payment due - Money amount; - @jsondata:Name {value: "next_payment_retry_time"} - DateTime nextPaymentRetryTime?; - # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- DateTime time; +# An array of JSON patch objects to apply partial updates to resources. +public type patch_request patch[]; + +# The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency. +@constraint:String {maxLength: 3, minLength: 3} +public type currency_code string; + +# Represents the Queries record for the operation: subscriptions.transactions +public type SubscriptionsTransactionsQueries record { + # The start time of the range of transactions to list. + @constraint:String {maxLength: 64, minLength: 20, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$`} + string start_time; + # The end time of the range of transactions to list. + @constraint:String {maxLength: 64, minLength: 20, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$`} + string end_time; }; -# The request-related [HATEOAS link](/docs/api/reference/api-responses/#hateoas-links) information -public type LinkDescription record { - # The HTTP method required to make the related call - "GET"|"POST"|"PUT"|"DELETE"|"HEAD"|"CONNECT"|"OPTIONS"|"PATCH" method?; - # The [link relation type](https://tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](https://www.iana.org/assignments/link-relations/link-relations.xhtml) - string rel; - # The complete target URL. To make the related call, combine the method with this [URI Template-formatted](https://tools.ietf.org/html/rfc6570) link. For pre-processing, include the `$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call - string href; +# The update pricing scheme request details. +public type update_pricing_scheme_request record { + # The billing cycle sequence. + @constraint:Int {minValue: 1, maxValue: 99} + int billing_cycle_sequence; + # The pricing scheme details. + pricing_scheme pricing_scheme; }; -# The shipping details -public type ShippingDetail record { - # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute) - AddressPortable address?; - # The name of the party - Name name?; - # The method by which the payer wants to get their items from the payee e.g shipping, in-person pickup. Either type or options but not both may be present - "SHIPPING"|"PICKUP_IN_PERSON" 'type?; +# The details for the failed payment of the subscription. +public type failed_payment_details record { + # The currency and amount for a financial transaction, such as a balance or payment due. + money amount; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ date_time time; + # The reason code for the payment failure. + "PAYMENT_DENIED"|"INTERNAL_SERVER_ERROR"|"PAYEE_ACCOUNT_RESTRICTED"|"PAYER_ACCOUNT_RESTRICTED"|"PAYER_CANNOT_PAY"|"SENDING_LIMIT_EXCEEDED"|"TRANSACTION_RECEIVING_LIMIT_EXCEEDED"|"CURRENCY_MISMATCH" reason_code?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ date_time next_payment_retry_time?; }; -# Represents the Queries record for the operation: subscriptions.transactions -public type SubscriptionsTransactionsQueries record { - # The start time of the range of transactions to list - @http:Query {name: "start_time"} - string startTime; - # The end time of the range of transactions to list - @http:Query {name: "end_time"} - string endTime; +# The stand-alone date, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard `date_time` type. This regular expression does not validate all dates. For example, February 31 is valid and nothing is known about leap years. +@constraint:String {maxLength: 10, minLength: 10, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$`} +public type date_no_time string; + +# The payment preferences to override at subscription level. +public type payment_preferences_override record { + # Indicates whether to automatically bill the outstanding amount in the next billing cycle. + boolean auto_bill_outstanding?; + # The currency and amount for a financial transaction, such as a balance or payment due. + money setup_fee?; + # The action to take on the subscription if the initial payment for the setup fails. + "CONTINUE"|"CANCEL" setup_fee_failure_action?; + # The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail. + @constraint:Int {minValue: 0, maxValue: 999} + int payment_failure_threshold?; }; -# The tax details -public type TaxesOverride record { - # Indicates whether the tax was already included in the billing amount - boolean inclusive?; - # The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99` - Percentage percentage?; -}; - -# Liability shift indicator. The outcome of the issuer's authentication -public type LiabilityShift "YES"|"NO"|"POSSIBLE"|"UNKNOWN"; - -# The breakdown details for the amount. Includes the gross, tax, fee, and shipping amounts -public type AmountWithBreakdown record { - @jsondata:Name {value: "shipping_amount"} - Money shippingAmount?; - @jsondata:Name {value: "tax_amount"} - Money taxAmount?; - @jsondata:Name {value: "fee_amount"} - Money feeAmount?; - @jsondata:Name {value: "total_item_amount"} - Money totalItemAmount?; - @jsondata:Name {value: "gross_amount"} - Money grossAmount; - @jsondata:Name {value: "net_amount"} - Money netAmount?; -}; - -# The currency and amount for a financial transaction, such as a balance or payment due -public type Money record { - # 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](/docs/integration/direct/rest/currency-codes/) - @constraint:String {maxLength: 32, pattern: re `^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$`} - string value; - @jsondata:Name {value: "currency_code"} - CurrencyCode currencyCode; +# The subscriber request information . +public type subscriber_request record { + *payer; + *SubscriberRequestAllOf2; }; -# The [language tag](https://tools.ietf.org/html/bcp47#section-2) for the language in which to localize the error-related strings, such as messages, issues, and suggested actions. The tag is made up of the [ISO 639-2 language code](https://www.loc.gov/standards/iso639-2/php/code_list.php), the optional [ISO-15924 script tag](https://www.unicode.org/iso15924/codelists.html), and the [ISO-3166 alpha-2 country code](/docs/integration/direct/rest/country-codes/) -@constraint:String {maxLength: 10, minLength: 2, pattern: re `^[a-z]{2}(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}))?$`} -public type Language string; - -# The details for the last payment -public type LastPaymentDetails LastPaymentDetailsAllOf1; - -# The phone number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en) -public type Phone record { - # The country calling code (CC), in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the CC and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN) - @jsondata:Name {value: "country_code"} - string countryCode; - # The extension number - @jsondata:Name {value: "extension_number"} - string extensionNumber?; - # The national number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the country calling code (CC) and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN) - @jsondata:Name {value: "national_number"} - string nationalNumber; -}; - -# The activate subscription request details -public type SubscriptionActivateRequest record { - # The reason for activation of a subscription. Required to reactivate the subscription - @constraint:String {maxLength: 128, minLength: 1} - string reason?; +# An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object. +public type plan_override record { + # An array of billing cycles for trial billing and regular billing. The subscription billing cycle definition has to adhere to the plan billing cycle definition. + @constraint:Array {maxLength: 12, minLength: 1} + billing_cycle_override[] billing_cycles?; + # The payment preferences to override at subscription level. + payment_preferences_override payment_preferences?; + # The tax details. + taxes_override taxes?; }; +# Liability shift indicator. The outcome of the issuer's authentication. +public type liability_shift "YES"|"NO"|"POSSIBLE"|"UNKNOWN"; + +# The card network or brand. Applies to credit, debit, gift, and payment cards. +public type card_brand "VISA"|"MASTERCARD"|"DISCOVER"|"AMEX"|"SOLO"|"JCB"|"STAR"|"DELTA"|"SWITCH"|"MAESTRO"|"CB_NATIONALE"|"CONFIGOGA"|"CONFIDIS"|"ELECTRON"|"CETELEM"|"CHINA_UNION_PAY"; + # Represents the Headers record for the operation: subscriptions.capture public type SubscriptionsCaptureHeaders record { - # The server stores keys for 72 hours - @http:Header {name: "PayPal-Request-Id"} - string payPalRequestId?; + # The server stores keys for 72 hours. + string PayPal\-Request\-Id?; }; -# The [two-character ISO 3166-1 code](/docs/integration/direct/rest/country-codes/) that identifies the country or region.
Note: The country code for Great Britain is GB and not UK as used in the top-level domain names for that country. Use the `C2` country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border transactions.
-@constraint:String {maxLength: 2, minLength: 2, pattern: re `^([A-Z]{2}|C2)$`} -public type CountryCode string; +# Transactions status result identifier. The outcome of the issuer's authentication. +public type pares_status "Y"|"N"|"U"|"A"|"C"|"R"|"D"|"I"; -# The pricing tier details -public type PricingTier record { - # The starting quantity for the tier - @jsondata:Name {value: "starting_quantity"} - string startingQuantity; - # The currency and amount for a financial transaction, such as a balance or payment due - Money amount; - # The ending quantity for the tier. Optional for the last tier - @jsondata:Name {value: "ending_quantity"} - string endingQuantity?; +# The create subscription request details. +public type subscription_request_post record { + # The ID of the plan. + @constraint:String {maxLength: 50, minLength: 3} + string plan_id; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ date_time start_time?; + # The quantity of the product in the subscription. + @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} + string quantity?; + # The currency and amount for a financial transaction, such as a balance or payment due. + money shipping_amount?; + # The subscriber request information . + subscriber_request subscriber?; + # DEPRECATED. Indicates whether the subscription auto-renews after the billing cycles complete. + # + # # Deprecated + @deprecated + boolean auto_renewal = false; + # The application context, which customizes the payer experience during the subscription approval process with PayPal. + application_context application_context?; + # The custom id for the subscription. Can be invoice id. + @constraint:String {maxLength: 127, minLength: 1} + string custom_id?; + # An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object. + plan_override plan?; }; -# The customer who approves and pays for the order. The customer is also known as the payer -public type PayerBase record { - @jsondata:Name {value: "email_address"} - Email emailAddress?; - @jsondata:Name {value: "payer_id"} - AccountId payerId?; +# The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute). +public type address_portable record { + # 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. + @constraint:String {maxLength: 300} + string address_line_1?; + # The second line of the address. For example, suite or apartment number. + @constraint:String {maxLength: 300} + string address_line_2?; + # The third line of the address, if needed. For example, a street complement for Brazil, direction text, such as `next to Walmart`, or a landmark in an Indian address. + @constraint:String {maxLength: 100} + string address_line_3?; + # The neighborhood, ward, or district. Smaller than `admin_area_level_3` or `sub_locality`. Value is:
  • The postal sorting code for Guernsey and many French territories, such as French Guiana.
  • The fine-grained administrative levels in China.
+ @constraint:String {maxLength: 100} + string admin_area_4?; + # A sub-locality, suburb, neighborhood, or district. Smaller than `admin_area_level_2`. Value is:
  • Brazil. Suburb, bairro, or neighborhood.
  • India. Sub-locality or district. Street name information is not always available but a sub-locality or district can be a very small area.
+ @constraint:String {maxLength: 100} + string admin_area_3?; + # A city, town, or village. Smaller than `admin_area_level_1`. + @constraint:String {maxLength: 120} + string admin_area_2?; + # 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`. Value, by country, is:
  • UK. A county.
  • US. A state.
  • Canada. A province.
  • Japan. A prefecture.
  • Switzerland. A kanton.
+ @constraint:String {maxLength: 300} + string admin_area_1?; + # The postal code, which is the zip code or equivalent. Typically required for countries with a postal code or an equivalent. See [postal code](https://en.wikipedia.org/wiki/Postal_code). + @constraint:String {maxLength: 60} + string postal_code?; + # The [two-character ISO 3166-1 code](/docs/integration/direct/rest/country-codes/) that identifies the country or region.
Note: The country code for Great Britain is GB and not UK as used in the top-level domain names for that country. Use the `C2` country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border transactions.
+ country_code country_code; + # The non-portable additional address details that are sometimes needed for compliance, risk, or other scenarios where fine-grain address information might be needed. Not portable with common third party and open source. Redundant with core fields.
For example, `address_portable.address_line_1` is usually a combination of `address_details.street_number`, `street_name`, and `street_type`. + AddressDetails address_details?; }; +# The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
+@constraint:String {maxLength: 254} +public type email string; + +# The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). +@constraint:String {maxLength: 7, minLength: 7, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])$`} +public type date_year_month string; + +# Status of Authentication eligibility. +public type enrolled "Y"|"N"|"U"|"B"; + public type SubscriberRequestAllOf2 record { - # The shipping details - ShippingDetail shipping_address?; - # The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (https://www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions - PaymentSource payment_source?; + # The shipping details. + shipping_detail shipping_address?; + # The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (https://www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions. + payment_source payment_source?; }; -# The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99` -@constraint:String {pattern: re `^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$`} -public type Percentage string; - -# The non-portable additional address details that are sometimes needed for compliance, risk, or other scenarios where fine-grain address information might be needed. Not portable with common third party and open source. Redundant with core fields.
For example, `address_portable.address_line_1` is usually a combination of `address_details.street_number`, `street_name`, and `street_type` +# The non-portable additional address details that are sometimes needed for compliance, risk, or other scenarios where fine-grain address information might be needed. Not portable with common third party and open source. Redundant with core fields.
For example, `address_portable.address_line_1` is usually a combination of `address_details.street_number`, `street_name`, and `street_type`. public type AddressDetails record { - # A named locations that represents the premise. Usually a building name or number or collection of buildings with a common name or number. For example, Craven House - @jsondata:Name {value: "building_name"} - string buildingName?; - # The street number - @jsondata:Name {value: "street_number"} - string streetNumber?; - # The street type. For example, avenue, boulevard, road, or expressway - @jsondata:Name {value: "street_type"} - string streetType?; - # The first-order entity below a named building or location that represents the sub-premises. Usually a single building within a collection of buildings with a common name. Can be a flat, story, floor, room, or apartment - @jsondata:Name {value: "sub_building"} - string subBuilding?; - # The delivery service. Post office box, bag number, or post office name - @jsondata:Name {value: "delivery_service"} - string deliveryService?; - # The street name. Just `Drury` in `Drury Lane` - @jsondata:Name {value: "street_name"} - string streetName?; + # The street number. + @constraint:String {maxLength: 100} + string street_number?; + # The street name. Just `Drury` in `Drury Lane`. + @constraint:String {maxLength: 100} + string street_name?; + # The street type. For example, avenue, boulevard, road, or expressway. + @constraint:String {maxLength: 100} + string street_type?; + # The delivery service. Post office box, bag number, or post office name. + @constraint:String {maxLength: 100} + string delivery_service?; + # A named locations that represents the premise. Usually a building name or number or collection of buildings with a common name or number. For example, Craven House. + @constraint:String {maxLength: 100} + string building_name?; + # The first-order entity below a named building or location that represents the sub-premises. Usually a single building within a collection of buildings with a common name. Can be a flat, story, floor, room, or apartment. + @constraint:String {maxLength: 100} + string sub_building?; }; # Represents the Queries record for the operation: plans.list public type PlansListQueries record { - # Filters the response by a Product ID - @http:Query {name: "product_id"} - string productId?; - # Filters the response by list of plan IDs. Filter supports upto 10 plan IDs - @http:Query {name: "plan_ids"} - string planIds?; - # A non-zero integer which is the start index of the entire list of items to return in the response. The combination of `page=1` and `page_size=20` returns the first 20 items. The combination of `page=2` and `page_size=20` returns the next 20 items + # Filters the response by a Product ID. + @constraint:String {maxLength: 50, minLength: 6} + string product_id?; + # Filters the response by list of plan IDs. Filter supports upto 10 plan IDs. + string plan_ids?; + # A non-zero integer which is the start index of the entire list of items to return in the response. The combination of `page=1` and `page_size=20` returns the first 20 items. The combination of `page=2` and `page_size=20` returns the next 20 items. @constraint:Int {minValue: 1, maxValue: 100000} int page = 1; - # Indicates whether to show the total count in the response - @http:Query {name: "total_required"} - boolean totalRequired = false; - # The number of items to return in the response - @http:Query {name: "page_size"} - int pageSize = 10; + # Indicates whether to show the total count in the response. + boolean total_required = false; + # The number of items to return in the response. + @constraint:Int {minValue: 1, maxValue: 20} + int page_size = 10; +}; + +public type 'transaction record { + *capture_status; + *TransactionAllOf2; + date_time time; + amount_with_breakdown amount_with_breakdown; + string id; +}; + +# The status of a captured payment. +public type capture_status record { + # The status of the captured payment. + "COMPLETED"|"DECLINED"|"PARTIALLY_REFUNDED"|"PENDING"|"REFUNDED" status?; + # The details of the captured payment status. + capture_status_details status_details?; }; # Represents the Headers record for the operation: plans.list public type PlansListHeaders record { # The preferred server response upon successful completion of the request. Value is:
  • return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links.
  • return=representation. The server returns a complete resource representation, including the current state of the resource.
- @http:Header {name: "Prefer"} - string prefer = "return=minimal"; -}; - -# The plan details -public type Plan record { - # Indicates whether you can subscribe to this plan by providing a quantity for the goods or service - @jsondata:Name {value: "quantity_supported"} - boolean quantitySupported = false; - @jsondata:Name {value: "update_time"} - DateTime updateTime?; - @jsondata:Name {value: "create_time"} - DateTime createTime?; - @jsondata:Name {value: "payment_preferences"} - PaymentPreferences paymentPreferences?; - # The ID for the product - @jsondata:Name {value: "product_id"} - string productId?; - # The plan name - @constraint:String {maxLength: 127, minLength: 1} - string name?; - # An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle - @jsondata:Name {value: "billing_cycles"} - BillingCycle[] billingCycles?; - # The detailed description of the plan - @constraint:String {maxLength: 127, minLength: 1} - string description?; - # The tax details - Taxes taxes?; - # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links) - @constraint:Array {maxLength: 10, minLength: 1} - LinkDescription[] links?; - # The unique PayPal-generated ID for the plan - @constraint:String {maxLength: 50, minLength: 3} - string id?; - # The plan status - "CREATED"|"INACTIVE"|"ACTIVE" status?; + string Prefer = "return=minimal"; }; -# The charge amount from the subscriber -public type SubscriptionCaptureRequest record { - # The reason or note for the subscription charge - @constraint:String {maxLength: 128, minLength: 1} - string note; - # The currency and amount for a financial transaction, such as a balance or payment due - Money amount; - # The type of capture - @jsondata:Name {value: "capture_type"} - "OUTSTANDING_BALANCE" captureType; -}; - -# Results of Authentication such as 3D Secure -public type AuthenticationResponse record { - @jsondata:Name {value: "liability_shift"} - LiabilityShift liabilityShift?; - @jsondata:Name {value: "three_d_secure"} - ThreeDSecureAuthenticationResponse threeDSecure?; +# The list of plans with details. +public type plan_collection record { + # An array of plans. + @constraint:Array {maxLength: 32767} + plan[] plans?; + # The total number of items. + @constraint:Int {minValue: 0, maxValue: 500000000} + int total_items?; + # The total number of pages. + @constraint:Int {minValue: 0, maxValue: 100000000} + int total_pages?; + # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links). + @constraint:Array {maxLength: 10, minLength: 1} + link_description[] links?; }; public type CardResponseWithBillingAddressAllOf2 record { # The card holder's name as it appears on the card. @constraint:String {maxLength: 300, minLength: 2} string name?; - # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute) - AddressPortable billing_address?; - # The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6) - DateYearMonth expiry?; - # The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency - CurrencyCode currency_code?; + # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute). + address_portable billing_address?; + # The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). + date_year_month expiry?; + # The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency. + currency_code currency_code?; }; public type LastPaymentDetailsAllOf1 record { - # The currency and amount for a financial transaction, such as a balance or payment due - Money amount?; + # The currency and amount for a financial transaction, such as a balance or payment due. + money amount?; # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- DateTime time?; + date_time time?; }; -# The subscription status details -public type SubscriptionStatus record { - # The reason or notes for the status of the subscription - @jsondata:Name {value: "status_change_note"} - string statusChangeNote?; - # The status of the subscription - "APPROVAL_PENDING"|"APPROVED"|"ACTIVE"|"SUSPENDED"|"CANCELLED"|"EXPIRED" status?; - @jsondata:Name {value: "status_update_time"} - DateTime statusUpdateTime?; -}; - -# The billing details for the subscription. If the subscription was or is active, these fields are populated -public type SubscriptionBillingInfo record { - @jsondata:Name {value: "final_payment_time"} - DateTime finalPaymentTime?; - # The trial and regular billing executions - @jsondata:Name {value: "cycle_executions"} - CycleExecution[] cycleExecutions?; - # The number of consecutive payment failures. Resets to `0` after a successful payment. If this reaches the `payment_failure_threshold` value, the subscription updates to the `SUSPENDED` state - @jsondata:Name {value: "failed_payments_count"} - int failedPaymentsCount; - @jsondata:Name {value: "next_billing_time"} - DateTime nextBillingTime?; - @jsondata:Name {value: "last_failed_payment"} - FailedPaymentDetails lastFailedPayment?; - @jsondata:Name {value: "outstanding_balance"} - Money outstandingBalance; - @jsondata:Name {value: "last_payment"} - LastPaymentDetails lastPayment?; -}; - -# The list of plans with details -public type PlanCollection record { - # An array of plans - @constraint:Array {maxLength: 32767} - Plan[] plans?; - # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links) - @constraint:Array {maxLength: 10, minLength: 1} - LinkDescription[] links?; - # The total number of pages - @jsondata:Name {value: "total_pages"} - int totalPages?; - # The total number of items - @jsondata:Name {value: "total_items"} - int totalItems?; -}; - -# The request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent -public type SubscriptionReviseRequest record { - @jsondata:Name {value: "shipping_amount"} - Money shippingAmount?; - # The quantity of the product or service in the subscription - @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} - string quantity?; - @jsondata:Name {value: "application_context"} - ApplicationContext applicationContext?; - @jsondata:Name {value: "shipping_address"} - ShippingDetail shippingAddress?; - # An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object - PlanOverride plan?; - # The unique PayPal-generated ID for the plan - @jsondata:Name {value: "plan_id"} - string planId?; -}; - -# The frequency of the billing cycle -public type Frequency record { - # The number of intervals after which a subscriber is billed. For example, if the `interval_unit` is `DAY` with an `interval_count` of `2`, the subscription is billed once every two days. The following table lists the maximum allowed values for the `interval_count` for each `interval_unit`:
Interval unitMaximum interval count
DAY365
WEEK52
MONTH12
YEAR1
- @jsondata:Name {value: "interval_count"} - int intervalCount = 1; - # The interval at which the subscription is charged or billed - @jsondata:Name {value: "interval_unit"} - "DAY"|"WEEK"|"MONTH"|"YEAR" intervalUnit; -}; +# The account identifier for a PayPal account. +@constraint:String {maxLength: 13, minLength: 13, pattern: re `^[2-9A-HJ-NP-Z]{13}$`} +public type account_id string; -# The merchant-preferred payment methods -public type PayeePaymentMethodPreference "UNRESTRICTED"|"IMMEDIATE_PAYMENT_REQUIRED"; +# The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
+@constraint:String {maxLength: 254, minLength: 3, pattern: re `^.+@[^"\-].+$`} +public type email_address string; -# Transactions status result identifier. The outcome of the issuer's authentication -public type ParesStatus "Y"|"N"|"U"|"A"|"C"|"R"|"D"|"I"; +# The currency and amount for a financial transaction, such as a balance or payment due. +public type money record { + # The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency. + currency_code currency_code; + # 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](/docs/integration/direct/rest/currency-codes/). + @constraint:String {maxLength: 32, pattern: re `^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$`} + string value; +}; -# The payment card used to fund the payment. Card can be a credit or debit card -public type CardResponseWithBillingAddress record { - *CardResponse; - *CardResponseWithBillingAddressAllOf2; +# The payment source used to fund the payment. +public type payment_source_response record { + # The payment card used to fund the payment. Card can be a credit or debit card. + card_response_with_billing_address card?; }; -public type PayerAllOf2 record { - # The name of the party - Name name?; - # The phone information - PhoneWithType phone?; - # The stand-alone date, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard `date_time` type. This regular expression does not validate all dates. For example, February 31 is valid and nothing is known about leap years - DateNoTime birth_date?; - # The tax ID of the customer. The customer is also known as the payer. Both `tax_id` and `tax_id_type` are required - TaxInfo tax_info?; - # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute) - AddressPortable address?; -}; - -# The billing cycle details to override at subscription level. The subscription billing cycle definition has to adhere to the plan billing cycle definition -public type BillingCycleOverride record { - # The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle - @constraint:Int {minValue: 1, maxValue: 99} - int sequence; - # The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles) - @jsondata:Name {value: "total_cycles"} - int totalCycles?; - @jsondata:Name {value: "pricing_scheme"} - PricingScheme pricingScheme?; +# The breakdown details for the amount. Includes the gross, tax, fee, and shipping amounts. +public type amount_with_breakdown record { + # The currency and amount for a financial transaction, such as a balance or payment due. + money gross_amount; + # The currency and amount for a financial transaction, such as a balance or payment due. + money total_item_amount?; + # The currency and amount for a financial transaction, such as a balance or payment due. + money fee_amount?; + # The currency and amount for a financial transaction, such as a balance or payment due. + money shipping_amount?; + # The currency and amount for a financial transaction, such as a balance or payment due. + money tax_amount?; + # The currency and amount for a financial transaction, such as a balance or payment due. + money net_amount?; }; -# The regular and trial execution details for a billing cycle -public type CycleExecution record { - # The order in which to run this cycle among other billing cycles - @constraint:Int {minValue: 0, maxValue: 99} - int sequence; - # For a finite billing cycle, cycles_remaining is the number of remaining cycles. For an infinite billing cycle, cycles_remaining is set as 0 - @jsondata:Name {value: "cycles_remaining"} - int cyclesRemaining?; - # The type of the billing cycle - @jsondata:Name {value: "tenure_type"} - "REGULAR"|"TRIAL" tenureType; - # The number of billing cycles that have completed - @jsondata:Name {value: "cycles_completed"} - int cyclesCompleted; - # The active pricing scheme version for the billing cycle - @jsondata:Name {value: "current_pricing_scheme_version"} - int currentPricingSchemeVersion?; - # The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles) - @jsondata:Name {value: "total_cycles"} - int totalCycles?; +public type PayerAllOf2 record { + # The name of the party. + name name?; + # The phone information. + phone_with_type phone?; + # The stand-alone date, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard `date_time` type. This regular expression does not validate all dates. For example, February 31 is valid and nothing is known about leap years. + date_no_time birth_date?; + # The tax ID of the customer. The customer is also known as the payer. Both `tax_id` and `tax_id_type` are required. + tax_info tax_info?; + # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute). + address_portable address?; }; From 26c9e95a050ceadc3d0ba5bedca38bf4a3f788a0 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Thu, 19 Jun 2025 17:19:30 +0530 Subject: [PATCH 20/56] Refactor flatten specification with input sanitization --- docs/spec/openapi.json | 4412 +++++++++++++++++++--------------------- 1 file changed, 2087 insertions(+), 2325 deletions(-) diff --git a/docs/spec/openapi.json b/docs/spec/openapi.json index f35965b..c2d82d6 100644 --- a/docs/spec/openapi.json +++ b/docs/spec/openapi.json @@ -45,11 +45,11 @@ } ], "responses" : { "200" : { - "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that lists billing plans", + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that lists billing plans.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/PlanCollection" + "$ref" : "#/components/schemas/plan_collection" } } } @@ -89,7 +89,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Error404" + "$ref" : "#/components/schemas/error_404" } } } @@ -99,7 +99,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Error500" + "$ref" : "#/components/schemas/error_500" } } } @@ -126,7 +126,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/PlanRequestPOST" + "$ref" : "#/components/schemas/plan_request_POST" }, "examples" : { "plan_request_post" : { @@ -199,11 +199,11 @@ }, "responses" : { "200" : { - "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows billing plan details", + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows billing plan details.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Plan" + "$ref" : "#/components/schemas/plan" }, "examples" : { "plan" : { @@ -308,7 +308,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Plan" + "$ref" : "#/components/schemas/plan" } } } @@ -358,7 +358,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Error500" + "$ref" : "#/components/schemas/error_500" } } } @@ -383,11 +383,11 @@ } ], "responses" : { "200" : { - "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows plan details", + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows plan details.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Plan" + "$ref" : "#/components/schemas/plan" } } } @@ -427,7 +427,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Error500" + "$ref" : "#/components/schemas/error_500" } } } @@ -453,7 +453,7 @@ }, "responses" : { "204" : { - "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body." }, "400" : { "description" : "Request is not well-formed, syntactically incorrect, or violates schema.", @@ -510,7 +510,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Error500" + "$ref" : "#/components/schemas/error_500" } } } @@ -535,7 +535,7 @@ } ], "responses" : { "204" : { - "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body." }, "401" : { "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", @@ -582,7 +582,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Error500" + "$ref" : "#/components/schemas/error_500" } } } @@ -607,7 +607,7 @@ } ], "responses" : { "204" : { - "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body." }, "401" : { "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", @@ -654,7 +654,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Error500" + "$ref" : "#/components/schemas/error_500" } } } @@ -681,7 +681,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/UpdatePricingSchemesListRequest" + "$ref" : "#/components/schemas/update_pricing_schemes_list_request" }, "examples" : { "update_pricing_schemes_list_request" : { @@ -726,7 +726,7 @@ }, "responses" : { "204" : { - "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body." }, "400" : { "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", @@ -783,7 +783,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Error500" + "$ref" : "#/components/schemas/error_500" } } } @@ -812,7 +812,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/SubscriptionRequestPost" + "$ref" : "#/components/schemas/subscription_request_post" }, "examples" : { "subscription_request_post" : { @@ -864,11 +864,11 @@ }, "responses" : { "200" : { - "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Subscription" + "$ref" : "#/components/schemas/subscription" }, "examples" : { "subscription" : { @@ -930,7 +930,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Subscription" + "$ref" : "#/components/schemas/subscription" }, "examples" : { "subscription" : { @@ -1032,7 +1032,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Error500" + "$ref" : "#/components/schemas/error_500" } } } @@ -1059,11 +1059,11 @@ } ], "responses" : { "200" : { - "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Subscription" + "$ref" : "#/components/schemas/subscription" } } } @@ -1103,7 +1103,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Error500" + "$ref" : "#/components/schemas/error_500" } } } @@ -1129,7 +1129,7 @@ }, "responses" : { "204" : { - "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body." }, "400" : { "description" : "Request is not well-formed, syntactically incorrect, or violates schema.", @@ -1186,7 +1186,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Error500" + "$ref" : "#/components/schemas/error_500" } } } @@ -1213,7 +1213,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/SubscriptionReviseRequest" + "$ref" : "#/components/schemas/subscription_revise_request" }, "examples" : { "subscription_revise_request" : { @@ -1255,11 +1255,11 @@ }, "responses" : { "200" : { - "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/SubscriptionReviseResponse" + "$ref" : "#/components/schemas/subscription_revise_response" }, "examples" : { "subscription_revise_response" : { @@ -1369,7 +1369,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Error500" + "$ref" : "#/components/schemas/error_500" } } } @@ -1396,7 +1396,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/SubscriptionSuspendRequest" + "$ref" : "#/components/schemas/subscription_suspend_request" }, "examples" : { "subscription_suspend_request" : { @@ -1410,7 +1410,7 @@ }, "responses" : { "204" : { - "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body." }, "400" : { "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", @@ -1467,7 +1467,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Error500" + "$ref" : "#/components/schemas/error_500" } } } @@ -1494,7 +1494,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/SubscriptionCancelRequest" + "$ref" : "#/components/schemas/subscription_cancel_request" }, "examples" : { "subscription_cancel_request" : { @@ -1508,7 +1508,7 @@ }, "responses" : { "204" : { - "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body." }, "400" : { "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", @@ -1565,7 +1565,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Error500" + "$ref" : "#/components/schemas/error_500" } } } @@ -1592,7 +1592,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/SubscriptionActivateRequest" + "$ref" : "#/components/schemas/subscription_activate_request" }, "examples" : { "subscription_activate_request" : { @@ -1606,7 +1606,7 @@ }, "responses" : { "204" : { - "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body." }, "400" : { "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", @@ -1663,7 +1663,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Error500" + "$ref" : "#/components/schemas/error_500" } } } @@ -1692,7 +1692,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/SubscriptionCaptureRequest" + "$ref" : "#/components/schemas/subscription_capture_request" }, "examples" : { "subscription_capture_request" : { @@ -1711,11 +1711,11 @@ }, "responses" : { "200" : { - "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Transaction" + "$ref" : "#/components/schemas/transaction" } } } @@ -1778,7 +1778,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Error500" + "$ref" : "#/components/schemas/error_500" } } } @@ -1807,11 +1807,11 @@ } ], "responses" : { "200" : { - "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/TransactionsList" + "$ref" : "#/components/schemas/transactions_list" } } } @@ -1861,7 +1861,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Error500" + "$ref" : "#/components/schemas/error_500" } } } @@ -1885,39 +1885,105 @@ "$ref" : "#/components/schemas/SUBSCRIPTIONSTATUSINVALID1" } ] }, - "ErrorLocation" : { - "type" : "string", - "description" : "The location of the field that caused the error. Value is `body`, `path`, or `query`", - "default" : "body", - "enum" : [ "body", "path", "query" ] + "error_link_description" : { + "title" : "Link Description", + "required" : [ "href", "rel" ], + "type" : "object", + "properties" : { + "href" : { + "maxLength" : 20000, + "minLength" : 0, + "pattern" : "^.*$", + "type" : "string", + "description" : "The complete target URL. To make the related call, combine the method with this [URI Template-formatted](https://tools.ietf.org/html/rfc6570) link. For pre-processing, include the `$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call." + }, + "rel" : { + "maxLength" : 100, + "minLength" : 0, + "pattern" : "^.*$", + "type" : "string", + "description" : "The [link relation type](https://tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](https://www.iana.org/assignments/link-relations/link-relations.xhtml)." + }, + "method" : { + "maxLength" : 6, + "minLength" : 3, + "pattern" : "^[A-Z]*$", + "type" : "string", + "description" : "The HTTP method required to make the related call.", + "enum" : [ "GET", "POST", "PUT", "DELETE", "PATCH" ] + } + }, + "description" : "The request-related [HATEOAS link](/api/rest/responses/#hateoas-links) information." }, - "UpdatePricingSchemeRequest" : { - "title" : "Update Pricing Scheme", - "required" : [ "billing_cycle_sequence", "pricing_scheme" ], + "subscriptions.create-400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscreate400Details" + } + } + } + }, + "card_response_with_billing_address" : { + "title" : "Card Response with billing address and name", + "type" : "object", + "description" : "The payment card used to fund the payment. Card can be a credit or debit card.", + "allOf" : [ { + "$ref" : "#/components/schemas/card_response" + }, { + "$ref" : "#/components/schemas/CardResponseWithBillingAddressAllOf2" + } ] + }, + "card_response" : { + "title" : "Card Response", "type" : "object", "properties" : { - "billing_cycle_sequence" : { - "maximum" : 99, - "minimum" : 1, - "type" : "integer", - "description" : "The billing cycle sequence", - "x-ballerina-name" : "billingCycleSequence" + "last_digits" : { + "pattern" : "[0-9]{2,}", + "type" : "string", + "description" : "The last digits of the payment card.", + "readOnly" : true }, - "pricing_scheme" : { - "allOf" : [ { - "$ref" : "#/components/schemas/PricingScheme" - } ], - "x-ballerina-name" : "pricingScheme" + "brand" : { + "$ref" : "#/components/schemas/card_brand" + }, + "type" : { + "type" : "string", + "description" : "The payment card type.", + "readOnly" : true, + "enum" : [ "CREDIT", "DEBIT", "PREPAID", "UNKNOWN" ] + }, + "authentication_result" : { + "$ref" : "#/components/schemas/authentication_response" } }, - "description" : "The update pricing scheme request details" + "description" : "The payment card to use to fund a payment. Card can be a credit or debit card." }, - "CurrencyCode" : { - "maxLength" : 3, - "minLength" : 3, - "type" : "string", - "description" : "The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency", - "format" : "ppaas_common_currency_code_v2" + "patch" : { + "title" : "Patch", + "required" : [ "op" ], + "type" : "object", + "properties" : { + "op" : { + "type" : "string", + "description" : "The operation.", + "enum" : [ "add", "remove", "replace", "move", "copy", "test" ] + }, + "path" : { + "type" : "string", + "description" : "The JSON Pointer to the target document location at which to complete the operation." + }, + "value" : { + "title" : "Patch Value", + "description" : "The value to apply. The remove operation does not require a value." + }, + "from" : { + "type" : "string", + "description" : "The JSON Pointer to the target document location from which to move the value. Required for the move operation." + } + }, + "description" : "The JSON patch object to apply partial updates to resources." }, "Planscreate400Details" : { "anyOf" : [ { @@ -1936,26 +2002,6 @@ "$ref" : "#/components/schemas/INVALIDINTEGERMAXVALUE" } ] }, - "PhoneWithType" : { - "title" : "Phone With Type", - "required" : [ "phone_number" ], - "type" : "object", - "properties" : { - "phone_type" : { - "allOf" : [ { - "$ref" : "#/components/schemas/PhoneType" - } ], - "x-ballerina-name" : "phoneType" - }, - "phone_number" : { - "allOf" : [ { - "$ref" : "#/components/schemas/Phone" - } ], - "x-ballerina-name" : "phoneNumber" - } - }, - "description" : "The phone information" - }, "Subscriptionspatch400Details" : { "anyOf" : [ { "$ref" : "#/components/schemas/UNSUPPORTEDPATCHOPERATION1" @@ -1990,89 +2036,55 @@ "$ref" : "#/components/schemas/MISSINGREQUIREDPARAMETER6" } ] }, - "PricingScheme" : { + "SubscriberAllOf2" : { + "properties" : { + "shipping_address" : { + "$ref" : "#/components/schemas/shipping_detail" + }, + "payment_source" : { + "$ref" : "#/components/schemas/payment_source_response" + } + } + }, + "pricing_scheme" : { "title" : "Pricing Scheme", "type" : "object", "properties" : { - "tiers" : { - "maxItems" : 32, - "minItems" : 1, - "type" : "array", - "description" : "An array of pricing tiers which are used for billing volume/tiered plans. pricing_model field has to be specified", - "items" : { - "$ref" : "#/components/schemas/PricingTier" - } - }, - "update_time" : { - "allOf" : [ { - "$ref" : "#/components/schemas/DateTime" - } ], - "x-ballerina-name" : "updateTime" + "version" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The version of the pricing scheme.", + "readOnly" : true }, - "create_time" : { - "allOf" : [ { - "$ref" : "#/components/schemas/DateTime" - } ], - "x-ballerina-name" : "createTime" + "fixed_price" : { + "$ref" : "#/components/schemas/money" }, "pricing_model" : { "maxLength" : 24, "minLength" : 1, "pattern" : "^[A-Z_]+$", "type" : "string", - "description" : "The pricing model for tiered plan. The `tiers` parameter is required", - "enum" : [ "VOLUME", "TIERED" ], - "x-ballerina-name" : "pricingModel" - }, - "fixed_price" : { - "allOf" : [ { - "$ref" : "#/components/schemas/Money" - } ], - "x-ballerina-name" : "fixedPrice" + "description" : "The pricing model for tiered plan. The `tiers` parameter is required.", + "enum" : [ "VOLUME", "TIERED" ] }, - "version" : { - "maximum" : 999, - "minimum" : 0, - "type" : "integer", - "description" : "The version of the pricing scheme", - "readOnly" : true - } - }, - "description" : "The pricing scheme details" - }, - "SubscriptionsTransactions400" : { - "properties" : { - "details" : { + "tiers" : { + "maxItems" : 32, + "minItems" : 1, "type" : "array", + "description" : "An array of pricing tiers which are used for billing volume/tiered plans. pricing_model field has to be specified.", "items" : { - "$ref" : "#/components/schemas/Subscriptionstransactions400Details" + "$ref" : "#/components/schemas/pricing_tier" } - } - } - }, - "SubscriberAllOf2" : { - "properties" : { - "shipping_address" : { - "$ref" : "#/components/schemas/ShippingDetail" }, - "payment_source" : { - "$ref" : "#/components/schemas/PaymentSourceResponse" - } - } - }, - "SubscriptionCancelRequest" : { - "title" : "Cancel Subscription Request", - "required" : [ "reason" ], - "type" : "object", - "properties" : { - "reason" : { - "maxLength" : 128, - "minLength" : 1, - "type" : "string", - "description" : "The reason for the cancellation of a subscription" + "create_time" : { + "$ref" : "#/components/schemas/date_time" + }, + "update_time" : { + "$ref" : "#/components/schemas/date_time" } }, - "description" : "The cancel subscription request details" + "description" : "The pricing scheme details." }, "SubscriptionAllOf2" : { "properties" : { @@ -2090,7 +2102,7 @@ "description" : "The ID of the plan." }, "start_time" : { - "$ref" : "#/components/schemas/DateTime" + "$ref" : "#/components/schemas/date_time" }, "quantity" : { "maxLength" : 32, @@ -2100,19 +2112,19 @@ "description" : "The quantity of the product in the subscription." }, "shipping_amount" : { - "$ref" : "#/components/schemas/Money" + "$ref" : "#/components/schemas/money" }, "subscriber" : { - "$ref" : "#/components/schemas/Subscriber" + "$ref" : "#/components/schemas/subscriber" }, "billing_info" : { - "$ref" : "#/components/schemas/SubscriptionBillingInfo" + "$ref" : "#/components/schemas/subscription_billing_info" }, "create_time" : { - "$ref" : "#/components/schemas/DateTime" + "$ref" : "#/components/schemas/date_time" }, "update_time" : { - "$ref" : "#/components/schemas/DateTime" + "$ref" : "#/components/schemas/date_time" }, "custom_id" : { "maxLength" : 127, @@ -2127,18 +2139,73 @@ "readOnly" : true }, "plan" : { - "$ref" : "#/components/schemas/Plan" + "$ref" : "#/components/schemas/plan" }, "links" : { "type" : "array", "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).", "readOnly" : true, "items" : { - "$ref" : "#/components/schemas/LinkDescription" + "$ref" : "#/components/schemas/link_description" } } } }, + "plan_request_POST" : { + "title" : "Create Plan Request", + "required" : [ "billing_cycles", "name", "payment_preferences", "product_id" ], + "type" : "object", + "properties" : { + "product_id" : { + "maxLength" : 50, + "minLength" : 6, + "type" : "string", + "description" : "The ID of the product created through Catalog Products API." + }, + "name" : { + "maxLength" : 127, + "minLength" : 1, + "type" : "string", + "description" : "The plan name." + }, + "status" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The initial state of the plan. Allowed input values are CREATED and ACTIVE.", + "default" : "ACTIVE", + "enum" : [ "CREATED", "INACTIVE", "ACTIVE" ] + }, + "description" : { + "maxLength" : 127, + "minLength" : 1, + "type" : "string", + "description" : "The detailed description of the plan." + }, + "billing_cycles" : { + "maxItems" : 12, + "minItems" : 1, + "type" : "array", + "description" : "An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle.", + "items" : { + "$ref" : "#/components/schemas/billing_cycle" + } + }, + "payment_preferences" : { + "$ref" : "#/components/schemas/payment_preferences" + }, + "taxes" : { + "$ref" : "#/components/schemas/taxes" + }, + "quantity_supported" : { + "type" : "boolean", + "description" : "Indicates whether you can subscribe to this plan by providing a quantity for the goods or service.", + "default" : false + } + }, + "description" : "The create plan request details." + }, "INVALIDQUANTITYSUPPORTED" : { "title" : "INVALID_QUANTITY_SUPPORTED", "properties" : { @@ -2152,106 +2219,111 @@ } } }, - "BillingCycle" : { - "title" : "Billing Cycle", - "required" : [ "frequency", "sequence", "tenure_type" ], - "type" : "object", + "phone_type" : { + "title" : "Phone Type", + "type" : "string", + "description" : "The phone type.", + "enum" : [ "FAX", "HOME", "MOBILE", "OTHER", "PAGER" ] + }, + "payee_payment_method_preference" : { + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "The merchant-preferred payment methods.", + "default" : "UNRESTRICTED", + "enum" : [ "UNRESTRICTED", "IMMEDIATE_PAYMENT_REQUIRED" ] + }, + "plans.update-pricing-schemes-422" : { "properties" : { - "sequence" : { - "maximum" : 99, - "minimum" : 1, - "type" : "integer", - "description" : "The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle" - }, - "tenure_type" : { - "maxLength" : 24, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", - "type" : "string", - "description" : "The tenure type of the billing cycle. In case of a plan having trial cycle, only 2 trial cycles are allowed per plan", - "enum" : [ "REGULAR", "TRIAL" ], - "x-ballerina-name" : "tenureType" - }, - "total_cycles" : { - "maximum" : 999, - "minimum" : 0, - "type" : "integer", - "description" : "The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles)", - "default" : 1, - "x-ballerina-name" : "totalCycles" - }, - "pricing_scheme" : { - "allOf" : [ { - "$ref" : "#/components/schemas/PricingScheme" - } ], - "x-ballerina-name" : "pricingScheme" - }, - "frequency" : { - "$ref" : "#/components/schemas/Frequency" + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PlansupdatePricingSchemes422Details" + } } - }, - "description" : "The billing cycle details" + } }, "InlineResponse42211" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error422" + "$ref" : "#/components/schemas/error_422" }, { - "$ref" : "#/components/schemas/SubscriptionsCapture422" + "$ref" : "#/components/schemas/subscriptions.capture-422" + } ] + }, + "last_payment_details" : { + "title" : "Last Payment Details", + "required" : [ "amount", "time" ], + "type" : "object", + "description" : "The details for the last payment.", + "allOf" : [ { + "$ref" : "#/components/schemas/LastPaymentDetailsAllOf1" } ] }, "InlineResponse42210" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error422" + "$ref" : "#/components/schemas/error_422" }, { - "$ref" : "#/components/schemas/SubscriptionsActivate422" + "$ref" : "#/components/schemas/subscriptions.activate-422" } ] }, - "INVALIDRESOURCEID1" : { - "title" : "INVALID_RESOURCE_ID", + "shipping_detail" : { + "title" : "Shipping Details", + "type" : "object", "properties" : { - "issue" : { - "type" : "string", - "enum" : [ "INVALID_RESOURCE_ID" ] + "name" : { + "$ref" : "#/components/schemas/name" }, - "description" : { - "type" : "string", - "enum" : [ "Requested resource ID was not found." ] + "type" : { + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "The method by which the payer wants to get their items from the payee e.g shipping, in-person pickup. Either type or options but not both may be present.", + "enum" : [ "SHIPPING", "PICKUP_IN_PERSON" ] + }, + "address" : { + "$ref" : "#/components/schemas/address_portable" } - } + }, + "description" : "The shipping details." }, - "PaymentPreferencesOverride" : { - "title" : "Payment Preferences Override", + "taxes_override" : { + "title" : "Taxes Override", "type" : "object", "properties" : { - "setup_fee" : { - "allOf" : [ { - "$ref" : "#/components/schemas/Money" - } ], - "x-ballerina-name" : "setupFee" - }, - "setup_fee_failure_action" : { - "maxLength" : 24, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", - "type" : "string", - "description" : "The action to take on the subscription if the initial payment for the setup fails", - "enum" : [ "CONTINUE", "CANCEL" ], - "x-ballerina-name" : "setupFeeFailureAction" + "percentage" : { + "$ref" : "#/components/schemas/percentage" }, - "auto_bill_outstanding" : { + "inclusive" : { "type" : "boolean", - "description" : "Indicates whether to automatically bill the outstanding amount in the next billing cycle", - "x-ballerina-name" : "autoBillOutstanding" - }, - "payment_failure_threshold" : { - "maximum" : 999, - "minimum" : 0, - "type" : "integer", - "description" : "The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail", - "x-ballerina-name" : "paymentFailureThreshold" + "description" : "Indicates whether the tax was already included in the billing amount." } }, - "description" : "The payment preferences to override at subscription level" + "description" : "The tax details." + }, + "INVALIDRESOURCEID1" : { + "title" : "INVALID_RESOURCE_ID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_RESOURCE_ID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Requested resource ID was not found." ] + } + } + }, + "subscriptions.suspend-400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionssuspend400Details" + } + } + } }, "Subscriptionscreate422Details" : { "anyOf" : [ { @@ -2284,31 +2356,25 @@ "$ref" : "#/components/schemas/CURRENCYMISMATCH2" } ] }, - "UpdatePricingSchemesListRequest" : { - "title" : "Update Pricing Scheme Request", - "required" : [ "pricing_schemes" ], - "type" : "object", + "subscriptions.revise-422" : { "properties" : { - "pricing_schemes" : { - "maxItems" : 99, - "minItems" : 1, + "details" : { "type" : "array", - "description" : "An array of pricing schemes", "items" : { - "$ref" : "#/components/schemas/UpdatePricingSchemeRequest" - }, - "x-ballerina-name" : "pricingSchemes" + "$ref" : "#/components/schemas/Subscriptionsrevise422Details" + } } - }, - "description" : "The update pricing scheme request details" + } }, - "DateNoTime" : { - "maxLength" : 10, - "minLength" : 10, - "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$", - "type" : "string", - "description" : "The stand-alone date, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard `date_time` type. This regular expression does not validate all dates. For example, February 31 is valid and nothing is known about leap years", - "format" : "ppaas_date_notime_v2" + "subscriptions.capture-400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscapture400Details" + } + } + } }, "CURRENCYNOTSUPPORTEDFORRECEIVER" : { "title" : "CURRENCY_NOT_SUPPORTED_FOR_RECEIVER", @@ -2323,65 +2389,6 @@ } } }, - "SubscriberRequest" : { - "title" : "Subscriber Request Information", - "type" : "object", - "description" : "The subscriber request information ", - "allOf" : [ { - "$ref" : "#/components/schemas/Payer" - }, { - "$ref" : "#/components/schemas/SubscriberRequestAllOf2" - } ] - }, - "CaptureStatus" : { - "title" : "Capture Status", - "type" : "object", - "properties" : { - "status_details" : { - "allOf" : [ { - "$ref" : "#/components/schemas/CaptureStatusDetails" - } ], - "x-ballerina-name" : "statusDetails" - }, - "status" : { - "type" : "string", - "description" : "The status of the captured payment", - "readOnly" : true, - "enum" : [ "COMPLETED", "DECLINED", "PARTIALLY_REFUNDED", "PENDING", "REFUNDED" ] - } - }, - "description" : "The status of a captured payment" - }, - "FailedPaymentDetails" : { - "title" : "Failed Payment Details", - "required" : [ "amount", "time" ], - "type" : "object", - "properties" : { - "reason_code" : { - "maxLength" : 120, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", - "type" : "string", - "description" : "The reason code for the payment failure", - "readOnly" : true, - "enum" : [ "PAYMENT_DENIED", "INTERNAL_SERVER_ERROR", "PAYEE_ACCOUNT_RESTRICTED", "PAYER_ACCOUNT_RESTRICTED", "PAYER_CANNOT_PAY", "SENDING_LIMIT_EXCEEDED", "TRANSACTION_RECEIVING_LIMIT_EXCEEDED", "CURRENCY_MISMATCH" ], - "x-ballerina-name" : "reasonCode" - }, - "amount" : { - "$ref" : "#/components/schemas/Money" - }, - "next_payment_retry_time" : { - "allOf" : [ { - "$ref" : "#/components/schemas/DateTime" - } ], - "x-ballerina-name" : "nextPaymentRetryTime" - }, - "time" : { - "$ref" : "#/components/schemas/DateTime" - } - }, - "description" : "The details for the failed payment of the subscription" - }, "INVALIDBILLINGCYCLESEQUENCE1" : { "title" : "INVALID_BILLING_CYCLE_SEQUENCE", "properties" : { @@ -2446,50 +2453,33 @@ }, "InlineResponse401" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error401" + "$ref" : "#/components/schemas/error_401" }, { - "$ref" : "#/components/schemas/Unauthorized" + "$ref" : "#/components/schemas/401" } ] }, "InlineResponse400" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error400" + "$ref" : "#/components/schemas/error_400" }, { - "$ref" : "#/components/schemas/BadRequest" + "$ref" : "#/components/schemas/400" } ] }, - "ErrorDetails" : { - "title" : "Error Details", - "required" : [ "issue" ], - "type" : "object", + "subscriptions.cancel-422" : { "properties" : { - "field" : { - "type" : "string", - "description" : "The field that caused the error. If this field is in the body, set this value to the field's JSON pointer value. Required for client-side errors" - }, - "issue" : { - "type" : "string", - "description" : "The unique, fine-grained application-level error code" - }, - "description" : { - "type" : "string", - "description" : "The human-readable description for an issue. The description can change over the lifetime of an API, so clients must not depend on this value" - }, - "location" : { - "$ref" : "#/components/schemas/ErrorLocation" - }, - "value" : { - "type" : "string", - "description" : "The value of the field that caused the error" + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscancel422Details" + } } - }, - "description" : "The error details. Required for client-side `4XX` errors" + } }, "InlineResponse403" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error403" + "$ref" : "#/components/schemas/error_403" }, { - "$ref" : "#/components/schemas/Forbidden" + "$ref" : "#/components/schemas/403" } ] }, "INVALIDACCOUNTSTATUS" : { @@ -2512,20 +2502,72 @@ }, "InlineResponse404" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error404" + "$ref" : "#/components/schemas/error_404" }, { - "$ref" : "#/components/schemas/NotFound" + "$ref" : "#/components/schemas/404" } ] }, - "PlansPatch400" : { + "failed_payment_details" : { + "title" : "Failed Payment Details", + "required" : [ "amount", "time" ], + "type" : "object", "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Planspatch400Details" - } + "amount" : { + "$ref" : "#/components/schemas/money" + }, + "time" : { + "$ref" : "#/components/schemas/date_time" + }, + "reason_code" : { + "maxLength" : 120, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The reason code for the payment failure.", + "readOnly" : true, + "enum" : [ "PAYMENT_DENIED", "INTERNAL_SERVER_ERROR", "PAYEE_ACCOUNT_RESTRICTED", "PAYER_ACCOUNT_RESTRICTED", "PAYER_CANNOT_PAY", "SENDING_LIMIT_EXCEEDED", "TRANSACTION_RECEIVING_LIMIT_EXCEEDED", "CURRENCY_MISMATCH" ] + }, + "next_payment_retry_time" : { + "$ref" : "#/components/schemas/date_time" } - } + }, + "description" : "The details for the failed payment of the subscription." + }, + "date_no_time" : { + "maxLength" : 10, + "minLength" : 10, + "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$", + "type" : "string", + "description" : "The stand-alone date, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard `date_time` type. This regular expression does not validate all dates. For example, February 31 is valid and nothing is known about leap years.", + "format" : "ppaas_date_notime_v2" + }, + "payment_preferences_override" : { + "title" : "Payment Preferences Override", + "type" : "object", + "properties" : { + "auto_bill_outstanding" : { + "type" : "boolean", + "description" : "Indicates whether to automatically bill the outstanding amount in the next billing cycle." + }, + "setup_fee" : { + "$ref" : "#/components/schemas/money" + }, + "setup_fee_failure_action" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The action to take on the subscription if the initial payment for the setup fails.", + "enum" : [ "CONTINUE", "CANCEL" ] + }, + "payment_failure_threshold" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail." + } + }, + "description" : "The payment preferences to override at subscription level." }, "Subscriptionsrevise400Details" : { "anyOf" : [ { @@ -2542,6 +2584,14 @@ "$ref" : "#/components/schemas/MISSINGREQUIREDPARAMETER4" } ] }, + "liability_shift" : { + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "Liability shift indicator. The outcome of the issuer's authentication.", + "enum" : [ "YES", "NO", "POSSIBLE", "UNKNOWN" ] + }, "INVALIDBILLINGCYCLESEQUENCE3" : { "title" : "INVALID_BILLING_CYCLE_SEQUENCE", "properties" : { @@ -2568,6 +2618,21 @@ } } }, + "email" : { + "maxLength" : 254, + "pattern" : "(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])", + "type" : "string", + "description" : "The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
", + "format" : "merchant_common_email_address_v2" + }, + "enrolled" : { + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "Status of Authentication eligibility.", + "enum" : [ "Y", "N", "U", "B" ] + }, "MULTIPLEFREETRIALBILLINGCYCLESNOTSUPPORTED" : { "title" : "MULTIPLE_FREE_TRIAL_BILLING_CYCLES_NOT_SUPPORTED", "properties" : { @@ -2616,44 +2681,38 @@ "title" : "Address Details", "type" : "object", "properties" : { - "building_name" : { + "street_number" : { "maxLength" : 100, "type" : "string", - "description" : "A named locations that represents the premise. Usually a building name or number or collection of buildings with a common name or number. For example, Craven House", - "x-ballerina-name" : "buildingName" + "description" : "The street number." }, - "street_number" : { + "street_name" : { "maxLength" : 100, "type" : "string", - "description" : "The street number", - "x-ballerina-name" : "streetNumber" + "description" : "The street name. Just `Drury` in `Drury Lane`." }, "street_type" : { "maxLength" : 100, "type" : "string", - "description" : "The street type. For example, avenue, boulevard, road, or expressway", - "x-ballerina-name" : "streetType" + "description" : "The street type. For example, avenue, boulevard, road, or expressway." }, - "sub_building" : { + "delivery_service" : { "maxLength" : 100, "type" : "string", - "description" : "The first-order entity below a named building or location that represents the sub-premises. Usually a single building within a collection of buildings with a common name. Can be a flat, story, floor, room, or apartment", - "x-ballerina-name" : "subBuilding" + "description" : "The delivery service. Post office box, bag number, or post office name." }, - "delivery_service" : { + "building_name" : { "maxLength" : 100, "type" : "string", - "description" : "The delivery service. Post office box, bag number, or post office name", - "x-ballerina-name" : "deliveryService" + "description" : "A named locations that represents the premise. Usually a building name or number or collection of buildings with a common name or number. For example, Craven House." }, - "street_name" : { + "sub_building" : { "maxLength" : 100, "type" : "string", - "description" : "The street name. Just `Drury` in `Drury Lane`", - "x-ballerina-name" : "streetName" + "description" : "The first-order entity below a named building or location that represents the sub-premises. Usually a single building within a collection of buildings with a common name. Can be a flat, story, floor, room, or apartment." } }, - "description" : "The non-portable additional address details that are sometimes needed for compliance, risk, or other scenarios where fine-grain address information might be needed. Not portable with common third party and open source. Redundant with core fields.
For example, `address_portable.address_line_1` is usually a combination of `address_details.street_number`, `street_name`, and `street_type`" + "description" : "The non-portable additional address details that are sometimes needed for compliance, risk, or other scenarios where fine-grain address information might be needed. Not portable with common third party and open source. Redundant with core fields.
For example, `address_portable.address_line_1` is usually a combination of `address_details.street_number`, `street_name`, and `street_type`." }, "INVALIDPRICINGTIERAMOUNT2" : { "title" : "INVALID_PRICING_TIER_AMOUNT", @@ -2668,16 +2727,6 @@ } } }, - "PlansUpdatePricingSchemes422" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/PlansupdatePricingSchemes422Details" - } - } - } - }, "CARDSUBSCRIPTIONSNOTENABLED" : { "title" : "CARD_SUBSCRIPTIONS_NOT_ENABLED", "properties" : { @@ -2738,23 +2787,50 @@ "LastPaymentDetailsAllOf1" : { "properties" : { "amount" : { - "$ref" : "#/components/schemas/Money" + "$ref" : "#/components/schemas/money" }, "time" : { - "$ref" : "#/components/schemas/DateTime" + "$ref" : "#/components/schemas/date_time" } } }, - "SubscriptionsSuspend400" : { + "subscriptions.suspend-422" : { "properties" : { "details" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/Subscriptionssuspend400Details" + "$ref" : "#/components/schemas/Subscriptionssuspend422Details" + } + } + } + }, + "plans.activate-422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Plansactivate422Details" } } } }, + "account_id" : { + "title" : "PayPal Account Identifier", + "maxLength" : 13, + "minLength" : 13, + "pattern" : "^[2-9A-HJ-NP-Z]{13}$", + "type" : "string", + "description" : "The account identifier for a PayPal account.", + "format" : "ppaas_payer_id_v3" + }, + "email_address" : { + "maxLength" : 254, + "minLength" : 3, + "pattern" : "^.+@[^\"\\-].+$", + "type" : "string", + "description" : "The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
", + "format" : "ppaas_common_email_address_v2" + }, "MISSINGREGULARBILLINGCYCLE" : { "title" : "MISSING_REGULAR_BILLING_CYCLE", "properties" : { @@ -2768,104 +2844,25 @@ } } }, - "SubscriptionBillingInfo" : { - "title" : "Subscription Billing Information", - "required" : [ "failed_payments_count", "outstanding_balance" ], + "payment_source_response" : { + "title" : "Payment Source Response", "type" : "object", "properties" : { - "final_payment_time" : { - "allOf" : [ { - "$ref" : "#/components/schemas/DateTime" - } ], - "x-ballerina-name" : "finalPaymentTime" - }, - "cycle_executions" : { - "maxItems" : 3, - "minItems" : 0, - "type" : "array", - "description" : "The trial and regular billing executions", - "readOnly" : true, - "items" : { - "$ref" : "#/components/schemas/CycleExecution" - }, - "x-ballerina-name" : "cycleExecutions" - }, - "failed_payments_count" : { - "maximum" : 999, - "minimum" : 0, - "type" : "integer", - "description" : "The number of consecutive payment failures. Resets to `0` after a successful payment. If this reaches the `payment_failure_threshold` value, the subscription updates to the `SUSPENDED` state", - "readOnly" : true, - "x-ballerina-name" : "failedPaymentsCount" - }, - "next_billing_time" : { - "allOf" : [ { - "$ref" : "#/components/schemas/DateTime" - } ], - "x-ballerina-name" : "nextBillingTime" - }, - "last_failed_payment" : { - "allOf" : [ { - "$ref" : "#/components/schemas/FailedPaymentDetails" - } ], - "x-ballerina-name" : "lastFailedPayment" - }, - "outstanding_balance" : { - "allOf" : [ { - "$ref" : "#/components/schemas/Money" - } ], - "x-ballerina-name" : "outstandingBalance" - }, - "last_payment" : { - "allOf" : [ { - "$ref" : "#/components/schemas/LastPaymentDetails" - } ], - "x-ballerina-name" : "lastPayment" + "card" : { + "$ref" : "#/components/schemas/card_response_with_billing_address" } }, - "description" : "The billing details for the subscription. If the subscription was or is active, these fields are populated" + "description" : "The payment source used to fund the payment." }, - "SubscriptionReviseRequest" : { - "title" : "Subscription Modify Plan Request", - "type" : "object", + "subscriptions.capture-422" : { "properties" : { - "shipping_amount" : { - "allOf" : [ { - "$ref" : "#/components/schemas/Money" - } ], - "x-ballerina-name" : "shippingAmount" - }, - "quantity" : { - "maxLength" : 32, - "minLength" : 1, - "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", - "type" : "string", - "description" : "The quantity of the product or service in the subscription" - }, - "application_context" : { - "allOf" : [ { - "$ref" : "#/components/schemas/ApplicationContext" - } ], - "x-ballerina-name" : "applicationContext" - }, - "shipping_address" : { - "allOf" : [ { - "$ref" : "#/components/schemas/ShippingDetail" - } ], - "x-ballerina-name" : "shippingAddress" - }, - "plan" : { - "$ref" : "#/components/schemas/PlanOverride" - }, - "plan_id" : { - "maxLength" : 50, - "minLength" : 3, - "type" : "string", - "description" : "The unique PayPal-generated ID for the plan", - "x-ballerina-name" : "planId" + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscapture422Details" + } } - }, - "description" : "The request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent" + } }, "INVALIDSTRINGMAXLENGTH" : { "title" : "INVALID_STRING_MAX_LENGTH", @@ -2880,40 +2877,6 @@ } } }, - "PayeePaymentMethodPreference" : { - "maxLength" : 255, - "minLength" : 1, - "pattern" : "^[0-9A-Z_]+$", - "type" : "string", - "description" : "The merchant-preferred payment methods", - "default" : "UNRESTRICTED", - "enum" : [ "UNRESTRICTED", "IMMEDIATE_PAYMENT_REQUIRED" ] - }, - "Frequency" : { - "title" : "Billing Cycle Frequency", - "required" : [ "interval_unit" ], - "type" : "object", - "properties" : { - "interval_count" : { - "maximum" : 365, - "minimum" : 1, - "type" : "integer", - "description" : "The number of intervals after which a subscriber is billed. For example, if the `interval_unit` is `DAY` with an `interval_count` of `2`, the subscription is billed once every two days. The following table lists the maximum allowed values for the `interval_count` for each `interval_unit`:
Interval unitMaximum interval count
DAY365
WEEK52
MONTH12
YEAR1
", - "default" : 1, - "x-ballerina-name" : "intervalCount" - }, - "interval_unit" : { - "maxLength" : 24, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", - "type" : "string", - "description" : "The interval at which the subscription is charged or billed", - "enum" : [ "DAY", "WEEK", "MONTH", "YEAR" ], - "x-ballerina-name" : "intervalUnit" - } - }, - "description" : "The frequency of the billing cycle" - }, "422Details" : { "anyOf" : [ { "$ref" : "#/components/schemas/USERACCOUNTCLOSED" @@ -2962,16 +2925,6 @@ "$ref" : "#/components/schemas/PLANSTATUSINACTIVE" } ] }, - "CardResponseWithBillingAddress" : { - "title" : "Card Response with billing address and name", - "type" : "object", - "description" : "The payment card used to fund the payment. Card can be a credit or debit card", - "allOf" : [ { - "$ref" : "#/components/schemas/CardResponse" - }, { - "$ref" : "#/components/schemas/CardResponseWithBillingAddressAllOf2" - } ] - }, "PlansupdatePricingSchemes400Details" : { "anyOf" : [ { "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE4" @@ -2982,105 +2935,22 @@ "PayerAllOf2" : { "properties" : { "name" : { - "$ref" : "#/components/schemas/Name" + "$ref" : "#/components/schemas/name" }, "phone" : { - "$ref" : "#/components/schemas/PhoneWithType" + "$ref" : "#/components/schemas/phone_with_type" }, "birth_date" : { - "$ref" : "#/components/schemas/DateNoTime" + "$ref" : "#/components/schemas/date_no_time" }, "tax_info" : { - "$ref" : "#/components/schemas/TaxInfo" + "$ref" : "#/components/schemas/tax_info" }, "address" : { - "$ref" : "#/components/schemas/AddressPortable" + "$ref" : "#/components/schemas/address_portable" } } }, - "BillingCycleOverride" : { - "title" : "Billing Cycle Override", - "required" : [ "sequence" ], - "type" : "object", - "properties" : { - "sequence" : { - "maximum" : 99, - "minimum" : 1, - "type" : "integer", - "description" : "The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle" - }, - "total_cycles" : { - "maximum" : 999, - "minimum" : 0, - "type" : "integer", - "description" : "The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles)", - "x-ballerina-name" : "totalCycles" - }, - "pricing_scheme" : { - "allOf" : [ { - "$ref" : "#/components/schemas/PricingScheme" - } ], - "x-ballerina-name" : "pricingScheme" - } - }, - "description" : "The billing cycle details to override at subscription level. The subscription billing cycle definition has to adhere to the plan billing cycle definition" - }, - "CycleExecution" : { - "title" : "Billing Cycle Execution Details", - "required" : [ "cycles_completed", "sequence", "tenure_type" ], - "type" : "object", - "properties" : { - "sequence" : { - "maximum" : 99, - "minimum" : 0, - "type" : "integer", - "description" : "The order in which to run this cycle among other billing cycles" - }, - "cycles_remaining" : { - "maximum" : 9999, - "minimum" : 0, - "type" : "integer", - "description" : "For a finite billing cycle, cycles_remaining is the number of remaining cycles. For an infinite billing cycle, cycles_remaining is set as 0", - "readOnly" : true, - "x-ballerina-name" : "cyclesRemaining" - }, - "tenure_type" : { - "maxLength" : 24, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", - "type" : "string", - "description" : "The type of the billing cycle", - "readOnly" : true, - "enum" : [ "REGULAR", "TRIAL" ], - "x-ballerina-name" : "tenureType" - }, - "cycles_completed" : { - "maximum" : 9999, - "minimum" : 0, - "type" : "integer", - "description" : "The number of billing cycles that have completed", - "readOnly" : true, - "x-ballerina-name" : "cyclesCompleted" - }, - "current_pricing_scheme_version" : { - "maximum" : 99, - "minimum" : 1, - "type" : "integer", - "description" : "The active pricing scheme version for the billing cycle", - "readOnly" : true, - "x-ballerina-name" : "currentPricingSchemeVersion" - }, - "total_cycles" : { - "maximum" : 999, - "minimum" : 0, - "type" : "integer", - "description" : "The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles)", - "readOnly" : true, - "x-ballerina-name" : "totalCycles" - } - }, - "description" : "The regular and trial execution details for a billing cycle" - }, "INVALIDTRIALBILLINGTOTALCYCLES" : { "title" : "INVALID_TRIAL_BILLING_TOTAL_CYCLES", "properties" : { @@ -3094,22 +2964,6 @@ } } }, - "Email" : { - "maxLength" : 254, - "pattern" : "(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])", - "type" : "string", - "description" : "The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
", - "format" : "merchant_common_email_address_v2" - }, - "AccountId" : { - "title" : "PayPal Account Identifier", - "maxLength" : 13, - "minLength" : 13, - "pattern" : "^[2-9A-HJ-NP-Z]{13}$", - "type" : "string", - "description" : "The account identifier for a PayPal account", - "format" : "ppaas_payer_id_v3" - }, "Subscriptionsactivate422Details" : { "anyOf" : [ { "$ref" : "#/components/schemas/USERACCOUNTCLOSED9" @@ -3123,15 +2977,26 @@ "$ref" : "#/components/schemas/SUBSCRIPTIONCANNOTBEACTIVATED2" } ] }, - "SubscriptionsCreate422" : { + "subscription_activate_request" : { + "title" : "Activate Subscription Request", + "type" : "object", "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionscreate422Details" - } + "reason" : { + "maxLength" : 128, + "minLength" : 1, + "type" : "string", + "description" : "The reason for activation of a subscription. Required to reactivate the subscription." } - } + }, + "description" : "The activate subscription request details." + }, + "language" : { + "maxLength" : 10, + "minLength" : 2, + "pattern" : "^[a-z]{2}(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}))?$", + "type" : "string", + "description" : "The [language tag](https://tools.ietf.org/html/bcp47#section-2) for the language in which to localize the error-related strings, such as messages, issues, and suggested actions. The tag is made up of the [ISO 639-2 language code](https://www.loc.gov/standards/iso639-2/php/code_list.php), the optional [ISO-15924 script tag](https://www.unicode.org/iso15924/codelists.html), and the [ISO-3166 alpha-2 country code](/docs/integration/direct/rest/country-codes/).", + "format" : "ppaas_common_language_v3" }, "INVALIDPRICINGTIERAMOUNT" : { "title" : "INVALID_PRICING_TIER_AMOUNT", @@ -3146,59 +3011,44 @@ } } }, - "Name" : { - "title" : "Name", + "error_location" : { + "type" : "string", + "description" : "The location of the field that caused the error. Value is `body`, `path`, or `query`.", + "default" : "body", + "enum" : [ "body", "path", "query" ] + }, + "subscriptions.cancel-400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscancel400Details" + } + } + } + }, + "frequency" : { + "title" : "Billing Cycle Frequency", + "required" : [ "interval_unit" ], "type" : "object", "properties" : { - "full_name" : { - "maxLength" : 300, - "type" : "string", - "description" : "When the party is a person, the party's full name", - "x-ballerina-name" : "fullName" - }, - "prefix" : { - "maxLength" : 140, - "type" : "string", - "description" : "The prefix, or title, to the party's name" - }, - "surname" : { - "maxLength" : 140, - "type" : "string", - "description" : "When the party is a person, the party's surname or family name. Also known as the last name. Required when the party is a person. Use also to store multiple surnames including the matronymic, or mother's, surname" - }, - "given_name" : { - "maxLength" : 140, - "type" : "string", - "description" : "When the party is a person, the party's given, or first, name", - "x-ballerina-name" : "givenName" - }, - "middle_name" : { - "maxLength" : 140, - "type" : "string", - "description" : "When the party is a person, the party's middle name. Use also to store multiple middle names including the patronymic, or father's, middle name", - "x-ballerina-name" : "middleName" - }, - "suffix" : { - "maxLength" : 140, + "interval_unit" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", "type" : "string", - "description" : "The suffix for the party's name" + "description" : "The interval at which the subscription is charged or billed.", + "enum" : [ "DAY", "WEEK", "MONTH", "YEAR" ] }, - "alternate_full_name" : { - "maxLength" : 300, - "type" : "string", - "description" : "DEPRECATED. The party's alternate name. Can be a business name, nickname, or any other name that cannot be split into first, last name. Required when the party is a business", - "x-ballerina-name" : "alternateFullName" + "interval_count" : { + "maximum" : 365, + "minimum" : 1, + "type" : "integer", + "description" : "The number of intervals after which a subscriber is billed. For example, if the `interval_unit` is `DAY` with an `interval_count` of `2`, the subscription is billed once every two days. The following table lists the maximum allowed values for the `interval_count` for each `interval_unit`:
Interval unitMaximum interval count
DAY365
WEEK52
MONTH12
YEAR1
", + "default" : 1 } }, - "description" : "The name of the party" - }, - "Enrolled" : { - "maxLength" : 255, - "minLength" : 1, - "pattern" : "^[0-9A-Z_]+$", - "type" : "string", - "description" : "Status of Authentication eligibility", - "enum" : [ "Y", "N", "U", "B" ] + "description" : "The frequency of the billing cycle." }, "BILLINGCYCLEEXECUTIONCOMPLETED" : { "title" : "BILLING_CYCLE_EXECUTION_COMPLETED", @@ -3213,224 +3063,125 @@ } } }, - "PaymentPreferences" : { - "title" : "Payment Preferences", - "type" : "object", + "MULTIPLEREGULARBILLINGCYCLESNOTSUPPORTED" : { + "title" : "MULTIPLE_REGULAR_BILLING_CYCLES_NOT_SUPPORTED", "properties" : { - "setup_fee" : { - "allOf" : [ { - "$ref" : "#/components/schemas/Money" - } ], - "x-ballerina-name" : "setupFee" - }, - "setup_fee_failure_action" : { - "maxLength" : 24, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", + "issue" : { "type" : "string", - "description" : "The action to take on the subscription if the initial payment for the setup fails", - "default" : "CANCEL", - "enum" : [ "CONTINUE", "CANCEL" ], - "x-ballerina-name" : "setupFeeFailureAction" - }, - "auto_bill_outstanding" : { - "type" : "boolean", - "description" : "Indicates whether to automatically bill the outstanding amount in the next billing cycle", - "default" : true, - "x-ballerina-name" : "autoBillOutstanding" + "enum" : [ "MULTIPLE_REGULAR_BILLING_CYCLES_NOT_SUPPORTED" ] }, - "payment_failure_threshold" : { - "maximum" : 999, - "minimum" : 0, - "type" : "integer", - "description" : "The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail", - "default" : 0, - "x-ballerina-name" : "paymentFailureThreshold" + "description" : { + "type" : "string", + "enum" : [ "Only one regular billing cycle is allowed." ] } - }, - "description" : "The payment preferences for a subscription" + } }, - "TransactionsList" : { - "title" : "List Transactions", - "type" : "object", - "properties" : { - "links" : { - "maxItems" : 10, - "minItems" : 1, - "type" : "array", - "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links)", - "readOnly" : true, - "items" : { - "$ref" : "#/components/schemas/LinkDescription" - } + "error_default" : { + "description" : "The default error response.", + "oneOf" : [ { + "$ref" : "#/components/schemas/error_400" + }, { + "$ref" : "#/components/schemas/error_401" + }, { + "$ref" : "#/components/schemas/error_403" + }, { + "$ref" : "#/components/schemas/error_404" + }, { + "$ref" : "#/components/schemas/error_409" + }, { + "$ref" : "#/components/schemas/error_415" + }, { + "$ref" : "#/components/schemas/error_422" + }, { + "$ref" : "#/components/schemas/error_500" + }, { + "$ref" : "#/components/schemas/error_503" + } ] + }, + "billing_cycle_override" : { + "title" : "Billing Cycle Override", + "required" : [ "sequence" ], + "type" : "object", + "properties" : { + "pricing_scheme" : { + "$ref" : "#/components/schemas/pricing_scheme" }, - "total_pages" : { - "maximum" : 100000000, - "minimum" : 0, + "sequence" : { + "maximum" : 99, + "minimum" : 1, "type" : "integer", - "description" : "The total number of pages", - "x-ballerina-name" : "totalPages" + "description" : "The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle." }, - "transactions" : { - "maxItems" : 32767, - "minItems" : 0, - "type" : "array", - "description" : "An array of transactions", - "items" : { - "$ref" : "#/components/schemas/Transaction" - } - }, - "total_items" : { - "maximum" : 500000000, + "total_cycles" : { + "maximum" : 999, "minimum" : 0, "type" : "integer", - "description" : "The total number of items", - "x-ballerina-name" : "totalItems" + "description" : "The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles)." } }, - "description" : "The list transactions for a subscription request details" + "description" : "The billing cycle details to override at subscription level. The subscription billing cycle definition has to adhere to the plan billing cycle definition." }, - "MULTIPLEREGULARBILLINGCYCLESNOTSUPPORTED" : { - "title" : "MULTIPLE_REGULAR_BILLING_CYCLES_NOT_SUPPORTED", + "AMOUNTGREATERTHANOUTSTANDINGBALANCE1" : { + "title" : "AMOUNT_GREATER_THAN_OUTSTANDING_BALANCE", "properties" : { "issue" : { "type" : "string", - "enum" : [ "MULTIPLE_REGULAR_BILLING_CYCLES_NOT_SUPPORTED" ] + "enum" : [ "AMOUNT_GREATER_THAN_OUTSTANDING_BALANCE" ] }, "description" : { "type" : "string", - "enum" : [ "Only one regular billing cycle is allowed." ] - } - } - }, - "PlansPatch422" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Planspatch422Details" - } + "enum" : [ "The capture amount can not be greater than the current outstanding balance." ] } } }, - "ApplicationContext" : { - "title" : "Application Context", - "required" : [ "cancel_url", "return_url" ], + "billing_cycle" : { + "title" : "Billing Cycle", + "required" : [ "frequency", "sequence", "tenure_type" ], "type" : "object", "properties" : { - "user_action" : { - "maxLength" : 24, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", - "type" : "string", - "description" : "Configures the label name to `Continue` or `Subscribe Now` for subscription consent experience", - "default" : "SUBSCRIBE_NOW", - "enum" : [ "CONTINUE", "SUBSCRIBE_NOW" ], - "x-ballerina-name" : "userAction" - }, - "return_url" : { - "maxLength" : 4000, - "minLength" : 10, - "type" : "string", - "description" : "The URL where the customer is redirected after the customer approves the payment", - "format" : "uri", - "x-ballerina-name" : "returnUrl" - }, - "brand_name" : { - "maxLength" : 127, - "minLength" : 1, - "type" : "string", - "description" : "The label that overrides the business name in the PayPal account on the PayPal site", - "x-ballerina-name" : "brandName" - }, - "locale" : { - "$ref" : "#/components/schemas/Language" + "pricing_scheme" : { + "$ref" : "#/components/schemas/pricing_scheme" }, - "cancel_url" : { - "maxLength" : 4000, - "minLength" : 10, - "type" : "string", - "description" : "The URL where the customer is redirected after the customer cancels the payment", - "format" : "uri", - "x-ballerina-name" : "cancelUrl" + "frequency" : { + "$ref" : "#/components/schemas/frequency" }, - "shipping_preference" : { + "tenure_type" : { "maxLength" : 24, "minLength" : 1, "pattern" : "^[A-Z_]+$", "type" : "string", - "description" : "The location from which the shipping address is derived", - "default" : "GET_FROM_FILE", - "enum" : [ "GET_FROM_FILE", "NO_SHIPPING", "SET_PROVIDED_ADDRESS" ], - "x-ballerina-name" : "shippingPreference" + "description" : "The tenure type of the billing cycle. In case of a plan having trial cycle, only 2 trial cycles are allowed per plan.", + "enum" : [ "REGULAR", "TRIAL" ] }, - "payment_method" : { - "allOf" : [ { - "$ref" : "#/components/schemas/PaymentMethod" - } ], - "x-ballerina-name" : "paymentMethod" - } - }, - "description" : "The application context, which customizes the payer experience during the subscription approval process with PayPal" - }, - "Subscriber" : { - "title" : "Subscriber Response Information", - "type" : "object", - "description" : "The subscriber response information", - "allOf" : [ { - "$ref" : "#/components/schemas/Payer" - }, { - "$ref" : "#/components/schemas/SubscriberAllOf2" - } ] - }, - "AMOUNTGREATERTHANOUTSTANDINGBALANCE1" : { - "title" : "AMOUNT_GREATER_THAN_OUTSTANDING_BALANCE", - "properties" : { - "issue" : { - "type" : "string", - "enum" : [ "AMOUNT_GREATER_THAN_OUTSTANDING_BALANCE" ] + "sequence" : { + "maximum" : 99, + "minimum" : 1, + "type" : "integer", + "description" : "The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle." }, - "description" : { - "type" : "string", - "enum" : [ "The capture amount can not be greater than the current outstanding balance." ] - } - } - }, - "PaymentSourceResponse" : { - "title" : "Payment Source Response", - "type" : "object", - "properties" : { - "card" : { - "$ref" : "#/components/schemas/CardResponseWithBillingAddress" + "total_cycles" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles).", + "default" : 1 } }, - "description" : "The payment source used to fund the payment" + "description" : "The billing cycle details." }, - "PlanOverride" : { - "title" : "Plan Override", + "phone_with_type" : { + "title" : "Phone With Type", + "required" : [ "phone_number" ], "type" : "object", "properties" : { - "payment_preferences" : { - "allOf" : [ { - "$ref" : "#/components/schemas/PaymentPreferencesOverride" - } ], - "x-ballerina-name" : "paymentPreferences" - }, - "billing_cycles" : { - "maxItems" : 12, - "minItems" : 1, - "type" : "array", - "description" : "An array of billing cycles for trial billing and regular billing. The subscription billing cycle definition has to adhere to the plan billing cycle definition", - "items" : { - "$ref" : "#/components/schemas/BillingCycleOverride" - }, - "x-ballerina-name" : "billingCycles" + "phone_type" : { + "$ref" : "#/components/schemas/phone_type" }, - "taxes" : { - "$ref" : "#/components/schemas/TaxesOverride" + "phone_number" : { + "$ref" : "#/components/schemas/phone" } }, - "description" : "An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object" + "description" : "The phone information." }, "INVALIDINTEGERMINVALUE" : { "title" : "INVALID_INTEGER_MIN_VALUE", @@ -3462,7 +3213,7 @@ "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).", "readOnly" : true, "items" : { - "$ref" : "#/components/schemas/LinkDescription" + "$ref" : "#/components/schemas/link_description" } } } @@ -3506,25 +3257,6 @@ } } }, - "ThreeDSecureAuthenticationResponse" : { - "title" : "The 3D Secure Authentication Response", - "type" : "object", - "properties" : { - "authentication_status" : { - "allOf" : [ { - "$ref" : "#/components/schemas/ParesStatus" - } ], - "x-ballerina-name" : "authenticationStatus" - }, - "enrollment_status" : { - "allOf" : [ { - "$ref" : "#/components/schemas/Enrolled" - } ], - "x-ballerina-name" : "enrollmentStatus" - } - }, - "description" : "Results of 3D Secure Authentication" - }, "403Details" : { "anyOf" : [ { "$ref" : "#/components/schemas/PERMISSIONDENIED" @@ -3587,13 +3319,47 @@ } } }, - "PatchRequest" : { - "title" : "Patch Request", - "type" : "array", - "description" : "An array of JSON patch objects to apply partial updates to resources", - "items" : { - "$ref" : "#/components/schemas/Patch" - } + "subscription_revise_request" : { + "title" : "Subscription Modify Plan Request", + "type" : "object", + "properties" : { + "plan_id" : { + "maxLength" : 50, + "minLength" : 3, + "type" : "string", + "description" : "The unique PayPal-generated ID for the plan." + }, + "quantity" : { + "maxLength" : 32, + "minLength" : 1, + "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", + "type" : "string", + "description" : "The quantity of the product or service in the subscription." + }, + "shipping_amount" : { + "$ref" : "#/components/schemas/money" + }, + "shipping_address" : { + "$ref" : "#/components/schemas/shipping_detail" + }, + "application_context" : { + "$ref" : "#/components/schemas/application_context" + }, + "plan" : { + "$ref" : "#/components/schemas/plan_override" + } + }, + "description" : "The request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent." + }, + "subscription_revise_response" : { + "title" : "Update Product Quantity in Subscription Response", + "type" : "object", + "description" : "The response to a request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent.", + "allOf" : [ { + "$ref" : "#/components/schemas/subscription_revise_request" + }, { + "$ref" : "#/components/schemas/SubscriptionReviseResponseAllOf2" + } ] }, "CURRENCYMISMATCH5" : { "title" : "CURRENCY_MISMATCH", @@ -3647,11 +3413,19 @@ } } }, + "country_code" : { + "maxLength" : 2, + "minLength" : 2, + "pattern" : "^([A-Z]{2}|C2)$", + "type" : "string", + "description" : "The [two-character ISO 3166-1 code](/docs/integration/direct/rest/country-codes/) that identifies the country or region.
Note: The country code for Great Britain is GB and not UK as used in the top-level domain names for that country. Use the `C2` country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border transactions.
", + "format" : "ppaas_common_country_code_v2" + }, "InlineResponse4041" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error404" + "$ref" : "#/components/schemas/error_404" }, { - "$ref" : "#/components/schemas/SubscriptionsRevise404" + "$ref" : "#/components/schemas/subscriptions.revise-404" } ] }, "Subscriptionscancel422Details" : { @@ -3661,133 +3435,112 @@ "$ref" : "#/components/schemas/SUBSCRIPTIONSTATUSINVALID2" } ] }, - "CardResponse" : { - "title" : "Card Response", + "name" : { + "title" : "Name", "type" : "object", "properties" : { - "authentication_result" : { - "allOf" : [ { - "$ref" : "#/components/schemas/AuthenticationResponse" - } ], - "x-ballerina-name" : "authenticationResult" + "prefix" : { + "maxLength" : 140, + "type" : "string", + "description" : "The prefix, or title, to the party's name." }, - "type" : { + "given_name" : { + "maxLength" : 140, "type" : "string", - "description" : "The payment card type", - "readOnly" : true, - "enum" : [ "CREDIT", "DEBIT", "PREPAID", "UNKNOWN" ] + "description" : "When the party is a person, the party's given, or first, name." }, - "last_digits" : { - "pattern" : "[0-9]{2,}", + "surname" : { + "maxLength" : 140, "type" : "string", - "description" : "The last digits of the payment card", - "readOnly" : true, - "x-ballerina-name" : "lastDigits" + "description" : "When the party is a person, the party's surname or family name. Also known as the last name. Required when the party is a person. Use also to store multiple surnames including the matronymic, or mother's, surname." }, - "brand" : { - "$ref" : "#/components/schemas/CardBrand" + "middle_name" : { + "maxLength" : 140, + "type" : "string", + "description" : "When the party is a person, the party's middle name. Use also to store multiple middle names including the patronymic, or father's, middle name." + }, + "suffix" : { + "maxLength" : 140, + "type" : "string", + "description" : "The suffix for the party's name." + }, + "alternate_full_name" : { + "maxLength" : 300, + "type" : "string", + "description" : "DEPRECATED. The party's alternate name. Can be a business name, nickname, or any other name that cannot be split into first, last name. Required when the party is a business." + }, + "full_name" : { + "maxLength" : 300, + "type" : "string", + "description" : "When the party is a person, the party's full name." } }, - "description" : "The payment card to use to fund a payment. Card can be a credit or debit card" + "description" : "The name of the party." }, - "PlanRequestPOST" : { - "title" : "Create Plan Request", - "required" : [ "billing_cycles", "name", "payment_preferences", "product_id" ], + "application_context" : { + "title" : "Application Context", + "required" : [ "cancel_url", "return_url" ], "type" : "object", "properties" : { - "quantity_supported" : { - "type" : "boolean", - "description" : "Indicates whether you can subscribe to this plan by providing a quantity for the goods or service", - "default" : false, - "x-ballerina-name" : "quantitySupported" - }, - "payment_preferences" : { - "allOf" : [ { - "$ref" : "#/components/schemas/PaymentPreferences" - } ], - "x-ballerina-name" : "paymentPreferences" - }, - "product_id" : { - "maxLength" : 50, - "minLength" : 6, - "type" : "string", - "description" : "The ID of the product created through Catalog Products API", - "x-ballerina-name" : "productId" - }, - "name" : { + "brand_name" : { "maxLength" : 127, "minLength" : 1, "type" : "string", - "description" : "The plan name" + "description" : "The label that overrides the business name in the PayPal account on the PayPal site." }, - "billing_cycles" : { - "maxItems" : 12, - "minItems" : 1, - "type" : "array", - "description" : "An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle", - "items" : { - "$ref" : "#/components/schemas/BillingCycle" - }, - "x-ballerina-name" : "billingCycles" + "locale" : { + "$ref" : "#/components/schemas/language" }, - "description" : { - "maxLength" : 127, + "shipping_preference" : { + "maxLength" : 24, "minLength" : 1, + "pattern" : "^[A-Z_]+$", "type" : "string", - "description" : "The detailed description of the plan" - }, - "taxes" : { - "$ref" : "#/components/schemas/Taxes" + "description" : "The location from which the shipping address is derived.", + "default" : "GET_FROM_FILE", + "enum" : [ "GET_FROM_FILE", "NO_SHIPPING", "SET_PROVIDED_ADDRESS" ] }, - "status" : { + "user_action" : { "maxLength" : 24, "minLength" : 1, "pattern" : "^[A-Z_]+$", "type" : "string", - "description" : "The initial state of the plan. Allowed input values are CREATED and ACTIVE", - "default" : "ACTIVE", - "enum" : [ "CREATED", "INACTIVE", "ACTIVE" ] - } - }, - "description" : "The create plan request details" - }, - "INVALIDINTEGERMAXVALUE2" : { - "title" : "INVALID_INTEGER_MAX_VALUE", - "properties" : { - "issue" : { - "type" : "string", - "enum" : [ "INVALID_INTEGER_MAX_VALUE" ] + "description" : "Configures the label name to `Continue` or `Subscribe Now` for subscription consent experience.", + "default" : "SUBSCRIBE_NOW", + "enum" : [ "CONTINUE", "SUBSCRIBE_NOW" ] }, - "description" : { + "payment_method" : { + "$ref" : "#/components/schemas/payment_method" + }, + "return_url" : { + "maxLength" : 4000, + "minLength" : 10, "type" : "string", - "enum" : [ "The integer value of a field is too large." ] + "description" : "The URL where the customer is redirected after the customer approves the payment.", + "format" : "uri" + }, + "cancel_url" : { + "maxLength" : 4000, + "minLength" : 10, + "type" : "string", + "description" : "The URL where the customer is redirected after the customer cancels the payment.", + "format" : "uri" } - } + }, + "description" : "The application context, which customizes the payer experience during the subscription approval process with PayPal." }, - "Patch" : { - "title" : "Patch", - "required" : [ "op" ], - "type" : "object", + "INVALIDINTEGERMAXVALUE2" : { + "title" : "INVALID_INTEGER_MAX_VALUE", "properties" : { - "op" : { - "type" : "string", - "description" : "The operation", - "enum" : [ "add", "remove", "replace", "move", "copy", "test" ] - }, - "path" : { + "issue" : { "type" : "string", - "description" : "The JSON Pointer to the target document location at which to complete the operation" + "enum" : [ "INVALID_INTEGER_MAX_VALUE" ] }, - "from" : { + "description" : { "type" : "string", - "description" : "The JSON Pointer to the target document location from which to move the value. Required for the move operation" - }, - "value" : { - "title" : "Patch Value", - "description" : "The value to apply. The remove operation does not require a value" + "enum" : [ "The integer value of a field is too large." ] } - }, - "description" : "The JSON patch object to apply partial updates to resources" + } }, "INVALIDINTEGERMAXVALUE3" : { "title" : "INVALID_INTEGER_MAX_VALUE", @@ -3846,57 +3599,123 @@ } } }, - "LinkDescription" : { - "title" : "Link Description", - "required" : [ "href", "rel" ], + "payment_preferences" : { + "title" : "Payment Preferences", "type" : "object", "properties" : { - "method" : { + "auto_bill_outstanding" : { + "type" : "boolean", + "description" : "Indicates whether to automatically bill the outstanding amount in the next billing cycle.", + "default" : true + }, + "setup_fee" : { + "$ref" : "#/components/schemas/money" + }, + "setup_fee_failure_action" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", "type" : "string", - "description" : "The HTTP method required to make the related call", - "enum" : [ "GET", "POST", "PUT", "DELETE", "HEAD", "CONNECT", "OPTIONS", "PATCH" ] + "description" : "The action to take on the subscription if the initial payment for the setup fails.", + "default" : "CANCEL", + "enum" : [ "CONTINUE", "CANCEL" ] }, - "rel" : { + "payment_failure_threshold" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail.", + "default" : 0 + } + }, + "description" : "The payment preferences for a subscription." + }, + "subscription_capture_request" : { + "title" : "Charge Amount from Subscriber", + "required" : [ "amount", "capture_type", "note" ], + "type" : "object", + "properties" : { + "note" : { + "maxLength" : 128, + "minLength" : 1, "type" : "string", - "description" : "The [link relation type](https://tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](https://www.iana.org/assignments/link-relations/link-relations.xhtml)" + "description" : "The reason or note for the subscription charge." }, - "href" : { + "capture_type" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", "type" : "string", - "description" : "The complete target URL. To make the related call, combine the method with this [URI Template-formatted](https://tools.ietf.org/html/rfc6570) link. For pre-processing, include the `$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call" + "description" : "The type of capture.", + "enum" : [ "OUTSTANDING_BALANCE" ] + }, + "amount" : { + "$ref" : "#/components/schemas/money" + } + }, + "description" : "The charge amount from the subscriber." + }, + "transactions_list" : { + "title" : "List Transactions", + "type" : "object", + "properties" : { + "transactions" : { + "maxItems" : 32767, + "minItems" : 0, + "type" : "array", + "description" : "An array of transactions.", + "items" : { + "$ref" : "#/components/schemas/transaction" + } + }, + "total_items" : { + "maximum" : 500000000, + "minimum" : 0, + "type" : "integer", + "description" : "The total number of items." + }, + "total_pages" : { + "maximum" : 100000000, + "minimum" : 0, + "type" : "integer", + "description" : "The total number of pages." + }, + "links" : { + "maxItems" : 10, + "minItems" : 1, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).", + "readOnly" : true, + "items" : { + "$ref" : "#/components/schemas/link_description" + } } }, - "description" : "The request-related [HATEOAS link](/docs/api/reference/api-responses/#hateoas-links) information" + "description" : "The list transactions for a subscription request details." }, - "SubscriptionsCreate400" : { + "subscriptions.transactions-400" : { "properties" : { "details" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/Subscriptionscreate400Details" + "$ref" : "#/components/schemas/Subscriptionstransactions400Details" } } } }, - "ShippingDetail" : { - "title" : "Shipping Details", + "subscription_cancel_request" : { + "title" : "Cancel Subscription Request", + "required" : [ "reason" ], "type" : "object", "properties" : { - "address" : { - "$ref" : "#/components/schemas/AddressPortable" - }, - "name" : { - "$ref" : "#/components/schemas/Name" - }, - "type" : { - "maxLength" : 255, + "reason" : { + "maxLength" : 128, "minLength" : 1, - "pattern" : "^[0-9A-Z_]+$", "type" : "string", - "description" : "The method by which the payer wants to get their items from the payee e.g shipping, in-person pickup. Either type or options but not both may be present", - "enum" : [ "SHIPPING", "PICKUP_IN_PERSON" ] + "description" : "The reason for the cancellation of a subscription." } }, - "description" : "The shipping details" + "description" : "The cancel subscription request details." }, "INVALIDMETADATAINVOICEID" : { "title" : "INVALID_METADATA_INVOICE_ID", @@ -3911,6 +3730,14 @@ } } }, + "patch_request" : { + "title" : "Patch Request", + "type" : "array", + "description" : "An array of JSON patch objects to apply partial updates to resources.", + "items" : { + "$ref" : "#/components/schemas/patch" + } + }, "INVALIDINTEGERMAXVALUE" : { "title" : "INVALID_INTEGER_MAX_VALUE", "properties" : { @@ -3956,16 +3783,6 @@ "$ref" : "#/components/schemas/AMOUNTGREATERTHANOUTSTANDINGBALANCE1" } ] }, - "PlansCreate400" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Planscreate400Details" - } - } - } - }, "PLANSTATUSINVALID1" : { "title" : "PLAN_STATUS_INVALID", "properties" : { @@ -3979,58 +3796,6 @@ } } }, - "LiabilityShift" : { - "maxLength" : 255, - "minLength" : 1, - "pattern" : "^[0-9A-Z_]+$", - "type" : "string", - "description" : "Liability shift indicator. The outcome of the issuer's authentication", - "enum" : [ "YES", "NO", "POSSIBLE", "UNKNOWN" ] - }, - "AmountWithBreakdown" : { - "title" : "Amount with Breakdown", - "required" : [ "gross_amount" ], - "type" : "object", - "properties" : { - "shipping_amount" : { - "allOf" : [ { - "$ref" : "#/components/schemas/Money" - } ], - "x-ballerina-name" : "shippingAmount" - }, - "tax_amount" : { - "allOf" : [ { - "$ref" : "#/components/schemas/Money" - } ], - "x-ballerina-name" : "taxAmount" - }, - "fee_amount" : { - "allOf" : [ { - "$ref" : "#/components/schemas/Money" - } ], - "x-ballerina-name" : "feeAmount" - }, - "total_item_amount" : { - "allOf" : [ { - "$ref" : "#/components/schemas/Money" - } ], - "x-ballerina-name" : "totalItemAmount" - }, - "gross_amount" : { - "allOf" : [ { - "$ref" : "#/components/schemas/Money" - } ], - "x-ballerina-name" : "grossAmount" - }, - "net_amount" : { - "allOf" : [ { - "$ref" : "#/components/schemas/Money" - } ], - "x-ballerina-name" : "netAmount" - } - }, - "description" : "The breakdown details for the amount. Includes the gross, tax, fee, and shipping amounts" - }, "SUBSCRIBERACCOUNTLOCKED" : { "title" : "SUBSCRIBER_ACCOUNT_LOCKED", "properties" : { @@ -4044,66 +3809,6 @@ } } }, - "Money" : { - "title" : "Money", - "required" : [ "currency_code", "value" ], - "type" : "object", - "properties" : { - "value" : { - "maxLength" : 32, - "pattern" : "^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$", - "type" : "string", - "description" : "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](/docs/integration/direct/rest/currency-codes/)" - }, - "currency_code" : { - "allOf" : [ { - "$ref" : "#/components/schemas/CurrencyCode" - } ], - "x-ballerina-name" : "currencyCode" - } - }, - "description" : "The currency and amount for a financial transaction, such as a balance or payment due" - }, - "UnprocessableEntity" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/422Details" - } - } - } - }, - "LastPaymentDetails" : { - "title" : "Last Payment Details", - "required" : [ "amount", "time" ], - "type" : "object", - "description" : "The details for the last payment", - "allOf" : [ { - "$ref" : "#/components/schemas/LastPaymentDetailsAllOf1" - } ] - }, - "Language" : { - "maxLength" : 10, - "minLength" : 2, - "pattern" : "^[a-z]{2}(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}))?$", - "type" : "string", - "description" : "The [language tag](https://tools.ietf.org/html/bcp47#section-2) for the language in which to localize the error-related strings, such as messages, issues, and suggested actions. The tag is made up of the [ISO 639-2 language code](https://www.loc.gov/standards/iso639-2/php/code_list.php), the optional [ISO-15924 script tag](https://www.unicode.org/iso15924/codelists.html), and the [ISO-3166 alpha-2 country code](/docs/integration/direct/rest/country-codes/)", - "format" : "ppaas_common_language_v3" - }, - "SubscriptionActivateRequest" : { - "title" : "Activate Subscription Request", - "type" : "object", - "properties" : { - "reason" : { - "maxLength" : 128, - "minLength" : 1, - "type" : "string", - "description" : "The reason for activation of a subscription. Required to reactivate the subscription" - } - }, - "description" : "The activate subscription request details" - }, "Subscriptionscapture400Details" : { "anyOf" : [ { "$ref" : "#/components/schemas/MISSINGREQUESTBODY3" @@ -4122,13 +3827,62 @@ "$ref" : "#/components/schemas/PLANSTATUSINVALID" } ] }, + "subscription_request_post" : { + "title" : "Create Subscription Request", + "required" : [ "plan_id" ], + "type" : "object", + "properties" : { + "plan_id" : { + "maxLength" : 50, + "minLength" : 3, + "type" : "string", + "description" : "The ID of the plan." + }, + "start_time" : { + "$ref" : "#/components/schemas/date_time" + }, + "quantity" : { + "maxLength" : 32, + "minLength" : 1, + "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", + "type" : "string", + "description" : "The quantity of the product in the subscription." + }, + "shipping_amount" : { + "$ref" : "#/components/schemas/money" + }, + "subscriber" : { + "$ref" : "#/components/schemas/subscriber_request" + }, + "auto_renewal" : { + "type" : "boolean", + "description" : "DEPRECATED. Indicates whether the subscription auto-renews after the billing cycles complete.", + "deprecated" : true, + "default" : false + }, + "application_context" : { + "$ref" : "#/components/schemas/application_context" + }, + "custom_id" : { + "maxLength" : 127, + "minLength" : 1, + "pattern" : "^[\\x20-\\x7E]+", + "type" : "string", + "description" : "The custom id for the subscription. Can be invoice id." + }, + "plan" : { + "$ref" : "#/components/schemas/plan_override" + } + }, + "description" : "The create subscription request details." + }, "SubscriberRequestAllOf2" : { "properties" : { "shipping_address" : { - "$ref" : "#/components/schemas/ShippingDetail" + "$ref" : "#/components/schemas/shipping_detail" }, "payment_source" : { - "$ref" : "#/components/schemas/PaymentSource" + "$ref" : "#/components/schemas/payment_source" } } }, @@ -4145,61 +3899,15 @@ } } }, - "PricingTier" : { - "title" : "Pricing Tier", - "required" : [ "amount", "starting_quantity" ], - "type" : "object", - "properties" : { - "starting_quantity" : { - "maxLength" : 32, - "minLength" : 1, - "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", - "type" : "string", - "description" : "The starting quantity for the tier", - "x-ballerina-name" : "startingQuantity" - }, - "amount" : { - "$ref" : "#/components/schemas/Money" - }, - "ending_quantity" : { - "maxLength" : 32, - "minLength" : 1, - "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", - "type" : "string", - "description" : "The ending quantity for the tier. Optional for the last tier", - "x-ballerina-name" : "endingQuantity" - } - }, - "description" : "The pricing tier details" - }, - "PayerBase" : { - "title" : "Payer Base", - "type" : "object", - "properties" : { - "email_address" : { - "allOf" : [ { - "$ref" : "#/components/schemas/Email" - } ], - "x-ballerina-name" : "emailAddress" - }, - "payer_id" : { - "allOf" : [ { - "$ref" : "#/components/schemas/AccountId" - } ], - "x-ballerina-name" : "payerId" - } - }, - "description" : "The customer who approves and pays for the order. The customer is also known as the payer" - }, - "InlineResponse40010" : { - "allOf" : [ { - "$ref" : "#/components/schemas/Error400" - }, { - "$ref" : "#/components/schemas/SubscriptionsCapture400" - } ] - }, - "INVALIDSTRINGMINLENGTH1" : { - "title" : "INVALID_STRING_MIN_LENGTH", + "InlineResponse40010" : { + "allOf" : [ { + "$ref" : "#/components/schemas/error_400" + }, { + "$ref" : "#/components/schemas/subscriptions.capture-400" + } ] + }, + "INVALIDSTRINGMINLENGTH1" : { + "title" : "INVALID_STRING_MIN_LENGTH", "properties" : { "issue" : { "type" : "string", @@ -4226,9 +3934,9 @@ }, "InlineResponse40011" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error400" + "$ref" : "#/components/schemas/error_400" }, { - "$ref" : "#/components/schemas/SubscriptionsTransactions400" + "$ref" : "#/components/schemas/subscriptions.transactions-400" } ] }, "SUBSCRIPTIONCANNOTBEACTIVATED1" : { @@ -4257,6 +3965,22 @@ } } }, + "capture_status" : { + "title" : "Capture Status", + "type" : "object", + "properties" : { + "status" : { + "type" : "string", + "description" : "The status of the captured payment.", + "readOnly" : true, + "enum" : [ "COMPLETED", "DECLINED", "PARTIALLY_REFUNDED", "PENDING", "REFUNDED" ] + }, + "status_details" : { + "$ref" : "#/components/schemas/capture_status_details" + } + }, + "description" : "The status of a captured payment." + }, "SUBSCRIPTIONSTATUSINVALID" : { "title" : "SUBSCRIPTION_STATUS_INVALID", "properties" : { @@ -4296,63 +4020,48 @@ } } }, - "PlanCollection" : { - "title" : "Plan Collection", + "money" : { + "title" : "Money", + "required" : [ "currency_code", "value" ], "type" : "object", "properties" : { - "plans" : { - "maxItems" : 32767, - "minItems" : 0, - "type" : "array", - "description" : "An array of plans", - "items" : { - "$ref" : "#/components/schemas/Plan" - } - }, - "links" : { - "maxItems" : 10, - "minItems" : 1, - "type" : "array", - "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links)", - "readOnly" : true, - "items" : { - "$ref" : "#/components/schemas/LinkDescription" - } - }, - "total_pages" : { - "maximum" : 100000000, - "minimum" : 0, - "type" : "integer", - "description" : "The total number of pages", - "x-ballerina-name" : "totalPages" + "currency_code" : { + "$ref" : "#/components/schemas/currency_code" }, - "total_items" : { - "maximum" : 500000000, - "minimum" : 0, - "type" : "integer", - "description" : "The total number of items", - "x-ballerina-name" : "totalItems" + "value" : { + "maxLength" : 32, + "pattern" : "^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$", + "type" : "string", + "description" : "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](/docs/integration/direct/rest/currency-codes/)." } }, - "description" : "The list of plans with details" - }, - "ParesStatus" : { - "maxLength" : 255, - "minLength" : 1, - "pattern" : "^[0-9A-Z_]+$", - "type" : "string", - "description" : "Transactions status result identifier. The outcome of the issuer's authentication", - "enum" : [ "Y", "N", "U", "A", "C", "R", "D", "I" ] + "description" : "The currency and amount for a financial transaction, such as a balance or payment due." }, - "SubscriptionsPatch422" : { + "amount_with_breakdown" : { + "title" : "Amount with Breakdown", + "required" : [ "gross_amount" ], + "type" : "object", "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionspatch422Details" - } + "gross_amount" : { + "$ref" : "#/components/schemas/money" + }, + "total_item_amount" : { + "$ref" : "#/components/schemas/money" + }, + "fee_amount" : { + "$ref" : "#/components/schemas/money" + }, + "shipping_amount" : { + "$ref" : "#/components/schemas/money" + }, + "tax_amount" : { + "$ref" : "#/components/schemas/money" + }, + "net_amount" : { + "$ref" : "#/components/schemas/money" } - } + }, + "description" : "The breakdown details for the amount. Includes the gross, tax, fee, and shipping amounts." }, "INVALIDPRICINGTIERQUANTITY1" : { "title" : "INVALID_PRICING_TIER_QUANTITY", @@ -4406,53 +4115,81 @@ } } }, - "Error503" : { - "title" : "Service Unavailable Error", - "type" : "object", + "INVALIDPARAMETERSYNTAX" : { + "title" : "INVALID_PARAMETER_SYNTAX", "properties" : { - "debug_id" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_SYNTAX" ] + }, + "description" : { "type" : "string", - "description" : "The PayPal internal ID. Used for correlation purposes", - "x-ballerina-name" : "debugId" + "enum" : [ "The value of a field does not conform to the expected format." ] + } + } + }, + "three_d_secure_authentication_response" : { + "title" : "The 3D Secure Authentication Response", + "type" : "object", + "properties" : { + "authentication_status" : { + "$ref" : "#/components/schemas/pares_status" }, + "enrollment_status" : { + "$ref" : "#/components/schemas/enrolled" + } + }, + "description" : "Results of 3D Secure Authentication." + }, + "error_415" : { + "title" : "Unsupported Media Type Error", + "type" : "object", + "properties" : { "name" : { "type" : "string", - "enum" : [ "SERVICE_UNAVAILABLE" ] + "enum" : [ "UNSUPPORTED_MEDIA_TYPE" ] + }, + "message" : { + "type" : "string", + "enum" : [ "The server does not support the request payload's media type." ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/error_details" + } + }, + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes." }, "links" : { "maxItems" : 10000, "minItems" : 0, "type" : "array", - "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS).", "items" : { - "$ref" : "#/components/schemas/ErrorLinkDescription" + "$ref" : "#/components/schemas/error_link_description" } - }, - "message" : { - "type" : "string", - "enum" : [ "Service Unavailable." ] } }, - "description" : "The server is temporarily unable to handle the request, for example, because of planned maintenance or downtime", - "example" : { - "name" : "SERVICE_UNAVAILABLE", - "message" : "Service Unavailable.", - "debug_id" : "90957fca61718", - "information_link" : "https://developer.paypal.com/docs/api/orders/v2/#error-SERVICE_UNAVAILABLE" - } + "description" : "The server does not support the request payload's media type." }, - "INVALIDPARAMETERSYNTAX" : { - "title" : "INVALID_PARAMETER_SYNTAX", + "taxes" : { + "title" : "Taxes", + "required" : [ "percentage" ], + "type" : "object", "properties" : { - "issue" : { - "type" : "string", - "enum" : [ "INVALID_PARAMETER_SYNTAX" ] + "percentage" : { + "$ref" : "#/components/schemas/percentage" }, - "description" : { - "type" : "string", - "enum" : [ "The value of a field does not conform to the expected format." ] + "inclusive" : { + "type" : "boolean", + "description" : "Indicates whether the tax was already included in the billing amount.", + "default" : true } - } + }, + "description" : "The tax details." }, "UNSUPPORTEDPATCHOPERATION1" : { "title" : "UNSUPPORTED_PATCH_OPERATION", @@ -4467,72 +4204,50 @@ } } }, - "PaymentSource" : { - "title" : "Payment Source", + "payer" : { + "title" : "Customer", "type" : "object", - "properties" : { - "card" : { - "$ref" : "#/components/schemas/Card" - } - }, - "description" : "The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (https://www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions" - }, - "CardBrand" : { - "title" : "Card Brand", - "maxLength" : 255, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", - "type" : "string", - "description" : "The card network or brand. Applies to credit, debit, gift, and payment cards", - "enum" : [ "VISA", "MASTERCARD", "DISCOVER", "AMEX", "SOLO", "JCB", "STAR", "DELTA", "SWITCH", "MAESTRO", "CB_NATIONALE", "CONFIGOGA", "CONFIDIS", "ELECTRON", "CETELEM", "CHINA_UNION_PAY" ] - }, - "NotFound" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/404Details" - } - } - } - }, - "Forbidden" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/403Details" - } - } - } - }, - "DateTime" : { - "maxLength" : 64, - "minLength" : 20, - "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$", - "type" : "string", - "description" : "The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
", - "format" : "ppaas_date_time_v3" + "description" : "The customer who approves and pays for the order. The customer is also known as the payer.", + "format" : "payer_v1", + "allOf" : [ { + "$ref" : "#/components/schemas/payer_base" + }, { + "$ref" : "#/components/schemas/PayerAllOf2" + } ] }, - "Unauthorized" : { + "error_422" : { + "title" : "Unprocessable Entity Error", + "type" : "object", "properties" : { + "name" : { + "type" : "string", + "enum" : [ "UNPROCESSABLE_ENTITY" ] + }, + "message" : { + "type" : "string", + "enum" : [ "The requested action could not be performed, semantically incorrect, or failed business validation." ] + }, "details" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/401Details" + "$ref" : "#/components/schemas/error_details" } - } - } - }, - "BadRequest" : { - "properties" : { - "details" : { + }, + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes." + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS).", "items" : { - "$ref" : "#/components/schemas/400Details" + "$ref" : "#/components/schemas/error_link_description" } } - } + }, + "description" : "The requested action cannot be performed and may require interaction with APIs or processes outside of the current request. This is distinct from a 500 response in that there are no systemic problems limiting the API from performing the request." }, "MISSINGPRICINGSCHEMETIERS4" : { "title" : "MISSING_PRICING_SCHEME_TIERS", @@ -4547,32 +4262,71 @@ } } }, - "TaxInfo" : { - "title" : "Tax Information", - "required" : [ "tax_id", "tax_id_type" ], + "subscription_status" : { + "title" : "Subscription Status", "type" : "object", "properties" : { - "tax_id_type" : { + "status" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", "type" : "string", - "description" : "The customer's tax ID type", - "enum" : [ "BR_CPF", "BR_CNPJ" ], - "x-ballerina-name" : "taxIdType" + "description" : "The status of the subscription.", + "enum" : [ "APPROVAL_PENDING", "APPROVED", "ACTIVE", "SUSPENDED", "CANCELLED", "EXPIRED" ] }, - "tax_id" : { - "maxLength" : 14, + "status_change_note" : { + "maxLength" : 128, + "minLength" : 1, "type" : "string", - "description" : "The customer's tax ID value", - "x-ballerina-name" : "taxId" + "description" : "The reason or notes for the status of the subscription." + }, + "status_update_time" : { + "$ref" : "#/components/schemas/date_time" } }, - "description" : "The tax ID of the customer. The customer is also known as the payer. Both `tax_id` and `tax_id_type` are required" + "description" : "The subscription status details." }, - "MISSINGPRICINGSCHEMETIERS1" : { - "title" : "MISSING_PRICING_SCHEME_TIERS", + "subscriptions.activate-422" : { "properties" : { - "issue" : { - "type" : "string", - "enum" : [ "MISSING_PRICING_SCHEME_TIERS" ] + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionsactivate422Details" + } + } + } + }, + "pricing_tier" : { + "title" : "Pricing Tier", + "required" : [ "amount", "starting_quantity" ], + "type" : "object", + "properties" : { + "starting_quantity" : { + "maxLength" : 32, + "minLength" : 1, + "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", + "type" : "string", + "description" : "The starting quantity for the tier." + }, + "ending_quantity" : { + "maxLength" : 32, + "minLength" : 1, + "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", + "type" : "string", + "description" : "The ending quantity for the tier. Optional for the last tier." + }, + "amount" : { + "$ref" : "#/components/schemas/money" + } + }, + "description" : "The pricing tier details." + }, + "MISSINGPRICINGSCHEMETIERS1" : { + "title" : "MISSING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_PRICING_SCHEME_TIERS" ] }, "description" : { "type" : "string", @@ -4606,66 +4360,15 @@ } } }, - "SubscriptionRequestPost" : { - "title" : "Create Subscription Request", - "required" : [ "plan_id" ], + "payment_source" : { + "title" : "Payment Source", "type" : "object", "properties" : { - "shipping_amount" : { - "allOf" : [ { - "$ref" : "#/components/schemas/Money" - } ], - "x-ballerina-name" : "shippingAmount" - }, - "start_time" : { - "allOf" : [ { - "$ref" : "#/components/schemas/DateTime" - } ], - "x-ballerina-name" : "startTime" - }, - "quantity" : { - "maxLength" : 32, - "minLength" : 1, - "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", - "type" : "string", - "description" : "The quantity of the product in the subscription" - }, - "subscriber" : { - "$ref" : "#/components/schemas/SubscriberRequest" - }, - "custom_id" : { - "maxLength" : 127, - "minLength" : 1, - "pattern" : "^[\\x20-\\x7E]+", - "type" : "string", - "description" : "The custom id for the subscription. Can be invoice id", - "x-ballerina-name" : "customId" - }, - "application_context" : { - "allOf" : [ { - "$ref" : "#/components/schemas/ApplicationContext" - } ], - "x-ballerina-name" : "applicationContext" - }, - "plan" : { - "$ref" : "#/components/schemas/PlanOverride" - }, - "plan_id" : { - "maxLength" : 50, - "minLength" : 3, - "type" : "string", - "description" : "The ID of the plan", - "x-ballerina-name" : "planId" - }, - "auto_renewal" : { - "type" : "boolean", - "description" : "DEPRECATED. Indicates whether the subscription auto-renews after the billing cycles complete", - "deprecated" : true, - "default" : false, - "x-ballerina-name" : "autoRenewal" + "card" : { + "$ref" : "#/components/schemas/card" } }, - "description" : "The create subscription request details" + "description" : "The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (https://www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions." }, "MISSINGPRICINGSCHEMETIERS2" : { "title" : "MISSING_PRICING_SCHEME_TIERS", @@ -4680,53 +4383,81 @@ } } }, - "Subscription" : { - "title" : "Subscription", - "type" : "object", - "description" : "The subscription details", - "allOf" : [ { - "$ref" : "#/components/schemas/SubscriptionStatus" - }, { - "$ref" : "#/components/schemas/SubscriptionAllOf2" - } ] - }, - "Error500" : { - "title" : "Internal Server Error", + "plan" : { + "title" : "Plan", "type" : "object", "properties" : { - "debug_id" : { + "id" : { + "maxLength" : 50, + "minLength" : 3, + "type" : "string", + "description" : "The unique PayPal-generated ID for the plan.", + "readOnly" : true + }, + "product_id" : { + "maxLength" : 50, + "minLength" : 6, "type" : "string", - "description" : "The PayPal internal ID. Used for correlation purposes", - "x-ballerina-name" : "debugId" + "description" : "The ID for the product." }, "name" : { + "maxLength" : 127, + "minLength" : 1, "type" : "string", - "enum" : [ "INTERNAL_SERVER_ERROR" ] + "description" : "The plan name." }, - "links" : { - "maxItems" : 10000, - "minItems" : 0, + "status" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The plan status.", + "enum" : [ "CREATED", "INACTIVE", "ACTIVE" ] + }, + "description" : { + "maxLength" : 127, + "minLength" : 1, + "type" : "string", + "description" : "The detailed description of the plan." + }, + "billing_cycles" : { + "maxItems" : 12, + "minItems" : 1, "type" : "array", - "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "description" : "An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle.", "items" : { - "$ref" : "#/components/schemas/ErrorLinkDescription" + "$ref" : "#/components/schemas/billing_cycle" } }, - "message" : { - "type" : "string", - "enum" : [ "An internal server error occurred." ] + "payment_preferences" : { + "$ref" : "#/components/schemas/payment_preferences" + }, + "taxes" : { + "$ref" : "#/components/schemas/taxes" + }, + "quantity_supported" : { + "type" : "boolean", + "description" : "Indicates whether you can subscribe to this plan by providing a quantity for the goods or service.", + "default" : false + }, + "create_time" : { + "$ref" : "#/components/schemas/date_time" + }, + "update_time" : { + "$ref" : "#/components/schemas/date_time" + }, + "links" : { + "maxItems" : 10, + "minItems" : 1, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).", + "readOnly" : true, + "items" : { + "$ref" : "#/components/schemas/link_description" + } } }, - "description" : "This is either a system or application error, and generally indicates that although the client appeared to provide a correct request, something unexpected has gone wrong on the server", - "example" : { - "name" : "INTERNAL_SERVER_ERROR", - "message" : "An internal server error occurred.", - "debug_id" : "90957fca61718", - "links" : [ { - "href" : "https://developer.paypal.com/api/orders/v2/#error-INTERNAL_SERVER_ERROR", - "rel" : "information_link" - } ] - } + "description" : "The plan details." }, "Subscriptionsactivate400Details" : { "anyOf" : [ { @@ -4759,6 +4490,16 @@ } } }, + "subscriber" : { + "title" : "Subscriber Response Information", + "type" : "object", + "description" : "The subscriber response information.", + "allOf" : [ { + "$ref" : "#/components/schemas/payer" + }, { + "$ref" : "#/components/schemas/SubscriberAllOf2" + } ] + }, "CURRENCYMISMATCH" : { "title" : "CURRENCY_MISMATCH", "properties" : { @@ -4824,6 +4565,16 @@ } } }, + "plans.patch-422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Planspatch422Details" + } + } + } + }, "INVALIDPARAMETERSYNTAX2" : { "title" : "INVALID_PARAMETER_SYNTAX", "properties" : { @@ -4837,6 +4588,74 @@ } } }, + "error_403" : { + "title" : "Not Authorized Error", + "type" : "object", + "properties" : { + "name" : { + "type" : "string", + "enum" : [ "NOT_AUTHORIZED" ] + }, + "message" : { + "type" : "string", + "enum" : [ "Authorization failed due to insufficient permissions." ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/error_details" + } + }, + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes." + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS).", + "items" : { + "$ref" : "#/components/schemas/error_link_description" + } + } + }, + "description" : "The client is not authorized to access this resource, although it may have valid credentials. " + }, + "error_404" : { + "title" : "Not found Error", + "type" : "object", + "properties" : { + "name" : { + "type" : "string", + "enum" : [ "RESOURCE_NOT_FOUND" ] + }, + "message" : { + "type" : "string", + "enum" : [ "The specified resource does not exist." ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/error_details" + } + }, + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes." + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS).", + "items" : { + "$ref" : "#/components/schemas/error_link_description" + } + } + }, + "description" : "The server has not found anything matching the request URI. This either means that the URI is incorrect or the resource is not available." + }, "INVALIDRESOURCEID" : { "title" : "INVALID_RESOURCE_ID", "properties" : { @@ -4902,13 +4721,39 @@ } } }, - "EmailAddress" : { - "maxLength" : 254, - "minLength" : 3, - "pattern" : "^.+@[^\"\\-].+$", - "type" : "string", - "description" : "The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
", - "format" : "ppaas_common_email_address_v2" + "error_409" : { + "title" : "Resource Conflict Error", + "type" : "object", + "properties" : { + "name" : { + "type" : "string", + "enum" : [ "RESOURCE_CONFLICT" ] + }, + "message" : { + "type" : "string", + "enum" : [ "The server has detected a conflict while processing this request." ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/error_details" + } + }, + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes." + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS).", + "items" : { + "$ref" : "#/components/schemas/error_link_description" + } + } + }, + "description" : "The server has detected a conflict while processing this request." }, "FIXEDPRICENOTSUPPORTED1" : { "title" : "FIXED_PRICE_NOT_SUPPORTED", @@ -4923,165 +4768,245 @@ } } }, - "Card" : { - "title" : "Card", - "required" : [ "expiry", "number" ], - "type" : "object", + "400" : { "properties" : { - "number" : { - "maxLength" : 19, - "minLength" : 13, - "type" : "string", - "description" : "The primary account number (PAN) for the payment card" - }, - "security_code" : { - "pattern" : "[0-9]{3,4}", - "type" : "string", - "description" : "The three- or four-digit security code of the card. Also known as the CVV, CVC, CVN, CVE, or CID. This parameter cannot be present in the request when `payment_initiator=MERCHANT`", - "x-ballerina-name" : "securityCode" - }, - "name" : { - "maxLength" : 300, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/400Details" + } + } + } + }, + "401" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/401Details" + } + } + } + }, + "phone" : { + "title" : "Phone", + "required" : [ "country_code", "national_number" ], + "type" : "object", + "properties" : { + "country_code" : { + "maxLength" : 3, + "minLength" : 1, + "pattern" : "^[0-9]{1,3}?$", "type" : "string", - "description" : "The card holder's name as it appears on the card" - }, - "billing_address" : { - "allOf" : [ { - "$ref" : "#/components/schemas/AddressPortable" - } ], - "x-ballerina-name" : "billingAddress" + "description" : "The country calling code (CC), in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the CC and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN)." }, - "id" : { + "national_number" : { + "maxLength" : 14, + "minLength" : 1, + "pattern" : "^[0-9]{1,14}?$", "type" : "string", - "description" : "The PayPal-generated ID for the card", - "readOnly" : true + "description" : "The national number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the country calling code (CC) and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN)." }, - "expiry" : { - "$ref" : "#/components/schemas/DateYearMonth" - }, - "card_type" : { - "allOf" : [ { - "$ref" : "#/components/schemas/CardBrand" - } ], - "x-ballerina-name" : "cardType" - }, - "last_digits" : { - "pattern" : "[0-9]{2,}", + "extension_number" : { + "maxLength" : 15, + "minLength" : 1, + "pattern" : "^[0-9]{1,15}?$", "type" : "string", - "description" : "The last digits of the payment card", - "readOnly" : true, - "x-ballerina-name" : "lastDigits" + "description" : "The extension number." } }, - "description" : "The payment card to use to fund a payment. Can be a credit or debit card" + "description" : "The phone number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en)." }, "InlineResponse4001" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error400" + "$ref" : "#/components/schemas/error_400" }, { - "$ref" : "#/components/schemas/PlansCreate400" + "$ref" : "#/components/schemas/plans.create-400" } ] }, + "403" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/403Details" + } + } + } + }, + "404" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/404Details" + } + } + } + }, "InlineResponse4003" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error400" + "$ref" : "#/components/schemas/error_400" }, { - "$ref" : "#/components/schemas/PlansUpdatePricingSchemes400" + "$ref" : "#/components/schemas/plans.update-pricing-schemes-400" } ] }, "InlineResponse4002" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error400" + "$ref" : "#/components/schemas/error_400" }, { - "$ref" : "#/components/schemas/PlansPatch400" + "$ref" : "#/components/schemas/plans.patch-400" } ] }, "InlineResponse4005" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error400" + "$ref" : "#/components/schemas/error_400" }, { - "$ref" : "#/components/schemas/SubscriptionsPatch400" + "$ref" : "#/components/schemas/subscriptions.patch-400" } ] }, "InlineResponse4004" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error400" + "$ref" : "#/components/schemas/error_400" }, { - "$ref" : "#/components/schemas/SubscriptionsCreate400" + "$ref" : "#/components/schemas/subscriptions.create-400" } ] }, "InlineResponse4007" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error400" + "$ref" : "#/components/schemas/error_400" }, { - "$ref" : "#/components/schemas/SubscriptionsSuspend400" + "$ref" : "#/components/schemas/subscriptions.suspend-400" } ] }, - "SubscriptionsPatch400" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionspatch400Details" - } - } - } - }, "InlineResponse4006" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error400" + "$ref" : "#/components/schemas/error_400" }, { - "$ref" : "#/components/schemas/SubscriptionsRevise400" + "$ref" : "#/components/schemas/subscriptions.revise-400" } ] }, + "card" : { + "title" : "Card", + "required" : [ "expiry", "number" ], + "type" : "object", + "properties" : { + "id" : { + "type" : "string", + "description" : "The PayPal-generated ID for the card.", + "readOnly" : true + }, + "name" : { + "maxLength" : 300, + "type" : "string", + "description" : "The card holder's name as it appears on the card." + }, + "number" : { + "maxLength" : 19, + "minLength" : 13, + "type" : "string", + "description" : "The primary account number (PAN) for the payment card." + }, + "expiry" : { + "$ref" : "#/components/schemas/date_year_month" + }, + "security_code" : { + "pattern" : "[0-9]{3,4}", + "type" : "string", + "description" : "The three- or four-digit security code of the card. Also known as the CVV, CVC, CVN, CVE, or CID. This parameter cannot be present in the request when `payment_initiator=MERCHANT`." + }, + "last_digits" : { + "pattern" : "[0-9]{2,}", + "type" : "string", + "description" : "The last digits of the payment card.", + "readOnly" : true + }, + "card_type" : { + "$ref" : "#/components/schemas/card_brand" + }, + "billing_address" : { + "$ref" : "#/components/schemas/address_portable" + } + }, + "description" : "The payment card to use to fund a payment. Can be a credit or debit card." + }, "InlineResponse4009" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error400" + "$ref" : "#/components/schemas/error_400" }, { - "$ref" : "#/components/schemas/SubscriptionsActivate400" + "$ref" : "#/components/schemas/subscriptions.activate-400" } ] }, - "InlineResponse4008" : { - "allOf" : [ { - "$ref" : "#/components/schemas/Error400" - }, { - "$ref" : "#/components/schemas/SubscriptionsCancel400" - } ] + "payer_base" : { + "title" : "Payer Base", + "type" : "object", + "properties" : { + "email_address" : { + "$ref" : "#/components/schemas/email" + }, + "payer_id" : { + "$ref" : "#/components/schemas/account_id" + } + }, + "description" : "The customer who approves and pays for the order. The customer is also known as the payer." }, - "Error404" : { - "title" : "Not found Error", + "cycle_execution" : { + "title" : "Billing Cycle Execution Details", + "required" : [ "cycles_completed", "sequence", "tenure_type" ], "type" : "object", "properties" : { - "debug_id" : { + "tenure_type" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", "type" : "string", - "description" : "The PayPal internal ID. Used for correlation purposes", - "x-ballerina-name" : "debugId" + "description" : "The type of the billing cycle.", + "readOnly" : true, + "enum" : [ "REGULAR", "TRIAL" ] }, - "name" : { - "type" : "string", - "enum" : [ "RESOURCE_NOT_FOUND" ] + "sequence" : { + "maximum" : 99, + "minimum" : 0, + "type" : "integer", + "description" : "The order in which to run this cycle among other billing cycles." }, - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/ErrorDetails" - } + "cycles_completed" : { + "maximum" : 9999, + "minimum" : 0, + "type" : "integer", + "description" : "The number of billing cycles that have completed.", + "readOnly" : true }, - "links" : { - "maxItems" : 10000, - "minItems" : 0, - "type" : "array", - "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", - "items" : { - "$ref" : "#/components/schemas/ErrorLinkDescription" - } + "cycles_remaining" : { + "maximum" : 9999, + "minimum" : 0, + "type" : "integer", + "description" : "For a finite billing cycle, cycles_remaining is the number of remaining cycles. For an infinite billing cycle, cycles_remaining is set as 0.", + "readOnly" : true }, - "message" : { - "type" : "string", - "enum" : [ "The specified resource does not exist." ] + "current_pricing_scheme_version" : { + "maximum" : 99, + "minimum" : 1, + "type" : "integer", + "description" : "The active pricing scheme version for the billing cycle.", + "readOnly" : true + }, + "total_cycles" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles).", + "readOnly" : true } }, - "description" : "The server has not found anything matching the request URI. This either means that the URI is incorrect or the resource is not available" + "description" : "The regular and trial execution details for a billing cycle." + }, + "InlineResponse4008" : { + "allOf" : [ { + "$ref" : "#/components/schemas/error_400" + }, { + "$ref" : "#/components/schemas/subscriptions.cancel-400" + } ] }, "MISSINGREQUIREDPARAMETER5" : { "title" : "MISSING_REQUIRED_PARAMETER", @@ -5096,41 +5021,6 @@ } } }, - "Error409" : { - "title" : "Resource Conflict Error", - "type" : "object", - "properties" : { - "debug_id" : { - "type" : "string", - "description" : "The PayPal internal ID. Used for correlation purposes", - "x-ballerina-name" : "debugId" - }, - "name" : { - "type" : "string", - "enum" : [ "RESOURCE_CONFLICT" ] - }, - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/ErrorDetails" - } - }, - "links" : { - "maxItems" : 10000, - "minItems" : 0, - "type" : "array", - "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", - "items" : { - "$ref" : "#/components/schemas/ErrorLinkDescription" - } - }, - "message" : { - "type" : "string", - "enum" : [ "The server has detected a conflict while processing this request." ] - } - }, - "description" : "The server has detected a conflict while processing this request" - }, "AMOUNTGREATERTHANOUTSTANDINGBALANCE" : { "title" : "AMOUNT_GREATER_THAN_OUTSTANDING_BALANCE", "properties" : { @@ -5182,16 +5072,6 @@ "$ref" : "#/components/schemas/CURRENCYMISMATCH4" } ] }, - "SubscriptionsCancel400" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionscancel400Details" - } - } - } - }, "MISSINGREQUIREDPARAMETER6" : { "title" : "MISSING_REQUIRED_PARAMETER", "properties" : { @@ -5218,184 +5098,135 @@ } } }, - "MISSINGREQUIREDPARAMETER1" : { - "title" : "MISSING_REQUIRED_PARAMETER", + "subscription" : { + "title" : "Subscription", + "type" : "object", + "description" : "The subscription details.", + "allOf" : [ { + "$ref" : "#/components/schemas/subscription_status" + }, { + "$ref" : "#/components/schemas/SubscriptionAllOf2" + } ] + }, + "currency_code" : { + "maxLength" : 3, + "minLength" : 3, + "type" : "string", + "description" : "The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency.", + "format" : "ppaas_common_currency_code_v2" + }, + "update_pricing_scheme_request" : { + "title" : "Update Pricing Scheme", + "required" : [ "billing_cycle_sequence", "pricing_scheme" ], + "type" : "object", "properties" : { - "issue" : { - "type" : "string", - "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + "billing_cycle_sequence" : { + "maximum" : 99, + "minimum" : 1, + "type" : "integer", + "description" : "The billing cycle sequence." }, - "description" : { - "type" : "string", - "enum" : [ "A required field is missing." ] + "pricing_scheme" : { + "$ref" : "#/components/schemas/pricing_scheme" } - } + }, + "description" : "The update pricing scheme request details." }, - "MISSINGREQUIREDPARAMETER3" : { - "title" : "MISSING_REQUIRED_PARAMETER", + "error_details" : { + "title" : "Error Details", + "required" : [ "issue" ], + "type" : "object", "properties" : { - "issue" : { + "field" : { "type" : "string", - "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + "description" : "The field that caused the error. If this field is in the body, set this value to the field's JSON pointer value. Required for client-side errors." }, - "description" : { + "value" : { "type" : "string", - "enum" : [ "A required field is missing." ] - } - } - }, - "MISSINGREQUIREDPARAMETER2" : { - "title" : "MISSING_REQUIRED_PARAMETER", - "properties" : { + "description" : "The value of the field that caused the error." + }, + "location" : { + "$ref" : "#/components/schemas/error_location" + }, "issue" : { "type" : "string", - "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + "description" : "The unique, fine-grained application-level error code." }, "description" : { "type" : "string", - "enum" : [ "A required field is missing." ] + "description" : "The human-readable description for an issue. The description can change over the lifetime of an API, so clients must not depend on this value." } - } + }, + "description" : "The error details. Required for client-side `4XX` errors." }, - "Error400" : { - "title" : "Bad Request Error", + "plan_override" : { + "title" : "Plan Override", "type" : "object", "properties" : { - "debug_id" : { - "type" : "string", - "description" : "The PayPal internal ID. Used for correlation purposes", - "x-ballerina-name" : "debugId" - }, - "name" : { - "type" : "string", - "enum" : [ "INVALID_REQUEST" ] - }, - "details" : { + "billing_cycles" : { + "maxItems" : 12, + "minItems" : 1, "type" : "array", + "description" : "An array of billing cycles for trial billing and regular billing. The subscription billing cycle definition has to adhere to the plan billing cycle definition.", "items" : { - "$ref" : "#/components/schemas/ErrorDetails" + "$ref" : "#/components/schemas/billing_cycle_override" } }, - "links" : { - "maxItems" : 10000, - "minItems" : 0, - "type" : "array", - "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", - "items" : { - "$ref" : "#/components/schemas/ErrorLinkDescription" - } + "payment_preferences" : { + "$ref" : "#/components/schemas/payment_preferences_override" }, - "message" : { - "type" : "string", - "enum" : [ "Request is not well-formed, syntactically incorrect, or violates schema." ] + "taxes" : { + "$ref" : "#/components/schemas/taxes_override" } }, - "description" : "Request is not well-formed, syntactically incorrect, or violates schema" + "description" : "An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object." }, - "Error401" : { - "title" : "Unauthorized Error", - "type" : "object", + "MISSINGREQUIREDPARAMETER1" : { + "title" : "MISSING_REQUIRED_PARAMETER", "properties" : { - "debug_id" : { - "type" : "string", - "description" : "The PayPal internal ID. Used for correlation purposes", - "x-ballerina-name" : "debugId" - }, - "name" : { + "issue" : { "type" : "string", - "enum" : [ "AUTHENTICATION_FAILURE" ] - }, - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/ErrorDetails" - } - }, - "links" : { - "maxItems" : 10000, - "minItems" : 0, - "type" : "array", - "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", - "items" : { - "$ref" : "#/components/schemas/ErrorLinkDescription" - } + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] }, - "message" : { + "description" : { "type" : "string", - "enum" : [ "Authentication failed due to missing authorization header, or invalid authentication credentials." ] + "enum" : [ "A required field is missing." ] } - }, - "description" : "Authentication failed due to missing Authorization header, or invalid authentication credentials" + } }, - "Error403" : { - "title" : "Not Authorized Error", - "type" : "object", + "MISSINGREQUIREDPARAMETER3" : { + "title" : "MISSING_REQUIRED_PARAMETER", "properties" : { - "debug_id" : { - "type" : "string", - "description" : "The PayPal internal ID. Used for correlation purposes", - "x-ballerina-name" : "debugId" - }, - "name" : { + "issue" : { "type" : "string", - "enum" : [ "NOT_AUTHORIZED" ] - }, - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/ErrorDetails" - } - }, - "links" : { - "maxItems" : 10000, - "minItems" : 0, - "type" : "array", - "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", - "items" : { - "$ref" : "#/components/schemas/ErrorLinkDescription" - } + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] }, - "message" : { + "description" : { "type" : "string", - "enum" : [ "Authorization failed due to insufficient permissions." ] + "enum" : [ "A required field is missing." ] } - }, - "description" : "The client is not authorized to access this resource, although it may have valid credentials. " + } }, - "Error415" : { - "title" : "Unsupported Media Type Error", - "type" : "object", + "pares_status" : { + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "Transactions status result identifier. The outcome of the issuer's authentication.", + "enum" : [ "Y", "N", "U", "A", "C", "R", "D", "I" ] + }, + "MISSINGREQUIREDPARAMETER2" : { + "title" : "MISSING_REQUIRED_PARAMETER", "properties" : { - "debug_id" : { - "type" : "string", - "description" : "The PayPal internal ID. Used for correlation purposes", - "x-ballerina-name" : "debugId" - }, - "name" : { + "issue" : { "type" : "string", - "enum" : [ "UNSUPPORTED_MEDIA_TYPE" ] - }, - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/ErrorDetails" - } - }, - "links" : { - "maxItems" : 10000, - "minItems" : 0, - "type" : "array", - "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", - "items" : { - "$ref" : "#/components/schemas/ErrorLinkDescription" - } + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] }, - "message" : { + "description" : { "type" : "string", - "enum" : [ "The server does not support the request payload's media type." ] + "enum" : [ "A required field is missing." ] } - }, - "description" : "The server does not support the request payload's media type" + } }, "PLANSTATUSINACTIVE" : { "title" : "PLAN_STATUS_INACTIVE", @@ -5410,11 +5241,15 @@ } } }, - "Percentage" : { - "pattern" : "^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$", - "type" : "string", - "description" : "The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99`", - "format" : "ppaas_common_percentage_v2" + "plans.patch-400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Planspatch400Details" + } + } + } }, "Planspatch400Details" : { "anyOf" : [ { @@ -5431,112 +5266,15 @@ "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE3" } ] }, - "Plan" : { - "title" : "Plan", - "type" : "object", + "plans.deactivate-422" : { "properties" : { - "quantity_supported" : { - "type" : "boolean", - "description" : "Indicates whether you can subscribe to this plan by providing a quantity for the goods or service", - "default" : false, - "x-ballerina-name" : "quantitySupported" - }, - "update_time" : { - "allOf" : [ { - "$ref" : "#/components/schemas/DateTime" - } ], - "x-ballerina-name" : "updateTime" - }, - "create_time" : { - "allOf" : [ { - "$ref" : "#/components/schemas/DateTime" - } ], - "x-ballerina-name" : "createTime" - }, - "payment_preferences" : { - "allOf" : [ { - "$ref" : "#/components/schemas/PaymentPreferences" - } ], - "x-ballerina-name" : "paymentPreferences" - }, - "product_id" : { - "maxLength" : 50, - "minLength" : 6, - "type" : "string", - "description" : "The ID for the product", - "x-ballerina-name" : "productId" - }, - "name" : { - "maxLength" : 127, - "minLength" : 1, - "type" : "string", - "description" : "The plan name" - }, - "billing_cycles" : { - "maxItems" : 12, - "minItems" : 1, - "type" : "array", - "description" : "An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle", - "items" : { - "$ref" : "#/components/schemas/BillingCycle" - }, - "x-ballerina-name" : "billingCycles" - }, - "description" : { - "maxLength" : 127, - "minLength" : 1, - "type" : "string", - "description" : "The detailed description of the plan" - }, - "taxes" : { - "$ref" : "#/components/schemas/Taxes" - }, - "links" : { - "maxItems" : 10, - "minItems" : 1, + "details" : { "type" : "array", - "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links)", - "readOnly" : true, "items" : { - "$ref" : "#/components/schemas/LinkDescription" + "$ref" : "#/components/schemas/Plansdeactivate422Details" } - }, - "id" : { - "maxLength" : 50, - "minLength" : 3, - "type" : "string", - "description" : "The unique PayPal-generated ID for the plan", - "readOnly" : true - }, - "status" : { - "maxLength" : 24, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", - "type" : "string", - "description" : "The plan status", - "enum" : [ "CREATED", "INACTIVE", "ACTIVE" ] - } - }, - "description" : "The plan details" - }, - "AuthenticationResponse" : { - "title" : "Authentication Response", - "type" : "object", - "properties" : { - "liability_shift" : { - "allOf" : [ { - "$ref" : "#/components/schemas/LiabilityShift" - } ], - "x-ballerina-name" : "liabilityShift" - }, - "three_d_secure" : { - "allOf" : [ { - "$ref" : "#/components/schemas/ThreeDSecureAuthenticationResponse" - } ], - "x-ballerina-name" : "threeDSecure" } - }, - "description" : "Results of Authentication such as 3D Secure" + } }, "USERACCOUNTCLOSED7" : { "title" : "USER_ACCOUNT_CLOSED", @@ -5603,6 +5341,16 @@ } } }, + "422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/422Details" + } + } + } + }, "SUBSCRIPTIONSTATUSINVALID1" : { "title" : "SUBSCRIPTION_STATUS_INVALID", "properties" : { @@ -5707,6 +5455,17 @@ } } }, + "transaction" : { + "title" : "Transaction Details", + "required" : [ "amount_with_breakdown", "id", "time" ], + "type" : "object", + "description" : "The transaction details.", + "allOf" : [ { + "$ref" : "#/components/schemas/capture_status" + }, { + "$ref" : "#/components/schemas/TransactionAllOf2" + } ] + }, "USERACCOUNTCLOSED" : { "title" : "USER_ACCOUNT_CLOSED", "properties" : { @@ -5746,31 +5505,11 @@ } } }, - "SubscriptionReviseResponse" : { - "title" : "Update Product Quantity in Subscription Response", - "type" : "object", - "description" : "The response to a request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent", - "allOf" : [ { - "$ref" : "#/components/schemas/SubscriptionReviseRequest" - }, { - "$ref" : "#/components/schemas/SubscriptionReviseResponseAllOf2" - } ] - }, - "SubscriptionsCancel422" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionscancel422Details" - } - } - } - }, "InlineResponse422" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error422" + "$ref" : "#/components/schemas/error_422" }, { - "$ref" : "#/components/schemas/UnprocessableEntity" + "$ref" : "#/components/schemas/422" } ] }, "INVALIDPATCHPATH1" : { @@ -5799,6 +5538,27 @@ } } }, + "link_description" : { + "title" : "Link Description", + "required" : [ "href", "rel" ], + "type" : "object", + "properties" : { + "href" : { + "type" : "string", + "description" : "The complete target URL. To make the related call, combine the method with this [URI Template-formatted](https://tools.ietf.org/html/rfc6570) link. For pre-processing, include the `$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call." + }, + "rel" : { + "type" : "string", + "description" : "The [link relation type](https://tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](https://www.iana.org/assignments/link-relations/link-relations.xhtml)." + }, + "method" : { + "type" : "string", + "description" : "The HTTP method required to make the related call.", + "enum" : [ "GET", "POST", "PUT", "DELETE", "HEAD", "CONNECT", "OPTIONS", "PATCH" ] + } + }, + "description" : "The request-related [HATEOAS link](/docs/api/reference/api-responses/#hateoas-links) information." + }, "INVALIDPATCHPATH3" : { "title" : "INVALID_PATCH_PATH", "properties" : { @@ -5812,16 +5572,6 @@ } } }, - "SubscriptionsCapture400" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionscapture400Details" - } - } - } - }, "TransactionAllOf2" : { "properties" : { "id" : { @@ -5832,16 +5582,16 @@ "readOnly" : true }, "amount_with_breakdown" : { - "$ref" : "#/components/schemas/AmountWithBreakdown" + "$ref" : "#/components/schemas/amount_with_breakdown" }, "payer_name" : { - "$ref" : "#/components/schemas/Name" + "$ref" : "#/components/schemas/name" }, "payer_email" : { - "$ref" : "#/components/schemas/EmailAddress" + "$ref" : "#/components/schemas/email_address" }, "time" : { - "$ref" : "#/components/schemas/DateTime" + "$ref" : "#/components/schemas/date_time" } } }, @@ -5871,39 +5621,50 @@ } } }, - "CaptureStatusDetails" : { - "title" : "Capture Status Details", + "date_time" : { + "maxLength" : 64, + "minLength" : 20, + "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$", + "type" : "string", + "description" : "The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
", + "format" : "ppaas_date_time_v3" + }, + "error_500" : { + "title" : "Internal Server Error", "type" : "object", "properties" : { - "reason" : { + "name" : { "type" : "string", - "description" : "The reason why the captured payment status is `PENDING` or `DENIED`", - "enum" : [ "BUYER_COMPLAINT", "CHARGEBACK", "ECHECK", "INTERNATIONAL_WITHDRAWAL", "OTHER", "PENDING_REVIEW", "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION", "REFUNDED", "TRANSACTION_APPROVED_AWAITING_FUNDING", "UNILATERAL", "VERIFICATION_REQUIRED" ] + "enum" : [ "INTERNAL_SERVER_ERROR" ] + }, + "message" : { + "type" : "string", + "enum" : [ "An internal server error occurred." ] + }, + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes." + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS).", + "items" : { + "$ref" : "#/components/schemas/error_link_description" + } } }, - "description" : "The details of the captured payment status" - }, - "ErrorDefault" : { - "description" : "The default error response", - "oneOf" : [ { - "$ref" : "#/components/schemas/Error400" - }, { - "$ref" : "#/components/schemas/Error401" - }, { - "$ref" : "#/components/schemas/Error403" - }, { - "$ref" : "#/components/schemas/Error404" - }, { - "$ref" : "#/components/schemas/Error409" - }, { - "$ref" : "#/components/schemas/Error415" - }, { - "$ref" : "#/components/schemas/Error422" - }, { - "$ref" : "#/components/schemas/Error500" - }, { - "$ref" : "#/components/schemas/Error503" - } ] + "description" : "This is either a system or application error, and generally indicates that although the client appeared to provide a correct request, something unexpected has gone wrong on the server.", + "example" : { + "name" : "INTERNAL_SERVER_ERROR", + "message" : "An internal server error occurred.", + "debug_id" : "90957fca61718", + "links" : [ { + "href" : "https://developer.paypal.com/api/orders/v2/#error-INTERNAL_SERVER_ERROR", + "rel" : "information_link" + } ] + } }, "MISSINGPRICINGSCHEMETIERS" : { "title" : "MISSING_PRICING_SCHEME_TIERS", @@ -5918,47 +5679,36 @@ } } }, - "DateYearMonth" : { - "maxLength" : 7, - "minLength" : 7, - "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])$", + "percentage" : { + "pattern" : "^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$", "type" : "string", - "description" : "The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6)" + "description" : "The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99`.", + "format" : "ppaas_common_percentage_v2" }, - "Error422" : { - "title" : "Unprocessable Entity Error", + "payment_method" : { + "title" : "Payment Method", "type" : "object", "properties" : { - "debug_id" : { - "type" : "string", - "description" : "The PayPal internal ID. Used for correlation purposes", - "x-ballerina-name" : "debugId" - }, - "name" : { + "payer_selected" : { + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", "type" : "string", - "enum" : [ "UNPROCESSABLE_ENTITY" ] - }, - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/ErrorDetails" - } + "description" : "The customer-selected payment method on the merchant site.", + "default" : "PAYPAL" }, - "links" : { - "maxItems" : 10000, - "minItems" : 0, - "type" : "array", - "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", - "items" : { - "$ref" : "#/components/schemas/ErrorLinkDescription" - } + "payee_preferred" : { + "$ref" : "#/components/schemas/payee_payment_method_preference" }, - "message" : { + "standard_entry_class_code" : { + "maxLength" : 255, + "minLength" : 3, "type" : "string", - "enum" : [ "The requested action could not be performed, semantically incorrect, or failed business validation." ] + "description" : "NACHA (the regulatory body governing the ACH network) requires that API callers (merchants, partners) obtain the consumer’s explicit authorization before initiating a transaction. To stay compliant, you’ll need to make sure that you retain a compliant authorization for each transaction that you originate to the ACH Network using this API. ACH transactions are categorized (using SEC codes) by how you capture authorization from the Receiver (the person whose bank account is being debited or credited). PayPal supports the following SEC codes.", + "default" : "WEB", + "enum" : [ "TEL", "WEB", "CCD", "PPD" ] } }, - "description" : "The requested action cannot be performed and may require interaction with APIs or processes outside of the current request. This is distinct from a 500 response in that there are no systemic problems limiting the API from performing the request" + "description" : "The customer and merchant payment preferences." }, "MISSINGREQUESTBODY" : { "title" : "MISSING_REQUEST_BODY", @@ -6006,27 +5756,6 @@ "$ref" : "#/components/schemas/CURRENCYMISMATCH3" } ] }, - "Payer" : { - "title" : "Customer", - "type" : "object", - "description" : "The customer who approves and pays for the order. The customer is also known as the payer", - "format" : "payer_v1", - "allOf" : [ { - "$ref" : "#/components/schemas/PayerBase" - }, { - "$ref" : "#/components/schemas/PayerAllOf2" - } ] - }, - "PlansActivate422" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Plansactivate422Details" - } - } - } - }, "USERACCOUNTCLOSED10" : { "title" : "USER_ACCOUNT_CLOSED", "properties" : { @@ -6053,15 +5782,19 @@ } } }, - "PlansDeactivate422" : { + "subscription_suspend_request" : { + "title" : "Suspend Subscription", + "required" : [ "reason" ], + "type" : "object", "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Plansdeactivate422Details" - } + "reason" : { + "maxLength" : 128, + "minLength" : 1, + "type" : "string", + "description" : "The reason for suspenson of the subscription." } - } + }, + "description" : "The suspend subscription request details." }, "Subscriptionscreate400Details" : { "anyOf" : [ { @@ -6082,17 +5815,7 @@ "$ref" : "#/components/schemas/MISSINGREQUIREDPARAMETER2" }, { "$ref" : "#/components/schemas/INVALIDSTRINGMAXLENGTH2" - } ] - }, - "PlansUpdatePricingSchemes400" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/PlansupdatePricingSchemes400Details" - } - } - } + } ] }, "SUBSCRIPTIONCANNOTBEACTIVATED" : { "title" : "SUBSCRIPTION_CANNOT_BE_ACTIVATED", @@ -6107,88 +5830,6 @@ } } }, - "SubscriptionSuspendRequest" : { - "title" : "Suspend Subscription", - "required" : [ "reason" ], - "type" : "object", - "properties" : { - "reason" : { - "maxLength" : 128, - "minLength" : 1, - "type" : "string", - "description" : "The reason for suspenson of the subscription" - } - }, - "description" : "The suspend subscription request details" - }, - "AddressPortable" : { - "title" : "Portable Postal Address (Medium-Grained)", - "required" : [ "country_code" ], - "type" : "object", - "properties" : { - "country_code" : { - "allOf" : [ { - "$ref" : "#/components/schemas/CountryCode" - } ], - "x-ballerina-name" : "countryCode" - }, - "admin_area_1" : { - "maxLength" : 300, - "type" : "string", - "description" : "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`. Value, by country, is:
  • UK. A county.
  • US. A state.
  • Canada. A province.
  • Japan. A prefecture.
  • Switzerland. A kanton.
", - "x-ballerina-name" : "adminArea1" - }, - "address_line_1" : { - "maxLength" : 300, - "type" : "string", - "description" : "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", - "x-ballerina-name" : "addressLine1" - }, - "admin_area_3" : { - "maxLength" : 100, - "type" : "string", - "description" : "A sub-locality, suburb, neighborhood, or district. Smaller than `admin_area_level_2`. Value is:
  • Brazil. Suburb, bairro, or neighborhood.
  • India. Sub-locality or district. Street name information is not always available but a sub-locality or district can be a very small area.
", - "x-ballerina-name" : "adminArea3" - }, - "address_details" : { - "allOf" : [ { - "$ref" : "#/components/schemas/AddressDetails" - } ], - "x-ballerina-name" : "addressDetails" - }, - "admin_area_2" : { - "maxLength" : 120, - "type" : "string", - "description" : "A city, town, or village. Smaller than `admin_area_level_1`", - "x-ballerina-name" : "adminArea2" - }, - "address_line_3" : { - "maxLength" : 100, - "type" : "string", - "description" : "The third line of the address, if needed. For example, a street complement for Brazil, direction text, such as `next to Walmart`, or a landmark in an Indian address", - "x-ballerina-name" : "addressLine3" - }, - "address_line_2" : { - "maxLength" : 300, - "type" : "string", - "description" : "The second line of the address. For example, suite or apartment number", - "x-ballerina-name" : "addressLine2" - }, - "admin_area_4" : { - "maxLength" : 100, - "type" : "string", - "description" : "The neighborhood, ward, or district. Smaller than `admin_area_level_3` or `sub_locality`. Value is:
  • The postal sorting code for Guernsey and many French territories, such as French Guiana.
  • The fine-grained administrative levels in China.
", - "x-ballerina-name" : "adminArea4" - }, - "postal_code" : { - "maxLength" : 60, - "type" : "string", - "description" : "The postal code, which is the zip code or equivalent. Typically required for countries with a postal code or an equivalent. See [postal code](https://en.wikipedia.org/wiki/Postal_code)", - "x-ballerina-name" : "postalCode" - } - }, - "description" : "The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute)" - }, "INVALIDPRICINGMODEL" : { "title" : "INVALID_PRICING_MODEL", "properties" : { @@ -6202,6 +5843,18 @@ } } }, + "capture_status_details" : { + "title" : "Capture Status Details", + "type" : "object", + "properties" : { + "reason" : { + "type" : "string", + "description" : "The reason why the captured payment status is `PENDING` or `DENIED`.", + "enum" : [ "BUYER_COMPLAINT", "CHARGEBACK", "ECHECK", "INTERNATIONAL_WITHDRAWAL", "OTHER", "PENDING_REVIEW", "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION", "REFUNDED", "TRANSACTION_APPROVED_AWAITING_FUNDING", "UNILATERAL", "VERIFICATION_REQUIRED" ] + } + }, + "description" : "The details of the captured payment status." + }, "INVALIDPARAMETERVALUE" : { "title" : "INVALID_PARAMETER_VALUE", "properties" : { @@ -6215,68 +5868,76 @@ } } }, - "SubscriptionsSuspend422" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionssuspend422Details" - } - } - } - }, - "SubscriptionsRevise404" : { + "tax_info" : { + "title" : "Tax Information", + "required" : [ "tax_id", "tax_id_type" ], + "type" : "object", "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionsrevise404Details" - } + "tax_id" : { + "maxLength" : 14, + "type" : "string", + "description" : "The customer's tax ID value." + }, + "tax_id_type" : { + "type" : "string", + "description" : "The customer's tax ID type.", + "enum" : [ "BR_CPF", "BR_CNPJ" ] } - } + }, + "description" : "The tax ID of the customer. The customer is also known as the payer. Both `tax_id` and `tax_id_type` are required." }, - "SubscriptionsActivate400" : { + "subscription_billing_info" : { + "title" : "Subscription Billing Information", + "required" : [ "failed_payments_count", "outstanding_balance" ], + "type" : "object", "properties" : { - "details" : { + "outstanding_balance" : { + "$ref" : "#/components/schemas/money" + }, + "cycle_executions" : { + "maxItems" : 3, + "minItems" : 0, "type" : "array", + "description" : "The trial and regular billing executions.", + "readOnly" : true, "items" : { - "$ref" : "#/components/schemas/Subscriptionsactivate400Details" + "$ref" : "#/components/schemas/cycle_execution" } + }, + "last_payment" : { + "$ref" : "#/components/schemas/last_payment_details" + }, + "next_billing_time" : { + "$ref" : "#/components/schemas/date_time" + }, + "final_payment_time" : { + "$ref" : "#/components/schemas/date_time" + }, + "failed_payments_count" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The number of consecutive payment failures. Resets to `0` after a successful payment. If this reaches the `payment_failure_threshold` value, the subscription updates to the `SUSPENDED` state.", + "readOnly" : true + }, + "last_failed_payment" : { + "$ref" : "#/components/schemas/failed_payment_details" } - } - }, - "PhoneType" : { - "title" : "Phone Type", - "type" : "string", - "description" : "The phone type", - "enum" : [ "FAX", "HOME", "MOBILE", "OTHER", "PAGER" ] + }, + "description" : "The billing details for the subscription. If the subscription was or is active, these fields are populated." }, - "Taxes" : { - "title" : "Taxes", - "required" : [ "percentage" ], + "authentication_response" : { + "title" : "Authentication Response", "type" : "object", "properties" : { - "inclusive" : { - "type" : "boolean", - "description" : "Indicates whether the tax was already included in the billing amount", - "default" : true + "liability_shift" : { + "$ref" : "#/components/schemas/liability_shift" }, - "percentage" : { - "$ref" : "#/components/schemas/Percentage" + "three_d_secure" : { + "$ref" : "#/components/schemas/three_d_secure_authentication_response" } }, - "description" : "The tax details" - }, - "Transaction" : { - "title" : "Transaction Details", - "required" : [ "amount_with_breakdown", "id", "time" ], - "type" : "object", - "description" : "The transaction details", - "allOf" : [ { - "$ref" : "#/components/schemas/CaptureStatus" - }, { - "$ref" : "#/components/schemas/TransactionAllOf2" - } ] + "description" : "Results of Authentication such as 3D Secure." }, "INVALIDSTRINGMAXLENGTH7" : { "title" : "INVALID_STRING_MAX_LENGTH", @@ -6291,36 +5952,6 @@ } } }, - "PaymentMethod" : { - "title" : "Payment Method", - "type" : "object", - "properties" : { - "payer_selected" : { - "minLength" : 1, - "pattern" : "^[0-9A-Z_]+$", - "type" : "string", - "description" : "The customer-selected payment method on the merchant site", - "default" : "PAYPAL", - "x-ballerina-name" : "payerSelected" - }, - "payee_preferred" : { - "allOf" : [ { - "$ref" : "#/components/schemas/PayeePaymentMethodPreference" - } ], - "x-ballerina-name" : "payeePreferred" - }, - "standard_entry_class_code" : { - "maxLength" : 255, - "minLength" : 3, - "type" : "string", - "description" : "NACHA (the regulatory body governing the ACH network) requires that API callers (merchants, partners) obtain the consumer’s explicit authorization before initiating a transaction. To stay compliant, you’ll need to make sure that you retain a compliant authorization for each transaction that you originate to the ACH Network using this API. ACH transactions are categorized (using SEC codes) by how you capture authorization from the Receiver (the person whose bank account is being debited or credited). PayPal supports the following SEC codes", - "default" : "WEB", - "enum" : [ "TEL", "WEB", "CCD", "PPD" ], - "x-ballerina-name" : "standardEntryClassCode" - } - }, - "description" : "The customer and merchant payment preferences" - }, "INVALIDSTRINGMAXLENGTH6" : { "title" : "INVALID_STRING_MAX_LENGTH", "properties" : { @@ -6347,6 +5978,16 @@ } } }, + "subscriptions.patch-422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionspatch422Details" + } + } + } + }, "INVALIDSTRINGMAXLENGTH2" : { "title" : "INVALID_STRING_MAX_LENGTH", "properties" : { @@ -6360,15 +6001,22 @@ } } }, - "SubscriptionsRevise400" : { + "update_pricing_schemes_list_request" : { + "title" : "Update Pricing Scheme Request", + "required" : [ "pricing_schemes" ], + "type" : "object", "properties" : { - "details" : { + "pricing_schemes" : { + "maxItems" : 99, + "minItems" : 1, "type" : "array", + "description" : "An array of pricing schemes.", "items" : { - "$ref" : "#/components/schemas/Subscriptionsrevise400Details" + "$ref" : "#/components/schemas/update_pricing_scheme_request" } } - } + }, + "description" : "The update pricing scheme request details." }, "INVALIDSTRINGMAXLENGTH5" : { "title" : "INVALID_STRING_MAX_LENGTH", @@ -6396,6 +6044,16 @@ } } }, + "plans.create-400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Planscreate400Details" + } + } + } + }, "PERMISSIONDENIED" : { "title" : "PERMISSION_DENIED", "properties" : { @@ -6422,36 +6080,6 @@ } } }, - "ErrorLinkDescription" : { - "title" : "Link Description", - "required" : [ "href", "rel" ], - "type" : "object", - "properties" : { - "method" : { - "maxLength" : 6, - "minLength" : 3, - "pattern" : "^[A-Z]*$", - "type" : "string", - "description" : "The HTTP method required to make the related call", - "enum" : [ "GET", "POST", "PUT", "DELETE", "PATCH" ] - }, - "rel" : { - "maxLength" : 100, - "minLength" : 0, - "pattern" : "^.*$", - "type" : "string", - "description" : "The [link relation type](https://tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](https://www.iana.org/assignments/link-relations/link-relations.xhtml)" - }, - "href" : { - "maxLength" : 20000, - "minLength" : 0, - "pattern" : "^.*$", - "type" : "string", - "description" : "The complete target URL. To make the related call, combine the method with this [URI Template-formatted](https://tools.ietf.org/html/rfc6570) link. For pre-processing, include the `$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call" - } - }, - "description" : "The request-related [HATEOAS link](/api/rest/responses/#hateoas-links) information" - }, "OVERLAPPINGPRICINGSCHEMETIERS3" : { "title" : "OVERLAPPING_PRICING_SCHEME_TIERS", "properties" : { @@ -6491,6 +6119,16 @@ } } }, + "subscriptions.create-422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscreate422Details" + } + } + } + }, "OVERLAPPINGPRICINGSCHEMETIERS1" : { "title" : "OVERLAPPING_PRICING_SCHEME_TIERS", "properties" : { @@ -6524,30 +6162,6 @@ "$ref" : "#/components/schemas/PLANSTATUSINVALID1" } ] }, - "SubscriptionsCapture422" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionscapture422Details" - } - } - } - }, - "TaxesOverride" : { - "title" : "Taxes Override", - "type" : "object", - "properties" : { - "inclusive" : { - "type" : "boolean", - "description" : "Indicates whether the tax was already included in the billing amount" - }, - "percentage" : { - "$ref" : "#/components/schemas/Percentage" - } - }, - "description" : "The tax details" - }, "INVALIDPARAMETERVALUE2" : { "title" : "INVALID_PARAMETER_VALUE", "properties" : { @@ -6574,6 +6188,16 @@ } } }, + "subscriber_request" : { + "title" : "Subscriber Request Information", + "type" : "object", + "description" : "The subscriber request information .", + "allOf" : [ { + "$ref" : "#/components/schemas/payer" + }, { + "$ref" : "#/components/schemas/SubscriberRequestAllOf2" + } ] + }, "INVALIDBILLINGCYCLESEQUENCE" : { "title" : "INVALID_BILLING_CYCLE_SEQUENCE", "properties" : { @@ -6592,13 +6216,47 @@ "properties" : { "issue" : { "type" : "string", - "enum" : [ "INVALID_PARAMETER_VALUE" ] + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Start time must be a valid future date and time." ] + } + } + }, + "error_400" : { + "title" : "Bad Request Error", + "type" : "object", + "properties" : { + "name" : { + "type" : "string", + "enum" : [ "INVALID_REQUEST" ] + }, + "message" : { + "type" : "string", + "enum" : [ "Request is not well-formed, syntactically incorrect, or violates schema." ] }, - "description" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/error_details" + } + }, + "debug_id" : { "type" : "string", - "enum" : [ "Start time must be a valid future date and time." ] + "description" : "The PayPal internal ID. Used for correlation purposes." + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS).", + "items" : { + "$ref" : "#/components/schemas/error_link_description" + } } - } + }, + "description" : "Request is not well-formed, syntactically incorrect, or violates schema." }, "INVALIDPARAMETERVALUE5" : { "title" : "INVALID_PARAMETER_VALUE", @@ -6613,37 +6271,39 @@ } } }, - "Phone" : { - "title" : "Phone", - "required" : [ "country_code", "national_number" ], + "error_401" : { + "title" : "Unauthorized Error", "type" : "object", "properties" : { - "country_code" : { - "maxLength" : 3, - "minLength" : 1, - "pattern" : "^[0-9]{1,3}?$", + "name" : { "type" : "string", - "description" : "The country calling code (CC), in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the CC and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN)", - "x-ballerina-name" : "countryCode" + "enum" : [ "AUTHENTICATION_FAILURE" ] }, - "extension_number" : { - "maxLength" : 15, - "minLength" : 1, - "pattern" : "^[0-9]{1,15}?$", + "message" : { "type" : "string", - "description" : "The extension number", - "x-ballerina-name" : "extensionNumber" + "enum" : [ "Authentication failed due to missing authorization header, or invalid authentication credentials." ] }, - "national_number" : { - "maxLength" : 14, - "minLength" : 1, - "pattern" : "^[0-9]{1,14}?$", + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/error_details" + } + }, + "debug_id" : { "type" : "string", - "description" : "The national number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the country calling code (CC) and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN)", - "x-ballerina-name" : "nationalNumber" + "description" : "The PayPal internal ID. Used for correlation purposes." + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS).", + "items" : { + "$ref" : "#/components/schemas/error_link_description" + } } }, - "description" : "The phone number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en)" + "description" : "Authentication failed due to missing Authorization header, or invalid authentication credentials." }, "INVALIDPARAMETERVALUE4" : { "title" : "INVALID_PARAMETER_VALUE", @@ -6658,6 +6318,16 @@ } } }, + "subscriptions.activate-400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionsactivate400Details" + } + } + } + }, "INVALIDPARAMETERVALUE3" : { "title" : "INVALID_PARAMETER_VALUE", "properties" : { @@ -6671,6 +6341,15 @@ } } }, + "card_brand" : { + "title" : "Card Brand", + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The card network or brand. Applies to credit, debit, gift, and payment cards.", + "enum" : [ "VISA", "MASTERCARD", "DISCOVER", "AMEX", "SOLO", "JCB", "STAR", "DELTA", "SWITCH", "MAESTRO", "CB_NATIONALE", "CONFIGOGA", "CONFIDIS", "ELECTRON", "CETELEM", "CHINA_UNION_PAY" ] + }, "INVALIDPARAMETERVALUE9" : { "title" : "INVALID_PARAMETER_VALUE", "properties" : { @@ -6710,13 +6389,66 @@ } } }, - "CountryCode" : { - "maxLength" : 2, - "minLength" : 2, - "pattern" : "^([A-Z]{2}|C2)$", + "address_portable" : { + "title" : "Portable Postal Address (Medium-Grained)", + "required" : [ "country_code" ], + "type" : "object", + "properties" : { + "address_line_1" : { + "maxLength" : 300, + "type" : "string", + "description" : "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_2" : { + "maxLength" : 300, + "type" : "string", + "description" : "The second line of the address. For example, suite or apartment number." + }, + "address_line_3" : { + "maxLength" : 100, + "type" : "string", + "description" : "The third line of the address, if needed. For example, a street complement for Brazil, direction text, such as `next to Walmart`, or a landmark in an Indian address." + }, + "admin_area_4" : { + "maxLength" : 100, + "type" : "string", + "description" : "The neighborhood, ward, or district. Smaller than `admin_area_level_3` or `sub_locality`. Value is:
  • The postal sorting code for Guernsey and many French territories, such as French Guiana.
  • The fine-grained administrative levels in China.
" + }, + "admin_area_3" : { + "maxLength" : 100, + "type" : "string", + "description" : "A sub-locality, suburb, neighborhood, or district. Smaller than `admin_area_level_2`. Value is:
  • Brazil. Suburb, bairro, or neighborhood.
  • India. Sub-locality or district. Street name information is not always available but a sub-locality or district can be a very small area.
" + }, + "admin_area_2" : { + "maxLength" : 120, + "type" : "string", + "description" : "A city, town, or village. Smaller than `admin_area_level_1`." + }, + "admin_area_1" : { + "maxLength" : 300, + "type" : "string", + "description" : "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`. Value, by country, is:
  • UK. A county.
  • US. A state.
  • Canada. A province.
  • Japan. A prefecture.
  • Switzerland. A kanton.
" + }, + "postal_code" : { + "maxLength" : 60, + "type" : "string", + "description" : "The postal code, which is the zip code or equivalent. Typically required for countries with a postal code or an equivalent. See [postal code](https://en.wikipedia.org/wiki/Postal_code)." + }, + "country_code" : { + "$ref" : "#/components/schemas/country_code" + }, + "address_details" : { + "$ref" : "#/components/schemas/AddressDetails" + } + }, + "description" : "The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute)." + }, + "date_year_month" : { + "maxLength" : 7, + "minLength" : 7, + "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])$", "type" : "string", - "description" : "The [two-character ISO 3166-1 code](/docs/integration/direct/rest/country-codes/) that identifies the country or region.
Note: The country code for Great Britain is GB and not UK as used in the top-level domain names for that country. Use the `C2` country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border transactions.
", - "format" : "ppaas_common_country_code_v2" + "description" : "The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6)." }, "UNSUPPORTEDPATCHOPERATION" : { "title" : "UNSUPPORTED_PATCH_OPERATION", @@ -6731,6 +6463,16 @@ } } }, + "plans.update-pricing-schemes-400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PlansupdatePricingSchemes400Details" + } + } + } + }, "INVALIDPRICINGMODEL2" : { "title" : "INVALID_PRICING_MODEL", "properties" : { @@ -6770,6 +6512,78 @@ } } }, + "error_503" : { + "title" : "Service Unavailable Error", + "type" : "object", + "properties" : { + "name" : { + "type" : "string", + "enum" : [ "SERVICE_UNAVAILABLE" ] + }, + "message" : { + "type" : "string", + "enum" : [ "Service Unavailable." ] + }, + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes." + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS).", + "items" : { + "$ref" : "#/components/schemas/error_link_description" + } + } + }, + "description" : "The server is temporarily unable to handle the request, for example, because of planned maintenance or downtime.", + "example" : { + "name" : "SERVICE_UNAVAILABLE", + "message" : "Service Unavailable.", + "debug_id" : "90957fca61718", + "information_link" : "https://developer.paypal.com/docs/api/orders/v2/#error-SERVICE_UNAVAILABLE" + } + }, + "plan_collection" : { + "title" : "Plan Collection", + "type" : "object", + "properties" : { + "plans" : { + "maxItems" : 32767, + "minItems" : 0, + "type" : "array", + "description" : "An array of plans.", + "items" : { + "$ref" : "#/components/schemas/plan" + } + }, + "total_items" : { + "maximum" : 500000000, + "minimum" : 0, + "type" : "integer", + "description" : "The total number of items." + }, + "total_pages" : { + "maximum" : 100000000, + "minimum" : 0, + "type" : "integer", + "description" : "The total number of pages." + }, + "links" : { + "maxItems" : 10, + "minItems" : 1, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).", + "readOnly" : true, + "items" : { + "$ref" : "#/components/schemas/link_description" + } + } + }, + "description" : "The list of plans with details." + }, "MORETHANTWOTRIALBILLINGCYCLENOTSUPPORTED" : { "title" : "MORE_THAN_TWO_TRIAL_BILLING_CYCLE_NOT_SUPPORTED", "properties" : { @@ -6796,32 +6610,6 @@ } } }, - "SubscriptionCaptureRequest" : { - "title" : "Charge Amount from Subscriber", - "required" : [ "amount", "capture_type", "note" ], - "type" : "object", - "properties" : { - "note" : { - "maxLength" : 128, - "minLength" : 1, - "type" : "string", - "description" : "The reason or note for the subscription charge" - }, - "amount" : { - "$ref" : "#/components/schemas/Money" - }, - "capture_type" : { - "maxLength" : 24, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", - "type" : "string", - "description" : "The type of capture", - "enum" : [ "OUTSTANDING_BALANCE" ], - "x-ballerina-name" : "captureType" - } - }, - "description" : "The charge amount from the subscriber" - }, "CardResponseWithBillingAddressAllOf2" : { "properties" : { "name" : { @@ -6831,13 +6619,13 @@ "description" : "The card holder's name as it appears on the card." }, "billing_address" : { - "$ref" : "#/components/schemas/AddressPortable" + "$ref" : "#/components/schemas/address_portable" }, "expiry" : { - "$ref" : "#/components/schemas/DateYearMonth" + "$ref" : "#/components/schemas/date_year_month" }, "currency_code" : { - "$ref" : "#/components/schemas/CurrencyCode" + "$ref" : "#/components/schemas/currency_code" } } }, @@ -6854,12 +6642,12 @@ } } }, - "SubscriptionsActivate422" : { + "subscriptions.revise-400" : { "properties" : { "details" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/Subscriptionsactivate422Details" + "$ref" : "#/components/schemas/Subscriptionsrevise400Details" } } } @@ -6877,39 +6665,11 @@ } } }, - "SubscriptionStatus" : { - "title" : "Subscription Status", - "type" : "object", - "properties" : { - "status_change_note" : { - "maxLength" : 128, - "minLength" : 1, - "type" : "string", - "description" : "The reason or notes for the status of the subscription", - "x-ballerina-name" : "statusChangeNote" - }, - "status" : { - "maxLength" : 24, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", - "type" : "string", - "description" : "The status of the subscription", - "enum" : [ "APPROVAL_PENDING", "APPROVED", "ACTIVE", "SUSPENDED", "CANCELLED", "EXPIRED" ] - }, - "status_update_time" : { - "allOf" : [ { - "$ref" : "#/components/schemas/DateTime" - } ], - "x-ballerina-name" : "statusUpdateTime" - } - }, - "description" : "The subscription status details" - }, "InlineResponse4221" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error422" + "$ref" : "#/components/schemas/error_422" }, { - "$ref" : "#/components/schemas/PlansPatch422" + "$ref" : "#/components/schemas/plans.patch-422" } ] }, "INVALIDSTRINGMINLENGTH" : { @@ -6927,68 +6687,78 @@ }, "InlineResponse4224" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error422" + "$ref" : "#/components/schemas/error_422" }, { - "$ref" : "#/components/schemas/PlansUpdatePricingSchemes422" + "$ref" : "#/components/schemas/plans.update-pricing-schemes-422" } ] }, "InlineResponse4225" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error422" + "$ref" : "#/components/schemas/error_422" }, { - "$ref" : "#/components/schemas/SubscriptionsCreate422" + "$ref" : "#/components/schemas/subscriptions.create-422" } ] }, "InlineResponse4222" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error422" + "$ref" : "#/components/schemas/error_422" }, { - "$ref" : "#/components/schemas/PlansActivate422" + "$ref" : "#/components/schemas/plans.activate-422" } ] }, "InlineResponse4223" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error422" + "$ref" : "#/components/schemas/error_422" }, { - "$ref" : "#/components/schemas/PlansDeactivate422" + "$ref" : "#/components/schemas/plans.deactivate-422" } ] }, "InlineResponse4228" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error422" + "$ref" : "#/components/schemas/error_422" }, { - "$ref" : "#/components/schemas/SubscriptionsSuspend422" + "$ref" : "#/components/schemas/subscriptions.suspend-422" } ] }, - "SubscriptionsRevise422" : { + "subscriptions.patch-400" : { "properties" : { "details" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/Subscriptionsrevise422Details" + "$ref" : "#/components/schemas/Subscriptionspatch400Details" } } } }, "InlineResponse4229" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error422" + "$ref" : "#/components/schemas/error_422" }, { - "$ref" : "#/components/schemas/SubscriptionsCancel422" + "$ref" : "#/components/schemas/subscriptions.cancel-422" } ] }, "InlineResponse4226" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error422" + "$ref" : "#/components/schemas/error_422" }, { - "$ref" : "#/components/schemas/SubscriptionsPatch422" + "$ref" : "#/components/schemas/subscriptions.patch-422" } ] }, + "subscriptions.revise-404" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionsrevise404Details" + } + } + } + }, "InlineResponse4227" : { "allOf" : [ { - "$ref" : "#/components/schemas/Error422" + "$ref" : "#/components/schemas/error_422" }, { - "$ref" : "#/components/schemas/SubscriptionsRevise422" + "$ref" : "#/components/schemas/subscriptions.revise-422" } ] } }, @@ -6998,7 +6768,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorDefault" + "$ref" : "#/components/schemas/error_default" } } } @@ -7015,25 +6785,23 @@ "schema" : { "type" : "string", "default" : "return=minimal" - }, - "x-ballerina-name" : "prefer" + } }, "paypal_request_id" : { "name" : "PayPal-Request-Id", "in" : "header", - "description" : "The server stores keys for 72 hours", + "description" : "The server stores keys for 72 hours.", "required" : false, "style" : "simple", "explode" : false, "schema" : { "type" : "string" - }, - "x-ballerina-name" : "payPalRequestId" + } }, "product_id" : { "name" : "product_id", "in" : "query", - "description" : "Filters the response by a Product ID", + "description" : "Filters the response by a Product ID.", "required" : false, "style" : "form", "explode" : true, @@ -7041,13 +6809,12 @@ "maxLength" : 50, "minLength" : 6, "type" : "string" - }, - "x-ballerina-name" : "productId" + } }, "plan_ids" : { "name" : "plan_ids", "in" : "query", - "description" : "Filters the response by list of plan IDs. Filter supports upto 10 plan IDs", + "description" : "Filters the response by list of plan IDs. Filter supports upto 10 plan IDs.", "required" : false, "style" : "form", "explode" : true, @@ -7055,13 +6822,12 @@ "maximum" : 270, "minimum" : 3, "type" : "string" - }, - "x-ballerina-name" : "planIds" + } }, "page_size" : { "name" : "page_size", "in" : "query", - "description" : "The number of items to return in the response", + "description" : "The number of items to return in the response.", "required" : false, "style" : "form", "explode" : true, @@ -7070,13 +6836,12 @@ "minimum" : 1, "type" : "integer", "default" : 10 - }, - "x-ballerina-name" : "pageSize" + } }, "page" : { "name" : "page", "in" : "query", - "description" : "A non-zero integer which is the start index of the entire list of items to return in the response. The combination of `page=1` and `page_size=20` returns the first 20 items. The combination of `page=2` and `page_size=20` returns the next 20 items", + "description" : "A non-zero integer which is the start index of the entire list of items to return in the response. The combination of `page=1` and `page_size=20` returns the first 20 items. The combination of `page=2` and `page_size=20` returns the next 20 items.", "required" : false, "style" : "form", "explode" : true, @@ -7090,20 +6855,19 @@ "total_required" : { "name" : "total_required", "in" : "query", - "description" : "Indicates whether to show the total count in the response", + "description" : "Indicates whether to show the total count in the response.", "required" : false, "style" : "form", "explode" : true, "schema" : { "type" : "boolean", "default" : false - }, - "x-ballerina-name" : "totalRequired" + } }, "id" : { "name" : "id", "in" : "path", - "description" : "The ID of the subscription", + "description" : "The ID of the subscription.", "required" : true, "style" : "simple", "explode" : false, @@ -7114,7 +6878,7 @@ "fields" : { "name" : "fields", "in" : "query", - "description" : "List of fields that are to be returned in the response. Possible value for fields are last_failed_payment and plan", + "description" : "List of fields that are to be returned in the response. Possible value for fields are last_failed_payment and plan.", "required" : false, "style" : "form", "explode" : true, @@ -7127,7 +6891,7 @@ "start_time" : { "name" : "start_time", "in" : "query", - "description" : "The start time of the range of transactions to list", + "description" : "The start time of the range of transactions to list.", "required" : true, "style" : "form", "explode" : true, @@ -7137,13 +6901,12 @@ "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$", "type" : "string", "format" : "ppaas_date_time_v3" - }, - "x-ballerina-name" : "startTime" + } }, "end_time" : { "name" : "end_time", "in" : "query", - "description" : "The end time of the range of transactions to list", + "description" : "The end time of the range of transactions to list.", "required" : true, "style" : "form", "explode" : true, @@ -7153,8 +6916,7 @@ "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$", "type" : "string", "format" : "ppaas_date_time_v3" - }, - "x-ballerina-name" : "endTime" + } } }, "requestBodies" : { @@ -7162,7 +6924,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/PatchRequest" + "$ref" : "#/components/schemas/patch_request" } } } From 31f75c7edc6a7e660eadf00d7463b6e4a3293fcb Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Thu, 19 Jun 2025 17:22:06 +0530 Subject: [PATCH 21/56] Refactor test cases for PayPal Billing Plans API with consistent naming and improved variable handling --- ballerina/tests/tests.bal | 86 +++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index 37bf8f3..abe8523 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -2,12 +2,12 @@ import ballerina/http; import ballerina/io; import ballerina/test; import ballerina/time; -import ballerina/toml; // Define configurable variables configurable string serviceUrl = isLiveServer ? "https://api-m.sandbox.paypal.com/v1/billing" : "http://localhost:9090/v1/billing"; configurable string clientId = ?; configurable string clientSecret = ?; +string testProductId = ""; string testPlanId = ""; ConnectionConfig config = { @@ -29,7 +29,7 @@ function initClient() returns Client|error { return new Client(config, serviceUrl); } -# # Test cases for PayPal Billing Plans API +# # Test cases for PayPal Billing Plans Connectors # # Test to list all plans @test:Config { @@ -37,16 +37,18 @@ function initClient() returns Client|error { dependsOn: [testCreatePlan] } function testListPlans() returns error? { - PlanCollection response = check paypal->/plans.get(); + plan_collection response = check paypal->/plans(); // io:println("List Plans Response: " + response.toString()); test:assertTrue(response?.plans !is ()); } // Function to create a product -function createProduct() returns string|error { +@test:BeforeSuite +function createProduct() returns error? { if !isLiveServer { - return "PRD-TEMP"; + testProductId = "PRD-TEMP"; + return; } // Generate timestamp for unique ID time:Utc currentTime = time:utcNow(); @@ -75,7 +77,7 @@ function createProduct() returns string|error { json responseJson = check response.getJsonPayload(); string productId = check responseJson.id; // io:println("Created Product ID: " + productId); - return productId; + testProductId = productId; } # Test to create a new plan @@ -83,51 +85,49 @@ function createProduct() returns string|error { groups: ["live_tests", "mock_tests"] } function testCreatePlan() returns error? { - string productId = check createProduct(); - - PlanRequestPOST payload = { - productId: productId, + plan_request_POST payload = { + product_id: testProductId, name: "Fresh Clean Tees Plan", status: "ACTIVE", - billingCycles: [ + billing_cycles: [ { frequency: { - intervalUnit: "MONTH", - intervalCount: 1 + interval_unit: "MONTH", + interval_count: 1 }, - tenureType: "TRIAL", + tenure_type: "TRIAL", sequence: 1, - totalCycles: 1, - pricingScheme: { - fixedPrice: { + total_cycles: 1, + pricing_scheme: { + fixed_price: { value: "1", - currencyCode: "USD" + currency_code: "USD" } } }, { frequency: { - intervalUnit: "MONTH", - intervalCount: 1 + interval_unit: "MONTH", + interval_count: 1 }, - tenureType: "REGULAR", + tenure_type: "REGULAR", sequence: 2, - totalCycles: 12, - pricingScheme: { - fixedPrice: { + total_cycles: 12, + pricing_scheme: { + fixed_price: { value: "44", - currencyCode: "USD" + currency_code: "USD" } } } ], - paymentPreferences: { - autoBillOutstanding: true, - setupFeeFailureAction: "CONTINUE", - paymentFailureThreshold: 3 + payment_preferences: { + auto_bill_outstanding: true, + setup_fee_failure_action: "CONTINUE", + payment_failure_threshold: 3 } }; - Plan createdPlan = check paypal->/plans.post(payload); + plan createdPlan = check paypal->/plans.post(payload); io:println("Plan created successfully: ", createdPlan.id); test:assertTrue(createdPlan.id is string, "Created plan should have an ID"); testPlanId = createdPlan.id; @@ -139,9 +139,9 @@ function testCreatePlan() returns error? { dependsOn: [testCreatePlan] } function testGetPlan() returns error? { - Plan plan = check paypal->/plans/[testPlanId].get(); + plan plan = check paypal->/plans/[testPlanId].get(); test:assertEquals(plan.id, testPlanId, "Retrieved plan ID should match the requested ID"); - io:println("Retrieved Plan: ", plan.toString()); + //io:println("Retrieved Plan: ", plan.toString()); } # Test to update a plan @@ -152,7 +152,7 @@ function testGetPlan() returns error? { } function testUpdatePlan() returns error? { - PatchRequest payload = + patch_request payload = [ { op: "replace", @@ -198,23 +198,23 @@ function testActivatePlan() returns error? { after: testGetPlan } function testUpdatePricingSchemes() returns error? { - UpdatePricingSchemesListRequest payload = { - pricingSchemes: [ + update_pricing_schemes_list_request payload = { + pricing_schemes: [ { - billingCycleSequence: 1, - pricingScheme: { - fixedPrice: { + billing_cycle_sequence: 1, + pricing_scheme: { + fixed_price: { value: "120", - currencyCode: "USD" + currency_code: "USD" } } }, { - billingCycleSequence: 2, - pricingScheme: { - fixedPrice: { + billing_cycle_sequence: 2, + pricing_scheme: { + fixed_price: { value: "555", - currencyCode: "USD" + currency_code: "USD" } } } From f9177c56d26783ab814b92eb8c4beb40b9cb4625 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Thu, 19 Jun 2025 17:22:30 +0530 Subject: [PATCH 22/56] Refactor mock service resource function signatures for consistent naming conventions --- ballerina/tests/mock_service.bal | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ballerina/tests/mock_service.bal b/ballerina/tests/mock_service.bal index be49794..e12cdbf 100644 --- a/ballerina/tests/mock_service.bal +++ b/ballerina/tests/mock_service.bal @@ -10,7 +10,7 @@ http:Service mockService = service object { # List plans # # + return - A successful request returns the HTTP 200 OK status code with a JSON response body that lists billing plans - resource function get plans() returns PlanCollection|error { + resource function get plans() returns plan_collection|error { return { plans: [ { @@ -47,12 +47,12 @@ http:Service mockService = service object { # + payload - The plan request payload # + return - A successful request returns the HTTP 200 OK status code with a JSON response body that shows billing plan details - resource function post plans(@http:Payload PlanRequestPOST payload) returns Plan|error { + resource function post plans(@http:Payload plan_request_POST payload) returns plan|error { return { name: payload.name, id: "P-20250618", status: payload.status, - productId: payload.productId, + product_id: payload.product_id, "billing_cycles": [ { sequence: 1, @@ -77,7 +77,7 @@ http:Service mockService = service object { # # + planId - The ID of the plan to retrieve # + return - A successful request returns the HTTP 200 OK status code with a JSON response body that shows billing plan details - resource function get plans/[string planId]() returns Plan|error { + resource function get plans/[string planId]() returns plan|error { return { name: "Basic Plan", id: planId, // Return the same plan ID that was requested @@ -107,7 +107,7 @@ http:Service mockService = service object { # + planId - The ID of the plan to update # + payload - The plan request payload # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body - resource function patch plans/[string planId](@http:Payload PatchRequest payload) returns http:Ok|error? { + resource function patch plans/[string planId](@http:Payload patch_request payload) returns http:Ok|error? { log:printInfo("Mock service received patch request for plan ID: " + planId); log:printInfo("Patch payload: " + payload.toString()); return {}; @@ -136,7 +136,7 @@ http:Service mockService = service object { # + id - The ID of the subscription # + payload - The request payload containing the pricing schemes to update # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body - resource function post plans/[string id]/update\-pricing\-schemes(@http:Payload UpdatePricingSchemesListRequest payload) returns http:Ok|error { + resource function post plans/[string id]/update\-pricing\-schemes(@http:Payload update_pricing_schemes_list_request payload) returns http:Ok|error { log:printInfo("Mock service received update pricing request for plan ID: " + id); log:printInfo("Update pricing payload: " + payload.toString()); return {}; From a23e4b313a95aa007fa871dd4f68f76b2e7a3dbe Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Thu, 19 Jun 2025 22:41:28 +0530 Subject: [PATCH 23/56] Add test cases for PayPal Billing Subscriptions including create, get, update, revise, suspend, activate, and cancel functionalities --- ballerina/tests/tests.bal | 174 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index abe8523..b34cbb2 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -9,6 +9,9 @@ configurable string clientId = ?; configurable string clientSecret = ?; string testProductId = ""; string testPlanId = ""; +string testSubscriptionId = ""; +configurable string testActivatedSubscriptionId = ?; +string testActivatedSubscriptionPlanId = ""; ConnectionConfig config = { auth: { @@ -224,3 +227,174 @@ function testUpdatePricingSchemes() returns error? { test:assertTrue(response is (), "Response should be empty on successful update of pricing schemes"); io:println("Pricing schemes updated successfully for plan: " + testPlanId); } + +# # Test cases for PayPal Billing Subscription Connectors +# +# Test to create a new subscription +@test:Config { + groups: ["live_tests", "mock_tests"], + dependsOn: [testActivatePlan] +} +function testCreateSubscription() returns error? { + string twoMinutesFromNow = time:utcToString(time:utcAddSeconds(time:utcNow(), 120)); + subscription_request_post payload = { + plan_id: testPlanId, + start_time: twoMinutesFromNow, + shipping_amount: { + currency_code: "USD", + value: "10.00" + }, + subscriber: { + name: { + given_name: "FooBuyer", + surname: "Jones" + }, + email_address: "foobuyer@example.com", + shipping_address: { + name: { + full_name: "John Doe" + }, + address: { + address_line_1: "2211 N First Street", + address_line_2: "Building 17", + admin_area_2: "San Jose", + admin_area_1: "CA", + postal_code: "95131", + country_code: "US" + } + } + }, + application_context: { + brand_name: "Example Inc", + locale: "en-US", + shipping_preference: "SET_PROVIDED_ADDRESS", + user_action: "SUBSCRIBE_NOW", + payment_method: { + payer_selected: "PAYPAL", + payee_preferred: "IMMEDIATE_PAYMENT_REQUIRED" + }, + return_url: "https://example.com/return", + cancel_url: "https://example.com/cancel" + } + }; + subscription response = check paypal->/subscriptions.post(payload); + test:assertTrue(response.id is string, "Created subscription should have an ID"); + testSubscriptionId = response.id; + io:println("Subscription created successfully: ", response.id); +} + +# Test to get a specific subscription +@test:Config { + groups: ["live_tests", "mock_tests"] +} +function testGetSubscription() returns error? { + SubscriptionsGetQueries queries = { + fields: "id,plan_id,status" + }; + subscription response = check paypal->/subscriptions/[testSubscriptionId].get(queries = queries); + test:assertEquals(response.id, testSubscriptionId, "Retrieved subscription ID should match the requested ID"); + io:println("Retrieved Subscription: ", response.toString()); + testActivatedSubscriptionPlanId = response.plan_id; + +} + +# Test to update a subscription +@test:Config { + groups: ["mock_tests", "live_active_subscription_tests"], + after: testGetSubscription +} +function testUpdateSubscription() returns error? { + patch_request payload = [ + { + op: "replace", + path: "/subscriber/shipping_address", + value: { + name: { + full_name: "Roy Nesarajah Viththagan" + }, + address: { + address_line_1: "2211 N First Street", + address_line_2: "Building 17", + admin_area_2: "San Jose", + admin_area_1: "CA", + postal_code: "95131", + country_code: "US" + } + } + } + ]; + error? response = check paypal->/subscriptions/[testActivatedSubscriptionId].patch(payload); + test:assertTrue(response is (), "Response should be empty on successful patch"); + io:println("Subscription updated successfully: " + testActivatedSubscriptionId); + testSubscriptionId = testActivatedSubscriptionId; +} + +# Test to revise a subscription +@test:Config { + groups: ["mock_tests", "live_active_subscription_tests"], + dependsOn: [testUpdateSubscription], + after: testGetSubscription +} +function testReviseSubscription() returns error? { + subscription_revise_request payload = { + plan_id: testActivatedSubscriptionPlanId, + shipping_amount: { + currency_code: "USD", + value: "2222.00" + } + }; + + subscription_revise_response|error response = check paypal->/subscriptions/[testActivatedSubscriptionId]/revise.post(payload); + if response is error { + io:println("Error revising subscription: ", response.message()); + return response; + } + io:println("Subscription revised successfully: " + testActivatedSubscriptionId); + test:assertTrue(response.plan_id is string, "Revised subscription should have a plan ID"); + testSubscriptionId = testActivatedSubscriptionId; +} + +# Test to suspend a subscription +@test:Config { + groups: ["mock_tests", "live_active_subscription_tests"], + dependsOn: [testReviseSubscription], + after: testGetSubscription +} +function testSuspendSubscription() returns error? { + subscription_suspend_request payload = { + reason: "Item out of stock" + }; + error? response = check paypal->/subscriptions/[testActivatedSubscriptionId]/suspend.post(payload); + test:assertTrue(response is (), "Response should be empty on successful suspension"); + io:println("Subscription suspended successfully: " + testActivatedSubscriptionId); +} + +# Test to activate a subscription +@test:Config { + groups: ["mock_tests", "live_active_subscription_tests"], + dependsOn: [testSuspendSubscription], + after: testGetSubscription +} +function testActivateSubscription() returns error? { + subscription_activate_request payload = { + reason: "Items are back in stock" + }; + error? response = check paypal->/subscriptions/[testActivatedSubscriptionId]/activate.post(payload); + test:assertTrue(response is (), "Response should be empty on successful activation"); + io:println("Subscription activated successfully: " + testActivatedSubscriptionId); +} + +# Test to cancel a subscription +@test:Config { + groups: ["mock_tests", "live_active_subscription_tests"], + dependsOn: [testActivateSubscription], + after: testGetSubscription +} +function testCancelSubscription() returns error? { + subscription_cancel_request payload = { + reason: "Customer requested cancellation" + }; + error? response = check paypal->/subscriptions/[testActivatedSubscriptionId]/cancel.post(payload); + test:assertTrue(response is (), "Response should be empty on successful cancellation"); + io:println("Subscription cancelled successfully: " + testActivatedSubscriptionId); +} From 7352a8fe5b37096f84eec801211c142cf16c8a02 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Thu, 19 Jun 2025 22:42:03 +0530 Subject: [PATCH 24/56] Add mock service functions for managing subscriptions including create, get, update, revise, suspend, activate, and cancel --- ballerina/tests/mock_service.bal | 118 +++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/ballerina/tests/mock_service.bal b/ballerina/tests/mock_service.bal index e12cdbf..b0e22fd 100644 --- a/ballerina/tests/mock_service.bal +++ b/ballerina/tests/mock_service.bal @@ -7,6 +7,8 @@ listener http:Listener httpListener = new (9090); http:Service mockService = service object { + # # Mock service for testing billing plans API + # List plans # # + return - A successful request returns the HTTP 200 OK status code with a JSON response body that lists billing plans @@ -141,6 +143,122 @@ http:Service mockService = service object { log:printInfo("Update pricing payload: " + payload.toString()); return {}; } + + # # Mock service for testing billing Subscriptions API + # + + # create a new subscription + # + payload - The subscription request payload + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. + resource function post subscriptions(@http:Payload subscription_request_post payload) returns subscription|error { + return + { + id: "I-1234567890", + status: "APPROVAL_PENDING", + plan_id: payload.plan_id, + start_time: payload.start_time, + shipping_amount: payload.shipping_amount, + create_time: "2025-06-16T10:53:00Z", + update_time: "2025-06-16T10:53:00Z", + links: [ + { + href: "/v1/billing/subscriptions/I-1234567890", + rel: "self", + method: "GET" + } + ] + } + ; + } + + # get subscription by ID + # + # + id - The ID of the subscription to retrieve + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. + resource function get subscriptions/[string id]() returns subscription|error { + return { + id: id, + status: "ACTIVE", + plan_id: "P-1234567890", + start_time: "2025-06-16T10:53:00Z", + shipping_amount: {currency_code: "USD", value: "0.00"}, + create_time: "2025-06-16T10:53:00Z", + update_time: "2025-06-16T10:53:00Z", + links: [ + { + href: string `/v1/billing/subscriptions/${id}`, + rel: "self", + method: "GET" + } + ] + }; + + }; + + # update subscription + # + # + id - The ID of the subscription to update + # + payload - The request payload containing the subscription details to update + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource function patch subscriptions/[string id](@http:Payload patch_request payload) returns http:Ok|error? { + log:printInfo("Mock service received update request for subscription ID: " + id); + log:printInfo("Update payload: " + payload.toString()); + return {}; + } + + # Revise plan or quantity of subscription + # + # + id - The ID of the subscription. + # + payload - Headers to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. + resource function post subscriptions/[string id]/revise(@http:Payload subscription_revise_request payload) returns subscription_revise_response|error { + log:printInfo("Mock service received revise request for subscription ID: " + id); + log:printInfo("Revise payload: " + payload.toString()); + return { + plan_id: payload.plan_id, + shipping_amount: payload.shipping_amount, + links: [ + { + href: string `/v1/billing/subscriptions/${id}`, + rel: "self", + method: "GET" + } + ] + }; + } + + # Suspend subscription + # + # + id - The ID of the subscription. + # + payload - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. + resource function post subscriptions/[string id]/suspend(@http:Payload subscription_suspend_request payload) returns http:Ok|error { + log:printInfo("Mock service received suspend request for subscription ID: " + id); + log:printInfo("Reason for suspension: " + payload.reason.toString()); + return {}; + } + + # Activate subscription + # + # + id - The ID of the subscription. + # + payload - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. + resource function post subscriptions/[string id]/activate(@http:Payload subscription_activate_request payload) returns http:Ok|error { + log:printInfo("Mock service received activate request for subscription ID: " + id); + log:printInfo("Reason for activation: " + payload.reason.toString()); + return {}; + } + + # Cancel subscription + # + # + id - The ID of the subscription. + # + payload - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. + resource function post subscriptions/[string id]/cancel(@http:Payload subscription_cancel_request payload) returns http:Ok|error { + log:printInfo("Mock service received cancel request for subscription ID: " + id); + log:printInfo("Reason for cancellation: " + payload.reason.toString()); + return {}; + } }; function init() returns error? { From db4221e467943bd0b51f24e79b8506ef6c63f328 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Fri, 20 Jun 2025 11:54:03 +0530 Subject: [PATCH 25/56] Update sanitation document for OpenAPI specification: modify server URLs and path keys for improved usability --- docs/spec/sanitations.md | 88 +++++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 32 deletions(-) diff --git a/docs/spec/sanitations.md b/docs/spec/sanitations.md index 79d7653..31ec468 100644 --- a/docs/spec/sanitations.md +++ b/docs/spec/sanitations.md @@ -1,41 +1,65 @@ _Author_: @RNViththagan \ _Created_: 2025/06/13 \ -_Updated_: 2025/06/13 \ +_Updated_: 2025/06/20 \ _Edition_: Swan Lake # Sanitation for OpenAPI specification -This document records the sanitation done on top of the official OpenAPI specification from PayPal Subscriptions. The OpenAPI specification is obtained from [PayPal REST API Specifications](https://github.com/paypal/paypal-rest-api-specifications/blob/main/openapi/billing_subscriptions_v1.json). These changes are implemented after flattening and aligning the OpenAPI specification to enhance usability and address language limitations in the Ballerina OpenAPI tool. - -1. **Renamed schema `Schema'400` to `BadRequest`**: - - **Original**: `Schema'400` - - **Updated**: `BadRequest` - - **Action**: Updated `$ref` values directly referencing this schema (e.g., `"$ref": "#/components/schemas/Schema'400"` to `"$ref": "#/components/schemas/BadRequest"`). - - **Reason**: The original schema name contained a single quote, which does not comply with the regular expression `^[a-zA-Z0-9\.\-_]+$`. Renaming improves compatibility with the Ballerina OpenAPI tool. - -2. **Renamed schema `Schema'401` to `Unauthorized`**: - - **Original**: `Schema'401` - - **Updated**: `Unauthorized` - - **Action**: Updated `$ref` values directly referencing this schema (e.g., `"$ref": "#/components/schemas/Schema'401"` to `"$ref": "#/components/schemas/Unauthorized"`). - - **Reason**: The original schema name contained a single quote, which does not comply with the regular expression `^[a-zA-Z0-9\.\-_]+$`. Renaming ensures compliance and clarity. - -3. **Renamed schema `Schema'403` to `Forbidden`**: - - **Original**: `Schema'403` - - **Updated**: `Forbidden` - - **Action**: Updated `$ref` values directly referencing this schema (e.g., `"$ref": "#/components/schemas/Schema'403"` to `"$ref": "#/components/schemas/Forbidden"`). - - **Reason**: The original schema name contained a single quote, which does not comply with the regular expression `^[a-zA-Z0-9\.\-_]+$`. Renaming enhances compatibility. - -4. **Renamed schema `Schema'404` to `NotFound`**: - - **Original**: `Schema'404` - - **Updated**: `NotFound` - - **Action**: Updated `$ref` values directly referencing this schema (e.g., `"$ref": "#/components/schemas/Schema'404"` to `"$ref": "#/components/schemas/NotFound"`). - - **Reason**: The original schema name contained a single quote, which does not comply with the regular expression `^[a-zA-Z0-9\.\-_]+$`. Renaming improves usability and compliance. - -5. **Renamed schema `Schema'422` to `UnprocessableEntity`**: - - **Original**: `Schema'422` - - **Updated**: `UnprocessableEntity` - - **Action**: Updated `$ref` values directly referencing this schema (e.g., `"$ref": "#/components/schemas/Schema'422"` to `"$ref": "#/components/schemas/UnprocessableEntity"`). - - **Reason**: The original schema name contained a single quote, which does not comply with the regular expression `^[a-zA-Z0-9\.\-_]+$`. Renaming ensures compliance and clarity. +This document records the sanitation done on top of the official OpenAPI specification from PayPal Subscriptions. The OpenAPI specification is obtained from [PayPal REST API Specifications](https://github.com/paypal/paypal-rest-api-specifications/blob/main/openapi/billing_subscriptions_v1.json). These changes are implemented after flattening the OpenAPI specification to enhance usability and address language limitations in the Ballerina OpenAPI tool. + +## Sanitization Steps + +Following the latest Ballerina connector guidelines, apply these changes **after flattening the OpenAPI specification and without aligning the spec**: + +### 1. Update `servers` URLs to include `/v1/billing` + +**Before:** +```json +"servers" : [ { + "url" : "https://api-m.sandbox.paypal.com", + "description" : "PayPal Sandbox Environment" + }, { + "url" : "https://api-m.paypal.com", + "description" : "PayPal Live Environment" + } ], +``` + +**After:** +```json +"servers" : [ { + "url" : "https://api-m.sandbox.paypal.com/v1/billing", + "description" : "PayPal Sandbox Environment" + }, { + "url" : "https://api-m.paypal.com/v1/billing", + "description" : "PayPal Live Environment" + } ], +``` + +### 2. Remove `/v1/billing` from all path keys + +**Before:** +```json +"paths" : { + "/v1/billing/plans" : { + // ...existing code... + }, + "/v1/billing/subscriptions" : { + // ...existing code... + } +} +``` + +**After:** +```json +"paths" : { + "/plans" : { + // ...existing code... + }, + "/subscriptions" : { + // ...existing code... + } +} +``` ## OpenAPI cli command From 1df0b1769c635a94b3b4780d4866ef4408054638 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Fri, 20 Jun 2025 13:29:17 +0530 Subject: [PATCH 26/56] Add copyright notice and license information to multiple Ballerina files --- ballerina/client.bal | 16 ++++++++++++++++ ballerina/tests/mock_service.bal | 16 ++++++++++++++++ ballerina/tests/tests.bal | 16 ++++++++++++++++ ballerina/types.bal | 16 ++++++++++++++++ ballerina/utils.bal | 16 ++++++++++++++++ 5 files changed, 80 insertions(+) diff --git a/ballerina/client.bal b/ballerina/client.bal index 82c4dbe..6e5ca98 100644 --- a/ballerina/client.bal +++ b/ballerina/client.bal @@ -1,6 +1,22 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. // This file is auto-generated by the Ballerina OpenAPI tool. +// Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + import ballerina/data.jsondata; import ballerina/http; diff --git a/ballerina/tests/mock_service.bal b/ballerina/tests/mock_service.bal index b0e22fd..d3db3c1 100644 --- a/ballerina/tests/mock_service.bal +++ b/ballerina/tests/mock_service.bal @@ -1,3 +1,19 @@ +// Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + import ballerina/http; import ballerina/log; diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index b34cbb2..15811a3 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -1,3 +1,19 @@ +// Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + import ballerina/http; import ballerina/io; import ballerina/test; diff --git a/ballerina/types.bal b/ballerina/types.bal index e107464..81db8a9 100644 --- a/ballerina/types.bal +++ b/ballerina/types.bal @@ -1,6 +1,22 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. // This file is auto-generated by the Ballerina OpenAPI tool. +// Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + import ballerina/constraint; import ballerina/http; diff --git a/ballerina/utils.bal b/ballerina/utils.bal index 859a6d2..8269f00 100644 --- a/ballerina/utils.bal +++ b/ballerina/utils.bal @@ -1,6 +1,22 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. // This file is auto-generated by the Ballerina OpenAPI tool. +// Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + import ballerina/http; import ballerina/url; From 7326908b9cd3cfa421f678b526ef40b270185866 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Fri, 20 Jun 2025 14:17:17 +0530 Subject: [PATCH 27/56] Update sanitation document: correct OpenAPI client generation command and add note on flattened specification usage --- docs/spec/sanitations.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/spec/sanitations.md b/docs/spec/sanitations.md index 31ec468..70d35d0 100644 --- a/docs/spec/sanitations.md +++ b/docs/spec/sanitations.md @@ -65,8 +65,8 @@ Following the latest Ballerina connector guidelines, apply these changes **after The following command was used to generate the Ballerina client from the OpenAPI specification. The command should be executed from the repository root directory. +> Note: The flattened OpenAPI specification must be used for Ballerina client generation to prevent type-inclusion [issue](https://github.com/ballerina-platform/ballerina-lang/issues/38535#issuecomment-2973521948) in the generated types. + ```bash -bal openapi -i docs/spec/openapi.yaml --mode client -o ballerina +bal openapi -i docs/spec/openapi.json --mode client -o ballerina ``` - -Note: The license year is hardcoded to 2025, change if necessary. \ No newline at end of file From 6ec9ef55d55e711bc347907a840b71c2c3acb488 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Fri, 20 Jun 2025 14:25:51 +0530 Subject: [PATCH 28/56] [Automated] Update the toml files --- ballerina/Dependencies.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 488faf7..899d0e0 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -5,7 +5,7 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.12.6" +distribution-version = "2201.12.0" [[package]] org = "ballerina" From 4da25f6b52ab56c2bdd167f4f27f432f36e148cd Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Tue, 24 Jun 2025 10:59:47 +0530 Subject: [PATCH 29/56] [Automated] Update the toml files --- ballerina/Ballerina.toml | 4 ++-- ballerina/Dependencies.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 3a59352..08b1743 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -5,8 +5,8 @@ name = "paypal.subscriptions" version = "1.0.0" license = ["Apache-2.0"] authors = ["Ballerina"] -keywords = [] # TODO: Add keywords -# icon = "icon.png" # TODO: Add icon +keywords = ["paypal", "subscriptions", "plans","billing", "payments", "recurring", "connector",] +icon = "https://www.paypalobjects.com/webstatic/mktg/logo/pp_cc_mark_111x69.jpg" repository = "https://github.com/ballerina-platform/module-ballerinax-paypal.subscriptions" [build-options] diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 899d0e0..8e86944 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -5,7 +5,7 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.12.0" +distribution-version = "2201.12.7" [[package]] org = "ballerina" From ea3e9cdcdca0d26c30429bd295383a1e6087bd4a Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Tue, 24 Jun 2025 11:33:40 +0530 Subject: [PATCH 30/56] [Automated] Update the toml files --- ballerina/Ballerina.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 08b1743..641c60e 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -6,7 +6,7 @@ version = "1.0.0" license = ["Apache-2.0"] authors = ["Ballerina"] keywords = ["paypal", "subscriptions", "plans","billing", "payments", "recurring", "connector",] -icon = "https://www.paypalobjects.com/webstatic/mktg/logo/pp_cc_mark_111x69.jpg" +icon = "https://upload.wikimedia.org/wikipedia/commons/a/a4/Paypal_2014_logo.png" repository = "https://github.com/ballerina-platform/module-ballerinax-paypal.subscriptions" [build-options] From 33e97d0093404d4ac15881255d81ed3e11fc2da6 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Tue, 24 Jun 2025 11:51:55 +0530 Subject: [PATCH 31/56] [Automated] Update the toml files --- ballerina/Ballerina.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 641c60e..96b3abc 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -6,7 +6,7 @@ version = "1.0.0" license = ["Apache-2.0"] authors = ["Ballerina"] keywords = ["paypal", "subscriptions", "plans","billing", "payments", "recurring", "connector",] -icon = "https://upload.wikimedia.org/wikipedia/commons/a/a4/Paypal_2014_logo.png" +icon = "" repository = "https://github.com/ballerina-platform/module-ballerinax-paypal.subscriptions" [build-options] From 2f8ca5b874f980c1c9656fc41906e3a51b94863a Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Tue, 24 Jun 2025 11:55:47 +0530 Subject: [PATCH 32/56] [Automated] Update the toml files --- ballerina/Ballerina.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 96b3abc..b4a77a5 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -6,7 +6,8 @@ version = "1.0.0" license = ["Apache-2.0"] authors = ["Ballerina"] keywords = ["paypal", "subscriptions", "plans","billing", "payments", "recurring", "connector",] -icon = "" +# icon = "icon.png" # TODO: Add icon + repository = "https://github.com/ballerina-platform/module-ballerinax-paypal.subscriptions" [build-options] From 4a8e91d6c16594e85e6e4604b66f4f98f04c9dd2 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Tue, 24 Jun 2025 12:39:00 +0530 Subject: [PATCH 33/56] Refactor authentication configuration to simplify clientId and clientSecret assignment --- ballerina/tests/tests.bal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index 15811a3..2339419 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -32,8 +32,8 @@ string testActivatedSubscriptionPlanId = ""; ConnectionConfig config = { auth: { tokenUrl: "https://api-m.sandbox.paypal.com/v1/oauth2/token", - clientId: clientId, - clientSecret: clientSecret + clientId, + clientSecret } }; From 6f8b5f691e0115c999c8d2e5b4eeb3d46dadeeb7 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Tue, 24 Jun 2025 12:39:20 +0530 Subject: [PATCH 34/56] Refactor PayPal client initialization to streamline connection setup --- ballerina/tests/tests.bal | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index 2339419..6789e51 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -37,20 +37,8 @@ ConnectionConfig config = { } }; -final Client paypal = check initClient(); +final Client paypal = check new Client(config, serviceUrl); -function initClient() returns Client|error { - // Log the service URL and credentials for debugging - io:println("API URL: " + serviceUrl); - //io:println("Client ID: " + clientId); - //io:println("Client Secret: " + clientSecret); - - return new Client(config, serviceUrl); -} - -# # Test cases for PayPal Billing Plans Connectors -# -# Test to list all plans @test:Config { groups: ["live_tests", "mock_tests"], dependsOn: [testCreatePlan] From acef0ce800e3f10625b326961a9a2859db970824 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Tue, 24 Jun 2025 13:56:22 +0530 Subject: [PATCH 35/56] Refactor test cases to remove unnecessary logging and streamline code --- ballerina/tests/tests.bal | 46 +++------------------------------------ 1 file changed, 3 insertions(+), 43 deletions(-) diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index 6789e51..92920fc 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -19,7 +19,6 @@ import ballerina/io; import ballerina/test; import ballerina/time; -// Define configurable variables configurable string serviceUrl = isLiveServer ? "https://api-m.sandbox.paypal.com/v1/billing" : "http://localhost:9090/v1/billing"; configurable string clientId = ?; configurable string clientSecret = ?; @@ -45,23 +44,17 @@ final Client paypal = check new Client(config, serviceUrl); } function testListPlans() returns error? { plan_collection response = check paypal->/plans(); - // io:println("List Plans Response: " + response.toString()); test:assertTrue(response?.plans !is ()); - } -// Function to create a product @test:BeforeSuite function createProduct() returns error? { if !isLiveServer { testProductId = "PRD-TEMP"; return; } - // Generate timestamp for unique ID time:Utc currentTime = time:utcNow(); - int timestamp = currentTime[0]; // This gives you Unix timestamp like 1750142621 - - // Create HTTP client for PayPal API + int timestamp = currentTime[0]; http:Client productClient = check new ("https://api-m.sandbox.paypal.com/v1/catalogs", config = { auth: { tokenUrl: "https://api-m.sandbox.paypal.com/v1/oauth2/token", @@ -70,9 +63,8 @@ function createProduct() returns error? { } }); - // Make API call to create product http:Response response = check productClient->/products.post({ - id: timestamp.toString(), // Convert int to string + id: timestamp.toString(), name: "T-Shirt", "type": "PHYSICAL", description: "Cotton XL", @@ -83,11 +75,9 @@ function createProduct() returns error? { json responseJson = check response.getJsonPayload(); string productId = check responseJson.id; - // io:println("Created Product ID: " + productId); testProductId = productId; } -# Test to create a new plan @test:Config { groups: ["live_tests", "mock_tests"] } @@ -135,12 +125,10 @@ function testCreatePlan() returns error? { } }; plan createdPlan = check paypal->/plans.post(payload); - io:println("Plan created successfully: ", createdPlan.id); test:assertTrue(createdPlan.id is string, "Created plan should have an ID"); testPlanId = createdPlan.id; } -# Test to get a specific plan @test:Config { groups: ["live_tests", "mock_tests"], dependsOn: [testCreatePlan] @@ -148,10 +136,8 @@ function testCreatePlan() returns error? { function testGetPlan() returns error? { plan plan = check paypal->/plans/[testPlanId].get(); test:assertEquals(plan.id, testPlanId, "Retrieved plan ID should match the requested ID"); - //io:println("Retrieved Plan: ", plan.toString()); } -# Test to update a plan @test:Config { groups: ["live_tests", "mock_tests"], dependsOn: [testCreatePlan], @@ -167,14 +153,10 @@ function testUpdatePlan() returns error? { value: "Updated Fresh Clean Tees Plan" } ]; - error? response = check paypal->/plans/[testPlanId].patch(payload); test:assertTrue(response is (), "Response should be empty on successful patch"); - io:println("Plan updated successfully: " + testPlanId); } -# Test to deactivate a plan - @test:Config { groups: ["live_tests", "mock_tests"], dependsOn: [testCreatePlan], @@ -183,10 +165,8 @@ function testUpdatePlan() returns error? { function testDeactivatePlan() returns error? { error? response = check paypal->/plans/[testPlanId]/deactivate.post(); test:assertTrue(response is (), "Response should be empty on successful deactivation"); - io:println("Plan deactivated successfully: " + testPlanId); } -# Test to activate a plan @test:Config { groups: ["live_tests", "mock_tests"], dependsOn: [testCreatePlan, testDeactivatePlan], @@ -195,10 +175,8 @@ function testDeactivatePlan() returns error? { function testActivatePlan() returns error? { error? response = check paypal->/plans/[testPlanId]/activate.post(); test:assertTrue(response is (), "Response should be empty on successful activation"); - io:println("Plan activated successfully: " + testPlanId); } -# Test to update pricing schemes @test:Config { groups: ["live_tests", "mock_tests"], dependsOn: [testCreatePlan, testGetPlan], @@ -229,12 +207,8 @@ function testUpdatePricingSchemes() returns error? { }; error? response = check paypal->/plans/[testPlanId]/update\-pricing\-schemes.post(payload); test:assertTrue(response is (), "Response should be empty on successful update of pricing schemes"); - io:println("Pricing schemes updated successfully for plan: " + testPlanId); } -# # Test cases for PayPal Billing Subscription Connectors -# -# Test to create a new subscription @test:Config { groups: ["live_tests", "mock_tests"], dependsOn: [testActivatePlan] @@ -284,10 +258,8 @@ function testCreateSubscription() returns error? { subscription response = check paypal->/subscriptions.post(payload); test:assertTrue(response.id is string, "Created subscription should have an ID"); testSubscriptionId = response.id; - io:println("Subscription created successfully: ", response.id); } -# Test to get a specific subscription @test:Config { groups: ["live_tests", "mock_tests"] } @@ -297,12 +269,9 @@ function testGetSubscription() returns error? { }; subscription response = check paypal->/subscriptions/[testSubscriptionId].get(queries = queries); test:assertEquals(response.id, testSubscriptionId, "Retrieved subscription ID should match the requested ID"); - io:println("Retrieved Subscription: ", response.toString()); - testActivatedSubscriptionPlanId = response.plan_id; - + testActivatedSubscriptionPlanId = check response.plan_id.ensureType(string); } -# Test to update a subscription @test:Config { groups: ["mock_tests", "live_active_subscription_tests"], after: testGetSubscription @@ -329,11 +298,9 @@ function testUpdateSubscription() returns error? { ]; error? response = check paypal->/subscriptions/[testActivatedSubscriptionId].patch(payload); test:assertTrue(response is (), "Response should be empty on successful patch"); - io:println("Subscription updated successfully: " + testActivatedSubscriptionId); testSubscriptionId = testActivatedSubscriptionId; } -# Test to revise a subscription @test:Config { groups: ["mock_tests", "live_active_subscription_tests"], dependsOn: [testUpdateSubscription], @@ -353,12 +320,10 @@ function testReviseSubscription() returns error? { io:println("Error revising subscription: ", response.message()); return response; } - io:println("Subscription revised successfully: " + testActivatedSubscriptionId); test:assertTrue(response.plan_id is string, "Revised subscription should have a plan ID"); testSubscriptionId = testActivatedSubscriptionId; } -# Test to suspend a subscription @test:Config { groups: ["mock_tests", "live_active_subscription_tests"], dependsOn: [testReviseSubscription], @@ -370,10 +335,8 @@ function testSuspendSubscription() returns error? { }; error? response = check paypal->/subscriptions/[testActivatedSubscriptionId]/suspend.post(payload); test:assertTrue(response is (), "Response should be empty on successful suspension"); - io:println("Subscription suspended successfully: " + testActivatedSubscriptionId); } -# Test to activate a subscription @test:Config { groups: ["mock_tests", "live_active_subscription_tests"], dependsOn: [testSuspendSubscription], @@ -385,10 +348,8 @@ function testActivateSubscription() returns error? { }; error? response = check paypal->/subscriptions/[testActivatedSubscriptionId]/activate.post(payload); test:assertTrue(response is (), "Response should be empty on successful activation"); - io:println("Subscription activated successfully: " + testActivatedSubscriptionId); } -# Test to cancel a subscription @test:Config { groups: ["mock_tests", "live_active_subscription_tests"], dependsOn: [testActivateSubscription], @@ -400,5 +361,4 @@ function testCancelSubscription() returns error? { }; error? response = check paypal->/subscriptions/[testActivatedSubscriptionId]/cancel.post(payload); test:assertTrue(response is (), "Response should be empty on successful cancellation"); - io:println("Subscription cancelled successfully: " + testActivatedSubscriptionId); } From 7b9f8b0b8b418d9997fc89d8726944bfbd8d2f2d Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Tue, 24 Jun 2025 13:56:41 +0530 Subject: [PATCH 36/56] Update ballerinaGradlePluginVersion to 2.3.0 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index e0fa520..31465cb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,5 +3,5 @@ group=io.ballerina.lib version=1.0.0-SNAPSHOT releasePluginVersion=2.8.0 -ballerinaGradlePluginVersion=2.2.4 +ballerinaGradlePluginVersion=2.3.0 ballerinaLangVersion=2201.12.0 From d721d696c78a698377096f9a34f32c0470a45674 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Tue, 24 Jun 2025 13:57:49 +0530 Subject: [PATCH 37/56] [Automated] Update the toml files --- ballerina/Ballerina.toml | 2 +- ballerina/Dependencies.toml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index b4a77a5..d6ce09e 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -6,7 +6,7 @@ version = "1.0.0" license = ["Apache-2.0"] authors = ["Ballerina"] keywords = ["paypal", "subscriptions", "plans","billing", "payments", "recurring", "connector",] -# icon = "icon.png" # TODO: Add icon +icon = "icon.png" repository = "https://github.com/ballerina-platform/module-ballerinax-paypal.subscriptions" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 8e86944..d64a0ba 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -5,7 +5,7 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.12.7" +distribution-version = "2201.12.0" [[package]] org = "ballerina" @@ -76,7 +76,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.14.1" +version = "2.14.2" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "cache"}, From 775198ee6f04182b75742fb65d9a3b140137074d Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Tue, 24 Jun 2025 13:59:54 +0530 Subject: [PATCH 38/56] Add keywords and icon to Ballerina.toml --- build-config/resources/Ballerina.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build-config/resources/Ballerina.toml b/build-config/resources/Ballerina.toml index 4d8e3e2..afddfe0 100644 --- a/build-config/resources/Ballerina.toml +++ b/build-config/resources/Ballerina.toml @@ -5,8 +5,9 @@ name = "paypal.subscriptions" version = "@toml.version@" license = ["Apache-2.0"] authors = ["Ballerina"] -keywords = [] # TODO: Add keywords -# icon = "icon.png" # TODO: Add icon +keywords = ["paypal", "subscriptions", "plans","billing", "payments", "recurring", "connector",] +icon = "icon.png" + repository = "https://github.com/ballerina-platform/module-ballerinax-paypal.subscriptions" [build-options] From 72f5c1aa1dca5c0fd9d444e23d768fce30cad78c Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Tue, 24 Jun 2025 14:00:03 +0530 Subject: [PATCH 39/56] Add icon image for Ballerina project --- ballerina/icon.png | Bin 0 -> 5062 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ballerina/icon.png diff --git a/ballerina/icon.png b/ballerina/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..224668cc59e48ef38048914d739053220a44d504 GIT binary patch literal 5062 zcmX|FXH-+$)=hx~sgWYZBm@XWB1jhqNP-~YDn+D;AVq}Gn{<%Ss}QAJq)1heDvIri_%nH?tSn3ew?$%IAfl<=GuF$z1H6GhWa{e%mT~+0Dw)Gpk+iKDgQi7 z5c<2)yy_W!0Qwl|XacG}!&dCcjFm~(Eg3r;gKr$eYff`?)OO}-8B%5} zlVe^Ib4m0XO--re>+P+iNOd;@1Ah~Ls)~tYTXp;9YSkT+<*@$h&#fh!l^BNTcFFP- zLu%`<4}&;azcWKYCZ(nprAsWDio8ri0mc$bQiat=if5}UIlD?8lo+;#BtPVd8?ur# z<~lTa4Z&(p1nG8D12vy|z2%cx=59CXT$Gi}7pRwmi+1h2XGyR_o-1==8EP^xz738h zx$~80_rEk|{F>HDN&}J&v~0`qr7xScr&q<(Eks+?#Te&?ogu}XB>32}P(fy*cFWIl zxQUF)!MWO8w+PSYZ$TptMTWOVc{tFaavbVz_fH2U$i@KQdz)|Ri3?Ko*VqcOF8iDo zm!l*eSO)HuU(YEl&*hxmnP2)+SiiHVIn>k6SV^+0w80s6zP{S+a>BR)328~@Hl(tG zBbZ@h##j{hUR82gQai_A;fHBO(auOa+yHQJIPWP}8fM#T_dZFM?V(*bo<9l=Zq98&8prp_|8-B}CN4`Doll?9#$Ybr(5f)LjyjdgkBf3^i? zNp+S!2G`ncaypke)*>2>hB3XW$tV?eotpPAGy6?GXcx9x4^8xuq5!Znz84i0#y?xS zuPuW6CGJWc3dZSg_s%I5Ve-4#*_d)UQN+MkK}r7oK9cW;ZTtUG*U*frSD1oi6N z?+By&2odf*JqS9DL^5=)-d+=?Nl%y5{Z)ER9?WTk``Q#u^Yd&UF7K6z5vlO39evwZ zov78^VmJAj6eR$gar|?P&w*a3>;Dxcn^;oZw$`UzXl43#*qh-@FoSGfa$V|4&9f0u zJdQ!udT(BsCiSi99N`dwPNKdra!cs{e%4Coz*!~zE$+AojNv5O*>K^xC=tn?A9IrQQX4&6~oCMo4^htlhWYwCJ3eZv@hO zA5>@b8Qr3R2gAhTRy(Sd*#68LpxlGs@?^2_rUO{3Bh6LC${Lx~QCE58;clJ_!R@E& zu*+^xuOk-J@emInMo?xM2wU@C0XD8XvJ$Sy?1mn61f$xHTKemmw_OxAbDaNg+)3Bf&?H-sb9 zb~zx$1SaPDCy?Rhs!ae|e)}X#A?e}=9pToq(f9=Gr~RI3K=w1A88uw4Tm-%kq8=|f z94-^&4F?Vz-U@^=G`gyQjl^)$zeQ`c$QNnbM8%KV&78er=XjZjY_t3OR3Y9$8yE;yw&?t8R#2nK_hbLL{U4b4+%z#XGxQr{9M%aDJP4whbCorTXy(;d(tBa3LV?TA)lp%`egldyDlO^@^9)l3!dsjy(Rc zXp;Ext4jZuni08eOXVWMrxpgfUjBV=6`aJ4H|Z%acV^+1=WMzy>KnVg%mj5})bz@dfAX}|Sd=wF zLb+TTEam8R9a+k7g5u6ONREa8-BuNQZ!haklieoaJkr)NlTtQpo=9$WD^ycS2cr4qqp;xC)(*44qWAJwsG$1zjIKgQ{JzjlYBNoT{AM{KU;za- znq!=cx;vi>3XE-Kf#t6Pn8NW1 zW>t2$zZe#N@kVU<+js5ImJzk$#yur)DQ=g`$4tT_^B5Ywu;us5`}*y7m?g@Vr$&h06=(kA;JLh7X z&N@F)e^j|BHcH}Y_+=*$XLbU;*S+!6>sU+LF7&K0`k1z)KU$Xhf)^)Ce_< zCfGR|kFejo7ib+S;+IZ71K;7z)oWFYtz#7m$aw?JIYBYMX(c!$+EIp(Jz z<$6vwR$c^XXz&1M!(}HD!AI@ja*b zI&8$XArFb-9tPbkx=g59=Bf(*eJv~Wk*maOjS+=+irm0X4Z_a5ylWysH+=9{IMawR zWnC{!&Z8CCOZNfs*_R4E?5zH1t^gmij9J!XJk%&+i&5LcI!RX)Wd+l~My*0=qzBnc zn$^)%s_i2_6>U9`4c`55wE#L3Z^ zbobv8!S9`Udp$(u$LrK&7SyuM`a9abJI+c3ktBLk=!p=XGM|Y2VyWyLvxYQ-dd|V? z8xMqek1v7!DgD`#E@5o$3*i(X+Ub^6vXuKD5EfPPFtn#&=gy=9YxNnnnc?EAxlUyS zhL>J846Q3d{pR!uy4gB!=H6N7_IW6wUK_d{?El14u-LcJai71UGsPYINk8TDYGSg2 zg}@Rm38|G4+_t-F1;;b#=vJP&Mq`N5gkap?jSfKvG?GXnma%8up?b;|$AZ1Bqu7-` zw%eY{w79J^;jCJ*xLTJWC#4B(KA4ZJA5Oo`fnSHCkcy#(bM$`m^=ojziY| zjy-g?nivu&(ARju5}V^t&e!}3>^;Td_SxoU5=v>kSr**70`gv3pW@C4MqUYq>cFx{ zpYmB^)qI}+v|FcLeKt*b9z5=Q3{w(0{N)W8hL7e2L?0*A$_;!WJBAN7QX;^+r3vkjeo|QZHB(NC! z2>RjX{M~1S#L@sxpm$D_t`+^c2Ttprl)dKdn!g+4wV`AU{ZZyTs-JvQ-q6!l34r%v z;pHP~RUl3Q%04pc3A93a_gm^tk`QF~-)lCX61Tj#5&@_n$V2j)UG1s(Ho9j%<|0wQ zIGZ1~P8!`tyYcPjhE8bGLphE1k&k`BlgLjbC>XX2WpcoV#-m!}>07JUH2f=kH1HNg zpSpavwmp^qVvm*v!D}EzZUWzT9`EO(v|qrcspDv1pS2;Ha{4&iTp1X6{d(6x@iS|W(Z-l9qiFY^QpJmsMm5iH8O>h^moMvdf3tM6FNZ8QmZDE{gk zr9)7`lc5tpfSilDw-Quy_~9+i_)8BG-}dv+1&(hzNA~AZny{?66YYokGV1!>;s1dK-T1I7K5$ z>3f}sfQTC=UXEVVS~<%bBA+qFIdn}g5G*FceRa=gpb?p6&xH!^+hn#OuiVo0kDqGe zak>1HNz&@YD8>0repLag%d-YUNNr<%Of0e8rhJy6T(D1dbZgjc~cL znIKfr+ChNq{0$33AgaBq^WA@YBYq2<7&H>$|BIkUHBByct5UdXSkl zZ!q^As>jwhtV08WVN1nWS+$(z^Tg?4!NL3F<;&iyclYnTs#Qp0Z#q5b^zm-Yk%d*H(nX>l1sjnMjIod5yiNW11|*6>30f6lx0U>G`y)qZv7%S#feWB zK;~7??A100o-z}aCQ=YEYK+q#sYUfyASCyIn|U09EO5T;{}3zet~wk95zF;yqbV@P zun^=;WmdV)fkkm4N+oFuQ#m|zE8dvynl5_K@fy7OVLj3U<)9NM2?Hn|YX7rCZ(QD^ zBf_o+a#WC@jQgx#i&9Wd4c{W2ETicEla_D-Sk&&d7yklq@ywLu>dg*~S713?Opa-x zQ;P~_#v1rkwTC@+v%@;z$o|xq8oZs4`zV}7iEUWpCvMva@Y*u|!jK7F^f03*gwOx` zBPVkni_$&6x%)pzKK9iaEGnmS*Sfz2n!-%)u@ezwd&nG;I&W7&@@H(LF`Y&r*j3`5 z$eT~CWnMov#J!ni29aF%Y=wF6Gqzyzzsb-EvcQQgcPOH_fr8BRV;Of4&b47WHr_Ig zXS<5D*#TK6q2UeV&C!-mc(x1ZAAswml}Db*99)eOm>E4_>)AGXq@MBQ3i+HJZJ9vF zbm%!XF#kha_g{<^a584g7OGWm`^cZA5sjI-3Y-iVuK_>tobeJA^S)`?(F{WO+Nk6Q z*ORZm1|fNfflq=Ve)m#Px=`sKL}A{0bgAS~NN7!$Q2!+wKs>1a$-g+19AwSlzs_nf zDnK{IV0fj&H&3p=p>qt#Z!-kp25kZrQW9%Gf4Bz_=8q6C6|x~Z#nSW`#JZGKylRxJZ{bCNFtF5n9rD+rKA1+fx A_W%F@ literal 0 HcmV?d00001 From 6a4d7e2d1efda09ac4e9c324e328f9b5fd04715d Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Tue, 24 Jun 2025 14:03:13 +0530 Subject: [PATCH 40/56] Fix syntax errors and streamline test dependencies in subscription tests --- ballerina/tests/tests.bal | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index 92920fc..8490433 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -66,7 +66,7 @@ function createProduct() returns error? { http:Response response = check productClient->/products.post({ id: timestamp.toString(), name: "T-Shirt", - "type": "PHYSICAL", + 'type: "PHYSICAL", description: "Cotton XL", category: "CLOTHING", image_url: string `https://example.com/gallery/images/${timestamp}.jpg`, @@ -140,13 +140,10 @@ function testGetPlan() returns error? { @test:Config { groups: ["live_tests", "mock_tests"], - dependsOn: [testCreatePlan], - after: testGetPlan - + dependsOn: [testCreatePlan] } function testUpdatePlan() returns error? { - patch_request payload = - [ + patch_request payload = [ { op: "replace", path: "/name", @@ -159,8 +156,7 @@ function testUpdatePlan() returns error? { @test:Config { groups: ["live_tests", "mock_tests"], - dependsOn: [testCreatePlan], - after: testGetPlan + dependsOn: [testCreatePlan] } function testDeactivatePlan() returns error? { error? response = check paypal->/plans/[testPlanId]/deactivate.post(); @@ -169,8 +165,7 @@ function testDeactivatePlan() returns error? { @test:Config { groups: ["live_tests", "mock_tests"], - dependsOn: [testCreatePlan, testDeactivatePlan], - after: testGetPlan + dependsOn: [testCreatePlan, testDeactivatePlan] } function testActivatePlan() returns error? { error? response = check paypal->/plans/[testPlanId]/activate.post(); @@ -179,8 +174,7 @@ function testActivatePlan() returns error? { @test:Config { groups: ["live_tests", "mock_tests"], - dependsOn: [testCreatePlan, testGetPlan], - after: testGetPlan + dependsOn: [testCreatePlan, testGetPlan] } function testUpdatePricingSchemes() returns error? { update_pricing_schemes_list_request payload = { From 4755d353558803c597252e469c79545456ff752f Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Tue, 24 Jun 2025 14:03:58 +0530 Subject: [PATCH 41/56] Refactor client configuration and ensure type safety --- ballerina/tests/tests.bal | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index 8490433..f31cbbd 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -58,8 +58,8 @@ function createProduct() returns error? { http:Client productClient = check new ("https://api-m.sandbox.paypal.com/v1/catalogs", config = { auth: { tokenUrl: "https://api-m.sandbox.paypal.com/v1/oauth2/token", - clientId: clientId, - clientSecret: clientSecret + clientId, + clientSecret } }); @@ -126,7 +126,7 @@ function testCreatePlan() returns error? { }; plan createdPlan = check paypal->/plans.post(payload); test:assertTrue(createdPlan.id is string, "Created plan should have an ID"); - testPlanId = createdPlan.id; + testPlanId = check createdPlan.id.ensureType(string); } @test:Config { @@ -251,7 +251,7 @@ function testCreateSubscription() returns error? { }; subscription response = check paypal->/subscriptions.post(payload); test:assertTrue(response.id is string, "Created subscription should have an ID"); - testSubscriptionId = response.id; + testSubscriptionId = check response.id.ensureType(string); } @test:Config { From a2a73766d54ff92cdce273d15b75898c2df3b768 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Tue, 24 Jun 2025 14:08:59 +0530 Subject: [PATCH 42/56] Refactor sanitation steps to clarify API path updates and server URL changes --- docs/spec/sanitations.md | 56 +++++++--------------------------------- 1 file changed, 10 insertions(+), 46 deletions(-) diff --git a/docs/spec/sanitations.md b/docs/spec/sanitations.md index 70d35d0..a637605 100644 --- a/docs/spec/sanitations.md +++ b/docs/spec/sanitations.md @@ -11,55 +11,19 @@ This document records the sanitation done on top of the official OpenAPI specifi Following the latest Ballerina connector guidelines, apply these changes **after flattening the OpenAPI specification and without aligning the spec**: -### 1. Update `servers` URLs to include `/v1/billing` +### 1. Change the `url` property of the servers object -**Before:** -```json -"servers" : [ { - "url" : "https://api-m.sandbox.paypal.com", - "description" : "PayPal Sandbox Environment" - }, { - "url" : "https://api-m.paypal.com", - "description" : "PayPal Live Environment" - } ], -``` - -**After:** -```json -"servers" : [ { - "url" : "https://api-m.sandbox.paypal.com/v1/billing", - "description" : "PayPal Sandbox Environment" - }, { - "url" : "https://api-m.paypal.com/v1/billing", - "description" : "PayPal Live Environment" - } ], -``` +- **Original:** `https://api-m.sandbox.paypal.com` +- **Updated:** `https://api-m.sandbox.paypal.com/v1/billing` +- **Reason:** This change ensures that all API paths are relative to the versioned base URL (`/v1/billing`), which improves the consistency and usability of the APIs. -### 2. Remove `/v1/billing` from all path keys +### 2. Update API Paths -**Before:** -```json -"paths" : { - "/v1/billing/plans" : { - // ...existing code... - }, - "/v1/billing/subscriptions" : { - // ...existing code... - } -} -``` - -**After:** -```json -"paths" : { - "/plans" : { - // ...existing code... - }, - "/subscriptions" : { - // ...existing code... - } -} -``` +- **Original:** Paths included the version prefix in each endpoint (e.g., `/v1/billing/plans`). +- **Updated:** Paths are modified to remove the version prefix from the endpoints, as it is now included in the base URL. For example: + - **Original:** `/v1/billing/plans` + - **Updated:** `/plans` +- **Reason:** This modification simplifies the API paths, making them shorter and more readable. It also centralizes the versioning to the base URL, which is a common best practice. ## OpenAPI cli command From 7abb3581222b827f99834ae595b64ca47f8220ce Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Tue, 24 Jun 2025 14:09:33 +0530 Subject: [PATCH 43/56] Add README for running tests in PayPal Subscriptions connector --- ballerina/tests/README.md | 120 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 ballerina/tests/README.md diff --git a/ballerina/tests/README.md b/ballerina/tests/README.md new file mode 100644 index 0000000..8befc62 --- /dev/null +++ b/ballerina/tests/README.md @@ -0,0 +1,120 @@ +# Running Tests + +## Prerequisites + +To run the tests for this PayPal Subscriptions Ballerina connector, you need: +- A PayPal developer account with sandbox credentials (Client ID and Client Secret). +- (Optional) An activated subscription ID for certain live tests. + +For more information on obtaining credentials, refer to the [PayPal Developer Documentation](https://developer.paypal.com/api/rest/). + +--- + +## Test Environments + +There are two test environments for running the PayPal Subscriptions connector tests: + +| Test Group | Environment | +| ------------ | --------------------------------------------------- | +| `mock_tests` | Mock server for PayPal Subscriptions API (Default) | +| `live_tests` | PayPal Sandbox API | +| `live_active_subscription_tests`| PayPal Sandbox API (requires active subscription ID) | + +You can run tests in either environment. Each group has its own compatible set of tests. + +--- + +## Running Tests in the Mock Server + +To execute tests on the mock server, ensure that the `isLiveServer` configuration is set to `false` or is unset. + +You can configure this variable in the `Config.toml` file in the `tests` directory or set it as an environment variable. + +### Using a `Config.toml` file + +Create a `Config.toml` file in the `tests` directory with the following content: + +```toml +isLiveServer = false +clientId = "DUMMY_CLIENT_ID" +clientSecret = "DUMMY_CLIENT_SECRET" +``` + +### Using Environment Variables + +### Linux or macOS + +```bash +export IS_LIVE_SERVER=false +export CLIENT_ID="DUMMY_CLIENT_ID" +export CLIENT_SECRET="DUMMY_CLIENT_SECRET" +``` + +#### Windows + +```bash +setx IS_LIVE_SERVER false +setx CLIENT_ID DUMMY_CLIENT_ID +setx CLIENT_SECRET DUMMY_CLIENT_SECRET +``` +--- + +## Running Tests Against PayPal Sandbox API + +### Using a `Config.toml` file + +Create a `Config.toml` file in the `tests` directory and add your PayPal sandbox credentials: + +```toml +isLiveServer = true +clientId = "" +clientSecret = "" +# Optional: For some tests, you may need an activated subscription ID +testActivatedSubscriptionId = "" +``` + +Then, run the following command to run the tests: + +```bash +./gradlew clean test +``` + +### Using Environment Variables + +#### Linux or macOS + +```bash +export IS_LIVE_SERVER=true +export CLIENT_ID="" +export CLIENT_SECRET="" +export TEST_ACTIVATED_SUBSCRIPTION_ID="" +``` + +#### Windows + +```bash +setx IS_LIVE_SERVER true +setx CLIENT_ID +setx CLIENT_SECRET +setx TEST_ACTIVATED_SUBSCRIPTION_ID +``` + +Then, run the following command to run the tests: + +```bash +./gradlew clean test +``` + +## Running Specific Groups or Test Cases + +To run only certain test groups or individual test cases, pass the -Pgroups property: + +```bash +./gradlew clean test -Pgroups= +``` + +For example, to run only the mock tests: + +```bash +./gradlew clean test -Pgroups=mock_tests +``` \ No newline at end of file From fb44c5bac8c8e35a24602fd616180b3fdc7ab102 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Tue, 24 Jun 2025 14:20:10 +0530 Subject: [PATCH 44/56] Simplify response handling in testSuspendSubscription by removing error check --- ballerina/tests/tests.bal | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index f31cbbd..65cd2f7 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -327,8 +327,7 @@ function testSuspendSubscription() returns error? { subscription_suspend_request payload = { reason: "Item out of stock" }; - error? response = check paypal->/subscriptions/[testActivatedSubscriptionId]/suspend.post(payload); - test:assertTrue(response is (), "Response should be empty on successful suspension"); + check paypal->/subscriptions/[testActivatedSubscriptionId]/suspend.post(payload); } @test:Config { From ecdb98edfe13240f95d48ab78b148efc394e3633 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 25 Jun 2025 12:06:36 +0530 Subject: [PATCH 45/56] Update OpenAPI specification with new sanitization steps --- docs/spec/openapi.json | 4456 +++++++++++++++++++++------------------- 1 file changed, 2347 insertions(+), 2109 deletions(-) diff --git a/docs/spec/openapi.json b/docs/spec/openapi.json index c2d82d6..4c62f10 100644 --- a/docs/spec/openapi.json +++ b/docs/spec/openapi.json @@ -45,11 +45,11 @@ } ], "responses" : { "200" : { - "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that lists billing plans.", + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that lists billing plans", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/plan_collection" + "$ref" : "#/components/schemas/PlanCollection" } } } @@ -89,7 +89,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/error_404" + "$ref" : "#/components/schemas/Error404" } } } @@ -99,7 +99,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/error_500" + "$ref" : "#/components/schemas/Error500" } } } @@ -126,7 +126,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/plan_request_POST" + "$ref" : "#/components/schemas/PlanRequestPOST" }, "examples" : { "plan_request_post" : { @@ -199,11 +199,11 @@ }, "responses" : { "200" : { - "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows billing plan details.", + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows billing plan details", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/plan" + "$ref" : "#/components/schemas/Plan" }, "examples" : { "plan" : { @@ -308,7 +308,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/plan" + "$ref" : "#/components/schemas/Plan" } } } @@ -358,7 +358,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/error_500" + "$ref" : "#/components/schemas/Error500" } } } @@ -383,11 +383,11 @@ } ], "responses" : { "200" : { - "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows plan details.", + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows plan details", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/plan" + "$ref" : "#/components/schemas/Plan" } } } @@ -427,7 +427,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/error_500" + "$ref" : "#/components/schemas/Error500" } } } @@ -453,7 +453,7 @@ }, "responses" : { "204" : { - "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body." + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" }, "400" : { "description" : "Request is not well-formed, syntactically incorrect, or violates schema.", @@ -510,7 +510,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/error_500" + "$ref" : "#/components/schemas/Error500" } } } @@ -535,7 +535,7 @@ } ], "responses" : { "204" : { - "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body." + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" }, "401" : { "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", @@ -582,7 +582,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/error_500" + "$ref" : "#/components/schemas/Error500" } } } @@ -607,7 +607,7 @@ } ], "responses" : { "204" : { - "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body." + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" }, "401" : { "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", @@ -654,7 +654,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/error_500" + "$ref" : "#/components/schemas/Error500" } } } @@ -681,7 +681,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/update_pricing_schemes_list_request" + "$ref" : "#/components/schemas/UpdatePricingSchemesListRequest" }, "examples" : { "update_pricing_schemes_list_request" : { @@ -726,7 +726,7 @@ }, "responses" : { "204" : { - "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body." + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" }, "400" : { "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", @@ -783,7 +783,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/error_500" + "$ref" : "#/components/schemas/Error500" } } } @@ -812,7 +812,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/subscription_request_post" + "$ref" : "#/components/schemas/SubscriptionRequestPost" }, "examples" : { "subscription_request_post" : { @@ -864,11 +864,11 @@ }, "responses" : { "200" : { - "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details.", + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/subscription" + "$ref" : "#/components/schemas/Subscription" }, "examples" : { "subscription" : { @@ -930,7 +930,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/subscription" + "$ref" : "#/components/schemas/Subscription" }, "examples" : { "subscription" : { @@ -1032,7 +1032,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/error_500" + "$ref" : "#/components/schemas/Error500" } } } @@ -1059,11 +1059,11 @@ } ], "responses" : { "200" : { - "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details.", + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/subscription" + "$ref" : "#/components/schemas/Subscription" } } } @@ -1103,7 +1103,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/error_500" + "$ref" : "#/components/schemas/Error500" } } } @@ -1129,7 +1129,7 @@ }, "responses" : { "204" : { - "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body." + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" }, "400" : { "description" : "Request is not well-formed, syntactically incorrect, or violates schema.", @@ -1186,7 +1186,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/error_500" + "$ref" : "#/components/schemas/Error500" } } } @@ -1213,7 +1213,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/subscription_revise_request" + "$ref" : "#/components/schemas/SubscriptionReviseRequest" }, "examples" : { "subscription_revise_request" : { @@ -1255,11 +1255,11 @@ }, "responses" : { "200" : { - "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details.", + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/subscription_revise_response" + "$ref" : "#/components/schemas/SubscriptionReviseResponse" }, "examples" : { "subscription_revise_response" : { @@ -1369,7 +1369,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/error_500" + "$ref" : "#/components/schemas/Error500" } } } @@ -1396,7 +1396,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/subscription_suspend_request" + "$ref" : "#/components/schemas/SubscriptionSuspendRequest" }, "examples" : { "subscription_suspend_request" : { @@ -1410,7 +1410,7 @@ }, "responses" : { "204" : { - "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body." + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" }, "400" : { "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", @@ -1467,7 +1467,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/error_500" + "$ref" : "#/components/schemas/Error500" } } } @@ -1494,7 +1494,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/subscription_cancel_request" + "$ref" : "#/components/schemas/SubscriptionCancelRequest" }, "examples" : { "subscription_cancel_request" : { @@ -1508,7 +1508,7 @@ }, "responses" : { "204" : { - "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body." + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" }, "400" : { "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", @@ -1565,7 +1565,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/error_500" + "$ref" : "#/components/schemas/Error500" } } } @@ -1592,7 +1592,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/subscription_activate_request" + "$ref" : "#/components/schemas/SubscriptionActivateRequest" }, "examples" : { "subscription_activate_request" : { @@ -1606,7 +1606,7 @@ }, "responses" : { "204" : { - "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body." + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" }, "400" : { "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", @@ -1663,7 +1663,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/error_500" + "$ref" : "#/components/schemas/Error500" } } } @@ -1692,7 +1692,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/subscription_capture_request" + "$ref" : "#/components/schemas/SubscriptionCaptureRequest" }, "examples" : { "subscription_capture_request" : { @@ -1711,11 +1711,11 @@ }, "responses" : { "200" : { - "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details.", + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/transaction" + "$ref" : "#/components/schemas/Transaction" } } } @@ -1778,7 +1778,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/error_500" + "$ref" : "#/components/schemas/Error500" } } } @@ -1807,11 +1807,11 @@ } ], "responses" : { "200" : { - "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details.", + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/transactions_list" + "$ref" : "#/components/schemas/TransactionsList" } } } @@ -1861,7 +1861,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/error_500" + "$ref" : "#/components/schemas/Error500" } } } @@ -1885,105 +1885,39 @@ "$ref" : "#/components/schemas/SUBSCRIPTIONSTATUSINVALID1" } ] }, - "error_link_description" : { - "title" : "Link Description", - "required" : [ "href", "rel" ], - "type" : "object", - "properties" : { - "href" : { - "maxLength" : 20000, - "minLength" : 0, - "pattern" : "^.*$", - "type" : "string", - "description" : "The complete target URL. To make the related call, combine the method with this [URI Template-formatted](https://tools.ietf.org/html/rfc6570) link. For pre-processing, include the `$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call." - }, - "rel" : { - "maxLength" : 100, - "minLength" : 0, - "pattern" : "^.*$", - "type" : "string", - "description" : "The [link relation type](https://tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](https://www.iana.org/assignments/link-relations/link-relations.xhtml)." - }, - "method" : { - "maxLength" : 6, - "minLength" : 3, - "pattern" : "^[A-Z]*$", - "type" : "string", - "description" : "The HTTP method required to make the related call.", - "enum" : [ "GET", "POST", "PUT", "DELETE", "PATCH" ] - } - }, - "description" : "The request-related [HATEOAS link](/api/rest/responses/#hateoas-links) information." - }, - "subscriptions.create-400" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionscreate400Details" - } - } - } - }, - "card_response_with_billing_address" : { - "title" : "Card Response with billing address and name", - "type" : "object", - "description" : "The payment card used to fund the payment. Card can be a credit or debit card.", - "allOf" : [ { - "$ref" : "#/components/schemas/card_response" - }, { - "$ref" : "#/components/schemas/CardResponseWithBillingAddressAllOf2" - } ] + "ErrorLocation" : { + "type" : "string", + "description" : "The location of the field that caused the error. Value is `body`, `path`, or `query`", + "default" : "body", + "enum" : [ "body", "path", "query" ] }, - "card_response" : { - "title" : "Card Response", + "UpdatePricingSchemeRequest" : { + "title" : "Update Pricing Scheme", + "required" : [ "billing_cycle_sequence", "pricing_scheme" ], "type" : "object", "properties" : { - "last_digits" : { - "pattern" : "[0-9]{2,}", - "type" : "string", - "description" : "The last digits of the payment card.", - "readOnly" : true - }, - "brand" : { - "$ref" : "#/components/schemas/card_brand" - }, - "type" : { - "type" : "string", - "description" : "The payment card type.", - "readOnly" : true, - "enum" : [ "CREDIT", "DEBIT", "PREPAID", "UNKNOWN" ] + "billing_cycle_sequence" : { + "maximum" : 99, + "minimum" : 1, + "type" : "integer", + "description" : "The billing cycle sequence", + "x-ballerina-name-ignore" : "billingCycleSequence" }, - "authentication_result" : { - "$ref" : "#/components/schemas/authentication_response" + "pricing_scheme" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PricingScheme" + } ], + "x-ballerina-name-ignore" : "pricingScheme" } }, - "description" : "The payment card to use to fund a payment. Card can be a credit or debit card." + "description" : "The update pricing scheme request details" }, - "patch" : { - "title" : "Patch", - "required" : [ "op" ], - "type" : "object", - "properties" : { - "op" : { - "type" : "string", - "description" : "The operation.", - "enum" : [ "add", "remove", "replace", "move", "copy", "test" ] - }, - "path" : { - "type" : "string", - "description" : "The JSON Pointer to the target document location at which to complete the operation." - }, - "value" : { - "title" : "Patch Value", - "description" : "The value to apply. The remove operation does not require a value." - }, - "from" : { - "type" : "string", - "description" : "The JSON Pointer to the target document location from which to move the value. Required for the move operation." - } - }, - "description" : "The JSON patch object to apply partial updates to resources." + "CurrencyCode" : { + "maxLength" : 3, + "minLength" : 3, + "type" : "string", + "description" : "The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency", + "format" : "ppaas_common_currency_code_v2" }, "Planscreate400Details" : { "anyOf" : [ { @@ -2002,6 +1936,26 @@ "$ref" : "#/components/schemas/INVALIDINTEGERMAXVALUE" } ] }, + "PhoneWithType" : { + "title" : "Phone With Type", + "required" : [ "phone_number" ], + "type" : "object", + "properties" : { + "phone_type" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PhoneType" + } ], + "x-ballerina-name-ignore" : "phoneType" + }, + "phone_number" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Phone" + } ], + "x-ballerina-name-ignore" : "phoneNumber" + } + }, + "description" : "The phone information" + }, "Subscriptionspatch400Details" : { "anyOf" : [ { "$ref" : "#/components/schemas/UNSUPPORTEDPATCHOPERATION1" @@ -2036,55 +1990,89 @@ "$ref" : "#/components/schemas/MISSINGREQUIREDPARAMETER6" } ] }, - "SubscriberAllOf2" : { - "properties" : { - "shipping_address" : { - "$ref" : "#/components/schemas/shipping_detail" - }, - "payment_source" : { - "$ref" : "#/components/schemas/payment_source_response" - } - } - }, - "pricing_scheme" : { + "PricingScheme" : { "title" : "Pricing Scheme", "type" : "object", "properties" : { - "version" : { - "maximum" : 999, - "minimum" : 0, - "type" : "integer", - "description" : "The version of the pricing scheme.", - "readOnly" : true + "tiers" : { + "maxItems" : 32, + "minItems" : 1, + "type" : "array", + "description" : "An array of pricing tiers which are used for billing volume/tiered plans. pricing_model field has to be specified", + "items" : { + "$ref" : "#/components/schemas/PricingTier" + } }, - "fixed_price" : { - "$ref" : "#/components/schemas/money" + "update_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name-ignore" : "updateTime" + }, + "create_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name-ignore" : "createTime" }, "pricing_model" : { "maxLength" : 24, "minLength" : 1, "pattern" : "^[A-Z_]+$", "type" : "string", - "description" : "The pricing model for tiered plan. The `tiers` parameter is required.", - "enum" : [ "VOLUME", "TIERED" ] + "description" : "The pricing model for tiered plan. The `tiers` parameter is required", + "enum" : [ "VOLUME", "TIERED" ], + "x-ballerina-name-ignore" : "pricingModel" }, - "tiers" : { - "maxItems" : 32, - "minItems" : 1, + "fixed_price" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "fixedPrice" + }, + "version" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The version of the pricing scheme", + "readOnly" : true + } + }, + "description" : "The pricing scheme details" + }, + "SubscriptionsTransactions400" : { + "properties" : { + "details" : { "type" : "array", - "description" : "An array of pricing tiers which are used for billing volume/tiered plans. pricing_model field has to be specified.", "items" : { - "$ref" : "#/components/schemas/pricing_tier" + "$ref" : "#/components/schemas/Subscriptionstransactions400Details" } + } + } + }, + "SubscriberAllOf2" : { + "properties" : { + "shipping_address" : { + "$ref" : "#/components/schemas/ShippingDetail" }, - "create_time" : { - "$ref" : "#/components/schemas/date_time" - }, - "update_time" : { - "$ref" : "#/components/schemas/date_time" + "payment_source" : { + "$ref" : "#/components/schemas/PaymentSourceResponse" + } + } + }, + "SubscriptionCancelRequest" : { + "title" : "Cancel Subscription Request", + "required" : [ "reason" ], + "type" : "object", + "properties" : { + "reason" : { + "maxLength" : 128, + "minLength" : 1, + "type" : "string", + "description" : "The reason for the cancellation of a subscription" } }, - "description" : "The pricing scheme details." + "description" : "The cancel subscription request details" }, "SubscriptionAllOf2" : { "properties" : { @@ -2102,7 +2090,7 @@ "description" : "The ID of the plan." }, "start_time" : { - "$ref" : "#/components/schemas/date_time" + "$ref" : "#/components/schemas/DateTime" }, "quantity" : { "maxLength" : 32, @@ -2112,19 +2100,19 @@ "description" : "The quantity of the product in the subscription." }, "shipping_amount" : { - "$ref" : "#/components/schemas/money" + "$ref" : "#/components/schemas/Money" }, "subscriber" : { - "$ref" : "#/components/schemas/subscriber" + "$ref" : "#/components/schemas/Subscriber" }, "billing_info" : { - "$ref" : "#/components/schemas/subscription_billing_info" + "$ref" : "#/components/schemas/SubscriptionBillingInfo" }, "create_time" : { - "$ref" : "#/components/schemas/date_time" + "$ref" : "#/components/schemas/DateTime" }, "update_time" : { - "$ref" : "#/components/schemas/date_time" + "$ref" : "#/components/schemas/DateTime" }, "custom_id" : { "maxLength" : 127, @@ -2139,73 +2127,18 @@ "readOnly" : true }, "plan" : { - "$ref" : "#/components/schemas/plan" + "$ref" : "#/components/schemas/Plan" }, "links" : { "type" : "array", "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).", "readOnly" : true, "items" : { - "$ref" : "#/components/schemas/link_description" + "$ref" : "#/components/schemas/LinkDescription" } } } }, - "plan_request_POST" : { - "title" : "Create Plan Request", - "required" : [ "billing_cycles", "name", "payment_preferences", "product_id" ], - "type" : "object", - "properties" : { - "product_id" : { - "maxLength" : 50, - "minLength" : 6, - "type" : "string", - "description" : "The ID of the product created through Catalog Products API." - }, - "name" : { - "maxLength" : 127, - "minLength" : 1, - "type" : "string", - "description" : "The plan name." - }, - "status" : { - "maxLength" : 24, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", - "type" : "string", - "description" : "The initial state of the plan. Allowed input values are CREATED and ACTIVE.", - "default" : "ACTIVE", - "enum" : [ "CREATED", "INACTIVE", "ACTIVE" ] - }, - "description" : { - "maxLength" : 127, - "minLength" : 1, - "type" : "string", - "description" : "The detailed description of the plan." - }, - "billing_cycles" : { - "maxItems" : 12, - "minItems" : 1, - "type" : "array", - "description" : "An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle.", - "items" : { - "$ref" : "#/components/schemas/billing_cycle" - } - }, - "payment_preferences" : { - "$ref" : "#/components/schemas/payment_preferences" - }, - "taxes" : { - "$ref" : "#/components/schemas/taxes" - }, - "quantity_supported" : { - "type" : "boolean", - "description" : "Indicates whether you can subscribe to this plan by providing a quantity for the goods or service.", - "default" : false - } - }, - "description" : "The create plan request details." - }, "INVALIDQUANTITYSUPPORTED" : { "title" : "INVALID_QUANTITY_SUPPORTED", "properties" : { @@ -2219,111 +2152,106 @@ } } }, - "phone_type" : { - "title" : "Phone Type", - "type" : "string", - "description" : "The phone type.", - "enum" : [ "FAX", "HOME", "MOBILE", "OTHER", "PAGER" ] - }, - "payee_payment_method_preference" : { - "maxLength" : 255, - "minLength" : 1, - "pattern" : "^[0-9A-Z_]+$", - "type" : "string", - "description" : "The merchant-preferred payment methods.", - "default" : "UNRESTRICTED", - "enum" : [ "UNRESTRICTED", "IMMEDIATE_PAYMENT_REQUIRED" ] - }, - "plans.update-pricing-schemes-422" : { + "BillingCycle" : { + "title" : "Billing Cycle", + "required" : [ "frequency", "sequence", "tenure_type" ], + "type" : "object", "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/PlansupdatePricingSchemes422Details" - } + "sequence" : { + "maximum" : 99, + "minimum" : 1, + "type" : "integer", + "description" : "The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle" + }, + "tenure_type" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The tenure type of the billing cycle. In case of a plan having trial cycle, only 2 trial cycles are allowed per plan", + "enum" : [ "REGULAR", "TRIAL" ], + "x-ballerina-name-ignore" : "tenureType" + }, + "total_cycles" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles)", + "default" : 1, + "x-ballerina-name-ignore" : "totalCycles" + }, + "pricing_scheme" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PricingScheme" + } ], + "x-ballerina-name-ignore" : "pricingScheme" + }, + "frequency" : { + "$ref" : "#/components/schemas/Frequency" } - } + }, + "description" : "The billing cycle details" }, "InlineResponse42211" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_422" + "$ref" : "#/components/schemas/Error422" }, { - "$ref" : "#/components/schemas/subscriptions.capture-422" - } ] - }, - "last_payment_details" : { - "title" : "Last Payment Details", - "required" : [ "amount", "time" ], - "type" : "object", - "description" : "The details for the last payment.", - "allOf" : [ { - "$ref" : "#/components/schemas/LastPaymentDetailsAllOf1" + "$ref" : "#/components/schemas/SubscriptionsCapture422" } ] }, "InlineResponse42210" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_422" + "$ref" : "#/components/schemas/Error422" }, { - "$ref" : "#/components/schemas/subscriptions.activate-422" + "$ref" : "#/components/schemas/SubscriptionsActivate422" } ] }, - "shipping_detail" : { - "title" : "Shipping Details", - "type" : "object", + "INVALIDRESOURCEID1" : { + "title" : "INVALID_RESOURCE_ID", "properties" : { - "name" : { - "$ref" : "#/components/schemas/name" + "issue" : { + "type" : "string", + "enum" : [ "INVALID_RESOURCE_ID" ] }, - "type" : { - "maxLength" : 255, - "minLength" : 1, - "pattern" : "^[0-9A-Z_]+$", + "description" : { "type" : "string", - "description" : "The method by which the payer wants to get their items from the payee e.g shipping, in-person pickup. Either type or options but not both may be present.", - "enum" : [ "SHIPPING", "PICKUP_IN_PERSON" ] - }, - "address" : { - "$ref" : "#/components/schemas/address_portable" + "enum" : [ "Requested resource ID was not found." ] } - }, - "description" : "The shipping details." + } }, - "taxes_override" : { - "title" : "Taxes Override", + "PaymentPreferencesOverride" : { + "title" : "Payment Preferences Override", "type" : "object", "properties" : { - "percentage" : { - "$ref" : "#/components/schemas/percentage" + "setup_fee" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "setupFee" }, - "inclusive" : { - "type" : "boolean", - "description" : "Indicates whether the tax was already included in the billing amount." - } - }, - "description" : "The tax details." - }, - "INVALIDRESOURCEID1" : { - "title" : "INVALID_RESOURCE_ID", - "properties" : { - "issue" : { + "setup_fee_failure_action" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", "type" : "string", - "enum" : [ "INVALID_RESOURCE_ID" ] + "description" : "The action to take on the subscription if the initial payment for the setup fails", + "enum" : [ "CONTINUE", "CANCEL" ], + "x-ballerina-name-ignore" : "setupFeeFailureAction" }, - "description" : { - "type" : "string", - "enum" : [ "Requested resource ID was not found." ] - } - } - }, - "subscriptions.suspend-400" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionssuspend400Details" - } + "auto_bill_outstanding" : { + "type" : "boolean", + "description" : "Indicates whether to automatically bill the outstanding amount in the next billing cycle", + "x-ballerina-name-ignore" : "autoBillOutstanding" + }, + "payment_failure_threshold" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail", + "x-ballerina-name-ignore" : "paymentFailureThreshold" } - } + }, + "description" : "The payment preferences to override at subscription level" }, "Subscriptionscreate422Details" : { "anyOf" : [ { @@ -2356,25 +2284,31 @@ "$ref" : "#/components/schemas/CURRENCYMISMATCH2" } ] }, - "subscriptions.revise-422" : { + "UpdatePricingSchemesListRequest" : { + "title" : "Update Pricing Scheme Request", + "required" : [ "pricing_schemes" ], + "type" : "object", "properties" : { - "details" : { + "pricing_schemes" : { + "maxItems" : 99, + "minItems" : 1, "type" : "array", + "description" : "An array of pricing schemes", "items" : { - "$ref" : "#/components/schemas/Subscriptionsrevise422Details" - } + "$ref" : "#/components/schemas/UpdatePricingSchemeRequest" + }, + "x-ballerina-name-ignore" : "pricingSchemes" } - } + }, + "description" : "The update pricing scheme request details" }, - "subscriptions.capture-400" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionscapture400Details" - } - } - } + "DateNoTime" : { + "maxLength" : 10, + "minLength" : 10, + "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$", + "type" : "string", + "description" : "The stand-alone date, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard `date_time` type. This regular expression does not validate all dates. For example, February 31 is valid and nothing is known about leap years", + "format" : "ppaas_date_notime_v2" }, "CURRENCYNOTSUPPORTEDFORRECEIVER" : { "title" : "CURRENCY_NOT_SUPPORTED_FOR_RECEIVER", @@ -2389,6 +2323,65 @@ } } }, + "SubscriberRequest" : { + "title" : "Subscriber Request Information", + "type" : "object", + "description" : "The subscriber request information ", + "allOf" : [ { + "$ref" : "#/components/schemas/Payer" + }, { + "$ref" : "#/components/schemas/SubscriberRequestAllOf2" + } ] + }, + "CaptureStatus" : { + "title" : "Capture Status", + "type" : "object", + "properties" : { + "status_details" : { + "allOf" : [ { + "$ref" : "#/components/schemas/CaptureStatusDetails" + } ], + "x-ballerina-name-ignore" : "statusDetails" + }, + "status" : { + "type" : "string", + "description" : "The status of the captured payment", + "readOnly" : true, + "enum" : [ "COMPLETED", "DECLINED", "PARTIALLY_REFUNDED", "PENDING", "REFUNDED" ] + } + }, + "description" : "The status of a captured payment" + }, + "FailedPaymentDetails" : { + "title" : "Failed Payment Details", + "required" : [ "amount", "time" ], + "type" : "object", + "properties" : { + "reason_code" : { + "maxLength" : 120, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The reason code for the payment failure", + "readOnly" : true, + "enum" : [ "PAYMENT_DENIED", "INTERNAL_SERVER_ERROR", "PAYEE_ACCOUNT_RESTRICTED", "PAYER_ACCOUNT_RESTRICTED", "PAYER_CANNOT_PAY", "SENDING_LIMIT_EXCEEDED", "TRANSACTION_RECEIVING_LIMIT_EXCEEDED", "CURRENCY_MISMATCH" ], + "x-ballerina-name-ignore" : "reasonCode" + }, + "amount" : { + "$ref" : "#/components/schemas/Money" + }, + "next_payment_retry_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name-ignore" : "nextPaymentRetryTime" + }, + "time" : { + "$ref" : "#/components/schemas/DateTime" + } + }, + "description" : "The details for the failed payment of the subscription" + }, "INVALIDBILLINGCYCLESEQUENCE1" : { "title" : "INVALID_BILLING_CYCLE_SEQUENCE", "properties" : { @@ -2453,33 +2446,50 @@ }, "InlineResponse401" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_401" + "$ref" : "#/components/schemas/Error401" }, { - "$ref" : "#/components/schemas/401" + "$ref" : "#/components/schemas/Unauthorized" } ] }, "InlineResponse400" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_400" + "$ref" : "#/components/schemas/Error400" }, { - "$ref" : "#/components/schemas/400" + "$ref" : "#/components/schemas/BadRequest" } ] }, - "subscriptions.cancel-422" : { + "ErrorDetails" : { + "title" : "Error Details", + "required" : [ "issue" ], + "type" : "object", "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionscancel422Details" - } + "field" : { + "type" : "string", + "description" : "The field that caused the error. If this field is in the body, set this value to the field's JSON pointer value. Required for client-side errors" + }, + "issue" : { + "type" : "string", + "description" : "The unique, fine-grained application-level error code" + }, + "description" : { + "type" : "string", + "description" : "The human-readable description for an issue. The description can change over the lifetime of an API, so clients must not depend on this value" + }, + "location" : { + "$ref" : "#/components/schemas/ErrorLocation" + }, + "value" : { + "type" : "string", + "description" : "The value of the field that caused the error" } - } + }, + "description" : "The error details. Required for client-side `4XX` errors" }, "InlineResponse403" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_403" + "$ref" : "#/components/schemas/Error403" }, { - "$ref" : "#/components/schemas/403" + "$ref" : "#/components/schemas/Forbidden" } ] }, "INVALIDACCOUNTSTATUS" : { @@ -2502,72 +2512,20 @@ }, "InlineResponse404" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_404" + "$ref" : "#/components/schemas/Error404" }, { - "$ref" : "#/components/schemas/404" + "$ref" : "#/components/schemas/NotFound" } ] }, - "failed_payment_details" : { - "title" : "Failed Payment Details", - "required" : [ "amount", "time" ], - "type" : "object", - "properties" : { - "amount" : { - "$ref" : "#/components/schemas/money" - }, - "time" : { - "$ref" : "#/components/schemas/date_time" - }, - "reason_code" : { - "maxLength" : 120, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", - "type" : "string", - "description" : "The reason code for the payment failure.", - "readOnly" : true, - "enum" : [ "PAYMENT_DENIED", "INTERNAL_SERVER_ERROR", "PAYEE_ACCOUNT_RESTRICTED", "PAYER_ACCOUNT_RESTRICTED", "PAYER_CANNOT_PAY", "SENDING_LIMIT_EXCEEDED", "TRANSACTION_RECEIVING_LIMIT_EXCEEDED", "CURRENCY_MISMATCH" ] - }, - "next_payment_retry_time" : { - "$ref" : "#/components/schemas/date_time" - } - }, - "description" : "The details for the failed payment of the subscription." - }, - "date_no_time" : { - "maxLength" : 10, - "minLength" : 10, - "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$", - "type" : "string", - "description" : "The stand-alone date, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard `date_time` type. This regular expression does not validate all dates. For example, February 31 is valid and nothing is known about leap years.", - "format" : "ppaas_date_notime_v2" - }, - "payment_preferences_override" : { - "title" : "Payment Preferences Override", - "type" : "object", + "PlansPatch400" : { "properties" : { - "auto_bill_outstanding" : { - "type" : "boolean", - "description" : "Indicates whether to automatically bill the outstanding amount in the next billing cycle." - }, - "setup_fee" : { - "$ref" : "#/components/schemas/money" - }, - "setup_fee_failure_action" : { - "maxLength" : 24, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", - "type" : "string", - "description" : "The action to take on the subscription if the initial payment for the setup fails.", - "enum" : [ "CONTINUE", "CANCEL" ] - }, - "payment_failure_threshold" : { - "maximum" : 999, - "minimum" : 0, - "type" : "integer", - "description" : "The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail." + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Planspatch400Details" + } } - }, - "description" : "The payment preferences to override at subscription level." + } }, "Subscriptionsrevise400Details" : { "anyOf" : [ { @@ -2584,14 +2542,6 @@ "$ref" : "#/components/schemas/MISSINGREQUIREDPARAMETER4" } ] }, - "liability_shift" : { - "maxLength" : 255, - "minLength" : 1, - "pattern" : "^[0-9A-Z_]+$", - "type" : "string", - "description" : "Liability shift indicator. The outcome of the issuer's authentication.", - "enum" : [ "YES", "NO", "POSSIBLE", "UNKNOWN" ] - }, "INVALIDBILLINGCYCLESEQUENCE3" : { "title" : "INVALID_BILLING_CYCLE_SEQUENCE", "properties" : { @@ -2618,21 +2568,6 @@ } } }, - "email" : { - "maxLength" : 254, - "pattern" : "(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])", - "type" : "string", - "description" : "The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
", - "format" : "merchant_common_email_address_v2" - }, - "enrolled" : { - "maxLength" : 255, - "minLength" : 1, - "pattern" : "^[0-9A-Z_]+$", - "type" : "string", - "description" : "Status of Authentication eligibility.", - "enum" : [ "Y", "N", "U", "B" ] - }, "MULTIPLEFREETRIALBILLINGCYCLESNOTSUPPORTED" : { "title" : "MULTIPLE_FREE_TRIAL_BILLING_CYCLES_NOT_SUPPORTED", "properties" : { @@ -2681,38 +2616,44 @@ "title" : "Address Details", "type" : "object", "properties" : { - "street_number" : { + "building_name" : { "maxLength" : 100, "type" : "string", - "description" : "The street number." + "description" : "A named locations that represents the premise. Usually a building name or number or collection of buildings with a common name or number. For example, Craven House", + "x-ballerina-name-ignore" : "buildingName" }, - "street_name" : { + "street_number" : { "maxLength" : 100, "type" : "string", - "description" : "The street name. Just `Drury` in `Drury Lane`." + "description" : "The street number", + "x-ballerina-name-ignore" : "streetNumber" }, "street_type" : { "maxLength" : 100, "type" : "string", - "description" : "The street type. For example, avenue, boulevard, road, or expressway." + "description" : "The street type. For example, avenue, boulevard, road, or expressway", + "x-ballerina-name-ignore" : "streetType" }, - "delivery_service" : { + "sub_building" : { "maxLength" : 100, "type" : "string", - "description" : "The delivery service. Post office box, bag number, or post office name." + "description" : "The first-order entity below a named building or location that represents the sub-premises. Usually a single building within a collection of buildings with a common name. Can be a flat, story, floor, room, or apartment", + "x-ballerina-name-ignore" : "subBuilding" }, - "building_name" : { + "delivery_service" : { "maxLength" : 100, "type" : "string", - "description" : "A named locations that represents the premise. Usually a building name or number or collection of buildings with a common name or number. For example, Craven House." + "description" : "The delivery service. Post office box, bag number, or post office name", + "x-ballerina-name-ignore" : "deliveryService" }, - "sub_building" : { + "street_name" : { "maxLength" : 100, "type" : "string", - "description" : "The first-order entity below a named building or location that represents the sub-premises. Usually a single building within a collection of buildings with a common name. Can be a flat, story, floor, room, or apartment." + "description" : "The street name. Just `Drury` in `Drury Lane`", + "x-ballerina-name-ignore" : "streetName" } }, - "description" : "The non-portable additional address details that are sometimes needed for compliance, risk, or other scenarios where fine-grain address information might be needed. Not portable with common third party and open source. Redundant with core fields.
For example, `address_portable.address_line_1` is usually a combination of `address_details.street_number`, `street_name`, and `street_type`." + "description" : "The non-portable additional address details that are sometimes needed for compliance, risk, or other scenarios where fine-grain address information might be needed. Not portable with common third party and open source. Redundant with core fields.
For example, `address_portable.address_line_1` is usually a combination of `address_details.street_number`, `street_name`, and `street_type`" }, "INVALIDPRICINGTIERAMOUNT2" : { "title" : "INVALID_PRICING_TIER_AMOUNT", @@ -2727,6 +2668,16 @@ } } }, + "PlansUpdatePricingSchemes422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PlansupdatePricingSchemes422Details" + } + } + } + }, "CARDSUBSCRIPTIONSNOTENABLED" : { "title" : "CARD_SUBSCRIPTIONS_NOT_ENABLED", "properties" : { @@ -2787,50 +2738,23 @@ "LastPaymentDetailsAllOf1" : { "properties" : { "amount" : { - "$ref" : "#/components/schemas/money" + "$ref" : "#/components/schemas/Money" }, "time" : { - "$ref" : "#/components/schemas/date_time" - } - } - }, - "subscriptions.suspend-422" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionssuspend422Details" - } + "$ref" : "#/components/schemas/DateTime" } } }, - "plans.activate-422" : { + "SubscriptionsSuspend400" : { "properties" : { "details" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/Plansactivate422Details" + "$ref" : "#/components/schemas/Subscriptionssuspend400Details" } } } }, - "account_id" : { - "title" : "PayPal Account Identifier", - "maxLength" : 13, - "minLength" : 13, - "pattern" : "^[2-9A-HJ-NP-Z]{13}$", - "type" : "string", - "description" : "The account identifier for a PayPal account.", - "format" : "ppaas_payer_id_v3" - }, - "email_address" : { - "maxLength" : 254, - "minLength" : 3, - "pattern" : "^.+@[^\"\\-].+$", - "type" : "string", - "description" : "The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
", - "format" : "ppaas_common_email_address_v2" - }, "MISSINGREGULARBILLINGCYCLE" : { "title" : "MISSING_REGULAR_BILLING_CYCLE", "properties" : { @@ -2844,25 +2768,104 @@ } } }, - "payment_source_response" : { - "title" : "Payment Source Response", + "SubscriptionBillingInfo" : { + "title" : "Subscription Billing Information", + "required" : [ "failed_payments_count", "outstanding_balance" ], "type" : "object", "properties" : { - "card" : { - "$ref" : "#/components/schemas/card_response_with_billing_address" - } - }, - "description" : "The payment source used to fund the payment." - }, - "subscriptions.capture-422" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionscapture422Details" - } + "final_payment_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name-ignore" : "finalPaymentTime" + }, + "cycle_executions" : { + "maxItems" : 3, + "minItems" : 0, + "type" : "array", + "description" : "The trial and regular billing executions", + "readOnly" : true, + "items" : { + "$ref" : "#/components/schemas/CycleExecution" + }, + "x-ballerina-name-ignore" : "cycleExecutions" + }, + "failed_payments_count" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The number of consecutive payment failures. Resets to `0` after a successful payment. If this reaches the `payment_failure_threshold` value, the subscription updates to the `SUSPENDED` state", + "readOnly" : true, + "x-ballerina-name-ignore" : "failedPaymentsCount" + }, + "next_billing_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name-ignore" : "nextBillingTime" + }, + "last_failed_payment" : { + "allOf" : [ { + "$ref" : "#/components/schemas/FailedPaymentDetails" + } ], + "x-ballerina-name-ignore" : "lastFailedPayment" + }, + "outstanding_balance" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "outstandingBalance" + }, + "last_payment" : { + "allOf" : [ { + "$ref" : "#/components/schemas/LastPaymentDetails" + } ], + "x-ballerina-name-ignore" : "lastPayment" } - } + }, + "description" : "The billing details for the subscription. If the subscription was or is active, these fields are populated" + }, + "SubscriptionReviseRequest" : { + "title" : "Subscription Modify Plan Request", + "type" : "object", + "properties" : { + "shipping_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "shippingAmount" + }, + "quantity" : { + "maxLength" : 32, + "minLength" : 1, + "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", + "type" : "string", + "description" : "The quantity of the product or service in the subscription" + }, + "application_context" : { + "allOf" : [ { + "$ref" : "#/components/schemas/ApplicationContext" + } ], + "x-ballerina-name-ignore" : "applicationContext" + }, + "shipping_address" : { + "allOf" : [ { + "$ref" : "#/components/schemas/ShippingDetail" + } ], + "x-ballerina-name-ignore" : "shippingAddress" + }, + "plan" : { + "$ref" : "#/components/schemas/PlanOverride" + }, + "plan_id" : { + "maxLength" : 50, + "minLength" : 3, + "type" : "string", + "description" : "The unique PayPal-generated ID for the plan", + "x-ballerina-name-ignore" : "planId" + } + }, + "description" : "The request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent" }, "INVALIDSTRINGMAXLENGTH" : { "title" : "INVALID_STRING_MAX_LENGTH", @@ -2877,6 +2880,40 @@ } } }, + "PayeePaymentMethodPreference" : { + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "The merchant-preferred payment methods", + "default" : "UNRESTRICTED", + "enum" : [ "UNRESTRICTED", "IMMEDIATE_PAYMENT_REQUIRED" ] + }, + "Frequency" : { + "title" : "Billing Cycle Frequency", + "required" : [ "interval_unit" ], + "type" : "object", + "properties" : { + "interval_count" : { + "maximum" : 365, + "minimum" : 1, + "type" : "integer", + "description" : "The number of intervals after which a subscriber is billed. For example, if the `interval_unit` is `DAY` with an `interval_count` of `2`, the subscription is billed once every two days. The following table lists the maximum allowed values for the `interval_count` for each `interval_unit`:
Interval unitMaximum interval count
DAY365
WEEK52
MONTH12
YEAR1
", + "default" : 1, + "x-ballerina-name-ignore" : "intervalCount" + }, + "interval_unit" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The interval at which the subscription is charged or billed", + "enum" : [ "DAY", "WEEK", "MONTH", "YEAR" ], + "x-ballerina-name-ignore" : "intervalUnit" + } + }, + "description" : "The frequency of the billing cycle" + }, "422Details" : { "anyOf" : [ { "$ref" : "#/components/schemas/USERACCOUNTCLOSED" @@ -2925,6 +2962,16 @@ "$ref" : "#/components/schemas/PLANSTATUSINACTIVE" } ] }, + "CardResponseWithBillingAddress" : { + "title" : "Card Response with billing address and name", + "type" : "object", + "description" : "The payment card used to fund the payment. Card can be a credit or debit card", + "allOf" : [ { + "$ref" : "#/components/schemas/CardResponse" + }, { + "$ref" : "#/components/schemas/CardResponseWithBillingAddressAllOf2" + } ] + }, "PlansupdatePricingSchemes400Details" : { "anyOf" : [ { "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE4" @@ -2935,22 +2982,105 @@ "PayerAllOf2" : { "properties" : { "name" : { - "$ref" : "#/components/schemas/name" + "$ref" : "#/components/schemas/Name" }, "phone" : { - "$ref" : "#/components/schemas/phone_with_type" + "$ref" : "#/components/schemas/PhoneWithType" }, "birth_date" : { - "$ref" : "#/components/schemas/date_no_time" + "$ref" : "#/components/schemas/DateNoTime" }, "tax_info" : { - "$ref" : "#/components/schemas/tax_info" + "$ref" : "#/components/schemas/TaxInfo" }, "address" : { - "$ref" : "#/components/schemas/address_portable" + "$ref" : "#/components/schemas/AddressPortable" } } }, + "BillingCycleOverride" : { + "title" : "Billing Cycle Override", + "required" : [ "sequence" ], + "type" : "object", + "properties" : { + "sequence" : { + "maximum" : 99, + "minimum" : 1, + "type" : "integer", + "description" : "The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle" + }, + "total_cycles" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles)", + "x-ballerina-name-ignore" : "totalCycles" + }, + "pricing_scheme" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PricingScheme" + } ], + "x-ballerina-name-ignore" : "pricingScheme" + } + }, + "description" : "The billing cycle details to override at subscription level. The subscription billing cycle definition has to adhere to the plan billing cycle definition" + }, + "CycleExecution" : { + "title" : "Billing Cycle Execution Details", + "required" : [ "cycles_completed", "sequence", "tenure_type" ], + "type" : "object", + "properties" : { + "sequence" : { + "maximum" : 99, + "minimum" : 0, + "type" : "integer", + "description" : "The order in which to run this cycle among other billing cycles" + }, + "cycles_remaining" : { + "maximum" : 9999, + "minimum" : 0, + "type" : "integer", + "description" : "For a finite billing cycle, cycles_remaining is the number of remaining cycles. For an infinite billing cycle, cycles_remaining is set as 0", + "readOnly" : true, + "x-ballerina-name-ignore" : "cyclesRemaining" + }, + "tenure_type" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The type of the billing cycle", + "readOnly" : true, + "enum" : [ "REGULAR", "TRIAL" ], + "x-ballerina-name-ignore" : "tenureType" + }, + "cycles_completed" : { + "maximum" : 9999, + "minimum" : 0, + "type" : "integer", + "description" : "The number of billing cycles that have completed", + "readOnly" : true, + "x-ballerina-name-ignore" : "cyclesCompleted" + }, + "current_pricing_scheme_version" : { + "maximum" : 99, + "minimum" : 1, + "type" : "integer", + "description" : "The active pricing scheme version for the billing cycle", + "readOnly" : true, + "x-ballerina-name-ignore" : "currentPricingSchemeVersion" + }, + "total_cycles" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles)", + "readOnly" : true, + "x-ballerina-name-ignore" : "totalCycles" + } + }, + "description" : "The regular and trial execution details for a billing cycle" + }, "INVALIDTRIALBILLINGTOTALCYCLES" : { "title" : "INVALID_TRIAL_BILLING_TOTAL_CYCLES", "properties" : { @@ -2964,6 +3094,22 @@ } } }, + "Email" : { + "maxLength" : 254, + "pattern" : "(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])", + "type" : "string", + "description" : "The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
", + "format" : "merchant_common_email_address_v2" + }, + "AccountId" : { + "title" : "PayPal Account Identifier", + "maxLength" : 13, + "minLength" : 13, + "pattern" : "^[2-9A-HJ-NP-Z]{13}$", + "type" : "string", + "description" : "The account identifier for a PayPal account", + "format" : "ppaas_payer_id_v3" + }, "Subscriptionsactivate422Details" : { "anyOf" : [ { "$ref" : "#/components/schemas/USERACCOUNTCLOSED9" @@ -2977,26 +3123,15 @@ "$ref" : "#/components/schemas/SUBSCRIPTIONCANNOTBEACTIVATED2" } ] }, - "subscription_activate_request" : { - "title" : "Activate Subscription Request", - "type" : "object", + "SubscriptionsCreate422" : { "properties" : { - "reason" : { - "maxLength" : 128, - "minLength" : 1, - "type" : "string", - "description" : "The reason for activation of a subscription. Required to reactivate the subscription." + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscreate422Details" + } } - }, - "description" : "The activate subscription request details." - }, - "language" : { - "maxLength" : 10, - "minLength" : 2, - "pattern" : "^[a-z]{2}(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}))?$", - "type" : "string", - "description" : "The [language tag](https://tools.ietf.org/html/bcp47#section-2) for the language in which to localize the error-related strings, such as messages, issues, and suggested actions. The tag is made up of the [ISO 639-2 language code](https://www.loc.gov/standards/iso639-2/php/code_list.php), the optional [ISO-15924 script tag](https://www.unicode.org/iso15924/codelists.html), and the [ISO-3166 alpha-2 country code](/docs/integration/direct/rest/country-codes/).", - "format" : "ppaas_common_language_v3" + } }, "INVALIDPRICINGTIERAMOUNT" : { "title" : "INVALID_PRICING_TIER_AMOUNT", @@ -3011,44 +3146,59 @@ } } }, - "error_location" : { - "type" : "string", - "description" : "The location of the field that caused the error. Value is `body`, `path`, or `query`.", - "default" : "body", - "enum" : [ "body", "path", "query" ] - }, - "subscriptions.cancel-400" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionscancel400Details" - } - } - } - }, - "frequency" : { - "title" : "Billing Cycle Frequency", - "required" : [ "interval_unit" ], + "Name" : { + "title" : "Name", "type" : "object", "properties" : { - "interval_unit" : { - "maxLength" : 24, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", + "full_name" : { + "maxLength" : 300, "type" : "string", - "description" : "The interval at which the subscription is charged or billed.", - "enum" : [ "DAY", "WEEK", "MONTH", "YEAR" ] + "description" : "When the party is a person, the party's full name", + "x-ballerina-name-ignore" : "fullName" }, - "interval_count" : { - "maximum" : 365, - "minimum" : 1, - "type" : "integer", - "description" : "The number of intervals after which a subscriber is billed. For example, if the `interval_unit` is `DAY` with an `interval_count` of `2`, the subscription is billed once every two days. The following table lists the maximum allowed values for the `interval_count` for each `interval_unit`:
Interval unitMaximum interval count
DAY365
WEEK52
MONTH12
YEAR1
", - "default" : 1 + "prefix" : { + "maxLength" : 140, + "type" : "string", + "description" : "The prefix, or title, to the party's name" + }, + "surname" : { + "maxLength" : 140, + "type" : "string", + "description" : "When the party is a person, the party's surname or family name. Also known as the last name. Required when the party is a person. Use also to store multiple surnames including the matronymic, or mother's, surname" + }, + "given_name" : { + "maxLength" : 140, + "type" : "string", + "description" : "When the party is a person, the party's given, or first, name", + "x-ballerina-name-ignore" : "givenName" + }, + "middle_name" : { + "maxLength" : 140, + "type" : "string", + "description" : "When the party is a person, the party's middle name. Use also to store multiple middle names including the patronymic, or father's, middle name", + "x-ballerina-name-ignore" : "middleName" + }, + "suffix" : { + "maxLength" : 140, + "type" : "string", + "description" : "The suffix for the party's name" + }, + "alternate_full_name" : { + "maxLength" : 300, + "type" : "string", + "description" : "DEPRECATED. The party's alternate name. Can be a business name, nickname, or any other name that cannot be split into first, last name. Required when the party is a business", + "x-ballerina-name-ignore" : "alternateFullName" } }, - "description" : "The frequency of the billing cycle." + "description" : "The name of the party" + }, + "Enrolled" : { + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "Status of Authentication eligibility", + "enum" : [ "Y", "N", "U", "B" ] }, "BILLINGCYCLEEXECUTIONCOMPLETED" : { "title" : "BILLING_CYCLE_EXECUTION_COMPLETED", @@ -3063,125 +3213,224 @@ } } }, - "MULTIPLEREGULARBILLINGCYCLESNOTSUPPORTED" : { - "title" : "MULTIPLE_REGULAR_BILLING_CYCLES_NOT_SUPPORTED", + "PaymentPreferences" : { + "title" : "Payment Preferences", + "type" : "object", "properties" : { - "issue" : { - "type" : "string", - "enum" : [ "MULTIPLE_REGULAR_BILLING_CYCLES_NOT_SUPPORTED" ] + "setup_fee" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "setupFee" }, - "description" : { + "setup_fee_failure_action" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", "type" : "string", - "enum" : [ "Only one regular billing cycle is allowed." ] + "description" : "The action to take on the subscription if the initial payment for the setup fails", + "default" : "CANCEL", + "enum" : [ "CONTINUE", "CANCEL" ], + "x-ballerina-name-ignore" : "setupFeeFailureAction" + }, + "auto_bill_outstanding" : { + "type" : "boolean", + "description" : "Indicates whether to automatically bill the outstanding amount in the next billing cycle", + "default" : true, + "x-ballerina-name-ignore" : "autoBillOutstanding" + }, + "payment_failure_threshold" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail", + "default" : 0, + "x-ballerina-name-ignore" : "paymentFailureThreshold" } - } + }, + "description" : "The payment preferences for a subscription" }, - "error_default" : { - "description" : "The default error response.", - "oneOf" : [ { - "$ref" : "#/components/schemas/error_400" - }, { - "$ref" : "#/components/schemas/error_401" - }, { - "$ref" : "#/components/schemas/error_403" - }, { - "$ref" : "#/components/schemas/error_404" - }, { - "$ref" : "#/components/schemas/error_409" - }, { - "$ref" : "#/components/schemas/error_415" - }, { - "$ref" : "#/components/schemas/error_422" - }, { - "$ref" : "#/components/schemas/error_500" - }, { - "$ref" : "#/components/schemas/error_503" - } ] - }, - "billing_cycle_override" : { - "title" : "Billing Cycle Override", - "required" : [ "sequence" ], + "TransactionsList" : { + "title" : "List Transactions", "type" : "object", "properties" : { - "pricing_scheme" : { - "$ref" : "#/components/schemas/pricing_scheme" + "links" : { + "maxItems" : 10, + "minItems" : 1, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links)", + "readOnly" : true, + "items" : { + "$ref" : "#/components/schemas/LinkDescription" + } }, - "sequence" : { - "maximum" : 99, - "minimum" : 1, + "total_pages" : { + "maximum" : 100000000, + "minimum" : 0, "type" : "integer", - "description" : "The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle." + "description" : "The total number of pages", + "x-ballerina-name-ignore" : "totalPages" }, - "total_cycles" : { - "maximum" : 999, + "transactions" : { + "maxItems" : 32767, + "minItems" : 0, + "type" : "array", + "description" : "An array of transactions", + "items" : { + "$ref" : "#/components/schemas/Transaction" + } + }, + "total_items" : { + "maximum" : 500000000, "minimum" : 0, "type" : "integer", - "description" : "The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles)." + "description" : "The total number of items", + "x-ballerina-name-ignore" : "totalItems" } }, - "description" : "The billing cycle details to override at subscription level. The subscription billing cycle definition has to adhere to the plan billing cycle definition." + "description" : "The list transactions for a subscription request details" }, - "AMOUNTGREATERTHANOUTSTANDINGBALANCE1" : { - "title" : "AMOUNT_GREATER_THAN_OUTSTANDING_BALANCE", + "MULTIPLEREGULARBILLINGCYCLESNOTSUPPORTED" : { + "title" : "MULTIPLE_REGULAR_BILLING_CYCLES_NOT_SUPPORTED", "properties" : { "issue" : { "type" : "string", - "enum" : [ "AMOUNT_GREATER_THAN_OUTSTANDING_BALANCE" ] + "enum" : [ "MULTIPLE_REGULAR_BILLING_CYCLES_NOT_SUPPORTED" ] }, "description" : { "type" : "string", - "enum" : [ "The capture amount can not be greater than the current outstanding balance." ] + "enum" : [ "Only one regular billing cycle is allowed." ] } } }, - "billing_cycle" : { - "title" : "Billing Cycle", - "required" : [ "frequency", "sequence", "tenure_type" ], + "PlansPatch422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Planspatch422Details" + } + } + } + }, + "ApplicationContext" : { + "title" : "Application Context", + "required" : [ "cancel_url", "return_url" ], "type" : "object", "properties" : { - "pricing_scheme" : { - "$ref" : "#/components/schemas/pricing_scheme" + "user_action" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "Configures the label name to `Continue` or `Subscribe Now` for subscription consent experience", + "default" : "SUBSCRIBE_NOW", + "enum" : [ "CONTINUE", "SUBSCRIBE_NOW" ], + "x-ballerina-name-ignore" : "userAction" }, - "frequency" : { - "$ref" : "#/components/schemas/frequency" + "return_url" : { + "maxLength" : 4000, + "minLength" : 10, + "type" : "string", + "description" : "The URL where the customer is redirected after the customer approves the payment", + "format" : "uri", + "x-ballerina-name-ignore" : "returnUrl" }, - "tenure_type" : { + "brand_name" : { + "maxLength" : 127, + "minLength" : 1, + "type" : "string", + "description" : "The label that overrides the business name in the PayPal account on the PayPal site", + "x-ballerina-name-ignore" : "brandName" + }, + "locale" : { + "$ref" : "#/components/schemas/Language" + }, + "cancel_url" : { + "maxLength" : 4000, + "minLength" : 10, + "type" : "string", + "description" : "The URL where the customer is redirected after the customer cancels the payment", + "format" : "uri", + "x-ballerina-name-ignore" : "cancelUrl" + }, + "shipping_preference" : { "maxLength" : 24, "minLength" : 1, "pattern" : "^[A-Z_]+$", "type" : "string", - "description" : "The tenure type of the billing cycle. In case of a plan having trial cycle, only 2 trial cycles are allowed per plan.", - "enum" : [ "REGULAR", "TRIAL" ] + "description" : "The location from which the shipping address is derived", + "default" : "GET_FROM_FILE", + "enum" : [ "GET_FROM_FILE", "NO_SHIPPING", "SET_PROVIDED_ADDRESS" ], + "x-ballerina-name-ignore" : "shippingPreference" }, - "sequence" : { - "maximum" : 99, - "minimum" : 1, - "type" : "integer", - "description" : "The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle." + "payment_method" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PaymentMethod" + } ], + "x-ballerina-name-ignore" : "paymentMethod" + } + }, + "description" : "The application context, which customizes the payer experience during the subscription approval process with PayPal" + }, + "Subscriber" : { + "title" : "Subscriber Response Information", + "type" : "object", + "description" : "The subscriber response information", + "allOf" : [ { + "$ref" : "#/components/schemas/Payer" + }, { + "$ref" : "#/components/schemas/SubscriberAllOf2" + } ] + }, + "AMOUNTGREATERTHANOUTSTANDINGBALANCE1" : { + "title" : "AMOUNT_GREATER_THAN_OUTSTANDING_BALANCE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "AMOUNT_GREATER_THAN_OUTSTANDING_BALANCE" ] }, - "total_cycles" : { - "maximum" : 999, - "minimum" : 0, - "type" : "integer", - "description" : "The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles).", - "default" : 1 + "description" : { + "type" : "string", + "enum" : [ "The capture amount can not be greater than the current outstanding balance." ] + } + } + }, + "PaymentSourceResponse" : { + "title" : "Payment Source Response", + "type" : "object", + "properties" : { + "card" : { + "$ref" : "#/components/schemas/CardResponseWithBillingAddress" } }, - "description" : "The billing cycle details." + "description" : "The payment source used to fund the payment" }, - "phone_with_type" : { - "title" : "Phone With Type", - "required" : [ "phone_number" ], + "PlanOverride" : { + "title" : "Plan Override", "type" : "object", "properties" : { - "phone_type" : { - "$ref" : "#/components/schemas/phone_type" + "payment_preferences" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PaymentPreferencesOverride" + } ], + "x-ballerina-name-ignore" : "paymentPreferences" }, - "phone_number" : { - "$ref" : "#/components/schemas/phone" + "billing_cycles" : { + "maxItems" : 12, + "minItems" : 1, + "type" : "array", + "description" : "An array of billing cycles for trial billing and regular billing. The subscription billing cycle definition has to adhere to the plan billing cycle definition", + "items" : { + "$ref" : "#/components/schemas/BillingCycleOverride" + }, + "x-ballerina-name-ignore" : "billingCycles" + }, + "taxes" : { + "$ref" : "#/components/schemas/TaxesOverride" } }, - "description" : "The phone information." + "description" : "An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object" }, "INVALIDINTEGERMINVALUE" : { "title" : "INVALID_INTEGER_MIN_VALUE", @@ -3213,7 +3462,7 @@ "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).", "readOnly" : true, "items" : { - "$ref" : "#/components/schemas/link_description" + "$ref" : "#/components/schemas/LinkDescription" } } } @@ -3257,6 +3506,25 @@ } } }, + "ThreeDSecureAuthenticationResponse" : { + "title" : "The 3D Secure Authentication Response", + "type" : "object", + "properties" : { + "authentication_status" : { + "allOf" : [ { + "$ref" : "#/components/schemas/ParesStatus" + } ], + "x-ballerina-name-ignore" : "authenticationStatus" + }, + "enrollment_status" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Enrolled" + } ], + "x-ballerina-name-ignore" : "enrollmentStatus" + } + }, + "description" : "Results of 3D Secure Authentication" + }, "403Details" : { "anyOf" : [ { "$ref" : "#/components/schemas/PERMISSIONDENIED" @@ -3319,47 +3587,13 @@ } } }, - "subscription_revise_request" : { - "title" : "Subscription Modify Plan Request", - "type" : "object", - "properties" : { - "plan_id" : { - "maxLength" : 50, - "minLength" : 3, - "type" : "string", - "description" : "The unique PayPal-generated ID for the plan." - }, - "quantity" : { - "maxLength" : 32, - "minLength" : 1, - "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", - "type" : "string", - "description" : "The quantity of the product or service in the subscription." - }, - "shipping_amount" : { - "$ref" : "#/components/schemas/money" - }, - "shipping_address" : { - "$ref" : "#/components/schemas/shipping_detail" - }, - "application_context" : { - "$ref" : "#/components/schemas/application_context" - }, - "plan" : { - "$ref" : "#/components/schemas/plan_override" - } - }, - "description" : "The request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent." - }, - "subscription_revise_response" : { - "title" : "Update Product Quantity in Subscription Response", - "type" : "object", - "description" : "The response to a request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent.", - "allOf" : [ { - "$ref" : "#/components/schemas/subscription_revise_request" - }, { - "$ref" : "#/components/schemas/SubscriptionReviseResponseAllOf2" - } ] + "PatchRequest" : { + "title" : "Patch Request", + "type" : "array", + "description" : "An array of JSON patch objects to apply partial updates to resources", + "items" : { + "$ref" : "#/components/schemas/Patch" + } }, "CURRENCYMISMATCH5" : { "title" : "CURRENCY_MISMATCH", @@ -3413,19 +3647,11 @@ } } }, - "country_code" : { - "maxLength" : 2, - "minLength" : 2, - "pattern" : "^([A-Z]{2}|C2)$", - "type" : "string", - "description" : "The [two-character ISO 3166-1 code](/docs/integration/direct/rest/country-codes/) that identifies the country or region.
Note: The country code for Great Britain is GB and not UK as used in the top-level domain names for that country. Use the `C2` country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border transactions.
", - "format" : "ppaas_common_country_code_v2" - }, "InlineResponse4041" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_404" + "$ref" : "#/components/schemas/Error404" }, { - "$ref" : "#/components/schemas/subscriptions.revise-404" + "$ref" : "#/components/schemas/SubscriptionsRevise404" } ] }, "Subscriptionscancel422Details" : { @@ -3435,99 +3661,95 @@ "$ref" : "#/components/schemas/SUBSCRIPTIONSTATUSINVALID2" } ] }, - "name" : { - "title" : "Name", + "CardResponse" : { + "title" : "Card Response", "type" : "object", "properties" : { - "prefix" : { - "maxLength" : 140, - "type" : "string", - "description" : "The prefix, or title, to the party's name." - }, - "given_name" : { - "maxLength" : 140, - "type" : "string", - "description" : "When the party is a person, the party's given, or first, name." - }, - "surname" : { - "maxLength" : 140, - "type" : "string", - "description" : "When the party is a person, the party's surname or family name. Also known as the last name. Required when the party is a person. Use also to store multiple surnames including the matronymic, or mother's, surname." - }, - "middle_name" : { - "maxLength" : 140, - "type" : "string", - "description" : "When the party is a person, the party's middle name. Use also to store multiple middle names including the patronymic, or father's, middle name." + "authentication_result" : { + "allOf" : [ { + "$ref" : "#/components/schemas/AuthenticationResponse" + } ], + "x-ballerina-name-ignore" : "authenticationResult" }, - "suffix" : { - "maxLength" : 140, + "type" : { "type" : "string", - "description" : "The suffix for the party's name." + "description" : "The payment card type", + "readOnly" : true, + "enum" : [ "CREDIT", "DEBIT", "PREPAID", "UNKNOWN" ] }, - "alternate_full_name" : { - "maxLength" : 300, + "last_digits" : { + "pattern" : "[0-9]{2,}", "type" : "string", - "description" : "DEPRECATED. The party's alternate name. Can be a business name, nickname, or any other name that cannot be split into first, last name. Required when the party is a business." + "description" : "The last digits of the payment card", + "readOnly" : true, + "x-ballerina-name-ignore" : "lastDigits" }, - "full_name" : { - "maxLength" : 300, - "type" : "string", - "description" : "When the party is a person, the party's full name." + "brand" : { + "$ref" : "#/components/schemas/CardBrand" } }, - "description" : "The name of the party." + "description" : "The payment card to use to fund a payment. Card can be a credit or debit card" }, - "application_context" : { - "title" : "Application Context", - "required" : [ "cancel_url", "return_url" ], + "PlanRequestPOST" : { + "title" : "Create Plan Request", + "required" : [ "billing_cycles", "name", "payment_preferences", "product_id" ], "type" : "object", "properties" : { - "brand_name" : { + "quantity_supported" : { + "type" : "boolean", + "description" : "Indicates whether you can subscribe to this plan by providing a quantity for the goods or service", + "default" : false, + "x-ballerina-name-ignore" : "quantitySupported" + }, + "payment_preferences" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PaymentPreferences" + } ], + "x-ballerina-name-ignore" : "paymentPreferences" + }, + "product_id" : { + "maxLength" : 50, + "minLength" : 6, + "type" : "string", + "description" : "The ID of the product created through Catalog Products API", + "x-ballerina-name-ignore" : "productId" + }, + "name" : { "maxLength" : 127, "minLength" : 1, "type" : "string", - "description" : "The label that overrides the business name in the PayPal account on the PayPal site." + "description" : "The plan name" }, - "locale" : { - "$ref" : "#/components/schemas/language" + "billing_cycles" : { + "maxItems" : 12, + "minItems" : 1, + "type" : "array", + "description" : "An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle", + "items" : { + "$ref" : "#/components/schemas/BillingCycle" + }, + "x-ballerina-name-ignore" : "billingCycles" }, - "shipping_preference" : { - "maxLength" : 24, + "description" : { + "maxLength" : 127, "minLength" : 1, - "pattern" : "^[A-Z_]+$", "type" : "string", - "description" : "The location from which the shipping address is derived.", - "default" : "GET_FROM_FILE", - "enum" : [ "GET_FROM_FILE", "NO_SHIPPING", "SET_PROVIDED_ADDRESS" ] + "description" : "The detailed description of the plan" }, - "user_action" : { + "taxes" : { + "$ref" : "#/components/schemas/Taxes" + }, + "status" : { "maxLength" : 24, "minLength" : 1, "pattern" : "^[A-Z_]+$", "type" : "string", - "description" : "Configures the label name to `Continue` or `Subscribe Now` for subscription consent experience.", - "default" : "SUBSCRIBE_NOW", - "enum" : [ "CONTINUE", "SUBSCRIBE_NOW" ] - }, - "payment_method" : { - "$ref" : "#/components/schemas/payment_method" - }, - "return_url" : { - "maxLength" : 4000, - "minLength" : 10, - "type" : "string", - "description" : "The URL where the customer is redirected after the customer approves the payment.", - "format" : "uri" - }, - "cancel_url" : { - "maxLength" : 4000, - "minLength" : 10, - "type" : "string", - "description" : "The URL where the customer is redirected after the customer cancels the payment.", - "format" : "uri" + "description" : "The initial state of the plan. Allowed input values are CREATED and ACTIVE", + "default" : "ACTIVE", + "enum" : [ "CREATED", "INACTIVE", "ACTIVE" ] } }, - "description" : "The application context, which customizes the payer experience during the subscription approval process with PayPal." + "description" : "The create plan request details" }, "INVALIDINTEGERMAXVALUE2" : { "title" : "INVALID_INTEGER_MAX_VALUE", @@ -3542,6 +3764,31 @@ } } }, + "Patch" : { + "title" : "Patch", + "required" : [ "op" ], + "type" : "object", + "properties" : { + "op" : { + "type" : "string", + "description" : "The operation", + "enum" : [ "add", "remove", "replace", "move", "copy", "test" ] + }, + "path" : { + "type" : "string", + "description" : "The JSON Pointer to the target document location at which to complete the operation" + }, + "from" : { + "type" : "string", + "description" : "The JSON Pointer to the target document location from which to move the value. Required for the move operation" + }, + "value" : { + "title" : "Patch Value", + "description" : "The value to apply. The remove operation does not require a value" + } + }, + "description" : "The JSON patch object to apply partial updates to resources" + }, "INVALIDINTEGERMAXVALUE3" : { "title" : "INVALID_INTEGER_MAX_VALUE", "properties" : { @@ -3599,123 +3846,57 @@ } } }, - "payment_preferences" : { - "title" : "Payment Preferences", + "LinkDescription" : { + "title" : "Link Description", + "required" : [ "href", "rel" ], "type" : "object", "properties" : { - "auto_bill_outstanding" : { - "type" : "boolean", - "description" : "Indicates whether to automatically bill the outstanding amount in the next billing cycle.", - "default" : true - }, - "setup_fee" : { - "$ref" : "#/components/schemas/money" - }, - "setup_fee_failure_action" : { - "maxLength" : 24, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", + "method" : { "type" : "string", - "description" : "The action to take on the subscription if the initial payment for the setup fails.", - "default" : "CANCEL", - "enum" : [ "CONTINUE", "CANCEL" ] + "description" : "The HTTP method required to make the related call", + "enum" : [ "GET", "POST", "PUT", "DELETE", "HEAD", "CONNECT", "OPTIONS", "PATCH" ] }, - "payment_failure_threshold" : { - "maximum" : 999, - "minimum" : 0, - "type" : "integer", - "description" : "The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail.", - "default" : 0 - } - }, - "description" : "The payment preferences for a subscription." - }, - "subscription_capture_request" : { - "title" : "Charge Amount from Subscriber", - "required" : [ "amount", "capture_type", "note" ], - "type" : "object", - "properties" : { - "note" : { - "maxLength" : 128, - "minLength" : 1, + "rel" : { "type" : "string", - "description" : "The reason or note for the subscription charge." + "description" : "The [link relation type](https://tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](https://www.iana.org/assignments/link-relations/link-relations.xhtml)" }, - "capture_type" : { - "maxLength" : 24, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", + "href" : { "type" : "string", - "description" : "The type of capture.", - "enum" : [ "OUTSTANDING_BALANCE" ] - }, - "amount" : { - "$ref" : "#/components/schemas/money" - } - }, - "description" : "The charge amount from the subscriber." - }, - "transactions_list" : { - "title" : "List Transactions", - "type" : "object", - "properties" : { - "transactions" : { - "maxItems" : 32767, - "minItems" : 0, - "type" : "array", - "description" : "An array of transactions.", - "items" : { - "$ref" : "#/components/schemas/transaction" - } - }, - "total_items" : { - "maximum" : 500000000, - "minimum" : 0, - "type" : "integer", - "description" : "The total number of items." - }, - "total_pages" : { - "maximum" : 100000000, - "minimum" : 0, - "type" : "integer", - "description" : "The total number of pages." - }, - "links" : { - "maxItems" : 10, - "minItems" : 1, - "type" : "array", - "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).", - "readOnly" : true, - "items" : { - "$ref" : "#/components/schemas/link_description" - } + "description" : "The complete target URL. To make the related call, combine the method with this [URI Template-formatted](https://tools.ietf.org/html/rfc6570) link. For pre-processing, include the `$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call" } }, - "description" : "The list transactions for a subscription request details." + "description" : "The request-related [HATEOAS link](/docs/api/reference/api-responses/#hateoas-links) information" }, - "subscriptions.transactions-400" : { + "SubscriptionsCreate400" : { "properties" : { "details" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/Subscriptionstransactions400Details" + "$ref" : "#/components/schemas/Subscriptionscreate400Details" } } } }, - "subscription_cancel_request" : { - "title" : "Cancel Subscription Request", - "required" : [ "reason" ], + "ShippingDetail" : { + "title" : "Shipping Details", "type" : "object", "properties" : { - "reason" : { - "maxLength" : 128, + "address" : { + "$ref" : "#/components/schemas/AddressPortable" + }, + "name" : { + "$ref" : "#/components/schemas/Name" + }, + "type" : { + "maxLength" : 255, "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", "type" : "string", - "description" : "The reason for the cancellation of a subscription." + "description" : "The method by which the payer wants to get their items from the payee e.g shipping, in-person pickup. Either type or options but not both may be present", + "enum" : [ "SHIPPING", "PICKUP_IN_PERSON" ] } }, - "description" : "The cancel subscription request details." + "description" : "The shipping details" }, "INVALIDMETADATAINVOICEID" : { "title" : "INVALID_METADATA_INVOICE_ID", @@ -3730,14 +3911,6 @@ } } }, - "patch_request" : { - "title" : "Patch Request", - "type" : "array", - "description" : "An array of JSON patch objects to apply partial updates to resources.", - "items" : { - "$ref" : "#/components/schemas/patch" - } - }, "INVALIDINTEGERMAXVALUE" : { "title" : "INVALID_INTEGER_MAX_VALUE", "properties" : { @@ -3783,6 +3956,16 @@ "$ref" : "#/components/schemas/AMOUNTGREATERTHANOUTSTANDINGBALANCE1" } ] }, + "PlansCreate400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Planscreate400Details" + } + } + } + }, "PLANSTATUSINVALID1" : { "title" : "PLAN_STATUS_INVALID", "properties" : { @@ -3796,6 +3979,58 @@ } } }, + "LiabilityShift" : { + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "Liability shift indicator. The outcome of the issuer's authentication", + "enum" : [ "YES", "NO", "POSSIBLE", "UNKNOWN" ] + }, + "AmountWithBreakdown" : { + "title" : "Amount with Breakdown", + "required" : [ "gross_amount" ], + "type" : "object", + "properties" : { + "shipping_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "shippingAmount" + }, + "tax_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "taxAmount" + }, + "fee_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "feeAmount" + }, + "total_item_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "totalItemAmount" + }, + "gross_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "grossAmount" + }, + "net_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "netAmount" + } + }, + "description" : "The breakdown details for the amount. Includes the gross, tax, fee, and shipping amounts" + }, "SUBSCRIBERACCOUNTLOCKED" : { "title" : "SUBSCRIBER_ACCOUNT_LOCKED", "properties" : { @@ -3809,6 +4044,66 @@ } } }, + "Money" : { + "title" : "Money", + "required" : [ "currency_code", "value" ], + "type" : "object", + "properties" : { + "value" : { + "maxLength" : 32, + "pattern" : "^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$", + "type" : "string", + "description" : "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](/docs/integration/direct/rest/currency-codes/)" + }, + "currency_code" : { + "allOf" : [ { + "$ref" : "#/components/schemas/CurrencyCode" + } ], + "x-ballerina-name-ignore" : "currencyCode" + } + }, + "description" : "The currency and amount for a financial transaction, such as a balance or payment due" + }, + "UnprocessableEntity" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/422Details" + } + } + } + }, + "LastPaymentDetails" : { + "title" : "Last Payment Details", + "required" : [ "amount", "time" ], + "type" : "object", + "description" : "The details for the last payment", + "allOf" : [ { + "$ref" : "#/components/schemas/LastPaymentDetailsAllOf1" + } ] + }, + "Language" : { + "maxLength" : 10, + "minLength" : 2, + "pattern" : "^[a-z]{2}(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}))?$", + "type" : "string", + "description" : "The [language tag](https://tools.ietf.org/html/bcp47#section-2) for the language in which to localize the error-related strings, such as messages, issues, and suggested actions. The tag is made up of the [ISO 639-2 language code](https://www.loc.gov/standards/iso639-2/php/code_list.php), the optional [ISO-15924 script tag](https://www.unicode.org/iso15924/codelists.html), and the [ISO-3166 alpha-2 country code](/docs/integration/direct/rest/country-codes/)", + "format" : "ppaas_common_language_v3" + }, + "SubscriptionActivateRequest" : { + "title" : "Activate Subscription Request", + "type" : "object", + "properties" : { + "reason" : { + "maxLength" : 128, + "minLength" : 1, + "type" : "string", + "description" : "The reason for activation of a subscription. Required to reactivate the subscription" + } + }, + "description" : "The activate subscription request details" + }, "Subscriptionscapture400Details" : { "anyOf" : [ { "$ref" : "#/components/schemas/MISSINGREQUESTBODY3" @@ -3827,62 +4122,13 @@ "$ref" : "#/components/schemas/PLANSTATUSINVALID" } ] }, - "subscription_request_post" : { - "title" : "Create Subscription Request", - "required" : [ "plan_id" ], - "type" : "object", - "properties" : { - "plan_id" : { - "maxLength" : 50, - "minLength" : 3, - "type" : "string", - "description" : "The ID of the plan." - }, - "start_time" : { - "$ref" : "#/components/schemas/date_time" - }, - "quantity" : { - "maxLength" : 32, - "minLength" : 1, - "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", - "type" : "string", - "description" : "The quantity of the product in the subscription." - }, - "shipping_amount" : { - "$ref" : "#/components/schemas/money" - }, - "subscriber" : { - "$ref" : "#/components/schemas/subscriber_request" - }, - "auto_renewal" : { - "type" : "boolean", - "description" : "DEPRECATED. Indicates whether the subscription auto-renews after the billing cycles complete.", - "deprecated" : true, - "default" : false - }, - "application_context" : { - "$ref" : "#/components/schemas/application_context" - }, - "custom_id" : { - "maxLength" : 127, - "minLength" : 1, - "pattern" : "^[\\x20-\\x7E]+", - "type" : "string", - "description" : "The custom id for the subscription. Can be invoice id." - }, - "plan" : { - "$ref" : "#/components/schemas/plan_override" - } - }, - "description" : "The create subscription request details." - }, "SubscriberRequestAllOf2" : { "properties" : { "shipping_address" : { - "$ref" : "#/components/schemas/shipping_detail" + "$ref" : "#/components/schemas/ShippingDetail" }, "payment_source" : { - "$ref" : "#/components/schemas/payment_source" + "$ref" : "#/components/schemas/PaymentSource" } } }, @@ -3899,21 +4145,67 @@ } } }, - "InlineResponse40010" : { - "allOf" : [ { - "$ref" : "#/components/schemas/error_400" - }, { - "$ref" : "#/components/schemas/subscriptions.capture-400" - } ] - }, - "INVALIDSTRINGMINLENGTH1" : { - "title" : "INVALID_STRING_MIN_LENGTH", + "PricingTier" : { + "title" : "Pricing Tier", + "required" : [ "amount", "starting_quantity" ], + "type" : "object", "properties" : { - "issue" : { + "starting_quantity" : { + "maxLength" : 32, + "minLength" : 1, + "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", "type" : "string", - "enum" : [ "INVALID_STRING_MIN_LENGTH" ] + "description" : "The starting quantity for the tier", + "x-ballerina-name-ignore" : "startingQuantity" }, - "description" : { + "amount" : { + "$ref" : "#/components/schemas/Money" + }, + "ending_quantity" : { + "maxLength" : 32, + "minLength" : 1, + "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", + "type" : "string", + "description" : "The ending quantity for the tier. Optional for the last tier", + "x-ballerina-name-ignore" : "endingQuantity" + } + }, + "description" : "The pricing tier details" + }, + "PayerBase" : { + "title" : "Payer Base", + "type" : "object", + "properties" : { + "email_address" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Email" + } ], + "x-ballerina-name-ignore" : "emailAddress" + }, + "payer_id" : { + "allOf" : [ { + "$ref" : "#/components/schemas/AccountId" + } ], + "x-ballerina-name-ignore" : "payerId" + } + }, + "description" : "The customer who approves and pays for the order. The customer is also known as the payer" + }, + "InlineResponse40010" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/SubscriptionsCapture400" + } ] + }, + "INVALIDSTRINGMINLENGTH1" : { + "title" : "INVALID_STRING_MIN_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MIN_LENGTH" ] + }, + "description" : { "type" : "string", "enum" : [ "The value of a field is too short." ] } @@ -3934,9 +4226,9 @@ }, "InlineResponse40011" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_400" + "$ref" : "#/components/schemas/Error400" }, { - "$ref" : "#/components/schemas/subscriptions.transactions-400" + "$ref" : "#/components/schemas/SubscriptionsTransactions400" } ] }, "SUBSCRIPTIONCANNOTBEACTIVATED1" : { @@ -3965,22 +4257,6 @@ } } }, - "capture_status" : { - "title" : "Capture Status", - "type" : "object", - "properties" : { - "status" : { - "type" : "string", - "description" : "The status of the captured payment.", - "readOnly" : true, - "enum" : [ "COMPLETED", "DECLINED", "PARTIALLY_REFUNDED", "PENDING", "REFUNDED" ] - }, - "status_details" : { - "$ref" : "#/components/schemas/capture_status_details" - } - }, - "description" : "The status of a captured payment." - }, "SUBSCRIPTIONSTATUSINVALID" : { "title" : "SUBSCRIPTION_STATUS_INVALID", "properties" : { @@ -4020,48 +4296,63 @@ } } }, - "money" : { - "title" : "Money", - "required" : [ "currency_code", "value" ], + "PlanCollection" : { + "title" : "Plan Collection", "type" : "object", "properties" : { - "currency_code" : { - "$ref" : "#/components/schemas/currency_code" + "plans" : { + "maxItems" : 32767, + "minItems" : 0, + "type" : "array", + "description" : "An array of plans", + "items" : { + "$ref" : "#/components/schemas/Plan" + } }, - "value" : { - "maxLength" : 32, - "pattern" : "^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$", - "type" : "string", - "description" : "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](/docs/integration/direct/rest/currency-codes/)." + "links" : { + "maxItems" : 10, + "minItems" : 1, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links)", + "readOnly" : true, + "items" : { + "$ref" : "#/components/schemas/LinkDescription" + } + }, + "total_pages" : { + "maximum" : 100000000, + "minimum" : 0, + "type" : "integer", + "description" : "The total number of pages", + "x-ballerina-name-ignore" : "totalPages" + }, + "total_items" : { + "maximum" : 500000000, + "minimum" : 0, + "type" : "integer", + "description" : "The total number of items", + "x-ballerina-name-ignore" : "totalItems" } }, - "description" : "The currency and amount for a financial transaction, such as a balance or payment due." + "description" : "The list of plans with details" }, - "amount_with_breakdown" : { - "title" : "Amount with Breakdown", - "required" : [ "gross_amount" ], - "type" : "object", + "ParesStatus" : { + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "Transactions status result identifier. The outcome of the issuer's authentication", + "enum" : [ "Y", "N", "U", "A", "C", "R", "D", "I" ] + }, + "SubscriptionsPatch422" : { "properties" : { - "gross_amount" : { - "$ref" : "#/components/schemas/money" - }, - "total_item_amount" : { - "$ref" : "#/components/schemas/money" - }, - "fee_amount" : { - "$ref" : "#/components/schemas/money" - }, - "shipping_amount" : { - "$ref" : "#/components/schemas/money" - }, - "tax_amount" : { - "$ref" : "#/components/schemas/money" - }, - "net_amount" : { - "$ref" : "#/components/schemas/money" + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionspatch422Details" + } } - }, - "description" : "The breakdown details for the amount. Includes the gross, tax, fee, and shipping amounts." + } }, "INVALIDPRICINGTIERQUANTITY1" : { "title" : "INVALID_PRICING_TIER_QUANTITY", @@ -4115,81 +4406,53 @@ } } }, - "INVALIDPARAMETERSYNTAX" : { - "title" : "INVALID_PARAMETER_SYNTAX", - "properties" : { - "issue" : { - "type" : "string", - "enum" : [ "INVALID_PARAMETER_SYNTAX" ] - }, - "description" : { - "type" : "string", - "enum" : [ "The value of a field does not conform to the expected format." ] - } - } - }, - "three_d_secure_authentication_response" : { - "title" : "The 3D Secure Authentication Response", - "type" : "object", - "properties" : { - "authentication_status" : { - "$ref" : "#/components/schemas/pares_status" - }, - "enrollment_status" : { - "$ref" : "#/components/schemas/enrolled" - } - }, - "description" : "Results of 3D Secure Authentication." - }, - "error_415" : { - "title" : "Unsupported Media Type Error", + "Error503" : { + "title" : "Service Unavailable Error", "type" : "object", "properties" : { - "name" : { - "type" : "string", - "enum" : [ "UNSUPPORTED_MEDIA_TYPE" ] - }, - "message" : { + "debug_id" : { "type" : "string", - "enum" : [ "The server does not support the request payload's media type." ] - }, - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/error_details" - } + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name-ignore" : "debugId" }, - "debug_id" : { + "name" : { "type" : "string", - "description" : "The PayPal internal ID. Used for correlation purposes." + "enum" : [ "SERVICE_UNAVAILABLE" ] }, "links" : { "maxItems" : 10000, "minItems" : 0, "type" : "array", - "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS).", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", "items" : { - "$ref" : "#/components/schemas/error_link_description" + "$ref" : "#/components/schemas/ErrorLinkDescription" } + }, + "message" : { + "type" : "string", + "enum" : [ "Service Unavailable." ] } }, - "description" : "The server does not support the request payload's media type." + "description" : "The server is temporarily unable to handle the request, for example, because of planned maintenance or downtime", + "example" : { + "name" : "SERVICE_UNAVAILABLE", + "message" : "Service Unavailable.", + "debug_id" : "90957fca61718", + "information_link" : "https://developer.paypal.com/docs/api/orders/v2/#error-SERVICE_UNAVAILABLE" + } }, - "taxes" : { - "title" : "Taxes", - "required" : [ "percentage" ], - "type" : "object", + "INVALIDPARAMETERSYNTAX" : { + "title" : "INVALID_PARAMETER_SYNTAX", "properties" : { - "percentage" : { - "$ref" : "#/components/schemas/percentage" + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_SYNTAX" ] }, - "inclusive" : { - "type" : "boolean", - "description" : "Indicates whether the tax was already included in the billing amount.", - "default" : true + "description" : { + "type" : "string", + "enum" : [ "The value of a field does not conform to the expected format." ] } - }, - "description" : "The tax details." + } }, "UNSUPPORTEDPATCHOPERATION1" : { "title" : "UNSUPPORTED_PATCH_OPERATION", @@ -4204,50 +4467,72 @@ } } }, - "payer" : { - "title" : "Customer", + "PaymentSource" : { + "title" : "Payment Source", "type" : "object", - "description" : "The customer who approves and pays for the order. The customer is also known as the payer.", - "format" : "payer_v1", - "allOf" : [ { - "$ref" : "#/components/schemas/payer_base" - }, { - "$ref" : "#/components/schemas/PayerAllOf2" - } ] + "properties" : { + "card" : { + "$ref" : "#/components/schemas/Card" + } + }, + "description" : "The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (https://www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions" }, - "error_422" : { - "title" : "Unprocessable Entity Error", - "type" : "object", + "CardBrand" : { + "title" : "Card Brand", + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The card network or brand. Applies to credit, debit, gift, and payment cards", + "enum" : [ "VISA", "MASTERCARD", "DISCOVER", "AMEX", "SOLO", "JCB", "STAR", "DELTA", "SWITCH", "MAESTRO", "CB_NATIONALE", "CONFIGOGA", "CONFIDIS", "ELECTRON", "CETELEM", "CHINA_UNION_PAY" ] + }, + "NotFound" : { "properties" : { - "name" : { - "type" : "string", - "enum" : [ "UNPROCESSABLE_ENTITY" ] - }, - "message" : { - "type" : "string", - "enum" : [ "The requested action could not be performed, semantically incorrect, or failed business validation." ] - }, "details" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/error_details" + "$ref" : "#/components/schemas/404Details" } - }, - "debug_id" : { - "type" : "string", - "description" : "The PayPal internal ID. Used for correlation purposes." - }, - "links" : { - "maxItems" : 10000, - "minItems" : 0, + } + } + }, + "Forbidden" : { + "properties" : { + "details" : { "type" : "array", - "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS).", "items" : { - "$ref" : "#/components/schemas/error_link_description" + "$ref" : "#/components/schemas/403Details" } } - }, - "description" : "The requested action cannot be performed and may require interaction with APIs or processes outside of the current request. This is distinct from a 500 response in that there are no systemic problems limiting the API from performing the request." + } + }, + "DateTime" : { + "maxLength" : 64, + "minLength" : 20, + "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$", + "type" : "string", + "description" : "The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
", + "format" : "ppaas_date_time_v3" + }, + "Unauthorized" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/401Details" + } + } + } + }, + "BadRequest" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/400Details" + } + } + } }, "MISSINGPRICINGSCHEMETIERS4" : { "title" : "MISSING_PRICING_SCHEME_TIERS", @@ -4262,67 +4547,28 @@ } } }, - "subscription_status" : { - "title" : "Subscription Status", + "TaxInfo" : { + "title" : "Tax Information", + "required" : [ "tax_id", "tax_id_type" ], "type" : "object", "properties" : { - "status" : { - "maxLength" : 24, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", + "tax_id_type" : { "type" : "string", - "description" : "The status of the subscription.", - "enum" : [ "APPROVAL_PENDING", "APPROVED", "ACTIVE", "SUSPENDED", "CANCELLED", "EXPIRED" ] + "description" : "The customer's tax ID type", + "enum" : [ "BR_CPF", "BR_CNPJ" ], + "x-ballerina-name-ignore" : "taxIdType" }, - "status_change_note" : { - "maxLength" : 128, - "minLength" : 1, + "tax_id" : { + "maxLength" : 14, "type" : "string", - "description" : "The reason or notes for the status of the subscription." - }, - "status_update_time" : { - "$ref" : "#/components/schemas/date_time" + "description" : "The customer's tax ID value", + "x-ballerina-name-ignore" : "taxId" } }, - "description" : "The subscription status details." + "description" : "The tax ID of the customer. The customer is also known as the payer. Both `tax_id` and `tax_id_type` are required" }, - "subscriptions.activate-422" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionsactivate422Details" - } - } - } - }, - "pricing_tier" : { - "title" : "Pricing Tier", - "required" : [ "amount", "starting_quantity" ], - "type" : "object", - "properties" : { - "starting_quantity" : { - "maxLength" : 32, - "minLength" : 1, - "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", - "type" : "string", - "description" : "The starting quantity for the tier." - }, - "ending_quantity" : { - "maxLength" : 32, - "minLength" : 1, - "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", - "type" : "string", - "description" : "The ending quantity for the tier. Optional for the last tier." - }, - "amount" : { - "$ref" : "#/components/schemas/money" - } - }, - "description" : "The pricing tier details." - }, - "MISSINGPRICINGSCHEMETIERS1" : { - "title" : "MISSING_PRICING_SCHEME_TIERS", + "MISSINGPRICINGSCHEMETIERS1" : { + "title" : "MISSING_PRICING_SCHEME_TIERS", "properties" : { "issue" : { "type" : "string", @@ -4360,15 +4606,66 @@ } } }, - "payment_source" : { - "title" : "Payment Source", + "SubscriptionRequestPost" : { + "title" : "Create Subscription Request", + "required" : [ "plan_id" ], "type" : "object", "properties" : { - "card" : { - "$ref" : "#/components/schemas/card" + "shipping_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "shippingAmount" + }, + "start_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name-ignore" : "startTime" + }, + "quantity" : { + "maxLength" : 32, + "minLength" : 1, + "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", + "type" : "string", + "description" : "The quantity of the product in the subscription" + }, + "subscriber" : { + "$ref" : "#/components/schemas/SubscriberRequest" + }, + "custom_id" : { + "maxLength" : 127, + "minLength" : 1, + "pattern" : "^[\\x20-\\x7E]+", + "type" : "string", + "description" : "The custom id for the subscription. Can be invoice id", + "x-ballerina-name-ignore" : "customId" + }, + "application_context" : { + "allOf" : [ { + "$ref" : "#/components/schemas/ApplicationContext" + } ], + "x-ballerina-name-ignore" : "applicationContext" + }, + "plan" : { + "$ref" : "#/components/schemas/PlanOverride" + }, + "plan_id" : { + "maxLength" : 50, + "minLength" : 3, + "type" : "string", + "description" : "The ID of the plan", + "x-ballerina-name-ignore" : "planId" + }, + "auto_renewal" : { + "type" : "boolean", + "description" : "DEPRECATED. Indicates whether the subscription auto-renews after the billing cycles complete", + "deprecated" : true, + "default" : false, + "x-ballerina-name-ignore" : "autoRenewal" } }, - "description" : "The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (https://www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions." + "description" : "The create subscription request details" }, "MISSINGPRICINGSCHEMETIERS2" : { "title" : "MISSING_PRICING_SCHEME_TIERS", @@ -4383,81 +4680,53 @@ } } }, - "plan" : { - "title" : "Plan", + "Subscription" : { + "title" : "Subscription", + "type" : "object", + "description" : "The subscription details", + "allOf" : [ { + "$ref" : "#/components/schemas/SubscriptionStatus" + }, { + "$ref" : "#/components/schemas/SubscriptionAllOf2" + } ] + }, + "Error500" : { + "title" : "Internal Server Error", "type" : "object", "properties" : { - "id" : { - "maxLength" : 50, - "minLength" : 3, - "type" : "string", - "description" : "The unique PayPal-generated ID for the plan.", - "readOnly" : true - }, - "product_id" : { - "maxLength" : 50, - "minLength" : 6, + "debug_id" : { "type" : "string", - "description" : "The ID for the product." + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name-ignore" : "debugId" }, "name" : { - "maxLength" : 127, - "minLength" : 1, - "type" : "string", - "description" : "The plan name." - }, - "status" : { - "maxLength" : 24, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", - "type" : "string", - "description" : "The plan status.", - "enum" : [ "CREATED", "INACTIVE", "ACTIVE" ] - }, - "description" : { - "maxLength" : 127, - "minLength" : 1, "type" : "string", - "description" : "The detailed description of the plan." - }, - "billing_cycles" : { - "maxItems" : 12, - "minItems" : 1, - "type" : "array", - "description" : "An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle.", - "items" : { - "$ref" : "#/components/schemas/billing_cycle" - } - }, - "payment_preferences" : { - "$ref" : "#/components/schemas/payment_preferences" - }, - "taxes" : { - "$ref" : "#/components/schemas/taxes" - }, - "quantity_supported" : { - "type" : "boolean", - "description" : "Indicates whether you can subscribe to this plan by providing a quantity for the goods or service.", - "default" : false - }, - "create_time" : { - "$ref" : "#/components/schemas/date_time" - }, - "update_time" : { - "$ref" : "#/components/schemas/date_time" + "enum" : [ "INTERNAL_SERVER_ERROR" ] }, "links" : { - "maxItems" : 10, - "minItems" : 1, + "maxItems" : 10000, + "minItems" : 0, "type" : "array", - "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).", - "readOnly" : true, + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", "items" : { - "$ref" : "#/components/schemas/link_description" + "$ref" : "#/components/schemas/ErrorLinkDescription" } + }, + "message" : { + "type" : "string", + "enum" : [ "An internal server error occurred." ] } }, - "description" : "The plan details." + "description" : "This is either a system or application error, and generally indicates that although the client appeared to provide a correct request, something unexpected has gone wrong on the server", + "example" : { + "name" : "INTERNAL_SERVER_ERROR", + "message" : "An internal server error occurred.", + "debug_id" : "90957fca61718", + "links" : [ { + "href" : "https://developer.paypal.com/api/orders/v2/#error-INTERNAL_SERVER_ERROR", + "rel" : "information_link" + } ] + } }, "Subscriptionsactivate400Details" : { "anyOf" : [ { @@ -4490,16 +4759,6 @@ } } }, - "subscriber" : { - "title" : "Subscriber Response Information", - "type" : "object", - "description" : "The subscriber response information.", - "allOf" : [ { - "$ref" : "#/components/schemas/payer" - }, { - "$ref" : "#/components/schemas/SubscriberAllOf2" - } ] - }, "CURRENCYMISMATCH" : { "title" : "CURRENCY_MISMATCH", "properties" : { @@ -4565,16 +4824,6 @@ } } }, - "plans.patch-422" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Planspatch422Details" - } - } - } - }, "INVALIDPARAMETERSYNTAX2" : { "title" : "INVALID_PARAMETER_SYNTAX", "properties" : { @@ -4588,74 +4837,6 @@ } } }, - "error_403" : { - "title" : "Not Authorized Error", - "type" : "object", - "properties" : { - "name" : { - "type" : "string", - "enum" : [ "NOT_AUTHORIZED" ] - }, - "message" : { - "type" : "string", - "enum" : [ "Authorization failed due to insufficient permissions." ] - }, - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/error_details" - } - }, - "debug_id" : { - "type" : "string", - "description" : "The PayPal internal ID. Used for correlation purposes." - }, - "links" : { - "maxItems" : 10000, - "minItems" : 0, - "type" : "array", - "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS).", - "items" : { - "$ref" : "#/components/schemas/error_link_description" - } - } - }, - "description" : "The client is not authorized to access this resource, although it may have valid credentials. " - }, - "error_404" : { - "title" : "Not found Error", - "type" : "object", - "properties" : { - "name" : { - "type" : "string", - "enum" : [ "RESOURCE_NOT_FOUND" ] - }, - "message" : { - "type" : "string", - "enum" : [ "The specified resource does not exist." ] - }, - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/error_details" - } - }, - "debug_id" : { - "type" : "string", - "description" : "The PayPal internal ID. Used for correlation purposes." - }, - "links" : { - "maxItems" : 10000, - "minItems" : 0, - "type" : "array", - "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS).", - "items" : { - "$ref" : "#/components/schemas/error_link_description" - } - } - }, - "description" : "The server has not found anything matching the request URI. This either means that the URI is incorrect or the resource is not available." - }, "INVALIDRESOURCEID" : { "title" : "INVALID_RESOURCE_ID", "properties" : { @@ -4721,39 +4902,13 @@ } } }, - "error_409" : { - "title" : "Resource Conflict Error", - "type" : "object", - "properties" : { - "name" : { - "type" : "string", - "enum" : [ "RESOURCE_CONFLICT" ] - }, - "message" : { - "type" : "string", - "enum" : [ "The server has detected a conflict while processing this request." ] - }, - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/error_details" - } - }, - "debug_id" : { - "type" : "string", - "description" : "The PayPal internal ID. Used for correlation purposes." - }, - "links" : { - "maxItems" : 10000, - "minItems" : 0, - "type" : "array", - "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS).", - "items" : { - "$ref" : "#/components/schemas/error_link_description" - } - } - }, - "description" : "The server has detected a conflict while processing this request." + "EmailAddress" : { + "maxLength" : 254, + "minLength" : 3, + "pattern" : "^.+@[^\"\\-].+$", + "type" : "string", + "description" : "The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
", + "format" : "ppaas_common_email_address_v2" }, "FIXEDPRICENOTSUPPORTED1" : { "title" : "FIXED_PRICE_NOT_SUPPORTED", @@ -4768,245 +4923,165 @@ } } }, - "400" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/400Details" - } - } - } - }, - "401" : { + "Card" : { + "title" : "Card", + "required" : [ "expiry", "number" ], + "type" : "object", "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/401Details" - } - } - } - }, - "phone" : { - "title" : "Phone", - "required" : [ "country_code", "national_number" ], - "type" : "object", - "properties" : { - "country_code" : { - "maxLength" : 3, - "minLength" : 1, - "pattern" : "^[0-9]{1,3}?$", + "number" : { + "maxLength" : 19, + "minLength" : 13, "type" : "string", - "description" : "The country calling code (CC), in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the CC and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN)." + "description" : "The primary account number (PAN) for the payment card" }, - "national_number" : { - "maxLength" : 14, - "minLength" : 1, - "pattern" : "^[0-9]{1,14}?$", + "security_code" : { + "pattern" : "[0-9]{3,4}", "type" : "string", - "description" : "The national number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the country calling code (CC) and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN)." + "description" : "The three- or four-digit security code of the card. Also known as the CVV, CVC, CVN, CVE, or CID. This parameter cannot be present in the request when `payment_initiator=MERCHANT`", + "x-ballerina-name-ignore" : "securityCode" }, - "extension_number" : { - "maxLength" : 15, - "minLength" : 1, - "pattern" : "^[0-9]{1,15}?$", + "name" : { + "maxLength" : 300, + "type" : "string", + "description" : "The card holder's name as it appears on the card" + }, + "billing_address" : { + "allOf" : [ { + "$ref" : "#/components/schemas/AddressPortable" + } ], + "x-ballerina-name-ignore" : "billingAddress" + }, + "id" : { "type" : "string", - "description" : "The extension number." + "description" : "The PayPal-generated ID for the card", + "readOnly" : true + }, + "expiry" : { + "$ref" : "#/components/schemas/DateYearMonth" + }, + "card_type" : { + "allOf" : [ { + "$ref" : "#/components/schemas/CardBrand" + } ], + "x-ballerina-name-ignore" : "cardType" + }, + "last_digits" : { + "pattern" : "[0-9]{2,}", + "type" : "string", + "description" : "The last digits of the payment card", + "readOnly" : true, + "x-ballerina-name-ignore" : "lastDigits" } }, - "description" : "The phone number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en)." + "description" : "The payment card to use to fund a payment. Can be a credit or debit card" }, "InlineResponse4001" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_400" + "$ref" : "#/components/schemas/Error400" }, { - "$ref" : "#/components/schemas/plans.create-400" + "$ref" : "#/components/schemas/PlansCreate400" } ] }, - "403" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/403Details" - } - } - } - }, - "404" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/404Details" - } - } - } - }, "InlineResponse4003" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_400" + "$ref" : "#/components/schemas/Error400" }, { - "$ref" : "#/components/schemas/plans.update-pricing-schemes-400" + "$ref" : "#/components/schemas/PlansUpdatePricingSchemes400" } ] }, "InlineResponse4002" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_400" + "$ref" : "#/components/schemas/Error400" }, { - "$ref" : "#/components/schemas/plans.patch-400" + "$ref" : "#/components/schemas/PlansPatch400" } ] }, "InlineResponse4005" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_400" + "$ref" : "#/components/schemas/Error400" }, { - "$ref" : "#/components/schemas/subscriptions.patch-400" + "$ref" : "#/components/schemas/SubscriptionsPatch400" } ] }, "InlineResponse4004" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_400" + "$ref" : "#/components/schemas/Error400" }, { - "$ref" : "#/components/schemas/subscriptions.create-400" + "$ref" : "#/components/schemas/SubscriptionsCreate400" } ] }, "InlineResponse4007" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_400" + "$ref" : "#/components/schemas/Error400" }, { - "$ref" : "#/components/schemas/subscriptions.suspend-400" + "$ref" : "#/components/schemas/SubscriptionsSuspend400" } ] }, + "SubscriptionsPatch400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionspatch400Details" + } + } + } + }, "InlineResponse4006" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_400" + "$ref" : "#/components/schemas/Error400" }, { - "$ref" : "#/components/schemas/subscriptions.revise-400" + "$ref" : "#/components/schemas/SubscriptionsRevise400" } ] }, - "card" : { - "title" : "Card", - "required" : [ "expiry", "number" ], - "type" : "object", - "properties" : { - "id" : { - "type" : "string", - "description" : "The PayPal-generated ID for the card.", - "readOnly" : true - }, - "name" : { - "maxLength" : 300, - "type" : "string", - "description" : "The card holder's name as it appears on the card." - }, - "number" : { - "maxLength" : 19, - "minLength" : 13, - "type" : "string", - "description" : "The primary account number (PAN) for the payment card." - }, - "expiry" : { - "$ref" : "#/components/schemas/date_year_month" - }, - "security_code" : { - "pattern" : "[0-9]{3,4}", - "type" : "string", - "description" : "The three- or four-digit security code of the card. Also known as the CVV, CVC, CVN, CVE, or CID. This parameter cannot be present in the request when `payment_initiator=MERCHANT`." - }, - "last_digits" : { - "pattern" : "[0-9]{2,}", - "type" : "string", - "description" : "The last digits of the payment card.", - "readOnly" : true - }, - "card_type" : { - "$ref" : "#/components/schemas/card_brand" - }, - "billing_address" : { - "$ref" : "#/components/schemas/address_portable" - } - }, - "description" : "The payment card to use to fund a payment. Can be a credit or debit card." - }, "InlineResponse4009" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_400" + "$ref" : "#/components/schemas/Error400" }, { - "$ref" : "#/components/schemas/subscriptions.activate-400" + "$ref" : "#/components/schemas/SubscriptionsActivate400" } ] }, - "payer_base" : { - "title" : "Payer Base", - "type" : "object", - "properties" : { - "email_address" : { - "$ref" : "#/components/schemas/email" - }, - "payer_id" : { - "$ref" : "#/components/schemas/account_id" - } - }, - "description" : "The customer who approves and pays for the order. The customer is also known as the payer." + "InlineResponse4008" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/SubscriptionsCancel400" + } ] }, - "cycle_execution" : { - "title" : "Billing Cycle Execution Details", - "required" : [ "cycles_completed", "sequence", "tenure_type" ], + "Error404" : { + "title" : "Not found Error", "type" : "object", "properties" : { - "tenure_type" : { - "maxLength" : 24, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", + "debug_id" : { "type" : "string", - "description" : "The type of the billing cycle.", - "readOnly" : true, - "enum" : [ "REGULAR", "TRIAL" ] + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name-ignore" : "debugId" }, - "sequence" : { - "maximum" : 99, - "minimum" : 0, - "type" : "integer", - "description" : "The order in which to run this cycle among other billing cycles." - }, - "cycles_completed" : { - "maximum" : 9999, - "minimum" : 0, - "type" : "integer", - "description" : "The number of billing cycles that have completed.", - "readOnly" : true + "name" : { + "type" : "string", + "enum" : [ "RESOURCE_NOT_FOUND" ] }, - "cycles_remaining" : { - "maximum" : 9999, - "minimum" : 0, - "type" : "integer", - "description" : "For a finite billing cycle, cycles_remaining is the number of remaining cycles. For an infinite billing cycle, cycles_remaining is set as 0.", - "readOnly" : true + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } }, - "current_pricing_scheme_version" : { - "maximum" : 99, - "minimum" : 1, - "type" : "integer", - "description" : "The active pricing scheme version for the billing cycle.", - "readOnly" : true + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } }, - "total_cycles" : { - "maximum" : 999, - "minimum" : 0, - "type" : "integer", - "description" : "The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles).", - "readOnly" : true + "message" : { + "type" : "string", + "enum" : [ "The specified resource does not exist." ] } }, - "description" : "The regular and trial execution details for a billing cycle." - }, - "InlineResponse4008" : { - "allOf" : [ { - "$ref" : "#/components/schemas/error_400" - }, { - "$ref" : "#/components/schemas/subscriptions.cancel-400" - } ] + "description" : "The server has not found anything matching the request URI. This either means that the URI is incorrect or the resource is not available" }, "MISSINGREQUIREDPARAMETER5" : { "title" : "MISSING_REQUIRED_PARAMETER", @@ -5021,6 +5096,41 @@ } } }, + "Error409" : { + "title" : "Resource Conflict Error", + "type" : "object", + "properties" : { + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name-ignore" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "RESOURCE_CONFLICT" ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "The server has detected a conflict while processing this request." ] + } + }, + "description" : "The server has detected a conflict while processing this request" + }, "AMOUNTGREATERTHANOUTSTANDINGBALANCE" : { "title" : "AMOUNT_GREATER_THAN_OUTSTANDING_BALANCE", "properties" : { @@ -5072,6 +5182,16 @@ "$ref" : "#/components/schemas/CURRENCYMISMATCH4" } ] }, + "SubscriptionsCancel400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscancel400Details" + } + } + } + }, "MISSINGREQUIREDPARAMETER6" : { "title" : "MISSING_REQUIRED_PARAMETER", "properties" : { @@ -5098,183 +5218,325 @@ } } }, - "subscription" : { - "title" : "Subscription", - "type" : "object", - "description" : "The subscription details.", - "allOf" : [ { - "$ref" : "#/components/schemas/subscription_status" - }, { - "$ref" : "#/components/schemas/SubscriptionAllOf2" - } ] + "MISSINGREQUIREDPARAMETER1" : { + "title" : "MISSING_REQUIRED_PARAMETER", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + }, + "description" : { + "type" : "string", + "enum" : [ "A required field is missing." ] + } + } }, - "currency_code" : { - "maxLength" : 3, - "minLength" : 3, - "type" : "string", - "description" : "The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency.", - "format" : "ppaas_common_currency_code_v2" + "MISSINGREQUIREDPARAMETER3" : { + "title" : "MISSING_REQUIRED_PARAMETER", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + }, + "description" : { + "type" : "string", + "enum" : [ "A required field is missing." ] + } + } }, - "update_pricing_scheme_request" : { - "title" : "Update Pricing Scheme", - "required" : [ "billing_cycle_sequence", "pricing_scheme" ], - "type" : "object", + "MISSINGREQUIREDPARAMETER2" : { + "title" : "MISSING_REQUIRED_PARAMETER", "properties" : { - "billing_cycle_sequence" : { - "maximum" : 99, - "minimum" : 1, - "type" : "integer", - "description" : "The billing cycle sequence." + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] }, - "pricing_scheme" : { - "$ref" : "#/components/schemas/pricing_scheme" + "description" : { + "type" : "string", + "enum" : [ "A required field is missing." ] } - }, - "description" : "The update pricing scheme request details." + } }, - "error_details" : { - "title" : "Error Details", - "required" : [ "issue" ], + "Error400" : { + "title" : "Bad Request Error", "type" : "object", "properties" : { - "field" : { + "debug_id" : { "type" : "string", - "description" : "The field that caused the error. If this field is in the body, set this value to the field's JSON pointer value. Required for client-side errors." + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name-ignore" : "debugId" }, - "value" : { + "name" : { "type" : "string", - "description" : "The value of the field that caused the error." + "enum" : [ "INVALID_REQUEST" ] }, - "location" : { - "$ref" : "#/components/schemas/error_location" + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } }, - "issue" : { - "type" : "string", - "description" : "The unique, fine-grained application-level error code." + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } }, - "description" : { + "message" : { "type" : "string", - "description" : "The human-readable description for an issue. The description can change over the lifetime of an API, so clients must not depend on this value." + "enum" : [ "Request is not well-formed, syntactically incorrect, or violates schema." ] } }, - "description" : "The error details. Required for client-side `4XX` errors." + "description" : "Request is not well-formed, syntactically incorrect, or violates schema" }, - "plan_override" : { - "title" : "Plan Override", + "Error401" : { + "title" : "Unauthorized Error", "type" : "object", "properties" : { - "billing_cycles" : { - "maxItems" : 12, - "minItems" : 1, + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name-ignore" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "AUTHENTICATION_FAILURE" ] + }, + "details" : { "type" : "array", - "description" : "An array of billing cycles for trial billing and regular billing. The subscription billing cycle definition has to adhere to the plan billing cycle definition.", "items" : { - "$ref" : "#/components/schemas/billing_cycle_override" + "$ref" : "#/components/schemas/ErrorDetails" } }, - "payment_preferences" : { - "$ref" : "#/components/schemas/payment_preferences_override" + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } }, - "taxes" : { - "$ref" : "#/components/schemas/taxes_override" + "message" : { + "type" : "string", + "enum" : [ "Authentication failed due to missing authorization header, or invalid authentication credentials." ] } }, - "description" : "An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object." + "description" : "Authentication failed due to missing Authorization header, or invalid authentication credentials" }, - "MISSINGREQUIREDPARAMETER1" : { - "title" : "MISSING_REQUIRED_PARAMETER", + "Error403" : { + "title" : "Not Authorized Error", + "type" : "object", "properties" : { - "issue" : { + "debug_id" : { "type" : "string", - "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name-ignore" : "debugId" }, - "description" : { + "name" : { "type" : "string", - "enum" : [ "A required field is missing." ] + "enum" : [ "NOT_AUTHORIZED" ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "Authorization failed due to insufficient permissions." ] } - } + }, + "description" : "The client is not authorized to access this resource, although it may have valid credentials. " }, - "MISSINGREQUIREDPARAMETER3" : { - "title" : "MISSING_REQUIRED_PARAMETER", + "Error415" : { + "title" : "Unsupported Media Type Error", + "type" : "object", "properties" : { - "issue" : { + "debug_id" : { "type" : "string", - "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name-ignore" : "debugId" }, - "description" : { + "name" : { "type" : "string", - "enum" : [ "A required field is missing." ] + "enum" : [ "UNSUPPORTED_MEDIA_TYPE" ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "The server does not support the request payload's media type." ] } - } - }, - "pares_status" : { - "maxLength" : 255, - "minLength" : 1, - "pattern" : "^[0-9A-Z_]+$", - "type" : "string", - "description" : "Transactions status result identifier. The outcome of the issuer's authentication.", - "enum" : [ "Y", "N", "U", "A", "C", "R", "D", "I" ] + }, + "description" : "The server does not support the request payload's media type" }, - "MISSINGREQUIREDPARAMETER2" : { - "title" : "MISSING_REQUIRED_PARAMETER", + "PLANSTATUSINACTIVE" : { + "title" : "PLAN_STATUS_INACTIVE", "properties" : { "issue" : { "type" : "string", - "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + "enum" : [ "PLAN_STATUS_INACTIVE" ] }, "description" : { "type" : "string", - "enum" : [ "A required field is missing." ] + "enum" : [ "Status update is the only patchable filed on an inactive plan." ] } } }, - "PLANSTATUSINACTIVE" : { - "title" : "PLAN_STATUS_INACTIVE", + "Percentage" : { + "pattern" : "^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$", + "type" : "string", + "description" : "The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99`", + "format" : "ppaas_common_percentage_v2" + }, + "Planspatch400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/UNSUPPORTEDPATCHOPERATION" + }, { + "$ref" : "#/components/schemas/INVALIDPATCHPATH" + }, { + "$ref" : "#/components/schemas/INVALIDPATCHPATH1" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERSYNTAX1" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE2" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE3" + } ] + }, + "Plan" : { + "title" : "Plan", + "type" : "object", "properties" : { - "issue" : { + "quantity_supported" : { + "type" : "boolean", + "description" : "Indicates whether you can subscribe to this plan by providing a quantity for the goods or service", + "default" : false, + "x-ballerina-name-ignore" : "quantitySupported" + }, + "update_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name-ignore" : "updateTime" + }, + "create_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name-ignore" : "createTime" + }, + "payment_preferences" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PaymentPreferences" + } ], + "x-ballerina-name-ignore" : "paymentPreferences" + }, + "product_id" : { + "maxLength" : 50, + "minLength" : 6, "type" : "string", - "enum" : [ "PLAN_STATUS_INACTIVE" ] + "description" : "The ID for the product", + "x-ballerina-name-ignore" : "productId" + }, + "name" : { + "maxLength" : 127, + "minLength" : 1, + "type" : "string", + "description" : "The plan name" + }, + "billing_cycles" : { + "maxItems" : 12, + "minItems" : 1, + "type" : "array", + "description" : "An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle", + "items" : { + "$ref" : "#/components/schemas/BillingCycle" + }, + "x-ballerina-name-ignore" : "billingCycles" }, "description" : { + "maxLength" : 127, + "minLength" : 1, "type" : "string", - "enum" : [ "Status update is the only patchable filed on an inactive plan." ] - } - } - }, - "plans.patch-400" : { - "properties" : { - "details" : { + "description" : "The detailed description of the plan" + }, + "taxes" : { + "$ref" : "#/components/schemas/Taxes" + }, + "links" : { + "maxItems" : 10, + "minItems" : 1, "type" : "array", + "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links)", + "readOnly" : true, "items" : { - "$ref" : "#/components/schemas/Planspatch400Details" + "$ref" : "#/components/schemas/LinkDescription" } + }, + "id" : { + "maxLength" : 50, + "minLength" : 3, + "type" : "string", + "description" : "The unique PayPal-generated ID for the plan", + "readOnly" : true + }, + "status" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The plan status", + "enum" : [ "CREATED", "INACTIVE", "ACTIVE" ] } - } - }, - "Planspatch400Details" : { - "anyOf" : [ { - "$ref" : "#/components/schemas/UNSUPPORTEDPATCHOPERATION" - }, { - "$ref" : "#/components/schemas/INVALIDPATCHPATH" - }, { - "$ref" : "#/components/schemas/INVALIDPATCHPATH1" - }, { - "$ref" : "#/components/schemas/INVALIDPARAMETERSYNTAX1" - }, { - "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE2" - }, { - "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE3" - } ] + }, + "description" : "The plan details" }, - "plans.deactivate-422" : { + "AuthenticationResponse" : { + "title" : "Authentication Response", + "type" : "object", "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Plansdeactivate422Details" - } + "liability_shift" : { + "allOf" : [ { + "$ref" : "#/components/schemas/LiabilityShift" + } ], + "x-ballerina-name-ignore" : "liabilityShift" + }, + "three_d_secure" : { + "allOf" : [ { + "$ref" : "#/components/schemas/ThreeDSecureAuthenticationResponse" + } ], + "x-ballerina-name-ignore" : "threeDSecure" } - } + }, + "description" : "Results of Authentication such as 3D Secure" }, "USERACCOUNTCLOSED7" : { "title" : "USER_ACCOUNT_CLOSED", @@ -5341,16 +5603,6 @@ } } }, - "422" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/422Details" - } - } - } - }, "SUBSCRIPTIONSTATUSINVALID1" : { "title" : "SUBSCRIPTION_STATUS_INVALID", "properties" : { @@ -5455,17 +5707,6 @@ } } }, - "transaction" : { - "title" : "Transaction Details", - "required" : [ "amount_with_breakdown", "id", "time" ], - "type" : "object", - "description" : "The transaction details.", - "allOf" : [ { - "$ref" : "#/components/schemas/capture_status" - }, { - "$ref" : "#/components/schemas/TransactionAllOf2" - } ] - }, "USERACCOUNTCLOSED" : { "title" : "USER_ACCOUNT_CLOSED", "properties" : { @@ -5505,11 +5746,31 @@ } } }, + "SubscriptionReviseResponse" : { + "title" : "Update Product Quantity in Subscription Response", + "type" : "object", + "description" : "The response to a request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent", + "allOf" : [ { + "$ref" : "#/components/schemas/SubscriptionReviseRequest" + }, { + "$ref" : "#/components/schemas/SubscriptionReviseResponseAllOf2" + } ] + }, + "SubscriptionsCancel422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscancel422Details" + } + } + } + }, "InlineResponse422" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_422" + "$ref" : "#/components/schemas/Error422" }, { - "$ref" : "#/components/schemas/422" + "$ref" : "#/components/schemas/UnprocessableEntity" } ] }, "INVALIDPATCHPATH1" : { @@ -5538,27 +5799,6 @@ } } }, - "link_description" : { - "title" : "Link Description", - "required" : [ "href", "rel" ], - "type" : "object", - "properties" : { - "href" : { - "type" : "string", - "description" : "The complete target URL. To make the related call, combine the method with this [URI Template-formatted](https://tools.ietf.org/html/rfc6570) link. For pre-processing, include the `$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call." - }, - "rel" : { - "type" : "string", - "description" : "The [link relation type](https://tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](https://www.iana.org/assignments/link-relations/link-relations.xhtml)." - }, - "method" : { - "type" : "string", - "description" : "The HTTP method required to make the related call.", - "enum" : [ "GET", "POST", "PUT", "DELETE", "HEAD", "CONNECT", "OPTIONS", "PATCH" ] - } - }, - "description" : "The request-related [HATEOAS link](/docs/api/reference/api-responses/#hateoas-links) information." - }, "INVALIDPATCHPATH3" : { "title" : "INVALID_PATCH_PATH", "properties" : { @@ -5572,6 +5812,16 @@ } } }, + "SubscriptionsCapture400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscapture400Details" + } + } + } + }, "TransactionAllOf2" : { "properties" : { "id" : { @@ -5582,16 +5832,16 @@ "readOnly" : true }, "amount_with_breakdown" : { - "$ref" : "#/components/schemas/amount_with_breakdown" + "$ref" : "#/components/schemas/AmountWithBreakdown" }, "payer_name" : { - "$ref" : "#/components/schemas/name" + "$ref" : "#/components/schemas/Name" }, "payer_email" : { - "$ref" : "#/components/schemas/email_address" + "$ref" : "#/components/schemas/EmailAddress" }, "time" : { - "$ref" : "#/components/schemas/date_time" + "$ref" : "#/components/schemas/DateTime" } } }, @@ -5621,50 +5871,39 @@ } } }, - "date_time" : { - "maxLength" : 64, - "minLength" : 20, - "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$", - "type" : "string", - "description" : "The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
", - "format" : "ppaas_date_time_v3" - }, - "error_500" : { - "title" : "Internal Server Error", + "CaptureStatusDetails" : { + "title" : "Capture Status Details", "type" : "object", "properties" : { - "name" : { - "type" : "string", - "enum" : [ "INTERNAL_SERVER_ERROR" ] - }, - "message" : { - "type" : "string", - "enum" : [ "An internal server error occurred." ] - }, - "debug_id" : { + "reason" : { "type" : "string", - "description" : "The PayPal internal ID. Used for correlation purposes." - }, - "links" : { - "maxItems" : 10000, - "minItems" : 0, - "type" : "array", - "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS).", - "items" : { - "$ref" : "#/components/schemas/error_link_description" - } + "description" : "The reason why the captured payment status is `PENDING` or `DENIED`", + "enum" : [ "BUYER_COMPLAINT", "CHARGEBACK", "ECHECK", "INTERNATIONAL_WITHDRAWAL", "OTHER", "PENDING_REVIEW", "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION", "REFUNDED", "TRANSACTION_APPROVED_AWAITING_FUNDING", "UNILATERAL", "VERIFICATION_REQUIRED" ] } }, - "description" : "This is either a system or application error, and generally indicates that although the client appeared to provide a correct request, something unexpected has gone wrong on the server.", - "example" : { - "name" : "INTERNAL_SERVER_ERROR", - "message" : "An internal server error occurred.", - "debug_id" : "90957fca61718", - "links" : [ { - "href" : "https://developer.paypal.com/api/orders/v2/#error-INTERNAL_SERVER_ERROR", - "rel" : "information_link" - } ] - } + "description" : "The details of the captured payment status" + }, + "ErrorDefault" : { + "description" : "The default error response", + "oneOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/Error401" + }, { + "$ref" : "#/components/schemas/Error403" + }, { + "$ref" : "#/components/schemas/Error404" + }, { + "$ref" : "#/components/schemas/Error409" + }, { + "$ref" : "#/components/schemas/Error415" + }, { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/Error500" + }, { + "$ref" : "#/components/schemas/Error503" + } ] }, "MISSINGPRICINGSCHEMETIERS" : { "title" : "MISSING_PRICING_SCHEME_TIERS", @@ -5679,36 +5918,47 @@ } } }, - "percentage" : { - "pattern" : "^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$", + "DateYearMonth" : { + "maxLength" : 7, + "minLength" : 7, + "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])$", "type" : "string", - "description" : "The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99`.", - "format" : "ppaas_common_percentage_v2" + "description" : "The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6)" }, - "payment_method" : { - "title" : "Payment Method", + "Error422" : { + "title" : "Unprocessable Entity Error", "type" : "object", "properties" : { - "payer_selected" : { - "minLength" : 1, - "pattern" : "^[0-9A-Z_]+$", + "debug_id" : { "type" : "string", - "description" : "The customer-selected payment method on the merchant site.", - "default" : "PAYPAL" + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name-ignore" : "debugId" }, - "payee_preferred" : { - "$ref" : "#/components/schemas/payee_payment_method_preference" + "name" : { + "type" : "string", + "enum" : [ "UNPROCESSABLE_ENTITY" ] }, - "standard_entry_class_code" : { - "maxLength" : 255, - "minLength" : 3, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { "type" : "string", - "description" : "NACHA (the regulatory body governing the ACH network) requires that API callers (merchants, partners) obtain the consumer’s explicit authorization before initiating a transaction. To stay compliant, you’ll need to make sure that you retain a compliant authorization for each transaction that you originate to the ACH Network using this API. ACH transactions are categorized (using SEC codes) by how you capture authorization from the Receiver (the person whose bank account is being debited or credited). PayPal supports the following SEC codes.", - "default" : "WEB", - "enum" : [ "TEL", "WEB", "CCD", "PPD" ] + "enum" : [ "The requested action could not be performed, semantically incorrect, or failed business validation." ] } }, - "description" : "The customer and merchant payment preferences." + "description" : "The requested action cannot be performed and may require interaction with APIs or processes outside of the current request. This is distinct from a 500 response in that there are no systemic problems limiting the API from performing the request" }, "MISSINGREQUESTBODY" : { "title" : "MISSING_REQUEST_BODY", @@ -5756,6 +6006,27 @@ "$ref" : "#/components/schemas/CURRENCYMISMATCH3" } ] }, + "Payer" : { + "title" : "Customer", + "type" : "object", + "description" : "The customer who approves and pays for the order. The customer is also known as the payer", + "format" : "payer_v1", + "allOf" : [ { + "$ref" : "#/components/schemas/PayerBase" + }, { + "$ref" : "#/components/schemas/PayerAllOf2" + } ] + }, + "PlansActivate422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Plansactivate422Details" + } + } + } + }, "USERACCOUNTCLOSED10" : { "title" : "USER_ACCOUNT_CLOSED", "properties" : { @@ -5782,19 +6053,15 @@ } } }, - "subscription_suspend_request" : { - "title" : "Suspend Subscription", - "required" : [ "reason" ], - "type" : "object", + "PlansDeactivate422" : { "properties" : { - "reason" : { - "maxLength" : 128, - "minLength" : 1, - "type" : "string", - "description" : "The reason for suspenson of the subscription." + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Plansdeactivate422Details" + } } - }, - "description" : "The suspend subscription request details." + } }, "Subscriptionscreate400Details" : { "anyOf" : [ { @@ -5817,18 +6084,110 @@ "$ref" : "#/components/schemas/INVALIDSTRINGMAXLENGTH2" } ] }, - "SUBSCRIPTIONCANNOTBEACTIVATED" : { - "title" : "SUBSCRIPTION_CANNOT_BE_ACTIVATED", + "PlansUpdatePricingSchemes400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PlansupdatePricingSchemes400Details" + } + } + } + }, + "SUBSCRIPTIONCANNOTBEACTIVATED" : { + "title" : "SUBSCRIPTION_CANNOT_BE_ACTIVATED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIPTION_CANNOT_BE_ACTIVATED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Subscription cannot be activated after payment failure threshold has reached." ] + } + } + }, + "SubscriptionSuspendRequest" : { + "title" : "Suspend Subscription", + "required" : [ "reason" ], + "type" : "object", + "properties" : { + "reason" : { + "maxLength" : 128, + "minLength" : 1, + "type" : "string", + "description" : "The reason for suspenson of the subscription" + } + }, + "description" : "The suspend subscription request details" + }, + "AddressPortable" : { + "title" : "Portable Postal Address (Medium-Grained)", + "required" : [ "country_code" ], + "type" : "object", "properties" : { - "issue" : { + "country_code" : { + "allOf" : [ { + "$ref" : "#/components/schemas/CountryCode" + } ], + "x-ballerina-name-ignore" : "countryCode" + }, + "admin_area_1" : { + "maxLength" : 300, "type" : "string", - "enum" : [ "SUBSCRIPTION_CANNOT_BE_ACTIVATED" ] + "description" : "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`. Value, by country, is:
  • UK. A county.
  • US. A state.
  • Canada. A province.
  • Japan. A prefecture.
  • Switzerland. A kanton.
", + "x-ballerina-name-ignore" : "adminArea1" }, - "description" : { + "address_line_1" : { + "maxLength" : 300, "type" : "string", - "enum" : [ "Subscription cannot be activated after payment failure threshold has reached." ] + "description" : "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", + "x-ballerina-name-ignore" : "addressLine1" + }, + "admin_area_3" : { + "maxLength" : 100, + "type" : "string", + "description" : "A sub-locality, suburb, neighborhood, or district. Smaller than `admin_area_level_2`. Value is:
  • Brazil. Suburb, bairro, or neighborhood.
  • India. Sub-locality or district. Street name information is not always available but a sub-locality or district can be a very small area.
", + "x-ballerina-name-ignore" : "adminArea3" + }, + "address_details" : { + "allOf" : [ { + "$ref" : "#/components/schemas/AddressDetails" + } ], + "x-ballerina-name-ignore" : "addressDetails" + }, + "admin_area_2" : { + "maxLength" : 120, + "type" : "string", + "description" : "A city, town, or village. Smaller than `admin_area_level_1`", + "x-ballerina-name-ignore" : "adminArea2" + }, + "address_line_3" : { + "maxLength" : 100, + "type" : "string", + "description" : "The third line of the address, if needed. For example, a street complement for Brazil, direction text, such as `next to Walmart`, or a landmark in an Indian address", + "x-ballerina-name-ignore" : "addressLine3" + }, + "address_line_2" : { + "maxLength" : 300, + "type" : "string", + "description" : "The second line of the address. For example, suite or apartment number", + "x-ballerina-name-ignore" : "addressLine2" + }, + "admin_area_4" : { + "maxLength" : 100, + "type" : "string", + "description" : "The neighborhood, ward, or district. Smaller than `admin_area_level_3` or `sub_locality`. Value is:
  • The postal sorting code for Guernsey and many French territories, such as French Guiana.
  • The fine-grained administrative levels in China.
", + "x-ballerina-name-ignore" : "adminArea4" + }, + "postal_code" : { + "maxLength" : 60, + "type" : "string", + "description" : "The postal code, which is the zip code or equivalent. Typically required for countries with a postal code or an equivalent. See [postal code](https://en.wikipedia.org/wiki/Postal_code)", + "x-ballerina-name-ignore" : "postalCode" } - } + }, + "description" : "The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute)" }, "INVALIDPRICINGMODEL" : { "title" : "INVALID_PRICING_MODEL", @@ -5843,18 +6202,6 @@ } } }, - "capture_status_details" : { - "title" : "Capture Status Details", - "type" : "object", - "properties" : { - "reason" : { - "type" : "string", - "description" : "The reason why the captured payment status is `PENDING` or `DENIED`.", - "enum" : [ "BUYER_COMPLAINT", "CHARGEBACK", "ECHECK", "INTERNATIONAL_WITHDRAWAL", "OTHER", "PENDING_REVIEW", "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION", "REFUNDED", "TRANSACTION_APPROVED_AWAITING_FUNDING", "UNILATERAL", "VERIFICATION_REQUIRED" ] - } - }, - "description" : "The details of the captured payment status." - }, "INVALIDPARAMETERVALUE" : { "title" : "INVALID_PARAMETER_VALUE", "properties" : { @@ -5868,76 +6215,68 @@ } } }, - "tax_info" : { - "title" : "Tax Information", - "required" : [ "tax_id", "tax_id_type" ], - "type" : "object", + "SubscriptionsSuspend422" : { "properties" : { - "tax_id" : { - "maxLength" : 14, - "type" : "string", - "description" : "The customer's tax ID value." - }, - "tax_id_type" : { - "type" : "string", - "description" : "The customer's tax ID type.", - "enum" : [ "BR_CPF", "BR_CNPJ" ] + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionssuspend422Details" + } } - }, - "description" : "The tax ID of the customer. The customer is also known as the payer. Both `tax_id` and `tax_id_type` are required." + } }, - "subscription_billing_info" : { - "title" : "Subscription Billing Information", - "required" : [ "failed_payments_count", "outstanding_balance" ], - "type" : "object", + "SubscriptionsRevise404" : { "properties" : { - "outstanding_balance" : { - "$ref" : "#/components/schemas/money" - }, - "cycle_executions" : { - "maxItems" : 3, - "minItems" : 0, + "details" : { "type" : "array", - "description" : "The trial and regular billing executions.", - "readOnly" : true, "items" : { - "$ref" : "#/components/schemas/cycle_execution" + "$ref" : "#/components/schemas/Subscriptionsrevise404Details" } - }, - "last_payment" : { - "$ref" : "#/components/schemas/last_payment_details" - }, - "next_billing_time" : { - "$ref" : "#/components/schemas/date_time" - }, - "final_payment_time" : { - "$ref" : "#/components/schemas/date_time" - }, - "failed_payments_count" : { - "maximum" : 999, - "minimum" : 0, - "type" : "integer", - "description" : "The number of consecutive payment failures. Resets to `0` after a successful payment. If this reaches the `payment_failure_threshold` value, the subscription updates to the `SUSPENDED` state.", - "readOnly" : true - }, - "last_failed_payment" : { - "$ref" : "#/components/schemas/failed_payment_details" } - }, - "description" : "The billing details for the subscription. If the subscription was or is active, these fields are populated." + } }, - "authentication_response" : { - "title" : "Authentication Response", + "SubscriptionsActivate400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionsactivate400Details" + } + } + } + }, + "PhoneType" : { + "title" : "Phone Type", + "type" : "string", + "description" : "The phone type", + "enum" : [ "FAX", "HOME", "MOBILE", "OTHER", "PAGER" ] + }, + "Taxes" : { + "title" : "Taxes", + "required" : [ "percentage" ], "type" : "object", "properties" : { - "liability_shift" : { - "$ref" : "#/components/schemas/liability_shift" + "inclusive" : { + "type" : "boolean", + "description" : "Indicates whether the tax was already included in the billing amount", + "default" : true }, - "three_d_secure" : { - "$ref" : "#/components/schemas/three_d_secure_authentication_response" + "percentage" : { + "$ref" : "#/components/schemas/Percentage" } }, - "description" : "Results of Authentication such as 3D Secure." + "description" : "The tax details" + }, + "Transaction" : { + "title" : "Transaction Details", + "required" : [ "amount_with_breakdown", "id", "time" ], + "type" : "object", + "description" : "The transaction details", + "allOf" : [ { + "$ref" : "#/components/schemas/CaptureStatus" + }, { + "$ref" : "#/components/schemas/TransactionAllOf2" + } ] }, "INVALIDSTRINGMAXLENGTH7" : { "title" : "INVALID_STRING_MAX_LENGTH", @@ -5952,6 +6291,36 @@ } } }, + "PaymentMethod" : { + "title" : "Payment Method", + "type" : "object", + "properties" : { + "payer_selected" : { + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "The customer-selected payment method on the merchant site", + "default" : "PAYPAL", + "x-ballerina-name-ignore" : "payerSelected" + }, + "payee_preferred" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PayeePaymentMethodPreference" + } ], + "x-ballerina-name-ignore" : "payeePreferred" + }, + "standard_entry_class_code" : { + "maxLength" : 255, + "minLength" : 3, + "type" : "string", + "description" : "NACHA (the regulatory body governing the ACH network) requires that API callers (merchants, partners) obtain the consumer’s explicit authorization before initiating a transaction. To stay compliant, you’ll need to make sure that you retain a compliant authorization for each transaction that you originate to the ACH Network using this API. ACH transactions are categorized (using SEC codes) by how you capture authorization from the Receiver (the person whose bank account is being debited or credited). PayPal supports the following SEC codes", + "default" : "WEB", + "enum" : [ "TEL", "WEB", "CCD", "PPD" ], + "x-ballerina-name-ignore" : "standardEntryClassCode" + } + }, + "description" : "The customer and merchant payment preferences" + }, "INVALIDSTRINGMAXLENGTH6" : { "title" : "INVALID_STRING_MAX_LENGTH", "properties" : { @@ -5978,16 +6347,6 @@ } } }, - "subscriptions.patch-422" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionspatch422Details" - } - } - } - }, "INVALIDSTRINGMAXLENGTH2" : { "title" : "INVALID_STRING_MAX_LENGTH", "properties" : { @@ -6001,22 +6360,15 @@ } } }, - "update_pricing_schemes_list_request" : { - "title" : "Update Pricing Scheme Request", - "required" : [ "pricing_schemes" ], - "type" : "object", + "SubscriptionsRevise400" : { "properties" : { - "pricing_schemes" : { - "maxItems" : 99, - "minItems" : 1, + "details" : { "type" : "array", - "description" : "An array of pricing schemes.", "items" : { - "$ref" : "#/components/schemas/update_pricing_scheme_request" + "$ref" : "#/components/schemas/Subscriptionsrevise400Details" } } - }, - "description" : "The update pricing scheme request details." + } }, "INVALIDSTRINGMAXLENGTH5" : { "title" : "INVALID_STRING_MAX_LENGTH", @@ -6044,16 +6396,6 @@ } } }, - "plans.create-400" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Planscreate400Details" - } - } - } - }, "PERMISSIONDENIED" : { "title" : "PERMISSION_DENIED", "properties" : { @@ -6080,6 +6422,36 @@ } } }, + "ErrorLinkDescription" : { + "title" : "Link Description", + "required" : [ "href", "rel" ], + "type" : "object", + "properties" : { + "method" : { + "maxLength" : 6, + "minLength" : 3, + "pattern" : "^[A-Z]*$", + "type" : "string", + "description" : "The HTTP method required to make the related call", + "enum" : [ "GET", "POST", "PUT", "DELETE", "PATCH" ] + }, + "rel" : { + "maxLength" : 100, + "minLength" : 0, + "pattern" : "^.*$", + "type" : "string", + "description" : "The [link relation type](https://tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](https://www.iana.org/assignments/link-relations/link-relations.xhtml)" + }, + "href" : { + "maxLength" : 20000, + "minLength" : 0, + "pattern" : "^.*$", + "type" : "string", + "description" : "The complete target URL. To make the related call, combine the method with this [URI Template-formatted](https://tools.ietf.org/html/rfc6570) link. For pre-processing, include the `$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call" + } + }, + "description" : "The request-related [HATEOAS link](/api/rest/responses/#hateoas-links) information" + }, "OVERLAPPINGPRICINGSCHEMETIERS3" : { "title" : "OVERLAPPING_PRICING_SCHEME_TIERS", "properties" : { @@ -6119,16 +6491,6 @@ } } }, - "subscriptions.create-422" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionscreate422Details" - } - } - } - }, "OVERLAPPINGPRICINGSCHEMETIERS1" : { "title" : "OVERLAPPING_PRICING_SCHEME_TIERS", "properties" : { @@ -6162,6 +6524,30 @@ "$ref" : "#/components/schemas/PLANSTATUSINVALID1" } ] }, + "SubscriptionsCapture422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscapture422Details" + } + } + } + }, + "TaxesOverride" : { + "title" : "Taxes Override", + "type" : "object", + "properties" : { + "inclusive" : { + "type" : "boolean", + "description" : "Indicates whether the tax was already included in the billing amount" + }, + "percentage" : { + "$ref" : "#/components/schemas/Percentage" + } + }, + "description" : "The tax details" + }, "INVALIDPARAMETERVALUE2" : { "title" : "INVALID_PARAMETER_VALUE", "properties" : { @@ -6188,16 +6574,6 @@ } } }, - "subscriber_request" : { - "title" : "Subscriber Request Information", - "type" : "object", - "description" : "The subscriber request information .", - "allOf" : [ { - "$ref" : "#/components/schemas/payer" - }, { - "$ref" : "#/components/schemas/SubscriberRequestAllOf2" - } ] - }, "INVALIDBILLINGCYCLESEQUENCE" : { "title" : "INVALID_BILLING_CYCLE_SEQUENCE", "properties" : { @@ -6212,51 +6588,17 @@ } }, "INVALIDPARAMETERVALUE6" : { - "title" : "INVALID_PARAMETER_VALUE", - "properties" : { - "issue" : { - "type" : "string", - "enum" : [ "INVALID_PARAMETER_VALUE" ] - }, - "description" : { - "type" : "string", - "enum" : [ "Start time must be a valid future date and time." ] - } - } - }, - "error_400" : { - "title" : "Bad Request Error", - "type" : "object", - "properties" : { - "name" : { - "type" : "string", - "enum" : [ "INVALID_REQUEST" ] - }, - "message" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { "type" : "string", - "enum" : [ "Request is not well-formed, syntactically incorrect, or violates schema." ] - }, - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/error_details" - } + "enum" : [ "INVALID_PARAMETER_VALUE" ] }, - "debug_id" : { + "description" : { "type" : "string", - "description" : "The PayPal internal ID. Used for correlation purposes." - }, - "links" : { - "maxItems" : 10000, - "minItems" : 0, - "type" : "array", - "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS).", - "items" : { - "$ref" : "#/components/schemas/error_link_description" - } + "enum" : [ "Start time must be a valid future date and time." ] } - }, - "description" : "Request is not well-formed, syntactically incorrect, or violates schema." + } }, "INVALIDPARAMETERVALUE5" : { "title" : "INVALID_PARAMETER_VALUE", @@ -6271,39 +6613,37 @@ } } }, - "error_401" : { - "title" : "Unauthorized Error", + "Phone" : { + "title" : "Phone", + "required" : [ "country_code", "national_number" ], "type" : "object", "properties" : { - "name" : { + "country_code" : { + "maxLength" : 3, + "minLength" : 1, + "pattern" : "^[0-9]{1,3}?$", "type" : "string", - "enum" : [ "AUTHENTICATION_FAILURE" ] + "description" : "The country calling code (CC), in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the CC and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN)", + "x-ballerina-name-ignore" : "countryCode" }, - "message" : { + "extension_number" : { + "maxLength" : 15, + "minLength" : 1, + "pattern" : "^[0-9]{1,15}?$", "type" : "string", - "enum" : [ "Authentication failed due to missing authorization header, or invalid authentication credentials." ] - }, - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/error_details" - } + "description" : "The extension number", + "x-ballerina-name-ignore" : "extensionNumber" }, - "debug_id" : { + "national_number" : { + "maxLength" : 14, + "minLength" : 1, + "pattern" : "^[0-9]{1,14}?$", "type" : "string", - "description" : "The PayPal internal ID. Used for correlation purposes." - }, - "links" : { - "maxItems" : 10000, - "minItems" : 0, - "type" : "array", - "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS).", - "items" : { - "$ref" : "#/components/schemas/error_link_description" - } + "description" : "The national number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the country calling code (CC) and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN)", + "x-ballerina-name-ignore" : "nationalNumber" } }, - "description" : "Authentication failed due to missing Authorization header, or invalid authentication credentials." + "description" : "The phone number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en)" }, "INVALIDPARAMETERVALUE4" : { "title" : "INVALID_PARAMETER_VALUE", @@ -6318,16 +6658,6 @@ } } }, - "subscriptions.activate-400" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionsactivate400Details" - } - } - } - }, "INVALIDPARAMETERVALUE3" : { "title" : "INVALID_PARAMETER_VALUE", "properties" : { @@ -6341,15 +6671,6 @@ } } }, - "card_brand" : { - "title" : "Card Brand", - "maxLength" : 255, - "minLength" : 1, - "pattern" : "^[A-Z_]+$", - "type" : "string", - "description" : "The card network or brand. Applies to credit, debit, gift, and payment cards.", - "enum" : [ "VISA", "MASTERCARD", "DISCOVER", "AMEX", "SOLO", "JCB", "STAR", "DELTA", "SWITCH", "MAESTRO", "CB_NATIONALE", "CONFIGOGA", "CONFIDIS", "ELECTRON", "CETELEM", "CHINA_UNION_PAY" ] - }, "INVALIDPARAMETERVALUE9" : { "title" : "INVALID_PARAMETER_VALUE", "properties" : { @@ -6389,66 +6710,13 @@ } } }, - "address_portable" : { - "title" : "Portable Postal Address (Medium-Grained)", - "required" : [ "country_code" ], - "type" : "object", - "properties" : { - "address_line_1" : { - "maxLength" : 300, - "type" : "string", - "description" : "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_2" : { - "maxLength" : 300, - "type" : "string", - "description" : "The second line of the address. For example, suite or apartment number." - }, - "address_line_3" : { - "maxLength" : 100, - "type" : "string", - "description" : "The third line of the address, if needed. For example, a street complement for Brazil, direction text, such as `next to Walmart`, or a landmark in an Indian address." - }, - "admin_area_4" : { - "maxLength" : 100, - "type" : "string", - "description" : "The neighborhood, ward, or district. Smaller than `admin_area_level_3` or `sub_locality`. Value is:
  • The postal sorting code for Guernsey and many French territories, such as French Guiana.
  • The fine-grained administrative levels in China.
" - }, - "admin_area_3" : { - "maxLength" : 100, - "type" : "string", - "description" : "A sub-locality, suburb, neighborhood, or district. Smaller than `admin_area_level_2`. Value is:
  • Brazil. Suburb, bairro, or neighborhood.
  • India. Sub-locality or district. Street name information is not always available but a sub-locality or district can be a very small area.
" - }, - "admin_area_2" : { - "maxLength" : 120, - "type" : "string", - "description" : "A city, town, or village. Smaller than `admin_area_level_1`." - }, - "admin_area_1" : { - "maxLength" : 300, - "type" : "string", - "description" : "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`. Value, by country, is:
  • UK. A county.
  • US. A state.
  • Canada. A province.
  • Japan. A prefecture.
  • Switzerland. A kanton.
" - }, - "postal_code" : { - "maxLength" : 60, - "type" : "string", - "description" : "The postal code, which is the zip code or equivalent. Typically required for countries with a postal code or an equivalent. See [postal code](https://en.wikipedia.org/wiki/Postal_code)." - }, - "country_code" : { - "$ref" : "#/components/schemas/country_code" - }, - "address_details" : { - "$ref" : "#/components/schemas/AddressDetails" - } - }, - "description" : "The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute)." - }, - "date_year_month" : { - "maxLength" : 7, - "minLength" : 7, - "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])$", + "CountryCode" : { + "maxLength" : 2, + "minLength" : 2, + "pattern" : "^([A-Z]{2}|C2)$", "type" : "string", - "description" : "The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6)." + "description" : "The [two-character ISO 3166-1 code](/docs/integration/direct/rest/country-codes/) that identifies the country or region.
Note: The country code for Great Britain is GB and not UK as used in the top-level domain names for that country. Use the `C2` country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border transactions.
", + "format" : "ppaas_common_country_code_v2" }, "UNSUPPORTEDPATCHOPERATION" : { "title" : "UNSUPPORTED_PATCH_OPERATION", @@ -6463,16 +6731,6 @@ } } }, - "plans.update-pricing-schemes-400" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/PlansupdatePricingSchemes400Details" - } - } - } - }, "INVALIDPRICINGMODEL2" : { "title" : "INVALID_PRICING_MODEL", "properties" : { @@ -6512,78 +6770,6 @@ } } }, - "error_503" : { - "title" : "Service Unavailable Error", - "type" : "object", - "properties" : { - "name" : { - "type" : "string", - "enum" : [ "SERVICE_UNAVAILABLE" ] - }, - "message" : { - "type" : "string", - "enum" : [ "Service Unavailable." ] - }, - "debug_id" : { - "type" : "string", - "description" : "The PayPal internal ID. Used for correlation purposes." - }, - "links" : { - "maxItems" : 10000, - "minItems" : 0, - "type" : "array", - "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS).", - "items" : { - "$ref" : "#/components/schemas/error_link_description" - } - } - }, - "description" : "The server is temporarily unable to handle the request, for example, because of planned maintenance or downtime.", - "example" : { - "name" : "SERVICE_UNAVAILABLE", - "message" : "Service Unavailable.", - "debug_id" : "90957fca61718", - "information_link" : "https://developer.paypal.com/docs/api/orders/v2/#error-SERVICE_UNAVAILABLE" - } - }, - "plan_collection" : { - "title" : "Plan Collection", - "type" : "object", - "properties" : { - "plans" : { - "maxItems" : 32767, - "minItems" : 0, - "type" : "array", - "description" : "An array of plans.", - "items" : { - "$ref" : "#/components/schemas/plan" - } - }, - "total_items" : { - "maximum" : 500000000, - "minimum" : 0, - "type" : "integer", - "description" : "The total number of items." - }, - "total_pages" : { - "maximum" : 100000000, - "minimum" : 0, - "type" : "integer", - "description" : "The total number of pages." - }, - "links" : { - "maxItems" : 10, - "minItems" : 1, - "type" : "array", - "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).", - "readOnly" : true, - "items" : { - "$ref" : "#/components/schemas/link_description" - } - } - }, - "description" : "The list of plans with details." - }, "MORETHANTWOTRIALBILLINGCYCLENOTSUPPORTED" : { "title" : "MORE_THAN_TWO_TRIAL_BILLING_CYCLE_NOT_SUPPORTED", "properties" : { @@ -6610,6 +6796,32 @@ } } }, + "SubscriptionCaptureRequest" : { + "title" : "Charge Amount from Subscriber", + "required" : [ "amount", "capture_type", "note" ], + "type" : "object", + "properties" : { + "note" : { + "maxLength" : 128, + "minLength" : 1, + "type" : "string", + "description" : "The reason or note for the subscription charge" + }, + "amount" : { + "$ref" : "#/components/schemas/Money" + }, + "capture_type" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The type of capture", + "enum" : [ "OUTSTANDING_BALANCE" ], + "x-ballerina-name-ignore" : "captureType" + } + }, + "description" : "The charge amount from the subscriber" + }, "CardResponseWithBillingAddressAllOf2" : { "properties" : { "name" : { @@ -6619,13 +6831,13 @@ "description" : "The card holder's name as it appears on the card." }, "billing_address" : { - "$ref" : "#/components/schemas/address_portable" + "$ref" : "#/components/schemas/AddressPortable" }, "expiry" : { - "$ref" : "#/components/schemas/date_year_month" + "$ref" : "#/components/schemas/DateYearMonth" }, "currency_code" : { - "$ref" : "#/components/schemas/currency_code" + "$ref" : "#/components/schemas/CurrencyCode" } } }, @@ -6642,12 +6854,12 @@ } } }, - "subscriptions.revise-400" : { + "SubscriptionsActivate422" : { "properties" : { "details" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/Subscriptionsrevise400Details" + "$ref" : "#/components/schemas/Subscriptionsactivate422Details" } } } @@ -6665,11 +6877,39 @@ } } }, + "SubscriptionStatus" : { + "title" : "Subscription Status", + "type" : "object", + "properties" : { + "status_change_note" : { + "maxLength" : 128, + "minLength" : 1, + "type" : "string", + "description" : "The reason or notes for the status of the subscription", + "x-ballerina-name-ignore" : "statusChangeNote" + }, + "status" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The status of the subscription", + "enum" : [ "APPROVAL_PENDING", "APPROVED", "ACTIVE", "SUSPENDED", "CANCELLED", "EXPIRED" ] + }, + "status_update_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name-ignore" : "statusUpdateTime" + } + }, + "description" : "The subscription status details" + }, "InlineResponse4221" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_422" + "$ref" : "#/components/schemas/Error422" }, { - "$ref" : "#/components/schemas/plans.patch-422" + "$ref" : "#/components/schemas/PlansPatch422" } ] }, "INVALIDSTRINGMINLENGTH" : { @@ -6687,78 +6927,68 @@ }, "InlineResponse4224" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_422" + "$ref" : "#/components/schemas/Error422" }, { - "$ref" : "#/components/schemas/plans.update-pricing-schemes-422" + "$ref" : "#/components/schemas/PlansUpdatePricingSchemes422" } ] }, "InlineResponse4225" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_422" + "$ref" : "#/components/schemas/Error422" }, { - "$ref" : "#/components/schemas/subscriptions.create-422" + "$ref" : "#/components/schemas/SubscriptionsCreate422" } ] }, "InlineResponse4222" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_422" + "$ref" : "#/components/schemas/Error422" }, { - "$ref" : "#/components/schemas/plans.activate-422" + "$ref" : "#/components/schemas/PlansActivate422" } ] }, "InlineResponse4223" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_422" + "$ref" : "#/components/schemas/Error422" }, { - "$ref" : "#/components/schemas/plans.deactivate-422" + "$ref" : "#/components/schemas/PlansDeactivate422" } ] }, "InlineResponse4228" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_422" + "$ref" : "#/components/schemas/Error422" }, { - "$ref" : "#/components/schemas/subscriptions.suspend-422" + "$ref" : "#/components/schemas/SubscriptionsSuspend422" } ] }, - "subscriptions.patch-400" : { + "SubscriptionsRevise422" : { "properties" : { "details" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/Subscriptionspatch400Details" + "$ref" : "#/components/schemas/Subscriptionsrevise422Details" } } } }, "InlineResponse4229" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_422" + "$ref" : "#/components/schemas/Error422" }, { - "$ref" : "#/components/schemas/subscriptions.cancel-422" + "$ref" : "#/components/schemas/SubscriptionsCancel422" } ] }, "InlineResponse4226" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_422" + "$ref" : "#/components/schemas/Error422" }, { - "$ref" : "#/components/schemas/subscriptions.patch-422" + "$ref" : "#/components/schemas/SubscriptionsPatch422" } ] }, - "subscriptions.revise-404" : { - "properties" : { - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Subscriptionsrevise404Details" - } - } - } - }, "InlineResponse4227" : { "allOf" : [ { - "$ref" : "#/components/schemas/error_422" + "$ref" : "#/components/schemas/Error422" }, { - "$ref" : "#/components/schemas/subscriptions.revise-422" + "$ref" : "#/components/schemas/SubscriptionsRevise422" } ] } }, @@ -6768,7 +6998,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/error_default" + "$ref" : "#/components/schemas/ErrorDefault" } } } @@ -6785,23 +7015,25 @@ "schema" : { "type" : "string", "default" : "return=minimal" - } + }, + "x-ballerina-name-ignore" : "prefer" }, "paypal_request_id" : { "name" : "PayPal-Request-Id", "in" : "header", - "description" : "The server stores keys for 72 hours.", + "description" : "The server stores keys for 72 hours", "required" : false, "style" : "simple", "explode" : false, "schema" : { "type" : "string" - } + }, + "x-ballerina-name-ignore" : "payPalRequestId" }, "product_id" : { "name" : "product_id", "in" : "query", - "description" : "Filters the response by a Product ID.", + "description" : "Filters the response by a Product ID", "required" : false, "style" : "form", "explode" : true, @@ -6809,12 +7041,13 @@ "maxLength" : 50, "minLength" : 6, "type" : "string" - } + }, + "x-ballerina-name-ignore" : "productId" }, "plan_ids" : { "name" : "plan_ids", "in" : "query", - "description" : "Filters the response by list of plan IDs. Filter supports upto 10 plan IDs.", + "description" : "Filters the response by list of plan IDs. Filter supports upto 10 plan IDs", "required" : false, "style" : "form", "explode" : true, @@ -6822,12 +7055,13 @@ "maximum" : 270, "minimum" : 3, "type" : "string" - } + }, + "x-ballerina-name-ignore" : "planIds" }, "page_size" : { "name" : "page_size", "in" : "query", - "description" : "The number of items to return in the response.", + "description" : "The number of items to return in the response", "required" : false, "style" : "form", "explode" : true, @@ -6836,12 +7070,13 @@ "minimum" : 1, "type" : "integer", "default" : 10 - } + }, + "x-ballerina-name-ignore" : "pageSize" }, "page" : { "name" : "page", "in" : "query", - "description" : "A non-zero integer which is the start index of the entire list of items to return in the response. The combination of `page=1` and `page_size=20` returns the first 20 items. The combination of `page=2` and `page_size=20` returns the next 20 items.", + "description" : "A non-zero integer which is the start index of the entire list of items to return in the response. The combination of `page=1` and `page_size=20` returns the first 20 items. The combination of `page=2` and `page_size=20` returns the next 20 items", "required" : false, "style" : "form", "explode" : true, @@ -6855,19 +7090,20 @@ "total_required" : { "name" : "total_required", "in" : "query", - "description" : "Indicates whether to show the total count in the response.", + "description" : "Indicates whether to show the total count in the response", "required" : false, "style" : "form", "explode" : true, "schema" : { "type" : "boolean", "default" : false - } + }, + "x-ballerina-name-ignore" : "totalRequired" }, "id" : { "name" : "id", "in" : "path", - "description" : "The ID of the subscription.", + "description" : "The ID of the subscription", "required" : true, "style" : "simple", "explode" : false, @@ -6878,7 +7114,7 @@ "fields" : { "name" : "fields", "in" : "query", - "description" : "List of fields that are to be returned in the response. Possible value for fields are last_failed_payment and plan.", + "description" : "List of fields that are to be returned in the response. Possible value for fields are last_failed_payment and plan", "required" : false, "style" : "form", "explode" : true, @@ -6891,7 +7127,7 @@ "start_time" : { "name" : "start_time", "in" : "query", - "description" : "The start time of the range of transactions to list.", + "description" : "The start time of the range of transactions to list", "required" : true, "style" : "form", "explode" : true, @@ -6901,12 +7137,13 @@ "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$", "type" : "string", "format" : "ppaas_date_time_v3" - } + }, + "x-ballerina-name-ignore" : "startTime" }, "end_time" : { "name" : "end_time", "in" : "query", - "description" : "The end time of the range of transactions to list.", + "description" : "The end time of the range of transactions to list", "required" : true, "style" : "form", "explode" : true, @@ -6916,7 +7153,8 @@ "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$", "type" : "string", "format" : "ppaas_date_time_v3" - } + }, + "x-ballerina-name-ignore" : "endTime" } }, "requestBodies" : { @@ -6924,7 +7162,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/patch_request" + "$ref" : "#/components/schemas/PatchRequest" } } } @@ -6936,7 +7174,7 @@ "description" : "Oauth 2.0 authentication", "flows" : { "clientCredentials" : { - "tokenUrl" : "/v1/oauth2/token", + "tokenUrl" : "https://api-m.sandbox.paypal.com/v1/oauth2/token", "scopes" : { "https://uri.paypal.com/services/subscriptions" : "Manage plan & subscription" } @@ -6945,4 +7183,4 @@ } } } -} \ No newline at end of file +} From 4aa589b5618778882c9d4ab0ef232928a319a7fe Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 25 Jun 2025 14:08:58 +0530 Subject: [PATCH 46/56] Update sanitation documentation for OpenAPI specification --- docs/spec/sanitations.md | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/docs/spec/sanitations.md b/docs/spec/sanitations.md index a637605..b4453f6 100644 --- a/docs/spec/sanitations.md +++ b/docs/spec/sanitations.md @@ -1,36 +1,27 @@ _Author_: @RNViththagan \ _Created_: 2025/06/13 \ -_Updated_: 2025/06/20 \ +_Updated_: 2025/06/25 \ _Edition_: Swan Lake # Sanitation for OpenAPI specification -This document records the sanitation done on top of the official OpenAPI specification from PayPal Subscriptions. The OpenAPI specification is obtained from [PayPal REST API Specifications](https://github.com/paypal/paypal-rest-api-specifications/blob/main/openapi/billing_subscriptions_v1.json). These changes are implemented after flattening the OpenAPI specification to enhance usability and address language limitations in the Ballerina OpenAPI tool. +This document records the sanitation done on top of the official OpenAPI specification from PayPal Subscriptions. The OpenAPI specification is obtained from the [PayPal REST API Specifications](https://github.com/paypal/paypal-rest-api-specifications/blob/main/openapi/billing_subscriptions_v1.json). These changes are implemented after flattening and aligning the OpenAPI specification to enhance the overall usability and readability of the generated client. -## Sanitization Steps +1. **Renamed schemas with non-compliant names**: + - **Original**: `Schema'400`, `Schema'401`, `Schema'403`, `Schema'404`, `Schema'422` + - **Updated**: `BadRequest`, `Unauthorized`, `Forbidden`, `NotFound`, `UnprocessableEntity` + - **Action**: Updated `$ref` values directly referencing these schemas (e.g., `"$ref": "#/components/schemas/Schema'404"` to `"$ref": "#/components/schemas/NotFound"`). + - **Reason**: The original schema names contained single quotes, which do not comply with the regular expression `^[a-zA-Z0-9\.\-_]+$`. Renaming ensures compliance and clarity for the Ballerina OpenAPI tool. -Following the latest Ballerina connector guidelines, apply these changes **after flattening the OpenAPI specification and without aligning the spec**: - -### 1. Change the `url` property of the servers object - -- **Original:** `https://api-m.sandbox.paypal.com` -- **Updated:** `https://api-m.sandbox.paypal.com/v1/billing` -- **Reason:** This change ensures that all API paths are relative to the versioned base URL (`/v1/billing`), which improves the consistency and usability of the APIs. - -### 2. Update API Paths - -- **Original:** Paths included the version prefix in each endpoint (e.g., `/v1/billing/plans`). -- **Updated:** Paths are modified to remove the version prefix from the endpoints, as it is now included in the base URL. For example: - - **Original:** `/v1/billing/plans` - - **Updated:** `/plans` -- **Reason:** This modification simplifies the API paths, making them shorter and more readable. It also centralizes the versioning to the base URL, which is a common best practice. +2. **Update `tokenUrl` to absolute URL**: + - **Original**: `/v1/oauth2/token` + - **Updated**: `https://api-m.sandbox.paypal.com/v1/oauth2/token` + - **Reason**: Prevents the relative path from being appended to the server URL, avoiding an invalid token endpoint in the OAuth2 client credentials flow. ## OpenAPI cli command The following command was used to generate the Ballerina client from the OpenAPI specification. The command should be executed from the repository root directory. -> Note: The flattened OpenAPI specification must be used for Ballerina client generation to prevent type-inclusion [issue](https://github.com/ballerina-platform/ballerina-lang/issues/38535#issuecomment-2973521948) in the generated types. - ```bash bal openapi -i docs/spec/openapi.json --mode client -o ballerina ``` From f1d89d95731f44a7b4ac8bd42e7ac0e3a53d088c Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 25 Jun 2025 14:53:28 +0530 Subject: [PATCH 47/56] Update files based on new sanitized spec --- ballerina/client.bal | 130 ++-- ballerina/types.bal | 1368 ++++++++++++++++++++---------------------- 2 files changed, 725 insertions(+), 773 deletions(-) diff --git a/ballerina/client.bal b/ballerina/client.bal index 6e5ca98..e45abe8 100644 --- a/ballerina/client.bal +++ b/ballerina/client.bal @@ -25,9 +25,9 @@ public isolated client class Client { final http:Client clientEp; # Gets invoked to initialize the `connector`. # - # + config - The configurations to be used when initializing the `connector` - # + serviceUrl - URL of the target service - # + return - An error if connector initialization failed + # + config - The configurations to be used when initializing the `connector` + # + serviceUrl - URL of the target service + # + return - An error if connector initialization failed public isolated function init(ConnectionConfig config, string serviceUrl = "https://api-m.sandbox.paypal.com/v1/billing") returns error? { http:ClientConfiguration httpClientConfig = {auth: config.auth, httpVersion: config.httpVersion, http1Settings: config.http1Settings, http2Settings: config.http2Settings, timeout: config.timeout, forwarded: config.forwarded, followRedirects: config.followRedirects, poolConfig: config.poolConfig, cache: config.cache, compression: config.compression, circuitBreaker: config.circuitBreaker, retryConfig: config.retryConfig, cookieConfig: config.cookieConfig, responseLimits: config.responseLimits, secureSocket: config.secureSocket, proxy: config.proxy, socketConfig: config.socketConfig, validation: config.validation, laxDataBinding: config.laxDataBinding}; self.clientEp = check new (serviceUrl, httpClientConfig); @@ -35,10 +35,10 @@ public isolated client class Client { # List plans # - # + headers - Headers to be sent with the request - # + queries - Queries to be sent with the request - # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that lists billing plans. - resource isolated function get plans(PlansListHeaders headers = {}, *PlansListQueries queries) returns plan_collection|error { + # + headers - Headers to be sent with the request + # + queries - Queries to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that lists billing plans + resource isolated function get plans(PlansListHeaders headers = {}, *PlansListQueries queries) returns PlanCollection|error { string resourcePath = string `/plans`; resourcePath = resourcePath + check getPathForQueryParam(queries); map httpHeaders = http:getHeaderMap(headers); @@ -47,9 +47,9 @@ public isolated client class Client { # Create plan # - # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows billing plan details. - resource isolated function post plans(plan_request_POST payload, PlansCreateHeaders headers = {}) returns plan|error { + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows billing plan details + resource isolated function post plans(PlanRequestPOST payload, PlansCreateHeaders headers = {}) returns Plan|error { string resourcePath = string `/plans`; map httpHeaders = http:getHeaderMap(headers); http:Request request = new; @@ -60,20 +60,20 @@ public isolated client class Client { # Show plan details # - # + id - The ID of the subscription. - # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows plan details. - resource isolated function get plans/[string id](map headers = {}) returns plan|error { + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows plan details + resource isolated function get plans/[string id](map headers = {}) returns Plan|error { string resourcePath = string `/plans/${getEncodedUri(id)}`; return self.clientEp->get(resourcePath, headers); } # Update plan # - # + id - The ID of the subscription. - # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. - resource isolated function patch plans/[string id](patch_request payload, map headers = {}) returns error? { + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function patch plans/[string id](PatchRequest payload, map headers = {}) returns error? { string resourcePath = string `/plans/${getEncodedUri(id)}`; http:Request request = new; json jsonBody = jsondata:toJson(payload); @@ -83,9 +83,9 @@ public isolated client class Client { # Activate plan # - # + id - The ID of the subscription. - # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body resource isolated function post plans/[string id]/activate(map headers = {}) returns error? { string resourcePath = string `/plans/${getEncodedUri(id)}/activate`; http:Request request = new; @@ -94,9 +94,9 @@ public isolated client class Client { # Deactivate plan # - # + id - The ID of the subscription. - # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body resource isolated function post plans/[string id]/deactivate(map headers = {}) returns error? { string resourcePath = string `/plans/${getEncodedUri(id)}/deactivate`; http:Request request = new; @@ -105,10 +105,10 @@ public isolated client class Client { # Update pricing # - # + id - The ID of the subscription. - # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. - resource isolated function post plans/[string id]/update\-pricing\-schemes(update_pricing_schemes_list_request payload, map headers = {}) returns error? { + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function post plans/[string id]/update\-pricing\-schemes(UpdatePricingSchemesListRequest payload, map headers = {}) returns error? { string resourcePath = string `/plans/${getEncodedUri(id)}/update-pricing-schemes`; http:Request request = new; json jsonBody = jsondata:toJson(payload); @@ -118,9 +118,9 @@ public isolated client class Client { # Create subscription # - # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. - resource isolated function post subscriptions(subscription_request_post payload, SubscriptionsCreateHeaders headers = {}) returns subscription|error { + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details + resource isolated function post subscriptions(SubscriptionRequestPost payload, SubscriptionsCreateHeaders headers = {}) returns Subscription|error { string resourcePath = string `/subscriptions`; map httpHeaders = http:getHeaderMap(headers); http:Request request = new; @@ -131,11 +131,11 @@ public isolated client class Client { # Show subscription details # - # + id - The ID of the subscription. - # + headers - Headers to be sent with the request - # + queries - Queries to be sent with the request - # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. - resource isolated function get subscriptions/[string id](map headers = {}, *SubscriptionsGetQueries queries) returns subscription|error { + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + queries - Queries to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details + resource isolated function get subscriptions/[string id](map headers = {}, *SubscriptionsGetQueries queries) returns Subscription|error { string resourcePath = string `/subscriptions/${getEncodedUri(id)}`; resourcePath = resourcePath + check getPathForQueryParam(queries); return self.clientEp->get(resourcePath, headers); @@ -143,10 +143,10 @@ public isolated client class Client { # Update subscription # - # + id - The ID of the subscription. - # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. - resource isolated function patch subscriptions/[string id](patch_request payload, map headers = {}) returns error? { + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function patch subscriptions/[string id](PatchRequest payload, map headers = {}) returns error? { string resourcePath = string `/subscriptions/${getEncodedUri(id)}`; http:Request request = new; json jsonBody = jsondata:toJson(payload); @@ -156,10 +156,10 @@ public isolated client class Client { # Revise plan or quantity of subscription # - # + id - The ID of the subscription. - # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. - resource isolated function post subscriptions/[string id]/revise(subscription_revise_request payload, map headers = {}) returns subscription_revise_response|error { + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details + resource isolated function post subscriptions/[string id]/revise(SubscriptionReviseRequest payload, map headers = {}) returns SubscriptionReviseResponse|error { string resourcePath = string `/subscriptions/${getEncodedUri(id)}/revise`; http:Request request = new; json jsonBody = jsondata:toJson(payload); @@ -169,10 +169,10 @@ public isolated client class Client { # Suspend subscription # - # + id - The ID of the subscription. - # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. - resource isolated function post subscriptions/[string id]/suspend(subscription_suspend_request payload, map headers = {}) returns error? { + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function post subscriptions/[string id]/suspend(SubscriptionSuspendRequest payload, map headers = {}) returns error? { string resourcePath = string `/subscriptions/${getEncodedUri(id)}/suspend`; http:Request request = new; json jsonBody = jsondata:toJson(payload); @@ -182,10 +182,10 @@ public isolated client class Client { # Cancel subscription # - # + id - The ID of the subscription. - # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. - resource isolated function post subscriptions/[string id]/cancel(subscription_cancel_request payload, map headers = {}) returns error? { + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function post subscriptions/[string id]/cancel(SubscriptionCancelRequest payload, map headers = {}) returns error? { string resourcePath = string `/subscriptions/${getEncodedUri(id)}/cancel`; http:Request request = new; json jsonBody = jsondata:toJson(payload); @@ -195,10 +195,10 @@ public isolated client class Client { # Activate subscription # - # + id - The ID of the subscription. - # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. - resource isolated function post subscriptions/[string id]/activate(subscription_activate_request payload, map headers = {}) returns error? { + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function post subscriptions/[string id]/activate(SubscriptionActivateRequest payload, map headers = {}) returns error? { string resourcePath = string `/subscriptions/${getEncodedUri(id)}/activate`; http:Request request = new; json jsonBody = jsondata:toJson(payload); @@ -208,10 +208,10 @@ public isolated client class Client { # Capture authorized payment on subscription # - # + id - The ID of the subscription. - # + headers - Headers to be sent with the request - # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. - resource isolated function post subscriptions/[string id]/capture(subscription_capture_request payload, SubscriptionsCaptureHeaders headers = {}) returns 'transaction|error? { + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details + resource isolated function post subscriptions/[string id]/capture(SubscriptionCaptureRequest payload, SubscriptionsCaptureHeaders headers = {}) returns Transaction|error? { string resourcePath = string `/subscriptions/${getEncodedUri(id)}/capture`; map httpHeaders = http:getHeaderMap(headers); http:Request request = new; @@ -222,11 +222,11 @@ public isolated client class Client { # List transactions for subscription # - # + id - The ID of the subscription. - # + headers - Headers to be sent with the request - # + queries - Queries to be sent with the request - # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. - resource isolated function get subscriptions/[string id]/transactions(map headers = {}, *SubscriptionsTransactionsQueries queries) returns transactions_list|error { + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + queries - Queries to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details + resource isolated function get subscriptions/[string id]/transactions(map headers = {}, *SubscriptionsTransactionsQueries queries) returns TransactionsList|error { string resourcePath = string `/subscriptions/${getEncodedUri(id)}/transactions`; resourcePath = resourcePath + check getPathForQueryParam(queries); return self.clientEp->get(resourcePath, headers); diff --git a/ballerina/types.bal b/ballerina/types.bal index 81db8a9..ab9700b 100644 --- a/ballerina/types.bal +++ b/ballerina/types.bal @@ -24,264 +24,260 @@ import ballerina/http; public type OAuth2ClientCredentialsGrantConfig record {| *http:OAuth2ClientCredentialsGrantConfig; # Token URL - string tokenUrl = "https://api-m.sandbox.paypal.com/v1/billing/v1/oauth2/token"; + string tokenUrl = "https://api-m.sandbox.paypal.com/v1/oauth2/token"; |}; -# Results of 3D Secure Authentication. -public type three_d_secure_authentication_response record { - # Transactions status result identifier. The outcome of the issuer's authentication. - pares_status authentication_status?; - # Status of Authentication eligibility. - enrolled enrollment_status?; -}; +# The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
+@constraint:String {maxLength: 254} +public type Email string; -# The activate subscription request details. -public type subscription_activate_request record { - # The reason for activation of a subscription. Required to reactivate the subscription. - @constraint:String {maxLength: 128, minLength: 1} - string reason?; -}; +# The account identifier for a PayPal account +@constraint:String {maxLength: 13, minLength: 13, pattern: re `^[2-9A-HJ-NP-Z]{13}$`} +public type AccountId string; -# The tax details. -public type taxes record { - # The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99`. - percentage percentage; - # Indicates whether the tax was already included in the billing amount. - boolean inclusive = true; +# The response to a request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent +public type SubscriptionReviseResponse record { + *SubscriptionReviseRequest; + *SubscriptionReviseResponseAllOf2; }; -# The payment card used to fund the payment. Card can be a credit or debit card. -public type card_response_with_billing_address record { - *card_response; - *CardResponseWithBillingAddressAllOf2; +# The update pricing scheme request details +public type UpdatePricingSchemeRequest record { + # The billing cycle sequence + @constraint:Int {minValue: 1, maxValue: 99} + int billing_cycle_sequence; + PricingScheme pricing_scheme; }; -# The [language tag](https://tools.ietf.org/html/bcp47#section-2) for the language in which to localize the error-related strings, such as messages, issues, and suggested actions. The tag is made up of the [ISO 639-2 language code](https://www.loc.gov/standards/iso639-2/php/code_list.php), the optional [ISO-15924 script tag](https://www.unicode.org/iso15924/codelists.html), and the [ISO-3166 alpha-2 country code](/docs/integration/direct/rest/country-codes/). -@constraint:String {maxLength: 10, minLength: 2, pattern: re `^[a-z]{2}(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}))?$`} -public type language string; - -# The request-related [HATEOAS link](/docs/api/reference/api-responses/#hateoas-links) information. -public type link_description record { - # The complete target URL. To make the related call, combine the method with this [URI Template-formatted](https://tools.ietf.org/html/rfc6570) link. For pre-processing, include the `$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call. - string href; - # The [link relation type](https://tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](https://www.iana.org/assignments/link-relations/link-relations.xhtml). - string rel; - # The HTTP method required to make the related call. - "GET"|"POST"|"PUT"|"DELETE"|"HEAD"|"CONNECT"|"OPTIONS"|"PATCH" method?; +# The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (https://www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions +public type PaymentSource record { + # The payment card to use to fund a payment. Can be a credit or debit card + Card card?; }; -# The customer who approves and pays for the order. The customer is also known as the payer. -public type payer record { - *payer_base; - *PayerAllOf2; -}; +# The card network or brand. Applies to credit, debit, gift, and payment cards +public type CardBrand "VISA"|"MASTERCARD"|"DISCOVER"|"AMEX"|"SOLO"|"JCB"|"STAR"|"DELTA"|"SWITCH"|"MAESTRO"|"CB_NATIONALE"|"CONFIGOGA"|"CONFIDIS"|"ELECTRON"|"CETELEM"|"CHINA_UNION_PAY"; + +# The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+@constraint:String {maxLength: 64, minLength: 20, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$`} +public type DateTime string; public type TransactionAllOf2 record { # The PayPal-generated transaction ID. @constraint:String {maxLength: 50, minLength: 3} string id?; - # The breakdown details for the amount. Includes the gross, tax, fee, and shipping amounts. - amount_with_breakdown amount_with_breakdown?; - # The name of the party. - name payer_name?; + # The breakdown details for the amount. Includes the gross, tax, fee, and shipping amounts + AmountWithBreakdown amount_with_breakdown?; + # The name of the party + Name payer_name?; # The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
- email_address payer_email?; + EmailAddress payer_email?; # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- date_time time?; + DateTime time?; }; -# The frequency of the billing cycle. -public type frequency record { - # The interval at which the subscription is charged or billed. - "DAY"|"WEEK"|"MONTH"|"YEAR" interval_unit; - # The number of intervals after which a subscriber is billed. For example, if the `interval_unit` is `DAY` with an `interval_count` of `2`, the subscription is billed once every two days. The following table lists the maximum allowed values for the `interval_count` for each `interval_unit`:
Interval unitMaximum interval count
DAY365
WEEK52
MONTH12
YEAR1
- @constraint:Int {minValue: 1, maxValue: 365} - int interval_count = 1; +# The name of the party +public type Name record { + # When the party is a person, the party's full name + @constraint:String {maxLength: 300} + string full_name?; + # The prefix, or title, to the party's name + @constraint:String {maxLength: 140} + string prefix?; + # When the party is a person, the party's surname or family name. Also known as the last name. Required when the party is a person. Use also to store multiple surnames including the matronymic, or mother's, surname + @constraint:String {maxLength: 140} + string surname?; + # When the party is a person, the party's given, or first, name + @constraint:String {maxLength: 140} + string given_name?; + # When the party is a person, the party's middle name. Use also to store multiple middle names including the patronymic, or father's, middle name + @constraint:String {maxLength: 140} + string middle_name?; + # The suffix for the party's name + @constraint:String {maxLength: 140} + string suffix?; + # DEPRECATED. The party's alternate name. Can be a business name, nickname, or any other name that cannot be split into first, last name. Required when the party is a business + @constraint:String {maxLength: 300} + string alternate_full_name?; }; -# The payment card to use to fund a payment. Card can be a credit or debit card. -public type card_response record { - # The last digits of the payment card. - @constraint:String {pattern: re `[0-9]{2,}`} - string last_digits?; - # The card network or brand. Applies to credit, debit, gift, and payment cards. - card_brand brand?; - # The payment card type. - "CREDIT"|"DEBIT"|"PREPAID"|"UNKNOWN" 'type?; - # Results of Authentication such as 3D Secure. - authentication_response authentication_result?; +# The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency +@constraint:String {maxLength: 3, minLength: 3} +public type CurrencyCode string; + +# The payment preferences for a subscription +public type PaymentPreferences record { + Money setup_fee?; + # The action to take on the subscription if the initial payment for the setup fails + "CONTINUE"|"CANCEL" setup_fee_failure_action = "CANCEL"; + # Indicates whether to automatically bill the outstanding amount in the next billing cycle + boolean auto_bill_outstanding = true; + # The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail + @constraint:Int {minValue: 0, maxValue: 999} + int payment_failure_threshold = 0; }; -# The JSON patch object to apply partial updates to resources. -public type patch record { - # The operation. - "add"|"remove"|"replace"|"move"|"copy"|"test" op; - # The JSON Pointer to the target document location at which to complete the operation. - string path?; - # The value to apply. The remove operation does not require a value. - anydata value?; - # The JSON Pointer to the target document location from which to move the value. Required for the move operation. - string 'from?; +# Status of Authentication eligibility +public type Enrolled "Y"|"N"|"U"|"B"; + +# The list transactions for a subscription request details +public type TransactionsList record { + # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links) + @constraint:Array {maxLength: 10, minLength: 1} + LinkDescription[] links?; + # The total number of pages + @constraint:Int {minValue: 0, maxValue: 100000000} + int total_pages?; + # An array of transactions + @constraint:Array {maxLength: 32767} + Transaction[] transactions?; + # The total number of items + @constraint:Int {minValue: 0, maxValue: 500000000} + int total_items?; }; -# The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
-@constraint:String {maxLength: 64, minLength: 20, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$`} -public type date_time string; +# The application context, which customizes the payer experience during the subscription approval process with PayPal +public type ApplicationContext record { + # Configures the label name to `Continue` or `Subscribe Now` for subscription consent experience + "CONTINUE"|"SUBSCRIBE_NOW" user_action = "SUBSCRIBE_NOW"; + # The URL where the customer is redirected after the customer approves the payment + @constraint:String {maxLength: 4000, minLength: 10} + string return_url; + # The label that overrides the business name in the PayPal account on the PayPal site + @constraint:String {maxLength: 127, minLength: 1} + string brand_name?; + # The [language tag](https://tools.ietf.org/html/bcp47#section-2) for the language in which to localize the error-related strings, such as messages, issues, and suggested actions. The tag is made up of the [ISO 639-2 language code](https://www.loc.gov/standards/iso639-2/php/code_list.php), the optional [ISO-15924 script tag](https://www.unicode.org/iso15924/codelists.html), and the [ISO-3166 alpha-2 country code](/docs/integration/direct/rest/country-codes/) + Language locale?; + # The URL where the customer is redirected after the customer cancels the payment + @constraint:String {maxLength: 4000, minLength: 10} + string cancel_url; + # The location from which the shipping address is derived + "GET_FROM_FILE"|"NO_SHIPPING"|"SET_PROVIDED_ADDRESS" shipping_preference = "GET_FROM_FILE"; + PaymentMethod payment_method?; +}; -# The billing cycle details to override at subscription level. The subscription billing cycle definition has to adhere to the plan billing cycle definition. -public type billing_cycle_override record { - # The pricing scheme details. - pricing_scheme pricing_scheme?; - # The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle. - @constraint:Int {minValue: 1, maxValue: 99} - int sequence; - # The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles). - @constraint:Int {minValue: 0, maxValue: 999} - int total_cycles?; +# The phone information +public type PhoneWithType record { + PhoneType phone_type?; + Phone phone_number; }; -# The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99`. -@constraint:String {pattern: re `^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$`} -public type percentage string; +# The details of the captured payment status +public type CaptureStatusDetails record { + # The reason why the captured payment status is `PENDING` or `DENIED` + "BUYER_COMPLAINT"|"CHARGEBACK"|"ECHECK"|"INTERNATIONAL_WITHDRAWAL"|"OTHER"|"PENDING_REVIEW"|"RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION"|"REFUNDED"|"TRANSACTION_APPROVED_AWAITING_FUNDING"|"UNILATERAL"|"VERIFICATION_REQUIRED" reason?; +}; -# The subscription status details. -public type subscription_status record { - # The status of the subscription. - "APPROVAL_PENDING"|"APPROVED"|"ACTIVE"|"SUSPENDED"|"CANCELLED"|"EXPIRED" status?; - # The reason or notes for the status of the subscription. - @constraint:String {maxLength: 128, minLength: 1} - string status_change_note?; - # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- date_time status_update_time?; +# The subscriber response information +public type Subscriber record { + *Payer; + *SubscriberAllOf2; }; -# The pricing tier details. -public type pricing_tier record { - # The starting quantity for the tier. - @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} - string starting_quantity; - # The ending quantity for the tier. Optional for the last tier. - @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} - string ending_quantity?; - # The currency and amount for a financial transaction, such as a balance or payment due. - money amount; +# The tax ID of the customer. The customer is also known as the payer. Both `tax_id` and `tax_id_type` are required +public type TaxInfo record { + # The customer's tax ID type + "BR_CPF"|"BR_CNPJ" tax_id_type; + # The customer's tax ID value + @constraint:String {maxLength: 14} + string tax_id; }; -# The billing cycle details. -public type billing_cycle record { - # The pricing scheme details. - pricing_scheme pricing_scheme?; - # The frequency of the billing cycle. - frequency frequency; - # The tenure type of the billing cycle. In case of a plan having trial cycle, only 2 trial cycles are allowed per plan. - "REGULAR"|"TRIAL" tenure_type; - # The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle. - @constraint:Int {minValue: 1, maxValue: 99} - int sequence; - # The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles). +# The pricing scheme details +public type PricingScheme record { + # An array of pricing tiers which are used for billing volume/tiered plans. pricing_model field has to be specified + @constraint:Array {maxLength: 32, minLength: 1} + PricingTier[] tiers?; + DateTime update_time?; + DateTime create_time?; + # The pricing model for tiered plan. The `tiers` parameter is required + "VOLUME"|"TIERED" pricing_model?; + Money fixed_price?; + # The version of the pricing scheme @constraint:Int {minValue: 0, maxValue: 999} - int total_cycles = 1; + int version?; }; -# The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (https://www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions. -public type payment_source record { - # The payment card to use to fund a payment. Can be a credit or debit card. - card card?; +# The payment source used to fund the payment +public type PaymentSourceResponse record { + # The payment card used to fund the payment. Card can be a credit or debit card + CardResponseWithBillingAddress card?; +}; + +# An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object +public type PlanOverride record { + PaymentPreferencesOverride payment_preferences?; + # An array of billing cycles for trial billing and regular billing. The subscription billing cycle definition has to adhere to the plan billing cycle definition + @constraint:Array {maxLength: 12, minLength: 1} + BillingCycleOverride[] billing_cycles?; + # The tax details + TaxesOverride taxes?; +}; + +# The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6) +@constraint:String {maxLength: 7, minLength: 7, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])$`} +public type DateYearMonth string; + +# The create subscription request details +public type SubscriptionRequestPost record { + Money shipping_amount?; + DateTime start_time?; + # The quantity of the product in the subscription + @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} + string quantity?; + # The subscriber request information + SubscriberRequest subscriber?; + # The custom id for the subscription. Can be invoice id + @constraint:String {maxLength: 127, minLength: 1} + string custom_id?; + ApplicationContext application_context?; + # An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object + PlanOverride plan?; + # The ID of the plan + @constraint:String {maxLength: 50, minLength: 3} + string plan_id; + # DEPRECATED. Indicates whether the subscription auto-renews after the billing cycles complete + # + # # Deprecated + @deprecated + boolean auto_renewal = false; }; # Represents the Headers record for the operation: plans.create public type PlansCreateHeaders record { - # The server stores keys for 72 hours. + # The server stores keys for 72 hours string PayPal\-Request\-Id?; # The preferred server response upon successful completion of the request. Value is:
  • return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links.
  • return=representation. The server returns a complete resource representation, including the current state of the resource.
string Prefer = "return=minimal"; }; public type SubscriberAllOf2 record { - # The shipping details. - shipping_detail shipping_address?; - # The payment source used to fund the payment. - payment_source_response payment_source?; + # The shipping details + ShippingDetail shipping_address?; + # The payment source used to fund the payment + PaymentSourceResponse payment_source?; }; -# The plan details. -public type plan record { - # The unique PayPal-generated ID for the plan. - @constraint:String {maxLength: 50, minLength: 3} - string id?; - # The ID for the product. - @constraint:String {maxLength: 50, minLength: 6} - string product_id?; - # The plan name. - @constraint:String {maxLength: 127, minLength: 1} - string name?; - # The plan status. - "CREATED"|"INACTIVE"|"ACTIVE" status?; - # The detailed description of the plan. - @constraint:String {maxLength: 127, minLength: 1} - string description?; - # An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle. - @constraint:Array {maxLength: 12, minLength: 1} - billing_cycle[] billing_cycles?; - # The payment preferences for a subscription. - payment_preferences payment_preferences?; - # The tax details. - taxes taxes?; - # Indicates whether you can subscribe to this plan by providing a quantity for the goods or service. - boolean quantity_supported = false; - # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- date_time create_time?; - # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- date_time update_time?; - # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links). - @constraint:Array {maxLength: 10, minLength: 1} - link_description[] links?; +# The subscription details +public type Subscription record { + *SubscriptionStatus; + *SubscriptionAllOf2; }; -# The phone information. -public type phone_with_type record { - # The phone type. - phone_type phone_type?; - # The phone number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). - phone phone_number; +# The cancel subscription request details +public type SubscriptionCancelRequest record { + # The reason for the cancellation of a subscription + @constraint:String {maxLength: 128, minLength: 1} + string reason; }; # Represents the Queries record for the operation: subscriptions.get public type SubscriptionsGetQueries record { - # List of fields that are to be returned in the response. Possible value for fields are last_failed_payment and plan. + # List of fields that are to be returned in the response. Possible value for fields are last_failed_payment and plan @constraint:String {maxLength: 100, minLength: 1} string fields?; }; -# The pricing scheme details. -public type pricing_scheme record { - # The version of the pricing scheme. - @constraint:Int {minValue: 0, maxValue: 999} - int version?; - # The currency and amount for a financial transaction, such as a balance or payment due. - money fixed_price?; - # The pricing model for tiered plan. The `tiers` parameter is required. - "VOLUME"|"TIERED" pricing_model?; - # An array of pricing tiers which are used for billing volume/tiered plans. pricing_model field has to be specified. - @constraint:Array {maxLength: 32, minLength: 1} - pricing_tier[] tiers?; - # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- date_time create_time?; - # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- date_time update_time?; -}; - -# The customer and merchant payment preferences. -public type payment_method record { - # The customer-selected payment method on the merchant site. - @constraint:String {minLength: 1, pattern: re `^[0-9A-Z_]+$`} - string payer_selected = "PAYPAL"; - # The merchant-preferred payment methods. - payee_payment_method_preference payee_preferred?; - # NACHA (the regulatory body governing the ACH network) requires that API callers (merchants, partners) obtain the consumer’s explicit authorization before initiating a transaction. To stay compliant, you’ll need to make sure that you retain a compliant authorization for each transaction that you originate to the ACH Network using this API. ACH transactions are categorized (using SEC codes) by how you capture authorization from the Receiver (the person whose bank account is being debited or credited). PayPal supports the following SEC codes. - "TEL"|"WEB"|"CCD"|"PPD" standard_entry_class_code = "WEB"; -}; - # Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint. @display {label: "Connection Config"} public type ConnectionConfig record {| @@ -321,7 +317,7 @@ public type ConnectionConfig record {| http:ClientSocketConfig socketConfig = {}; # Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default boolean validation = true; - # Enables relaxed data binding on the client side. When enabled, `nil` values are treated as optional, + # Enables relaxed data binding on the client side. When enabled, `nil` values are treated as optional, # and absent fields are handled as `nilable` types. Enabled by default. boolean laxDataBinding = true; |}; @@ -330,7 +326,13 @@ public type SubscriptionReviseResponseAllOf2 record { # Indicates whether the subscription has overridden any plan attributes. boolean plan_overridden?; # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links). - link_description[] links?; + LinkDescription[] links?; +}; + +# The customer who approves and pays for the order. The customer is also known as the payer +public type Payer record { + *PayerBase; + *PayerAllOf2; }; public type SubscriptionAllOf2 record { @@ -341,655 +343,605 @@ public type SubscriptionAllOf2 record { @constraint:String {maxLength: 50, minLength: 3} string plan_id?; # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- date_time start_time?; + DateTime start_time?; # The quantity of the product in the subscription. @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} string quantity?; - # The currency and amount for a financial transaction, such as a balance or payment due. - money shipping_amount?; - # The subscriber response information. - subscriber subscriber?; - # The billing details for the subscription. If the subscription was or is active, these fields are populated. - subscription_billing_info billing_info?; + # The currency and amount for a financial transaction, such as a balance or payment due + Money shipping_amount?; + # The subscriber response information + Subscriber subscriber?; + # The billing details for the subscription. If the subscription was or is active, these fields are populated + SubscriptionBillingInfo billing_info?; # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- date_time create_time?; + DateTime create_time?; # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- date_time update_time?; + DateTime update_time?; # The custom id for the subscription. Can be invoice id. @constraint:String {maxLength: 127, minLength: 1} string custom_id?; # Indicates whether the subscription has overridden any plan attributes. boolean plan_overridden?; - # The plan details. - plan plan?; + # The plan details + Plan plan?; # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links). - link_description[] links?; + LinkDescription[] links?; }; -# The create plan request details. -public type plan_request_POST record { - # The ID of the product created through Catalog Products API. - @constraint:String {maxLength: 50, minLength: 6} - string product_id; - # The plan name. - @constraint:String {maxLength: 127, minLength: 1} - string name; - # The initial state of the plan. Allowed input values are CREATED and ACTIVE. - "CREATED"|"INACTIVE"|"ACTIVE" status = "ACTIVE"; - # The detailed description of the plan. - @constraint:String {maxLength: 127, minLength: 1} - string description?; - # An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle. - @constraint:Array {maxLength: 12, minLength: 1} - billing_cycle[] billing_cycles; - # The payment preferences for a subscription. - payment_preferences payment_preferences; - # The tax details. - taxes taxes?; - # Indicates whether you can subscribe to this plan by providing a quantity for the goods or service. - boolean quantity_supported = false; +# The billing cycle details +public type BillingCycle record { + # The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle + @constraint:Int {minValue: 1, maxValue: 99} + int sequence; + # The tenure type of the billing cycle. In case of a plan having trial cycle, only 2 trial cycles are allowed per plan + "REGULAR"|"TRIAL" tenure_type; + # The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles) + @constraint:Int {minValue: 0, maxValue: 999} + int total_cycles = 1; + PricingScheme pricing_scheme?; + # The frequency of the billing cycle + Frequency frequency; }; -# The phone type. -public type phone_type "FAX"|"HOME"|"MOBILE"|"OTHER"|"PAGER"; - -# The merchant-preferred payment methods. -public type payee_payment_method_preference "UNRESTRICTED"|"IMMEDIATE_PAYMENT_REQUIRED"; - -# The subscriber response information. -public type subscriber record { - *payer; - *SubscriberAllOf2; +# Results of 3D Secure Authentication +public type ThreeDSecureAuthenticationResponse record { + ParesStatus authentication_status?; + Enrolled enrollment_status?; }; -# The suspend subscription request details. -public type subscription_suspend_request record { - # The reason for suspenson of the subscription. +# The suspend subscription request details +public type SubscriptionSuspendRequest record { + # The reason for suspenson of the subscription @constraint:String {maxLength: 128, minLength: 1} string reason; }; -# The details for the last payment. -public type last_payment_details LastPaymentDetailsAllOf1; +# An array of JSON patch objects to apply partial updates to resources +public type PatchRequest Patch[]; -# The request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent. -public type subscription_revise_request record { - # The unique PayPal-generated ID for the plan. - @constraint:String {maxLength: 50, minLength: 3} - string plan_id?; - # The quantity of the product or service in the subscription. - @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} - string quantity?; - # The currency and amount for a financial transaction, such as a balance or payment due. - money shipping_amount?; - # The shipping details. - shipping_detail shipping_address?; - # The application context, which customizes the payer experience during the subscription approval process with PayPal. - application_context application_context?; - # An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object. - plan_override plan?; -}; - -# The shipping details. -public type shipping_detail record { - # The name of the party. - name name?; - # The method by which the payer wants to get their items from the payee e.g shipping, in-person pickup. Either type or options but not both may be present. - "SHIPPING"|"PICKUP_IN_PERSON" 'type?; - # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute). - address_portable address?; +# The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute) +public type AddressPortable record { + CountryCode country_code; + # 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`. Value, by country, is:
  • UK. A county.
  • US. A state.
  • Canada. A province.
  • Japan. A prefecture.
  • Switzerland. A kanton.
+ @constraint:String {maxLength: 300} + string admin_area_1?; + # 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 + @constraint:String {maxLength: 300} + string address_line_1?; + # A sub-locality, suburb, neighborhood, or district. Smaller than `admin_area_level_2`. Value is:
  • Brazil. Suburb, bairro, or neighborhood.
  • India. Sub-locality or district. Street name information is not always available but a sub-locality or district can be a very small area.
+ @constraint:String {maxLength: 100} + string admin_area_3?; + AddressDetails address_details?; + # A city, town, or village. Smaller than `admin_area_level_1` + @constraint:String {maxLength: 120} + string admin_area_2?; + # The third line of the address, if needed. For example, a street complement for Brazil, direction text, such as `next to Walmart`, or a landmark in an Indian address + @constraint:String {maxLength: 100} + string address_line_3?; + # The second line of the address. For example, suite or apartment number + @constraint:String {maxLength: 300} + string address_line_2?; + # The neighborhood, ward, or district. Smaller than `admin_area_level_3` or `sub_locality`. Value is:
  • The postal sorting code for Guernsey and many French territories, such as French Guiana.
  • The fine-grained administrative levels in China.
+ @constraint:String {maxLength: 100} + string admin_area_4?; + # The postal code, which is the zip code or equivalent. Typically required for countries with a postal code or an equivalent. See [postal code](https://en.wikipedia.org/wiki/Postal_code) + @constraint:String {maxLength: 60} + string postal_code?; }; -# The response to a request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent. -public type subscription_revise_response record { - *subscription_revise_request; - *SubscriptionReviseResponseAllOf2; +# The payment preferences to override at subscription level +public type PaymentPreferencesOverride record { + Money setup_fee?; + # The action to take on the subscription if the initial payment for the setup fails + "CONTINUE"|"CANCEL" setup_fee_failure_action?; + # Indicates whether to automatically bill the outstanding amount in the next billing cycle + boolean auto_bill_outstanding?; + # The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail + @constraint:Int {minValue: 0, maxValue: 999} + int payment_failure_threshold?; }; -# The tax details. -public type taxes_override record { - # The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99`. - percentage percentage?; - # Indicates whether the tax was already included in the billing amount. - boolean inclusive?; -}; +# The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
+@constraint:String {maxLength: 254, minLength: 3, pattern: re `^.+@[^"\-].+$`} +public type EmailAddress string; -# The details of the captured payment status. -public type capture_status_details record { - # The reason why the captured payment status is `PENDING` or `DENIED`. - "BUYER_COMPLAINT"|"CHARGEBACK"|"ECHECK"|"INTERNATIONAL_WITHDRAWAL"|"OTHER"|"PENDING_REVIEW"|"RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION"|"REFUNDED"|"TRANSACTION_APPROVED_AWAITING_FUNDING"|"UNILATERAL"|"VERIFICATION_REQUIRED" reason?; +# The payment card to use to fund a payment. Can be a credit or debit card +public type Card record { + # The primary account number (PAN) for the payment card + @constraint:String {maxLength: 19, minLength: 13} + string number; + # The three- or four-digit security code of the card. Also known as the CVV, CVC, CVN, CVE, or CID. This parameter cannot be present in the request when `payment_initiator=MERCHANT` + @constraint:String {pattern: re `[0-9]{3,4}`} + string security_code?; + # The card holder's name as it appears on the card + @constraint:String {maxLength: 300} + string name?; + AddressPortable billing_address?; + # The PayPal-generated ID for the card + string id?; + # The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6) + DateYearMonth expiry; + CardBrand card_type?; + # The last digits of the payment card + @constraint:String {pattern: re `[0-9]{2,}`} + string last_digits?; }; -# The [two-character ISO 3166-1 code](/docs/integration/direct/rest/country-codes/) that identifies the country or region.
Note: The country code for Great Britain is GB and not UK as used in the top-level domain names for that country. Use the `C2` country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border transactions.
-@constraint:String {maxLength: 2, minLength: 2, pattern: re `^([A-Z]{2}|C2)$`} -public type country_code string; - # Represents the Headers record for the operation: subscriptions.create public type SubscriptionsCreateHeaders record { - # The server stores keys for 72 hours. + # The server stores keys for 72 hours string PayPal\-Request\-Id?; # The preferred server response upon successful completion of the request. Value is:
  • return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links.
  • return=representation. The server returns a complete resource representation, including the current state of the resource.
string Prefer = "return=minimal"; }; -# The tax ID of the customer. The customer is also known as the payer. Both `tax_id` and `tax_id_type` are required. -public type tax_info record { - # The customer's tax ID value. - @constraint:String {maxLength: 14} - string tax_id; - # The customer's tax ID type. - "BR_CPF"|"BR_CNPJ" tax_id_type; +# The tax details +public type Taxes record { + # Indicates whether the tax was already included in the billing amount + boolean inclusive = true; + # The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99` + Percentage percentage; }; -# The phone number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). -public type phone record { - # The country calling code (CC), in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the CC and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN). - @constraint:String {maxLength: 3, minLength: 1, pattern: re `^[0-9]{1,3}?$`} - string country_code; - # The national number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the country calling code (CC) and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN). - @constraint:String {maxLength: 14, minLength: 1, pattern: re `^[0-9]{1,14}?$`} - string national_number; - # The extension number. - @constraint:String {maxLength: 15, minLength: 1, pattern: re `^[0-9]{1,15}?$`} - string extension_number?; +# The update pricing scheme request details +public type UpdatePricingSchemesListRequest record { + # An array of pricing schemes + @constraint:Array {maxLength: 99, minLength: 1} + UpdatePricingSchemeRequest[] pricing_schemes; }; -# The billing details for the subscription. If the subscription was or is active, these fields are populated. -public type subscription_billing_info record { - # The currency and amount for a financial transaction, such as a balance or payment due. - money outstanding_balance; - # The trial and regular billing executions. - @constraint:Array {maxLength: 3} - cycle_execution[] cycle_executions?; - # The details for the last payment. - last_payment_details last_payment?; - # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- date_time next_billing_time?; - # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- date_time final_payment_time?; - # The number of consecutive payment failures. Resets to `0` after a successful payment. If this reaches the `payment_failure_threshold` value, the subscription updates to the `SUSPENDED` state. - @constraint:Int {minValue: 0, maxValue: 999} - int failed_payments_count; - # The details for the failed payment of the subscription. - failed_payment_details last_failed_payment?; -}; +# The phone type +public type PhoneType "FAX"|"HOME"|"MOBILE"|"OTHER"|"PAGER"; -# Results of Authentication such as 3D Secure. -public type authentication_response record { - # Liability shift indicator. The outcome of the issuer's authentication. - liability_shift liability_shift?; - # Results of 3D Secure Authentication. - three_d_secure_authentication_response three_d_secure?; +# The transaction details +public type Transaction record { + *CaptureStatus; + *TransactionAllOf2; + DateTime time; + AmountWithBreakdown amount_with_breakdown; + string id; }; -# The name of the party. -public type name record { - # The prefix, or title, to the party's name. - @constraint:String {maxLength: 140} - string prefix?; - # When the party is a person, the party's given, or first, name. - @constraint:String {maxLength: 140} - string given_name?; - # When the party is a person, the party's surname or family name. Also known as the last name. Required when the party is a person. Use also to store multiple surnames including the matronymic, or mother's, surname. - @constraint:String {maxLength: 140} - string surname?; - # When the party is a person, the party's middle name. Use also to store multiple middle names including the patronymic, or father's, middle name. - @constraint:String {maxLength: 140} - string middle_name?; - # The suffix for the party's name. - @constraint:String {maxLength: 140} - string suffix?; - # DEPRECATED. The party's alternate name. Can be a business name, nickname, or any other name that cannot be split into first, last name. Required when the party is a business. - @constraint:String {maxLength: 300} - string alternate_full_name?; - # When the party is a person, the party's full name. - @constraint:String {maxLength: 300} - string full_name?; +# The payment card to use to fund a payment. Card can be a credit or debit card +public type CardResponse record { + AuthenticationResponse authentication_result?; + # The payment card type + "CREDIT"|"DEBIT"|"PREPAID"|"UNKNOWN" 'type?; + # The last digits of the payment card + @constraint:String {pattern: re `[0-9]{2,}`} + string last_digits?; + # The card network or brand. Applies to credit, debit, gift, and payment cards + CardBrand brand?; }; -# The application context, which customizes the payer experience during the subscription approval process with PayPal. -public type application_context record { - # The label that overrides the business name in the PayPal account on the PayPal site. +# The create plan request details +public type PlanRequestPOST record { + # Indicates whether you can subscribe to this plan by providing a quantity for the goods or service + boolean quantity_supported = false; + PaymentPreferences payment_preferences; + # The ID of the product created through Catalog Products API + @constraint:String {maxLength: 50, minLength: 6} + string product_id; + # The plan name @constraint:String {maxLength: 127, minLength: 1} - string brand_name?; - # The [language tag](https://tools.ietf.org/html/bcp47#section-2) for the language in which to localize the error-related strings, such as messages, issues, and suggested actions. The tag is made up of the [ISO 639-2 language code](https://www.loc.gov/standards/iso639-2/php/code_list.php), the optional [ISO-15924 script tag](https://www.unicode.org/iso15924/codelists.html), and the [ISO-3166 alpha-2 country code](/docs/integration/direct/rest/country-codes/). - language locale?; - # The location from which the shipping address is derived. - "GET_FROM_FILE"|"NO_SHIPPING"|"SET_PROVIDED_ADDRESS" shipping_preference = "GET_FROM_FILE"; - # Configures the label name to `Continue` or `Subscribe Now` for subscription consent experience. - "CONTINUE"|"SUBSCRIBE_NOW" user_action = "SUBSCRIBE_NOW"; - # The customer and merchant payment preferences. - payment_method payment_method?; - # The URL where the customer is redirected after the customer approves the payment. - @constraint:String {maxLength: 4000, minLength: 10} - string return_url; - # The URL where the customer is redirected after the customer cancels the payment. - @constraint:String {maxLength: 4000, minLength: 10} - string cancel_url; -}; - -# The update pricing scheme request details. -public type update_pricing_schemes_list_request record { - # An array of pricing schemes. - @constraint:Array {maxLength: 99, minLength: 1} - update_pricing_scheme_request[] pricing_schemes; + string name; + # An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle + @constraint:Array {maxLength: 12, minLength: 1} + BillingCycle[] billing_cycles; + # The detailed description of the plan + @constraint:String {maxLength: 127, minLength: 1} + string description?; + # The tax details + Taxes taxes?; + # The initial state of the plan. Allowed input values are CREATED and ACTIVE + "CREATED"|"INACTIVE"|"ACTIVE" status = "ACTIVE"; }; -# The payment card to use to fund a payment. Can be a credit or debit card. -public type card record { - # The PayPal-generated ID for the card. - string id?; - # The card holder's name as it appears on the card. - @constraint:String {maxLength: 300} - string name?; - # The primary account number (PAN) for the payment card. - @constraint:String {maxLength: 19, minLength: 13} - string number; - # The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). - date_year_month expiry; - # The three- or four-digit security code of the card. Also known as the CVV, CVC, CVN, CVE, or CID. This parameter cannot be present in the request when `payment_initiator=MERCHANT`. - @constraint:String {pattern: re `[0-9]{3,4}`} - string security_code?; - # The last digits of the payment card. - @constraint:String {pattern: re `[0-9]{2,}`} - string last_digits?; - # The card network or brand. Applies to credit, debit, gift, and payment cards. - card_brand card_type?; - # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute). - address_portable billing_address?; -}; +# The stand-alone date, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard `date_time` type. This regular expression does not validate all dates. For example, February 31 is valid and nothing is known about leap years +@constraint:String {maxLength: 10, minLength: 10, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$`} +public type DateNoTime string; -# The customer who approves and pays for the order. The customer is also known as the payer. -public type payer_base record { - # The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
- email email_address?; - # The account identifier for a PayPal account. - account_id payer_id?; +# The customer and merchant payment preferences +public type PaymentMethod record { + # The customer-selected payment method on the merchant site + @constraint:String {minLength: 1, pattern: re `^[0-9A-Z_]+$`} + string payer_selected = "PAYPAL"; + PayeePaymentMethodPreference payee_preferred?; + # NACHA (the regulatory body governing the ACH network) requires that API callers (merchants, partners) obtain the consumer’s explicit authorization before initiating a transaction. To stay compliant, you’ll need to make sure that you retain a compliant authorization for each transaction that you originate to the ACH Network using this API. ACH transactions are categorized (using SEC codes) by how you capture authorization from the Receiver (the person whose bank account is being debited or credited). PayPal supports the following SEC codes + "TEL"|"WEB"|"CCD"|"PPD" standard_entry_class_code = "WEB"; }; -# The regular and trial execution details for a billing cycle. -public type cycle_execution record { - # The type of the billing cycle. - "REGULAR"|"TRIAL" tenure_type; - # The order in which to run this cycle among other billing cycles. - @constraint:Int {minValue: 0, maxValue: 99} - int sequence; - # The number of billing cycles that have completed. - @constraint:Int {minValue: 0, maxValue: 9999} - int cycles_completed; - # For a finite billing cycle, cycles_remaining is the number of remaining cycles. For an infinite billing cycle, cycles_remaining is set as 0. - @constraint:Int {minValue: 0, maxValue: 9999} - int cycles_remaining?; - # The active pricing scheme version for the billing cycle. - @constraint:Int {minValue: 1, maxValue: 99} - int current_pricing_scheme_version?; - # The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles). - @constraint:Int {minValue: 0, maxValue: 999} - int total_cycles?; +# The subscriber request information +public type SubscriberRequest record { + *Payer; + *SubscriberRequestAllOf2; }; -# The payment preferences for a subscription. -public type payment_preferences record { - # Indicates whether to automatically bill the outstanding amount in the next billing cycle. - boolean auto_bill_outstanding = true; - # The currency and amount for a financial transaction, such as a balance or payment due. - money setup_fee?; - # The action to take on the subscription if the initial payment for the setup fails. - "CONTINUE"|"CANCEL" setup_fee_failure_action = "CANCEL"; - # The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail. - @constraint:Int {minValue: 0, maxValue: 999} - int payment_failure_threshold = 0; +# The status of a captured payment +public type CaptureStatus record { + CaptureStatusDetails status_details?; + # The status of the captured payment + "COMPLETED"|"DECLINED"|"PARTIALLY_REFUNDED"|"PENDING"|"REFUNDED" status?; }; -# The charge amount from the subscriber. -public type subscription_capture_request record { - # The reason or note for the subscription charge. - @constraint:String {maxLength: 128, minLength: 1} - string note; - # The type of capture. - "OUTSTANDING_BALANCE" capture_type; - # The currency and amount for a financial transaction, such as a balance or payment due. - money amount; +# The JSON patch object to apply partial updates to resources +public type Patch record { + # The operation + "add"|"remove"|"replace"|"move"|"copy"|"test" op; + # The JSON Pointer to the target document location at which to complete the operation + string path?; + # The JSON Pointer to the target document location from which to move the value. Required for the move operation + string 'from?; + # The value to apply. The remove operation does not require a value + anydata value?; }; -# The list transactions for a subscription request details. -public type transactions_list record { - # An array of transactions. - @constraint:Array {maxLength: 32767} - 'transaction[] transactions?; - # The total number of items. - @constraint:Int {minValue: 0, maxValue: 500000000} - int total_items?; - # The total number of pages. - @constraint:Int {minValue: 0, maxValue: 100000000} - int total_pages?; - # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links). - @constraint:Array {maxLength: 10, minLength: 1} - link_description[] links?; +# The details for the failed payment of the subscription +public type FailedPaymentDetails record { + # The reason code for the payment failure + "PAYMENT_DENIED"|"INTERNAL_SERVER_ERROR"|"PAYEE_ACCOUNT_RESTRICTED"|"PAYER_ACCOUNT_RESTRICTED"|"PAYER_CANNOT_PAY"|"SENDING_LIMIT_EXCEEDED"|"TRANSACTION_RECEIVING_LIMIT_EXCEEDED"|"CURRENCY_MISMATCH" reason_code?; + # The currency and amount for a financial transaction, such as a balance or payment due + Money amount; + DateTime next_payment_retry_time?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ DateTime time; }; -# The cancel subscription request details. -public type subscription_cancel_request record { - # The reason for the cancellation of a subscription. - @constraint:String {maxLength: 128, minLength: 1} - string reason; +# The request-related [HATEOAS link](/docs/api/reference/api-responses/#hateoas-links) information +public type LinkDescription record { + # The HTTP method required to make the related call + "GET"|"POST"|"PUT"|"DELETE"|"HEAD"|"CONNECT"|"OPTIONS"|"PATCH" method?; + # The [link relation type](https://tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](https://www.iana.org/assignments/link-relations/link-relations.xhtml) + string rel; + # The complete target URL. To make the related call, combine the method with this [URI Template-formatted](https://tools.ietf.org/html/rfc6570) link. For pre-processing, include the `$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call + string href; }; -# The subscription details. -public type subscription record { - *subscription_status; - *SubscriptionAllOf2; +# The shipping details +public type ShippingDetail record { + # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute) + AddressPortable address?; + # The name of the party + Name name?; + # The method by which the payer wants to get their items from the payee e.g shipping, in-person pickup. Either type or options but not both may be present + "SHIPPING"|"PICKUP_IN_PERSON" 'type?; }; -# An array of JSON patch objects to apply partial updates to resources. -public type patch_request patch[]; - -# The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency. -@constraint:String {maxLength: 3, minLength: 3} -public type currency_code string; - # Represents the Queries record for the operation: subscriptions.transactions public type SubscriptionsTransactionsQueries record { - # The start time of the range of transactions to list. + # The start time of the range of transactions to list @constraint:String {maxLength: 64, minLength: 20, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$`} string start_time; - # The end time of the range of transactions to list. + # The end time of the range of transactions to list @constraint:String {maxLength: 64, minLength: 20, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$`} string end_time; }; -# The update pricing scheme request details. -public type update_pricing_scheme_request record { - # The billing cycle sequence. - @constraint:Int {minValue: 1, maxValue: 99} - int billing_cycle_sequence; - # The pricing scheme details. - pricing_scheme pricing_scheme; -}; - -# The details for the failed payment of the subscription. -public type failed_payment_details record { - # The currency and amount for a financial transaction, such as a balance or payment due. - money amount; - # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- date_time time; - # The reason code for the payment failure. - "PAYMENT_DENIED"|"INTERNAL_SERVER_ERROR"|"PAYEE_ACCOUNT_RESTRICTED"|"PAYER_ACCOUNT_RESTRICTED"|"PAYER_CANNOT_PAY"|"SENDING_LIMIT_EXCEEDED"|"TRANSACTION_RECEIVING_LIMIT_EXCEEDED"|"CURRENCY_MISMATCH" reason_code?; - # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- date_time next_payment_retry_time?; +# The tax details +public type TaxesOverride record { + # Indicates whether the tax was already included in the billing amount + boolean inclusive?; + # The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99` + Percentage percentage?; }; -# The stand-alone date, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard `date_time` type. This regular expression does not validate all dates. For example, February 31 is valid and nothing is known about leap years. -@constraint:String {maxLength: 10, minLength: 10, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$`} -public type date_no_time string; +# Liability shift indicator. The outcome of the issuer's authentication +public type LiabilityShift "YES"|"NO"|"POSSIBLE"|"UNKNOWN"; -# The payment preferences to override at subscription level. -public type payment_preferences_override record { - # Indicates whether to automatically bill the outstanding amount in the next billing cycle. - boolean auto_bill_outstanding?; - # The currency and amount for a financial transaction, such as a balance or payment due. - money setup_fee?; - # The action to take on the subscription if the initial payment for the setup fails. - "CONTINUE"|"CANCEL" setup_fee_failure_action?; - # The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail. - @constraint:Int {minValue: 0, maxValue: 999} - int payment_failure_threshold?; +# The breakdown details for the amount. Includes the gross, tax, fee, and shipping amounts +public type AmountWithBreakdown record { + Money shipping_amount?; + Money tax_amount?; + Money fee_amount?; + Money total_item_amount?; + Money gross_amount; + Money net_amount?; }; -# The subscriber request information . -public type subscriber_request record { - *payer; - *SubscriberRequestAllOf2; +# The currency and amount for a financial transaction, such as a balance or payment due +public type Money record { + # 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](/docs/integration/direct/rest/currency-codes/) + @constraint:String {maxLength: 32, pattern: re `^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$`} + string value; + CurrencyCode currency_code; }; -# An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object. -public type plan_override record { - # An array of billing cycles for trial billing and regular billing. The subscription billing cycle definition has to adhere to the plan billing cycle definition. - @constraint:Array {maxLength: 12, minLength: 1} - billing_cycle_override[] billing_cycles?; - # The payment preferences to override at subscription level. - payment_preferences_override payment_preferences?; - # The tax details. - taxes_override taxes?; -}; +# The [language tag](https://tools.ietf.org/html/bcp47#section-2) for the language in which to localize the error-related strings, such as messages, issues, and suggested actions. The tag is made up of the [ISO 639-2 language code](https://www.loc.gov/standards/iso639-2/php/code_list.php), the optional [ISO-15924 script tag](https://www.unicode.org/iso15924/codelists.html), and the [ISO-3166 alpha-2 country code](/docs/integration/direct/rest/country-codes/) +@constraint:String {maxLength: 10, minLength: 2, pattern: re `^[a-z]{2}(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}))?$`} +public type Language string; -# Liability shift indicator. The outcome of the issuer's authentication. -public type liability_shift "YES"|"NO"|"POSSIBLE"|"UNKNOWN"; +# The details for the last payment +public type LastPaymentDetails LastPaymentDetailsAllOf1; -# The card network or brand. Applies to credit, debit, gift, and payment cards. -public type card_brand "VISA"|"MASTERCARD"|"DISCOVER"|"AMEX"|"SOLO"|"JCB"|"STAR"|"DELTA"|"SWITCH"|"MAESTRO"|"CB_NATIONALE"|"CONFIGOGA"|"CONFIDIS"|"ELECTRON"|"CETELEM"|"CHINA_UNION_PAY"; +# The phone number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en) +public type Phone record { + # The country calling code (CC), in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the CC and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN) + @constraint:String {maxLength: 3, minLength: 1, pattern: re `^[0-9]{1,3}?$`} + string country_code; + # The extension number + @constraint:String {maxLength: 15, minLength: 1, pattern: re `^[0-9]{1,15}?$`} + string extension_number?; + # The national number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the country calling code (CC) and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN) + @constraint:String {maxLength: 14, minLength: 1, pattern: re `^[0-9]{1,14}?$`} + string national_number; +}; + +# The activate subscription request details +public type SubscriptionActivateRequest record { + # The reason for activation of a subscription. Required to reactivate the subscription + @constraint:String {maxLength: 128, minLength: 1} + string reason?; +}; # Represents the Headers record for the operation: subscriptions.capture public type SubscriptionsCaptureHeaders record { - # The server stores keys for 72 hours. + # The server stores keys for 72 hours string PayPal\-Request\-Id?; }; -# Transactions status result identifier. The outcome of the issuer's authentication. -public type pares_status "Y"|"N"|"U"|"A"|"C"|"R"|"D"|"I"; +# The [two-character ISO 3166-1 code](/docs/integration/direct/rest/country-codes/) that identifies the country or region.
Note: The country code for Great Britain is GB and not UK as used in the top-level domain names for that country. Use the `C2` country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border transactions.
+@constraint:String {maxLength: 2, minLength: 2, pattern: re `^([A-Z]{2}|C2)$`} +public type CountryCode string; -# The create subscription request details. -public type subscription_request_post record { - # The ID of the plan. - @constraint:String {maxLength: 50, minLength: 3} - string plan_id; - # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- date_time start_time?; - # The quantity of the product in the subscription. +# The pricing tier details +public type PricingTier record { + # The starting quantity for the tier @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} - string quantity?; - # The currency and amount for a financial transaction, such as a balance or payment due. - money shipping_amount?; - # The subscriber request information . - subscriber_request subscriber?; - # DEPRECATED. Indicates whether the subscription auto-renews after the billing cycles complete. - # - # # Deprecated - @deprecated - boolean auto_renewal = false; - # The application context, which customizes the payer experience during the subscription approval process with PayPal. - application_context application_context?; - # The custom id for the subscription. Can be invoice id. - @constraint:String {maxLength: 127, minLength: 1} - string custom_id?; - # An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object. - plan_override plan?; + string starting_quantity; + # The currency and amount for a financial transaction, such as a balance or payment due + Money amount; + # The ending quantity for the tier. Optional for the last tier + @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} + string ending_quantity?; }; -# The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute). -public type address_portable record { - # 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. - @constraint:String {maxLength: 300} - string address_line_1?; - # The second line of the address. For example, suite or apartment number. - @constraint:String {maxLength: 300} - string address_line_2?; - # The third line of the address, if needed. For example, a street complement for Brazil, direction text, such as `next to Walmart`, or a landmark in an Indian address. - @constraint:String {maxLength: 100} - string address_line_3?; - # The neighborhood, ward, or district. Smaller than `admin_area_level_3` or `sub_locality`. Value is:
  • The postal sorting code for Guernsey and many French territories, such as French Guiana.
  • The fine-grained administrative levels in China.
- @constraint:String {maxLength: 100} - string admin_area_4?; - # A sub-locality, suburb, neighborhood, or district. Smaller than `admin_area_level_2`. Value is:
  • Brazil. Suburb, bairro, or neighborhood.
  • India. Sub-locality or district. Street name information is not always available but a sub-locality or district can be a very small area.
- @constraint:String {maxLength: 100} - string admin_area_3?; - # A city, town, or village. Smaller than `admin_area_level_1`. - @constraint:String {maxLength: 120} - string admin_area_2?; - # 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`. Value, by country, is:
  • UK. A county.
  • US. A state.
  • Canada. A province.
  • Japan. A prefecture.
  • Switzerland. A kanton.
- @constraint:String {maxLength: 300} - string admin_area_1?; - # The postal code, which is the zip code or equivalent. Typically required for countries with a postal code or an equivalent. See [postal code](https://en.wikipedia.org/wiki/Postal_code). - @constraint:String {maxLength: 60} - string postal_code?; - # The [two-character ISO 3166-1 code](/docs/integration/direct/rest/country-codes/) that identifies the country or region.
Note: The country code for Great Britain is GB and not UK as used in the top-level domain names for that country. Use the `C2` country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border transactions.
- country_code country_code; - # The non-portable additional address details that are sometimes needed for compliance, risk, or other scenarios where fine-grain address information might be needed. Not portable with common third party and open source. Redundant with core fields.
For example, `address_portable.address_line_1` is usually a combination of `address_details.street_number`, `street_name`, and `street_type`. - AddressDetails address_details?; +# The customer who approves and pays for the order. The customer is also known as the payer +public type PayerBase record { + Email email_address?; + AccountId payer_id?; }; -# The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
-@constraint:String {maxLength: 254} -public type email string; - -# The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). -@constraint:String {maxLength: 7, minLength: 7, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])$`} -public type date_year_month string; - -# Status of Authentication eligibility. -public type enrolled "Y"|"N"|"U"|"B"; - public type SubscriberRequestAllOf2 record { - # The shipping details. - shipping_detail shipping_address?; - # The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (https://www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions. - payment_source payment_source?; + # The shipping details + ShippingDetail shipping_address?; + # The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (https://www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions + PaymentSource payment_source?; }; -# The non-portable additional address details that are sometimes needed for compliance, risk, or other scenarios where fine-grain address information might be needed. Not portable with common third party and open source. Redundant with core fields.
For example, `address_portable.address_line_1` is usually a combination of `address_details.street_number`, `street_name`, and `street_type`. +# The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99` +@constraint:String {pattern: re `^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$`} +public type Percentage string; + +# The non-portable additional address details that are sometimes needed for compliance, risk, or other scenarios where fine-grain address information might be needed. Not portable with common third party and open source. Redundant with core fields.
For example, `address_portable.address_line_1` is usually a combination of `address_details.street_number`, `street_name`, and `street_type` public type AddressDetails record { - # The street number. + # A named locations that represents the premise. Usually a building name or number or collection of buildings with a common name or number. For example, Craven House @constraint:String {maxLength: 100} - string street_number?; - # The street name. Just `Drury` in `Drury Lane`. + string building_name?; + # The street number @constraint:String {maxLength: 100} - string street_name?; - # The street type. For example, avenue, boulevard, road, or expressway. + string street_number?; + # The street type. For example, avenue, boulevard, road, or expressway @constraint:String {maxLength: 100} string street_type?; - # The delivery service. Post office box, bag number, or post office name. + # The first-order entity below a named building or location that represents the sub-premises. Usually a single building within a collection of buildings with a common name. Can be a flat, story, floor, room, or apartment @constraint:String {maxLength: 100} - string delivery_service?; - # A named locations that represents the premise. Usually a building name or number or collection of buildings with a common name or number. For example, Craven House. + string sub_building?; + # The delivery service. Post office box, bag number, or post office name @constraint:String {maxLength: 100} - string building_name?; - # The first-order entity below a named building or location that represents the sub-premises. Usually a single building within a collection of buildings with a common name. Can be a flat, story, floor, room, or apartment. + string delivery_service?; + # The street name. Just `Drury` in `Drury Lane` @constraint:String {maxLength: 100} - string sub_building?; + string street_name?; }; # Represents the Queries record for the operation: plans.list public type PlansListQueries record { - # Filters the response by a Product ID. + # Filters the response by a Product ID @constraint:String {maxLength: 50, minLength: 6} string product_id?; - # Filters the response by list of plan IDs. Filter supports upto 10 plan IDs. + # Filters the response by list of plan IDs. Filter supports upto 10 plan IDs string plan_ids?; - # A non-zero integer which is the start index of the entire list of items to return in the response. The combination of `page=1` and `page_size=20` returns the first 20 items. The combination of `page=2` and `page_size=20` returns the next 20 items. + # A non-zero integer which is the start index of the entire list of items to return in the response. The combination of `page=1` and `page_size=20` returns the first 20 items. The combination of `page=2` and `page_size=20` returns the next 20 items @constraint:Int {minValue: 1, maxValue: 100000} int page = 1; - # Indicates whether to show the total count in the response. + # Indicates whether to show the total count in the response boolean total_required = false; - # The number of items to return in the response. + # The number of items to return in the response @constraint:Int {minValue: 1, maxValue: 20} int page_size = 10; }; -public type 'transaction record { - *capture_status; - *TransactionAllOf2; - date_time time; - amount_with_breakdown amount_with_breakdown; - string id; -}; - -# The status of a captured payment. -public type capture_status record { - # The status of the captured payment. - "COMPLETED"|"DECLINED"|"PARTIALLY_REFUNDED"|"PENDING"|"REFUNDED" status?; - # The details of the captured payment status. - capture_status_details status_details?; -}; - # Represents the Headers record for the operation: plans.list public type PlansListHeaders record { # The preferred server response upon successful completion of the request. Value is:
  • return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links.
  • return=representation. The server returns a complete resource representation, including the current state of the resource.
string Prefer = "return=minimal"; }; -# The list of plans with details. -public type plan_collection record { - # An array of plans. - @constraint:Array {maxLength: 32767} - plan[] plans?; - # The total number of items. - @constraint:Int {minValue: 0, maxValue: 500000000} - int total_items?; - # The total number of pages. - @constraint:Int {minValue: 0, maxValue: 100000000} - int total_pages?; - # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links). +# The plan details +public type Plan record { + # Indicates whether you can subscribe to this plan by providing a quantity for the goods or service + boolean quantity_supported = false; + DateTime update_time?; + DateTime create_time?; + PaymentPreferences payment_preferences?; + # The ID for the product + @constraint:String {maxLength: 50, minLength: 6} + string product_id?; + # The plan name + @constraint:String {maxLength: 127, minLength: 1} + string name?; + # An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle + @constraint:Array {maxLength: 12, minLength: 1} + BillingCycle[] billing_cycles?; + # The detailed description of the plan + @constraint:String {maxLength: 127, minLength: 1} + string description?; + # The tax details + Taxes taxes?; + # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links) @constraint:Array {maxLength: 10, minLength: 1} - link_description[] links?; + LinkDescription[] links?; + # The unique PayPal-generated ID for the plan + @constraint:String {maxLength: 50, minLength: 3} + string id?; + # The plan status + "CREATED"|"INACTIVE"|"ACTIVE" status?; +}; + +# The charge amount from the subscriber +public type SubscriptionCaptureRequest record { + # The reason or note for the subscription charge + @constraint:String {maxLength: 128, minLength: 1} + string note; + # The currency and amount for a financial transaction, such as a balance or payment due + Money amount; + # The type of capture + "OUTSTANDING_BALANCE" capture_type; +}; + +# Results of Authentication such as 3D Secure +public type AuthenticationResponse record { + LiabilityShift liability_shift?; + ThreeDSecureAuthenticationResponse three_d_secure?; }; public type CardResponseWithBillingAddressAllOf2 record { # The card holder's name as it appears on the card. @constraint:String {maxLength: 300, minLength: 2} string name?; - # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute). - address_portable billing_address?; - # The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). - date_year_month expiry?; - # The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency. - currency_code currency_code?; + # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute) + AddressPortable billing_address?; + # The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6) + DateYearMonth expiry?; + # The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency + CurrencyCode currency_code?; }; public type LastPaymentDetailsAllOf1 record { - # The currency and amount for a financial transaction, such as a balance or payment due. - money amount?; + # The currency and amount for a financial transaction, such as a balance or payment due + Money amount?; # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
- date_time time?; + DateTime time?; }; -# The account identifier for a PayPal account. -@constraint:String {maxLength: 13, minLength: 13, pattern: re `^[2-9A-HJ-NP-Z]{13}$`} -public type account_id string; +# The subscription status details +public type SubscriptionStatus record { + # The reason or notes for the status of the subscription + @constraint:String {maxLength: 128, minLength: 1} + string status_change_note?; + # The status of the subscription + "APPROVAL_PENDING"|"APPROVED"|"ACTIVE"|"SUSPENDED"|"CANCELLED"|"EXPIRED" status?; + DateTime status_update_time?; +}; -# The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
-@constraint:String {maxLength: 254, minLength: 3, pattern: re `^.+@[^"\-].+$`} -public type email_address string; +# The billing details for the subscription. If the subscription was or is active, these fields are populated +public type SubscriptionBillingInfo record { + DateTime final_payment_time?; + # The trial and regular billing executions + @constraint:Array {maxLength: 3} + CycleExecution[] cycle_executions?; + # The number of consecutive payment failures. Resets to `0` after a successful payment. If this reaches the `payment_failure_threshold` value, the subscription updates to the `SUSPENDED` state + @constraint:Int {minValue: 0, maxValue: 999} + int failed_payments_count; + DateTime next_billing_time?; + FailedPaymentDetails last_failed_payment?; + Money outstanding_balance; + LastPaymentDetails last_payment?; +}; -# The currency and amount for a financial transaction, such as a balance or payment due. -public type money record { - # The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency. - currency_code currency_code; - # 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](/docs/integration/direct/rest/currency-codes/). - @constraint:String {maxLength: 32, pattern: re `^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$`} - string value; +# The list of plans with details +public type PlanCollection record { + # An array of plans + @constraint:Array {maxLength: 32767} + Plan[] plans?; + # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links) + @constraint:Array {maxLength: 10, minLength: 1} + LinkDescription[] links?; + # The total number of pages + @constraint:Int {minValue: 0, maxValue: 100000000} + int total_pages?; + # The total number of items + @constraint:Int {minValue: 0, maxValue: 500000000} + int total_items?; }; -# The payment source used to fund the payment. -public type payment_source_response record { - # The payment card used to fund the payment. Card can be a credit or debit card. - card_response_with_billing_address card?; +# The request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent +public type SubscriptionReviseRequest record { + Money shipping_amount?; + # The quantity of the product or service in the subscription + @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} + string quantity?; + ApplicationContext application_context?; + ShippingDetail shipping_address?; + # An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object + PlanOverride plan?; + # The unique PayPal-generated ID for the plan + @constraint:String {maxLength: 50, minLength: 3} + string plan_id?; }; -# The breakdown details for the amount. Includes the gross, tax, fee, and shipping amounts. -public type amount_with_breakdown record { - # The currency and amount for a financial transaction, such as a balance or payment due. - money gross_amount; - # The currency and amount for a financial transaction, such as a balance or payment due. - money total_item_amount?; - # The currency and amount for a financial transaction, such as a balance or payment due. - money fee_amount?; - # The currency and amount for a financial transaction, such as a balance or payment due. - money shipping_amount?; - # The currency and amount for a financial transaction, such as a balance or payment due. - money tax_amount?; - # The currency and amount for a financial transaction, such as a balance or payment due. - money net_amount?; +# The frequency of the billing cycle +public type Frequency record { + # The number of intervals after which a subscriber is billed. For example, if the `interval_unit` is `DAY` with an `interval_count` of `2`, the subscription is billed once every two days. The following table lists the maximum allowed values for the `interval_count` for each `interval_unit`:
Interval unitMaximum interval count
DAY365
WEEK52
MONTH12
YEAR1
+ @constraint:Int {minValue: 1, maxValue: 365} + int interval_count = 1; + # The interval at which the subscription is charged or billed + "DAY"|"WEEK"|"MONTH"|"YEAR" interval_unit; +}; + +# The merchant-preferred payment methods +public type PayeePaymentMethodPreference "UNRESTRICTED"|"IMMEDIATE_PAYMENT_REQUIRED"; + +# Transactions status result identifier. The outcome of the issuer's authentication +public type ParesStatus "Y"|"N"|"U"|"A"|"C"|"R"|"D"|"I"; + +# The payment card used to fund the payment. Card can be a credit or debit card +public type CardResponseWithBillingAddress record { + *CardResponse; + *CardResponseWithBillingAddressAllOf2; }; public type PayerAllOf2 record { - # The name of the party. - name name?; - # The phone information. - phone_with_type phone?; - # The stand-alone date, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard `date_time` type. This regular expression does not validate all dates. For example, February 31 is valid and nothing is known about leap years. - date_no_time birth_date?; - # The tax ID of the customer. The customer is also known as the payer. Both `tax_id` and `tax_id_type` are required. - tax_info tax_info?; - # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute). - address_portable address?; + # The name of the party + Name name?; + # The phone information + PhoneWithType phone?; + # The stand-alone date, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard `date_time` type. This regular expression does not validate all dates. For example, February 31 is valid and nothing is known about leap years + DateNoTime birth_date?; + # The tax ID of the customer. The customer is also known as the payer. Both `tax_id` and `tax_id_type` are required + TaxInfo tax_info?; + # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute) + AddressPortable address?; +}; + +# The billing cycle details to override at subscription level. The subscription billing cycle definition has to adhere to the plan billing cycle definition +public type BillingCycleOverride record { + # The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle + @constraint:Int {minValue: 1, maxValue: 99} + int sequence; + # The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles) + @constraint:Int {minValue: 0, maxValue: 999} + int total_cycles?; + PricingScheme pricing_scheme?; +}; + +# The regular and trial execution details for a billing cycle +public type CycleExecution record { + # The order in which to run this cycle among other billing cycles + @constraint:Int {minValue: 0, maxValue: 99} + int sequence; + # For a finite billing cycle, cycles_remaining is the number of remaining cycles. For an infinite billing cycle, cycles_remaining is set as 0 + @constraint:Int {minValue: 0, maxValue: 9999} + int cycles_remaining?; + # The type of the billing cycle + "REGULAR"|"TRIAL" tenure_type; + # The number of billing cycles that have completed + @constraint:Int {minValue: 0, maxValue: 9999} + int cycles_completed; + # The active pricing scheme version for the billing cycle + @constraint:Int {minValue: 1, maxValue: 99} + int current_pricing_scheme_version?; + # The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles) + @constraint:Int {minValue: 0, maxValue: 999} + int total_cycles?; }; From 9c6c899b9c19d9bbcb70c032491b627ebbbb624f Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 25 Jun 2025 14:54:33 +0530 Subject: [PATCH 48/56] Refactor resource function signatures and payload types Updated mock service and tests to reflect changes in types.bal. Adjusted resource function parameters and payload structures for consistency with the latest type definitions. --- ballerina/tests/mock_service.bal | 50 ++++++++++++++++---------------- ballerina/tests/tests.bal | 32 ++++++++++---------- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/ballerina/tests/mock_service.bal b/ballerina/tests/mock_service.bal index d3db3c1..0469e77 100644 --- a/ballerina/tests/mock_service.bal +++ b/ballerina/tests/mock_service.bal @@ -28,7 +28,7 @@ http:Service mockService = service object { # List plans # # + return - A successful request returns the HTTP 200 OK status code with a JSON response body that lists billing plans - resource function get plans() returns plan_collection|error { + resource function get plans() returns PlanCollection|error { return { plans: [ { @@ -65,7 +65,7 @@ http:Service mockService = service object { # + payload - The plan request payload # + return - A successful request returns the HTTP 200 OK status code with a JSON response body that shows billing plan details - resource function post plans(@http:Payload plan_request_POST payload) returns plan|error { + resource function post plans(@http:Payload PlanRequestPOST payload) returns Plan|error { return { name: payload.name, id: "P-20250618", @@ -95,7 +95,7 @@ http:Service mockService = service object { # # + planId - The ID of the plan to retrieve # + return - A successful request returns the HTTP 200 OK status code with a JSON response body that shows billing plan details - resource function get plans/[string planId]() returns plan|error { + resource function get plans/[string planId]() returns Plan|error { return { name: "Basic Plan", id: planId, // Return the same plan ID that was requested @@ -124,8 +124,8 @@ http:Service mockService = service object { # Update plan by ID # + planId - The ID of the plan to update # + payload - The plan request payload - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body - resource function patch plans/[string planId](@http:Payload patch_request payload) returns http:Ok|error? { + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource function patch plans/[string planId](@http:Payload PatchRequest payload) returns http:Ok|error? { log:printInfo("Mock service received patch request for plan ID: " + planId); log:printInfo("Patch payload: " + payload.toString()); return {}; @@ -134,7 +134,7 @@ http:Service mockService = service object { # Deactivate plan # # + id - The ID of the subscription - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body resource function post plans/[string id]/deactivate() returns http:Ok|error { log:printInfo("Mock service received deactivate request for plan ID: " + id); return {}; @@ -143,7 +143,7 @@ http:Service mockService = service object { # Activate plan # # + id - The ID of the subscription - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body resource function post plans/[string id]/activate() returns http:Ok|error { log:printInfo("Mock service received activate request for plan ID: " + id); return {}; @@ -153,8 +153,8 @@ http:Service mockService = service object { # # + id - The ID of the subscription # + payload - The request payload containing the pricing schemes to update - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body - resource function post plans/[string id]/update\-pricing\-schemes(@http:Payload update_pricing_schemes_list_request payload) returns http:Ok|error { + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource function post plans/[string id]/update\-pricing\-schemes(@http:Payload UpdatePricingSchemesListRequest payload) returns http:Ok|error { log:printInfo("Mock service received update pricing request for plan ID: " + id); log:printInfo("Update pricing payload: " + payload.toString()); return {}; @@ -165,9 +165,9 @@ http:Service mockService = service object { # create a new subscription # + payload - The subscription request payload - # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. - resource function post subscriptions(@http:Payload subscription_request_post payload) returns subscription|error { - return + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. + resource function post subscriptions(@http:Payload SubscriptionRequestPost payload) returns Subscription|error { + return { id: "I-1234567890", status: "APPROVAL_PENDING", @@ -190,8 +190,8 @@ http:Service mockService = service object { # get subscription by ID # # + id - The ID of the subscription to retrieve - # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. - resource function get subscriptions/[string id]() returns subscription|error { + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. + resource function get subscriptions/[string id]() returns Subscription|error { return { id: id, status: "ACTIVE", @@ -215,8 +215,8 @@ http:Service mockService = service object { # # + id - The ID of the subscription to update # + payload - The request payload containing the subscription details to update - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body - resource function patch subscriptions/[string id](@http:Payload patch_request payload) returns http:Ok|error? { + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource function patch subscriptions/[string id](@http:Payload PatchRequest payload) returns http:Ok|error? { log:printInfo("Mock service received update request for subscription ID: " + id); log:printInfo("Update payload: " + payload.toString()); return {}; @@ -225,9 +225,9 @@ http:Service mockService = service object { # Revise plan or quantity of subscription # # + id - The ID of the subscription. - # + payload - Headers to be sent with the request - # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. - resource function post subscriptions/[string id]/revise(@http:Payload subscription_revise_request payload) returns subscription_revise_response|error { + # + payload - Headers to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. + resource function post subscriptions/[string id]/revise(@http:Payload SubscriptionReviseRequest payload) returns SubscriptionReviseResponse|error { log:printInfo("Mock service received revise request for subscription ID: " + id); log:printInfo("Revise payload: " + payload.toString()); return { @@ -247,8 +247,8 @@ http:Service mockService = service object { # # + id - The ID of the subscription. # + payload - Headers to be sent with the request - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. - resource function post subscriptions/[string id]/suspend(@http:Payload subscription_suspend_request payload) returns http:Ok|error { + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. + resource function post subscriptions/[string id]/suspend(@http:Payload SubscriptionSuspendRequest payload) returns http:Ok|error { log:printInfo("Mock service received suspend request for subscription ID: " + id); log:printInfo("Reason for suspension: " + payload.reason.toString()); return {}; @@ -258,8 +258,8 @@ http:Service mockService = service object { # # + id - The ID of the subscription. # + payload - Headers to be sent with the request - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. - resource function post subscriptions/[string id]/activate(@http:Payload subscription_activate_request payload) returns http:Ok|error { + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. + resource function post subscriptions/[string id]/activate(@http:Payload SubscriptionActivateRequest payload) returns http:Ok|error { log:printInfo("Mock service received activate request for subscription ID: " + id); log:printInfo("Reason for activation: " + payload.reason.toString()); return {}; @@ -269,8 +269,8 @@ http:Service mockService = service object { # # + id - The ID of the subscription. # + payload - Headers to be sent with the request - # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. - resource function post subscriptions/[string id]/cancel(@http:Payload subscription_cancel_request payload) returns http:Ok|error { + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. + resource function post subscriptions/[string id]/cancel(@http:Payload SubscriptionCancelRequest payload) returns http:Ok|error { log:printInfo("Mock service received cancel request for subscription ID: " + id); log:printInfo("Reason for cancellation: " + payload.reason.toString()); return {}; diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index 65cd2f7..21ad134 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -30,7 +30,7 @@ string testActivatedSubscriptionPlanId = ""; ConnectionConfig config = { auth: { - tokenUrl: "https://api-m.sandbox.paypal.com/v1/oauth2/token", + //tokenUrl: "https://api-m.sandbox.paypal.com/v1/oauth2/token", clientId, clientSecret } @@ -43,7 +43,7 @@ final Client paypal = check new Client(config, serviceUrl); dependsOn: [testCreatePlan] } function testListPlans() returns error? { - plan_collection response = check paypal->/plans(); + PlanCollection response = check paypal->/plans(); test:assertTrue(response?.plans !is ()); } @@ -82,7 +82,7 @@ function createProduct() returns error? { groups: ["live_tests", "mock_tests"] } function testCreatePlan() returns error? { - plan_request_POST payload = { + PlanRequestPOST payload = { product_id: testProductId, name: "Fresh Clean Tees Plan", status: "ACTIVE", @@ -124,7 +124,7 @@ function testCreatePlan() returns error? { payment_failure_threshold: 3 } }; - plan createdPlan = check paypal->/plans.post(payload); + Plan createdPlan = check paypal->/plans.post(payload); test:assertTrue(createdPlan.id is string, "Created plan should have an ID"); testPlanId = check createdPlan.id.ensureType(string); } @@ -134,7 +134,7 @@ function testCreatePlan() returns error? { dependsOn: [testCreatePlan] } function testGetPlan() returns error? { - plan plan = check paypal->/plans/[testPlanId].get(); + Plan plan = check paypal->/plans/[testPlanId].get(); test:assertEquals(plan.id, testPlanId, "Retrieved plan ID should match the requested ID"); } @@ -143,7 +143,7 @@ function testGetPlan() returns error? { dependsOn: [testCreatePlan] } function testUpdatePlan() returns error? { - patch_request payload = [ + PatchRequest payload = [ { op: "replace", path: "/name", @@ -177,7 +177,7 @@ function testActivatePlan() returns error? { dependsOn: [testCreatePlan, testGetPlan] } function testUpdatePricingSchemes() returns error? { - update_pricing_schemes_list_request payload = { + UpdatePricingSchemesListRequest payload = { pricing_schemes: [ { billing_cycle_sequence: 1, @@ -209,7 +209,7 @@ function testUpdatePricingSchemes() returns error? { } function testCreateSubscription() returns error? { string twoMinutesFromNow = time:utcToString(time:utcAddSeconds(time:utcNow(), 120)); - subscription_request_post payload = { + SubscriptionRequestPost payload = { plan_id: testPlanId, start_time: twoMinutesFromNow, shipping_amount: { @@ -249,7 +249,7 @@ function testCreateSubscription() returns error? { cancel_url: "https://example.com/cancel" } }; - subscription response = check paypal->/subscriptions.post(payload); + Subscription response = check paypal->/subscriptions.post(payload); test:assertTrue(response.id is string, "Created subscription should have an ID"); testSubscriptionId = check response.id.ensureType(string); } @@ -261,7 +261,7 @@ function testGetSubscription() returns error? { SubscriptionsGetQueries queries = { fields: "id,plan_id,status" }; - subscription response = check paypal->/subscriptions/[testSubscriptionId].get(queries = queries); + Subscription response = check paypal->/subscriptions/[testSubscriptionId].get(queries = queries); test:assertEquals(response.id, testSubscriptionId, "Retrieved subscription ID should match the requested ID"); testActivatedSubscriptionPlanId = check response.plan_id.ensureType(string); } @@ -271,7 +271,7 @@ function testGetSubscription() returns error? { after: testGetSubscription } function testUpdateSubscription() returns error? { - patch_request payload = [ + PatchRequest payload = [ { op: "replace", path: "/subscriber/shipping_address", @@ -301,7 +301,7 @@ function testUpdateSubscription() returns error? { after: testGetSubscription } function testReviseSubscription() returns error? { - subscription_revise_request payload = { + SubscriptionReviseRequest payload = { plan_id: testActivatedSubscriptionPlanId, shipping_amount: { currency_code: "USD", @@ -309,7 +309,7 @@ function testReviseSubscription() returns error? { } }; - subscription_revise_response|error response = check paypal->/subscriptions/[testActivatedSubscriptionId]/revise.post(payload); + SubscriptionReviseResponse|error response = check paypal->/subscriptions/[testActivatedSubscriptionId]/revise.post(payload); if response is error { io:println("Error revising subscription: ", response.message()); return response; @@ -324,7 +324,7 @@ function testReviseSubscription() returns error? { after: testGetSubscription } function testSuspendSubscription() returns error? { - subscription_suspend_request payload = { + SubscriptionSuspendRequest payload = { reason: "Item out of stock" }; check paypal->/subscriptions/[testActivatedSubscriptionId]/suspend.post(payload); @@ -336,7 +336,7 @@ function testSuspendSubscription() returns error? { after: testGetSubscription } function testActivateSubscription() returns error? { - subscription_activate_request payload = { + SubscriptionActivateRequest payload = { reason: "Items are back in stock" }; error? response = check paypal->/subscriptions/[testActivatedSubscriptionId]/activate.post(payload); @@ -349,7 +349,7 @@ function testActivateSubscription() returns error? { after: testGetSubscription } function testCancelSubscription() returns error? { - subscription_cancel_request payload = { + SubscriptionCancelRequest payload = { reason: "Customer requested cancellation" }; error? response = check paypal->/subscriptions/[testActivatedSubscriptionId]/cancel.post(payload); From 93752eecb5b4a50d51ff0872fc468aac7ef64f07 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 25 Jun 2025 17:04:57 +0530 Subject: [PATCH 49/56] Update sanitations.md for PayPal Subscriptions connector --- docs/spec/sanitations.md | 57 ++++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/docs/spec/sanitations.md b/docs/spec/sanitations.md index b4453f6..f1bc773 100644 --- a/docs/spec/sanitations.md +++ b/docs/spec/sanitations.md @@ -5,20 +5,55 @@ _Edition_: Swan Lake # Sanitation for OpenAPI specification -This document records the sanitation done on top of the official OpenAPI specification from PayPal Subscriptions. The OpenAPI specification is obtained from the [PayPal REST API Specifications](https://github.com/paypal/paypal-rest-api-specifications/blob/main/openapi/billing_subscriptions_v1.json). These changes are implemented after flattening and aligning the OpenAPI specification to enhance the overall usability and readability of the generated client. +This document records the sanitation done on top of the official OpenAPI specification from PayPal Subscriptions. The OpenAPI specification is obtained from the [PayPal REST API Specifications](https://github.com/paypal/paypal-rest-api-specifications/blob/main/openapi/billing_subscriptions_v1.json). These changes are done in order to improve the overall usability, and as workarounds for some known language limitations. -1. **Renamed schemas with non-compliant names**: - - **Original**: `Schema'400`, `Schema'401`, `Schema'403`, `Schema'404`, `Schema'422` - - **Updated**: `BadRequest`, `Unauthorized`, `Forbidden`, `NotFound`, `UnprocessableEntity` - - **Action**: Updated `$ref` values directly referencing these schemas (e.g., `"$ref": "#/components/schemas/Schema'404"` to `"$ref": "#/components/schemas/NotFound"`). - - **Reason**: The original schema names contained single quotes, which do not comply with the regular expression `^[a-zA-Z0-9\.\-_]+$`. Renaming ensures compliance and clarity for the Ballerina OpenAPI tool. +## 1. Update OAuth2 token URL to relative URL -2. **Update `tokenUrl` to absolute URL**: - - **Original**: `/v1/oauth2/token` - - **Updated**: `https://api-m.sandbox.paypal.com/v1/oauth2/token` - - **Reason**: Prevents the relative path from being appended to the server URL, avoiding an invalid token endpoint in the OAuth2 client credentials flow. +**Location**: `components.securitySchemes.Oauth2.flows.clientCredentials.tokenUrl` -## OpenAPI cli command +**Original**: `"tokenUrl": "/v1/oauth2/token"` + +**Sanitized**: `"tokenUrl": "https://api-m.sandbox.paypal.com/v1/oauth2/token"` + +```diff +- "tokenUrl": "/v1/oauth2/token" ++ "tokenUrl": "https://api-m.sandbox.paypal.com/v1/oauth2/token" +``` + +**Reason**: The relative path does not resolve correctly against the OAuth2 endpoint. + +## 2. Replace `Schema'` keys with related status codes + +**Original**: `Schema'400`, `Schema'401`, `Schema'403`, `Schema'404`, `Schema'422` + +**Sanitized**: `BadRequest`, `Unauthorized`, `Forbidden`, `NotFound`, `UnprocessableEntity` + +**Action**: Updated `$ref` values directly referencing these schemas (e.g., `"$ref": "#/components/schemas/Schema'404"` to `"$ref": "#/components/schemas/NotFound"`). + +**Reason**: JSON keys with apostrophes (e.g., `Schema'404`) are invalid and break schema parsing; using plain, descriptive identifiers (e.g., `NotFound`) ensures valid JSON Schema and prevents generator errors. See GitHub issue [#8011](https://github.com/ballerina-platform/ballerina-library/issues/8011) for details. + +## 3. Avoid JSON data annotations due to lang bug + +**Original**: + +```json +"x-ballerina-name": "billingCycleSequence" +``` + +**Sanitized**: + +```json +"x-ballerina-name-ignore": "billingCycleSequence" +``` + +```diff +- "x-ballerina-name": "billingCycleSequence" ++ "x-ballerina-name-ignore": "billingCycleSequence" +``` + +**Reason**: Due to issue [#38535](https://github.com/ballerina-platform/ballerina-lang/issues/38535), the data binding fails for the fields which have JSON data name annotations. The above change will avoid adding these annotations to the fields. + +## OpenAPI CLI command The following command was used to generate the Ballerina client from the OpenAPI specification. The command should be executed from the repository root directory. From 5cad1809780276b55da773a7447dd97d83fbc5e3 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 25 Jun 2025 17:05:10 +0530 Subject: [PATCH 50/56] Remove commented tokenUrl from connection configuration in tests --- ballerina/tests/tests.bal | 1 - 1 file changed, 1 deletion(-) diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index 21ad134..59e2cec 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -30,7 +30,6 @@ string testActivatedSubscriptionPlanId = ""; ConnectionConfig config = { auth: { - //tokenUrl: "https://api-m.sandbox.paypal.com/v1/oauth2/token", clientId, clientSecret } From d4f1926d9b9fd8df784f653ffa469f4816cead84 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 25 Jun 2025 17:12:12 +0530 Subject: [PATCH 51/56] Add license option to OpenAPI client generation command --- docs/spec/sanitations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/spec/sanitations.md b/docs/spec/sanitations.md index f1bc773..1da8ac5 100644 --- a/docs/spec/sanitations.md +++ b/docs/spec/sanitations.md @@ -58,5 +58,5 @@ This document records the sanitation done on top of the official OpenAPI specifi The following command was used to generate the Ballerina client from the OpenAPI specification. The command should be executed from the repository root directory. ```bash -bal openapi -i docs/spec/openapi.json --mode client -o ballerina +bal openapi -i docs/spec/openapi.json --mode client --license docs/license.txt -o ballerina ``` From d84cd9cdcce403f135a553cf444cf5b945357515 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Wed, 25 Jun 2025 18:27:10 +0530 Subject: [PATCH 52/56] Remove unnecessary response checks from subscription and plan test functions --- ballerina/tests/tests.bal | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index 59e2cec..c9b4643 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -15,7 +15,6 @@ // under the License. import ballerina/http; -import ballerina/io; import ballerina/test; import ballerina/time; @@ -149,8 +148,7 @@ function testUpdatePlan() returns error? { value: "Updated Fresh Clean Tees Plan" } ]; - error? response = check paypal->/plans/[testPlanId].patch(payload); - test:assertTrue(response is (), "Response should be empty on successful patch"); + check paypal->/plans/[testPlanId].patch(payload); } @test:Config { @@ -158,8 +156,7 @@ function testUpdatePlan() returns error? { dependsOn: [testCreatePlan] } function testDeactivatePlan() returns error? { - error? response = check paypal->/plans/[testPlanId]/deactivate.post(); - test:assertTrue(response is (), "Response should be empty on successful deactivation"); + check paypal->/plans/[testPlanId]/deactivate.post(); } @test:Config { @@ -167,8 +164,7 @@ function testDeactivatePlan() returns error? { dependsOn: [testCreatePlan, testDeactivatePlan] } function testActivatePlan() returns error? { - error? response = check paypal->/plans/[testPlanId]/activate.post(); - test:assertTrue(response is (), "Response should be empty on successful activation"); + check paypal->/plans/[testPlanId]/activate.post(); } @test:Config { @@ -198,8 +194,7 @@ function testUpdatePricingSchemes() returns error? { } ] }; - error? response = check paypal->/plans/[testPlanId]/update\-pricing\-schemes.post(payload); - test:assertTrue(response is (), "Response should be empty on successful update of pricing schemes"); + check paypal->/plans/[testPlanId]/update\-pricing\-schemes.post(payload); } @test:Config { @@ -289,8 +284,7 @@ function testUpdateSubscription() returns error? { } } ]; - error? response = check paypal->/subscriptions/[testActivatedSubscriptionId].patch(payload); - test:assertTrue(response is (), "Response should be empty on successful patch"); + check paypal->/subscriptions/[testActivatedSubscriptionId].patch(payload); testSubscriptionId = testActivatedSubscriptionId; } @@ -310,7 +304,6 @@ function testReviseSubscription() returns error? { SubscriptionReviseResponse|error response = check paypal->/subscriptions/[testActivatedSubscriptionId]/revise.post(payload); if response is error { - io:println("Error revising subscription: ", response.message()); return response; } test:assertTrue(response.plan_id is string, "Revised subscription should have a plan ID"); @@ -338,8 +331,7 @@ function testActivateSubscription() returns error? { SubscriptionActivateRequest payload = { reason: "Items are back in stock" }; - error? response = check paypal->/subscriptions/[testActivatedSubscriptionId]/activate.post(payload); - test:assertTrue(response is (), "Response should be empty on successful activation"); + check paypal->/subscriptions/[testActivatedSubscriptionId]/activate.post(payload); } @test:Config { @@ -351,6 +343,5 @@ function testCancelSubscription() returns error? { SubscriptionCancelRequest payload = { reason: "Customer requested cancellation" }; - error? response = check paypal->/subscriptions/[testActivatedSubscriptionId]/cancel.post(payload); - test:assertTrue(response is (), "Response should be empty on successful cancellation"); + check paypal->/subscriptions/[testActivatedSubscriptionId]/cancel.post(payload); } From 09d3d19b0643df13b78f5d28176d2d1437a28ef5 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Thu, 26 Jun 2025 11:51:39 +0530 Subject: [PATCH 53/56] Refactor test configuration and improve documentation for OpenAPI sanitizations --- ballerina/tests/tests.bal | 21 ++--- docs/spec/sanitations.md | 162 +++++++++++++++++++++++++++++++++++--- 2 files changed, 163 insertions(+), 20 deletions(-) diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index c9b4643..caa9de4 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -21,10 +21,11 @@ import ballerina/time; configurable string serviceUrl = isLiveServer ? "https://api-m.sandbox.paypal.com/v1/billing" : "http://localhost:9090/v1/billing"; configurable string clientId = ?; configurable string clientSecret = ?; +configurable string testActivatedSubscriptionId = ?; + string testProductId = ""; string testPlanId = ""; string testSubscriptionId = ""; -configurable string testActivatedSubscriptionId = ?; string testActivatedSubscriptionPlanId = ""; ConnectionConfig config = { @@ -36,15 +37,6 @@ ConnectionConfig config = { final Client paypal = check new Client(config, serviceUrl); -@test:Config { - groups: ["live_tests", "mock_tests"], - dependsOn: [testCreatePlan] -} -function testListPlans() returns error? { - PlanCollection response = check paypal->/plans(); - test:assertTrue(response?.plans !is ()); -} - @test:BeforeSuite function createProduct() returns error? { if !isLiveServer { @@ -76,6 +68,15 @@ function createProduct() returns error? { testProductId = productId; } +@test:Config { + groups: ["live_tests", "mock_tests"], + dependsOn: [testCreatePlan] +} +function testListPlans() returns error? { + PlanCollection response = check paypal->/plans(); + test:assertTrue(response?.plans !is ()); +} + @test:Config { groups: ["live_tests", "mock_tests"] } diff --git a/docs/spec/sanitations.md b/docs/spec/sanitations.md index 1da8ac5..14713c4 100644 --- a/docs/spec/sanitations.md +++ b/docs/spec/sanitations.md @@ -1,11 +1,11 @@ _Author_: @RNViththagan \ -_Created_: 2025/06/13 \ -_Updated_: 2025/06/25 \ +_Created_: 13 June 2025 \ +_Updated_: 26 June 2025 \ _Edition_: Swan Lake -# Sanitation for OpenAPI specification +# Sanitations for the OpenAPI specification -This document records the sanitation done on top of the official OpenAPI specification from PayPal Subscriptions. The OpenAPI specification is obtained from the [PayPal REST API Specifications](https://github.com/paypal/paypal-rest-api-specifications/blob/main/openapi/billing_subscriptions_v1.json). These changes are done in order to improve the overall usability, and as workarounds for some known language limitations. +This document outlines the manual sanitizations applied to the PayPal Subscriptions OpenAPI specification. The official specification is initially retrieved from [PayPal's official GitHub repository](https://github.com/paypal/paypal-rest-api-specifications/blob/main/openapi/billing_subscriptions_v1.json). After being flattened and aligned by the Ballerina OpenAPI tool, these manual modifications are implemented to improve the developer experience and to circumvent certain language and tool limitations. ## 1. Update OAuth2 token URL to relative URL @@ -22,17 +22,159 @@ This document records the sanitation done on top of the official OpenAPI specifi **Reason**: The relative path does not resolve correctly against the OAuth2 endpoint. -## 2. Replace `Schema'` keys with related status codes +## 2. Fix invalid generated schema names with apostrophe -**Original**: `Schema'400`, `Schema'401`, `Schema'403`, `Schema'404`, `Schema'422` +**Original**: + +```json +"Schema'400": { + "properties": { + "details": { + "type": "array", + "items": { + "$ref": "#/components/schemas/400Details" + } + } + } +}, +"Schema'401": { + "properties": { + "details": { + "type": "array", + "items": { + "$ref": "#/components/schemas/401Details" + } + } + } +} +``` + +```json +"InlineResponse400": { + "allOf": [ + { + "$ref": "#/components/schemas/Error400" + }, + { + "$ref": "#/components/schemas/Schema'400" + } + ] +}, +"InlineResponse401": { + "allOf": [ + { + "$ref": "#/components/schemas/Error401" + }, + { + "$ref": "#/components/schemas/Schema'401" + } + ] +} +``` + +**Sanitized**: + +```json +"BadRequest": { + "properties": { + "details": { + "type": "array", + "items": { + "$ref": "#/components/schemas/400Details" + } + } + } +}, +"Unauthorized": { + "properties": { + "details": { + "type": "array", + "items": { + "$ref": "#/components/schemas/401Details" + } + } + } +} +``` + +```json +"InlineResponse400": { + "allOf": [ + { + "$ref": "#/components/schemas/Error400" + }, + { + "$ref": "#/components/schemas/BadRequest" + } + ] +}, +"InlineResponse401": { + "allOf": [ + { + "$ref": "#/components/schemas/Error401" + }, + { + "$ref": "#/components/schemas/Unauthorized" + } + ] +} +``` -**Sanitized**: `BadRequest`, `Unauthorized`, `Forbidden`, `NotFound`, `UnprocessableEntity` +```diff +- "Schema'400": { ++ "BadRequest": { + "properties": { + "details": { + "type": "array", + "items": { + "$ref": "#/components/schemas/400Details" + } + } + } +}, +- "Schema'401": { ++ "Unauthorized": { + "properties": { + "details": { + "type": "array", + "items": { + "$ref": "#/components/schemas/401Details" + } + } + } +} +``` + +```diff +"InlineResponse400": { + "allOf": [ + { + "$ref": "#/components/schemas/Error400" + }, + { +- "$ref": "#/components/schemas/Schema'400" ++ "$ref": "#/components/schemas/BadRequest" + } + ] +}, +"InlineResponse401": { + "allOf": [ + { + "$ref": "#/components/schemas/Error401" + }, + { +- "$ref": "#/components/schemas/Schema'401" ++ "$ref": "#/components/schemas/Unauthorized" + } + ] +} +``` -**Action**: Updated `$ref` values directly referencing these schemas (e.g., `"$ref": "#/components/schemas/Schema'404"` to `"$ref": "#/components/schemas/NotFound"`). +**Reason**: Apostrophes in schema names generate invalid JSON Schema; plain identifiers prevent generator errors. **Reason**: JSON keys with apostrophes (e.g., `Schema'404`) are invalid and break schema parsing; using plain, descriptive identifiers (e.g., `NotFound`) ensures valid JSON Schema and prevents generator errors. See GitHub issue [#8011](https://github.com/ballerina-platform/ballerina-library/issues/8011) for details. -## 3. Avoid JSON data annotations due to lang bug +## 3. Avoid property name sanitisation to avoid data-binding error which is caused by a language limitation **Original**: @@ -51,7 +193,7 @@ This document records the sanitation done on top of the official OpenAPI specifi + "x-ballerina-name-ignore": "billingCycleSequence" ``` -**Reason**: Due to issue [#38535](https://github.com/ballerina-platform/ballerina-lang/issues/38535), the data binding fails for the fields which have JSON data name annotations. The above change will avoid adding these annotations to the fields. +**Reason**: Due to issue [#38535](https://github.com/ballerina-platform/ballerina-lang/issues/38535); the data binding fails for the fields which have JSON data name annotations. Above change will avoid adding this annotations to the fields. ## OpenAPI CLI command From 9571eb6e8afff214b70f8249170a0fc05f15b460 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Thu, 26 Jun 2025 11:51:55 +0530 Subject: [PATCH 54/56] Fix keyword casing in Ballerina.toml for consistency --- build-config/resources/Ballerina.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-config/resources/Ballerina.toml b/build-config/resources/Ballerina.toml index afddfe0..701bc5c 100644 --- a/build-config/resources/Ballerina.toml +++ b/build-config/resources/Ballerina.toml @@ -5,7 +5,7 @@ name = "paypal.subscriptions" version = "@toml.version@" license = ["Apache-2.0"] authors = ["Ballerina"] -keywords = ["paypal", "subscriptions", "plans","billing", "payments", "recurring", "connector",] +keywords = ["PayPal", "Subscriptions", "Plans","Billing", "Payments", "Recurring", "Connector"] icon = "icon.png" repository = "https://github.com/ballerina-platform/module-ballerinax-paypal.subscriptions" From 6a1be552cdcaab22f47725d8460642cf1b18f2d9 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Thu, 26 Jun 2025 11:53:20 +0530 Subject: [PATCH 55/56] [Automated] Update the toml files --- ballerina/Ballerina.toml | 2 +- ballerina/Dependencies.toml | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index d6ce09e..79c61cd 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -5,7 +5,7 @@ name = "paypal.subscriptions" version = "1.0.0" license = ["Apache-2.0"] authors = ["Ballerina"] -keywords = ["paypal", "subscriptions", "plans","billing", "payments", "recurring", "connector",] +keywords = ["PayPal", "Subscriptions", "Plans","Billing", "Payments", "Recurring", "Connector"] icon = "icon.png" repository = "https://github.com/ballerina-platform/module-ballerinax-paypal.subscriptions" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index d64a0ba..6fdf7f8 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -114,9 +114,6 @@ dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.value"} ] -modules = [ - {org = "ballerina", packageName = "io", moduleName = "io"} -] [[package]] org = "ballerina" @@ -341,7 +338,6 @@ dependencies = [ {org = "ballerina", name = "constraint"}, {org = "ballerina", name = "data.jsondata"}, {org = "ballerina", name = "http"}, - {org = "ballerina", name = "io"}, {org = "ballerina", name = "log"}, {org = "ballerina", name = "test"}, {org = "ballerina", name = "time"}, From 3d6f7c86ccb2f69f9eb425dea1219755e96e5757 Mon Sep 17 00:00:00 2001 From: RNViththagan Date: Thu, 26 Jun 2025 14:12:14 +0530 Subject: [PATCH 56/56] Remove unnecessary error handling --- ballerina/tests/tests.bal | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index caa9de4..e102bc6 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -303,10 +303,7 @@ function testReviseSubscription() returns error? { } }; - SubscriptionReviseResponse|error response = check paypal->/subscriptions/[testActivatedSubscriptionId]/revise.post(payload); - if response is error { - return response; - } + SubscriptionReviseResponse response = check paypal->/subscriptions/[testActivatedSubscriptionId]/revise.post(payload); test:assertTrue(response.plan_id is string, "Revised subscription should have a plan ID"); testSubscriptionId = testActivatedSubscriptionId; }