You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: airbyte-integrations/connectors/source-paypal-transaction/README.md
+130-8
Original file line number
Diff line number
Diff line change
@@ -1,54 +1,89 @@
1
1
# Paypal-Transaction source connector
2
2
3
-
4
3
This is the repository for the Paypal-Transaction source connector, written in Python.
5
4
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.com/integrations/sources/paypal-transaction).
* If you are going to use the data generator scripts you need to setup yourPaypal Sandbox and a Buyer user in your sandbox, to simulate the data. YOu cna get that information in the [Apps & Credentials page](https://developer.paypal.com/dashboard/applications/live).
14
+
* Buyer Username
15
+
* Buyer Password
16
+
* Payer ID (Account ID)
13
17
14
18
### Installing the connector
19
+
15
20
From this connector directory, run:
16
21
```bash
17
22
poetry install --with dev
18
23
```
19
24
20
-
21
25
### Create credentials
26
+
22
27
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.com/integrations/sources/paypal-transaction)
23
28
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_paypal_transaction/spec.yaml` file.
24
29
Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
25
30
See `sample_files/sample_config.json` for a sample config file.
26
31
32
+
* You must have created your credentials under the `secrets/` folder
33
+
* For the read command, you can create separate catalogs to test the streams individually. All catalogs are under the folder `integration_tests`. Select the one you want to test with the read command.
34
+
27
35
28
36
### Locally running the connector
37
+
29
38
```
30
39
poetry run source-paypal-transaction spec
31
40
poetry run source-paypal-transaction check --config secrets/config.json
32
41
poetry run source-paypal-transaction discover --config secrets/config.json
33
-
poetry run source-paypal-transaction read --config secrets/config.json --catalog sample_files/configured_catalog.json
42
+
#Example with list_payments catalog and the debug flag
43
+
poetry run source-paypal-transaction read --config secrets/config.json --catalog integration_tests/configured_catalog_list_payments.json --debug
34
44
```
35
45
36
46
### Running unit tests
37
47
To run unit tests locally, from the connector directory run:
When contributing on our connector you might need to customize the build process to add a system dependency or set an env var.
67
+
You can customize our build process by adding a `build_customization.py` module to your connector.
68
+
This module should contain a `pre_connector_install` and `post_connector_install` async function that will mutate the base image and the connector container respectively.
69
+
It will be imported at runtime by our build process and the functions will be called if they exist.
70
+
71
+
Here is an example of a `build_customization.py` module:
72
+
```python
73
+
from__future__import annotations
74
+
75
+
from typing importTYPE_CHECKING
76
+
77
+
ifTYPE_CHECKING:
78
+
# Feel free to check the dagger documentation for more information on the Container object and its methods.
You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
100
+
63
101
```bash
64
102
airbyte-ci connectors --name=source-paypal-transaction test
65
103
```
66
104
105
+
If you are testing locally, you can use your local credentials (config.json file) by using `--use-local-secrets`
106
+
107
+
```bash
108
+
airbyte-ci connectors --name source-paypal-transaction --use-local-secrets test
109
+
```
110
+
67
111
### Customizing acceptance Tests
68
112
Customize `acceptance-test-config.yml` file to configure acceptance tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
69
113
If your connector requires to create or destroy resources for use during acceptance tests create fixtures for it and place them inside integration_tests/acceptance.py.
70
114
71
-
### Dependency Management
115
+
116
+
## Running Unit tests locally
117
+
118
+
To run unit tests locally, form the root `source_paypal_transaction` directory run:
119
+
120
+
```bash
121
+
python -m pytest unit_test
122
+
```
123
+
124
+
## Test changes in the sandbox
125
+
126
+
If you have a [Paypal Sandbox](https://developer.paypal.com/tools/sandbox/accounts/) you will be able to use some APIs to create new data and test how data is being created in your destinaiton and choose the best syn strategy that suits better your use case.
127
+
Some endpoints will require special permissions on the sandbox to update and change some values.
128
+
129
+
In the `bin` folder you will find several data generator scripts:
130
+
131
+
***disputes_generator.py:**
132
+
* Update dispute: Uses the _PATCH_ method of the `https://api-m.paypal.com/v1/customer/disputes/{dispute_id}` endpoint. You need the ID and create a payload to pass it as an argument. See more information [here](https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_patch).
133
+
134
+
```bash
135
+
python disputes_generator.py update DISPUTE_ID ''[{"op": "replace", "path": "/reason", "value": "The new reason"}]'
136
+
```
137
+
138
+
* Update Evidence status: Uses the _POST_ method of the `https://api-m.paypal.com/v1/customer/disputes/{dispute_id}/require-evidence` endpoint. You need the ID and select an option to pass it as an argument. See more information [here](https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_require-evidence)
* Create draft invoice: Uses the _POST_ method of the `https://api-m.sandbox.paypal.com/v2/invoicing/invoices` endpoint. It will automatically generate an invoice (no need to pass any parameters). See more information [here](https://developer.paypal.com/docs/api/invoicing/v2/#invoices_create).
145
+
146
+
```bash
147
+
python invoices.py create_draft
148
+
```
149
+
150
+
* Send a Draft Invoice: Uses the _POST_ method of the `https://api-m.sandbox.paypal.com/v2/invoicing/invoices/{invoice_id}/send` endpoint. You need the Invoice ID, a subject and a note (just to have something to update) and an email as an argument. See more information [here](https://developer.paypal.com/docs/api/invoicing/v2/#invoices_send)
* Partially update payment: Uses the _PATCH_ method of the `https://api-m.paypal.com/v1/payments/payment/{payment_id}` endpoint. You need the payment ID and a payload with new values. (no need to pass any parameters). See more information [here](https://developer.paypal.com/docs/api/invoicing/v2/#invoices_create).
Make sure you have the `buyer_username`, `buyer_password` and `payer_id` in your config file. You can get the sample configuratin in the `sample_config.json`.
164
+
165
+
* Generate transactions: This uses Selenium, so you will be prompted to your account to simulate the complete transaction flow. You can add a number at the end of the command to do more than one transaction. By default the script runs 3 transactions.
166
+
167
+
**NOTE: Be midnfu of the number of transactions, as it will be interacting with your machine, and you may not be able to use it while creating the transactions**
* Create a product: Uses the _POST_ method of the `https://api-m.sandbox.paypal.com/v1/catalogs/products` endpoint. You need to add the description and the category in the command line. For the proper category see more information [here](https://developer.paypal.com/docs/api/catalog-products/v1/#products_create).
* Update a product: Uses the _PATCH_ method of the `https://developer.paypal.com/docs/api/catalog-products/v1/#products_patch` endpoint. You need the product ID, a description and the Category as an argument. See more information [here](https://developer.paypal.com/docs/api/catalog-products/v1/#products_patch)
181
+
```bash
182
+
python product_catalog.py --action update --product_id PRODUCT_ID --update_payload '[{"op": "replace", "path": "/description", "value": "My Update. Does it changes it?"}]'
183
+
```
184
+
185
+
## Dependency Management
186
+
All of your dependencies should go in `setup.py`, NOT `requirements.txt`. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development.
187
+
We split dependencies between two groups, dependencies that are:
188
+
* required for your connector to work need to go to `MAIN_REQUIREMENTS` list.
189
+
* required for the testing need to go to `TEST_REQUIREMENTS` list
190
+
191
+
72
192
All of your dependencies should be managed via Poetry.
193
+
73
194
To add a new dependency, run:
74
195
```bash
75
196
poetry add <package-name>
76
197
```
77
198
199
+
78
200
Please commit the changes to `pyproject.toml` and `poetry.lock` files.
0 commit comments