Skip to content

Commit

Permalink
Merge pull request #55 from fintoc-com/master
Browse files Browse the repository at this point in the history
  • Loading branch information
daleal authored Dec 22, 2022
2 parents 2f0f365 + 5542d3e commit f5173ee
Show file tree
Hide file tree
Showing 16 changed files with 357 additions and 537 deletions.
80 changes: 40 additions & 40 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,120 +13,120 @@ on:

jobs:
black:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Checkout to commit code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.6
python-version: "3.10.6"

- name: Install Poetry
run: |
make get-poetry
echo $HOME/.poetry/bin >> $GITHUB_PATH
# Cache the .venv directory
- name: Set up Poetry cache
uses: actions/cache@v2
id: poetry-cache
- name: Set up environment cache
uses: actions/cache@v3
id: environment-cache
with:
key: poetry-cache-v1-${{ hashFiles('**/poetry.lock') }}
key: environment-cache-v1-${{ hashFiles('**/poetry.lock') }}
path: .venv

- name: Install dependencies
if: steps.poetry-cache.outputs.cache-hit != 'true'
if: steps.environment-cache.outputs.cache-hit != 'true'
run: poetry install

- name: Lint with Black
run: make black

flake8:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Checkout to commit code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.6
python-version: "3.10.6"

- name: Install Poetry
run: |
make get-poetry
echo $HOME/.poetry/bin >> $GITHUB_PATH
# Cache the .venv directory
- name: Set up Poetry cache
uses: actions/cache@v2
id: poetry-cache
- name: Set up environment cache
uses: actions/cache@v3
id: environment-cache
with:
key: poetry-cache-v1-${{ hashFiles('**/poetry.lock') }}
key: environment-cache-v1-${{ hashFiles('**/poetry.lock') }}
path: .venv

- name: Install dependencies
if: steps.poetry-cache.outputs.cache-hit != 'true'
if: steps.environment-cache.outputs.cache-hit != 'true'
run: poetry install

- name: Lint with Flake8
run: make flake8

isort:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Checkout to commit code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.6
python-version: "3.10.6"

- name: Install Poetry
run: |
make get-poetry
echo $HOME/.poetry/bin >> $GITHUB_PATH
# Cache the .venv directory
- name: Set up Poetry cache
uses: actions/cache@v2
id: poetry-cache
- name: Set up environment cache
uses: actions/cache@v3
id: environment-cache
with:
key: poetry-cache-v1-${{ hashFiles('**/poetry.lock') }}
key: environment-cache-v1-${{ hashFiles('**/poetry.lock') }}
path: .venv

- name: Install dependencies
if: steps.poetry-cache.outputs.cache-hit != 'true'
if: steps.environment-cache.outputs.cache-hit != 'true'
run: poetry install

- name: Lint with Isort
run: make isort

pylint:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Checkout to commit code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.6
python-version: "3.10.6"

- name: Install Poetry
run: |
make get-poetry
echo $HOME/.poetry/bin >> $GITHUB_PATH
# Cache the .venv directory
- name: Set up Poetry cache
uses: actions/cache@v2
id: poetry-cache
- name: Set up environment cache
uses: actions/cache@v3
id: environment-cache
with:
key: poetry-cache-v1-${{ hashFiles('**/poetry.lock') }}
key: environment-cache-v1-${{ hashFiles('**/poetry.lock') }}
path: .venv

- name: Install dependencies
if: steps.poetry-cache.outputs.cache-hit != 'true'
if: steps.environment-cache.outputs.cache-hit != 'true'
run: poetry install

- name: Lint with Pylint
Expand Down
35 changes: 17 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,25 @@ on:

jobs:
pypi-release:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Checkout to commit code

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.6
python-version: "3.10.6"

- name: Install Poetry
run: |
make get-poetry
echo $HOME/.poetry/bin >> $GITHUB_PATH
# Cache the .venv directory
- name: Set up Poetry cache
uses: actions/cache@v2
id: poetry-cache
- name: Set up environment cache
uses: actions/cache@v3
id: environment-cache
with:
key: poetry-cache-v1-${{ hashFiles('**/poetry.lock') }}
key: environment-cache-v1-${{ hashFiles('**/poetry.lock') }}
path: .venv

- name: Install dependencies
Expand All @@ -45,26 +44,26 @@ jobs:
github-release:
needs: pypi-release

runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Checkout to commit code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.6
python-version: "3.10.6"

- name: Install Poetry
run: |
make get-poetry
echo $HOME/.poetry/bin >> $GITHUB_PATH
# Cache the .venv directory
- name: Set up Poetry cache
uses: actions/cache@v2
id: poetry-cache
- name: Set up environment cache
uses: actions/cache@v3
id: environment-cache
with:
key: poetry-cache-v1-${{ hashFiles('**/poetry.lock') }}
key: environment-cache-v1-${{ hashFiles('**/poetry.lock') }}
path: .venv

- name: Install dependencies
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@ on:

jobs:
pytest:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Checkout to commit code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.6
python-version: "3.10.6"

- name: Install Poetry
run: |
make get-poetry
echo $HOME/.poetry/bin >> $GITHUB_PATH
# Cache the .venv directory
- name: Set up Poetry cache
uses: actions/cache@v2
id: poetry-cache
- name: Set up environment cache
uses: actions/cache@v3
id: environment-cache
with:
key: poetry-cache-v1-${{ hashFiles('**/poetry.lock') }}
key: environment-cache-v1-${{ hashFiles('**/poetry.lock') }}
path: .venv

- name: Install dependencies
Expand All @@ -43,8 +43,8 @@ jobs:
- name: Run Pytest
run: make tests

- name: Upload coverage
uses: codecov/codecov-action@v2
- name: Upload coverage to CodeCov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
verbose: true
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
POETRY_VERSION = 1.2.1

# Env stuff
.PHONY: get-poetry
get-poetry:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 -
curl -sSL https://install.python-poetry.org | python3 - --version $(POETRY_VERSION)

.PHONY: build-env
build-env:
Expand Down
57 changes: 38 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@
</a>
</p>

## Why?

You can think of [Fintoc API](https://fintoc.com/docs) as a piscola.
And the key ingredient to a properly made piscola are the ice cubes.
Sure, you can still have a [piscola without ice cubes](https://curl.haxx.se/).
But hey… that’s not enjoyable -- why would you do that?
Do yourself a favor: go grab some ice cubes by installing this refreshing library.

## Installation

Install using pip!
Expand Down Expand Up @@ -323,17 +315,6 @@ for tax_return in link.tax_returns.all():
print(tax_return.id)
```

#### The `subscriptions` manager

Available methods: `all`, `get`.

Once you have a Link, you can use the `subscriptions` manager to get all the subscriptions associated to a link!

```python
for subscription in link.subscriptions.all():
print(subscription.id)
```

#### The `refresh_intents` manager

Available methods: `all`, `get`, `create`.
Expand Down Expand Up @@ -392,6 +373,44 @@ for movement in account.movements.all():
print(movement.id)
```

#### The `subscription_intents` manager

Available methods: `all`, `get`, `create`

Subscription intents allow you to start a subscription using Fintoc!:

```python
subscription_intent = fintoc_client.subscription_intents.create()

print(subscription_intent.id) # si_BO381oEATXonG6bj
print(subscription_intent.widget_token) # si_BO381oEATXonG6bj_sec_a4xK32BanKWYn
```

#### The `subscriptions` manager

Available methods: `all`, `get`

You can check the status of the created subscription with the `subscriptions` manager

```python
subscription = fintoc_client.subscriptions.get('<subscription_id>')
print(subscription.status)
```

#### The `charges` manager

Available methods: `all`, `get`, `create`

Once you have active subscriptions, you can use the `charges` manager to create charges to thosse subscriptions

```python
charge = fintoc_client.charges.create(
currency='CLP',
amount=1250,
subscription_id='<subscription_id>',
)
```

### Serialization

Any resource of the SDK can be serialized! To get the serialized resource, just call the `serialize` method!
Expand Down
6 changes: 6 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
comment:
behavior: default
layout: reach, diff, flags, files
require_head: true
require_base: false
require_changes: false
Loading

0 comments on commit f5173ee

Please sign in to comment.