Skip to content

Commit 4c4c74c

Browse files
Automated commit message
1 parent 47fafb6 commit 4c4c74c

File tree

388 files changed

+18233
-2820
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

388 files changed

+18233
-2820
lines changed

CHANGELOG.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

README.md

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,63 @@
55

66
### Important Notes
77

8-
- **Available Features:** This SDK currently contains only 3 of PayPal's API endpoints. Additional endpoints and functionality will be added in the future.
8+
- **Available Features:** This SDK currently contains only 5 of PayPal's API endpoints. Additional endpoints and functionality will be added in the future.
99

1010
### Information
1111

1212
The PayPal Server SDK provides integration access to the PayPal REST APIs. The API endpoints are divided into distinct controllers:
1313

1414
- Orders Controller: [Orders API v2](https://developer.paypal.com/docs/api/orders/v2/)
15-
- Payments Controller: [Payments API v2](https://developer.paypal.com/docs/api/payments/v2
15+
- Payments Controller: [Payments API v2](https://developer.paypal.com/docs/api/payments/v2)
1616
- Vault Controller: [Payment Method Tokens API v3](https://developer.paypal.com/docs/api/payment-tokens/v3/) *Available in the US only.*
17+
- Transaction Search Controller: [Transaction Search API v1](https://developer.paypal.com/docs/api/transaction-search/v1/)
18+
- Subscriptions Controller: [Subscriptions API v1](https://developer.paypal.com/docs/api/subscriptions/v1/)
1719

1820
## Install the Package
1921

2022
The package is compatible with Python versions `3.7+`.
2123
Install the package from PyPi using the following pip command:
2224

2325
```bash
24-
pip install paypal-server-sdk==1.1.0
26+
pip install paypal-server-sdk==2.0.0
2527
```
2628

2729
You can also view the package at:
28-
https://pypi.python.org/pypi/paypal-server-sdk/1.1.0
30+
https://pypi.python.org/pypi/paypal-server-sdk/2.0.0
2931

3032
## Initialize the API Client
3133

32-
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/client.md)
34+
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/client.md)
3335

3436
The following parameters are configurable for the API Client:
3537

3638
| Parameter | Type | Description |
3739
| --- | --- | --- |
3840
| environment | `Environment` | The API environment. <br> **Default: `Environment.SANDBOX`** |
39-
| http_client_instance | `HttpClient` | The Http Client passed from the sdk user for making requests |
41+
| http_client_instance | `Union[Session, HttpClientProvider]` | The Http Client passed from the sdk user for making requests |
4042
| override_http_client_configuration | `bool` | The value which determines to override properties of the passed Http Client from the sdk user |
4143
| http_call_back | `HttpCallBack` | The callback value that is invoked before and after an HTTP call is made to an endpoint |
4244
| timeout | `float` | The value to use for connection timeout. <br> **Default: 60** |
4345
| max_retries | `int` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
4446
| backoff_factor | `float` | A backoff factor to apply between attempts after the second try. <br> **Default: 2** |
4547
| retry_statuses | `Array of int` | The http statuses on which retry is to be done. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
4648
| retry_methods | `Array of string` | The http methods on which retry is to be done. <br> **Default: ['GET', 'PUT']** |
47-
| logging_configuration | [`LoggingConfiguration`](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/logging-configuration.md) | The SDK logging configuration for API calls |
48-
| client_credentials_auth_credentials | [`ClientCredentialsAuthCredentials`](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/auth/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant |
49+
| proxy_settings | [`ProxySettings`](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
50+
| logging_configuration | [`LoggingConfiguration`](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/logging-configuration.md) | The SDK logging configuration for API calls |
51+
| client_credentials_auth_credentials | [`ClientCredentialsAuthCredentials`](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/auth/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant |
4952

5053
The API client can be initialized as follows:
5154

5255
```python
56+
import logging
57+
58+
from paypalserversdk.configuration import Environment
59+
from paypalserversdk.http.auth.o_auth_2 import ClientCredentialsAuthCredentials
60+
from paypalserversdk.logging.configuration.api_logging_configuration import LoggingConfiguration
61+
from paypalserversdk.logging.configuration.api_logging_configuration import RequestLoggingConfiguration
62+
from paypalserversdk.logging.configuration.api_logging_configuration import ResponseLoggingConfiguration
63+
from paypalserversdk.paypal_serversdk_client import PaypalServersdkClient
64+
5365
client = PaypalServersdkClient(
5466
client_credentials_auth_credentials=ClientCredentialsAuthCredentials(
5567
o_auth_client_id='OAuthClientId',
@@ -83,33 +95,36 @@ The SDK can be configured to use a different environment for making API calls. A
8395

8496
This API uses the following authentication schemes.
8597

86-
* [`Oauth2 (OAuth 2 Client Credentials Grant)`](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/auth/oauth-2-client-credentials-grant.md)
98+
* [`Oauth2 (OAuth 2 Client Credentials Grant)`](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/auth/oauth-2-client-credentials-grant.md)
8799

88100
## List of APIs
89101

90-
* [Orders](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/controllers/orders.md)
91-
* [Payments](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/controllers/payments.md)
92-
* [Vault](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/controllers/vault.md)
102+
* [Transactionsearch](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/controllers/transactionsearch.md)
103+
* [Orders](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/controllers/orders.md)
104+
* [Payments](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/controllers/payments.md)
105+
* [Vault](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/controllers/vault.md)
106+
* [Subscriptions](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/controllers/subscriptions.md)
93107

94108
## SDK Infrastructure
95109

96110
### Configuration
97111

98-
* [AbstractLogger](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/abstract-logger.md)
99-
* [LoggingConfiguration](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/logging-configuration.md)
100-
* [RequestLoggingConfiguration](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/request-logging-configuration.md)
101-
* [ResponseLoggingConfiguration](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/response-logging-configuration.md)
112+
* [ProxySettings](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/proxy-settings.md)
113+
* [AbstractLogger](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/abstract-logger.md)
114+
* [LoggingConfiguration](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/logging-configuration.md)
115+
* [RequestLoggingConfiguration](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/request-logging-configuration.md)
116+
* [ResponseLoggingConfiguration](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/response-logging-configuration.md)
102117

103118
### HTTP
104119

105-
* [HttpResponse](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/http-response.md)
106-
* [HttpRequest](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/http-request.md)
120+
* [HttpResponse](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/http-response.md)
121+
* [HttpRequest](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/http-request.md)
107122

108123
### Utilities
109124

110-
* [ApiResponse](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/api-response.md)
111-
* [ApiHelper](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/api-helper.md)
112-
* [HttpDateTime](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/http-date-time.md)
113-
* [RFC3339DateTime](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/rfc3339-date-time.md)
114-
* [UnixDateTime](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/unix-date-time.md)
125+
* [ApiResponse](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/api-response.md)
126+
* [ApiHelper](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/api-helper.md)
127+
* [HttpDateTime](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/http-date-time.md)
128+
* [RFC3339DateTime](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/rfc3339-date-time.md)
129+
* [UnixDateTime](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/unix-date-time.md)
115130

doc/auth/oauth-2-client-credentials-grant.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ Documentation for accessing and setting credentials for Oauth2.
2727
You must initialize the client with *OAuth 2.0 Client Credentials Grant* credentials as shown in the following code snippet. This will fetch the OAuth token automatically when any of the endpoints, requiring *OAuth 2.0 Client Credentials Grant* authentication, are called.
2828

2929
```python
30+
from paypalserversdk.http.auth.o_auth_2 import ClientCredentialsAuthCredentials
31+
from paypalserversdk.paypal_serversdk_client import PaypalServersdkClient
32+
3033
client = PaypalServersdkClient(
3134
client_credentials_auth_credentials=ClientCredentialsAuthCredentials(
3235
o_auth_client_id='OAuthClientId',
@@ -44,6 +47,9 @@ Your application can also manually provide an OAuthToken using the setter `o_aut
4447
Whenever the OAuth Token gets updated, the provided callback implementation will be executed. For instance, you may use it to store your access token whenever it gets updated.
4548

4649
```python
50+
from paypalserversdk.http.auth.o_auth_2 import ClientCredentialsAuthCredentials
51+
from paypalserversdk.paypal_serversdk_client import PaypalServersdkClient
52+
4753
client = PaypalServersdkClient(
4854
client_credentials_auth_credentials=ClientCredentialsAuthCredentials(
4955
o_auth_client_id='OAuthClientId',
@@ -61,6 +67,9 @@ client = PaypalServersdkClient(
6167
To authorize a client using a stored access token, set up the `o_auth_token_provider` in `ClientCredentialsAuthCredentials` along with the other auth parameters before creating the client:
6268

6369
```python
70+
from paypalserversdk.http.auth.o_auth_2 import ClientCredentialsAuthCredentials
71+
from paypalserversdk.paypal_serversdk_client import PaypalServersdkClient
72+
6473
def _o_auth_token_provider(last_oauth_token, auth_manager):
6574
# Add the callback handler to provide a new OAuth token
6675
# It will be triggered whenever the last provided o_auth_token is null or expired

doc/client.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,30 @@ The following parameters are configurable for the API Client:
66
| Parameter | Type | Description |
77
| --- | --- | --- |
88
| environment | `Environment` | The API environment. <br> **Default: `Environment.SANDBOX`** |
9-
| http_client_instance | `HttpClient` | The Http Client passed from the sdk user for making requests |
9+
| http_client_instance | `Union[Session, HttpClientProvider]` | The Http Client passed from the sdk user for making requests |
1010
| override_http_client_configuration | `bool` | The value which determines to override properties of the passed Http Client from the sdk user |
1111
| http_call_back | `HttpCallBack` | The callback value that is invoked before and after an HTTP call is made to an endpoint |
1212
| timeout | `float` | The value to use for connection timeout. <br> **Default: 60** |
1313
| max_retries | `int` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
1414
| backoff_factor | `float` | A backoff factor to apply between attempts after the second try. <br> **Default: 2** |
1515
| retry_statuses | `Array of int` | The http statuses on which retry is to be done. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
1616
| retry_methods | `Array of string` | The http methods on which retry is to be done. <br> **Default: ['GET', 'PUT']** |
17+
| proxy_settings | [`ProxySettings`](../doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
1718
| logging_configuration | [`LoggingConfiguration`](../doc/logging-configuration.md) | The SDK logging configuration for API calls |
1819
| client_credentials_auth_credentials | [`ClientCredentialsAuthCredentials`](auth/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant |
1920

2021
The API client can be initialized as follows:
2122

2223
```python
24+
import logging
25+
26+
from paypalserversdk.configuration import Environment
27+
from paypalserversdk.http.auth.o_auth_2 import ClientCredentialsAuthCredentials
28+
from paypalserversdk.logging.configuration.api_logging_configuration import LoggingConfiguration
29+
from paypalserversdk.logging.configuration.api_logging_configuration import RequestLoggingConfiguration
30+
from paypalserversdk.logging.configuration.api_logging_configuration import ResponseLoggingConfiguration
31+
from paypalserversdk.paypal_serversdk_client import PaypalServersdkClient
32+
2333
client = PaypalServersdkClient(
2434
client_credentials_auth_credentials=ClientCredentialsAuthCredentials(
2535
o_auth_client_id='OAuthClientId',
@@ -49,5 +59,7 @@ The gateway for the SDK. This class acts as a factory for the Controllers and al
4959
| orders | Gets OrdersController |
5060
| payments | Gets PaymentsController |
5161
| vault | Gets VaultController |
62+
| transaction_search | Gets TransactionSearchController |
63+
| subscriptions | Gets SubscriptionsController |
5264
| o_auth_authorization | Gets OAuthAuthorizationController |
5365

0 commit comments

Comments
 (0)