Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ Once a feature has been marked as deprecated, we no longer develop the code or i
```

# Release History
* [9.2.0]
* Adds GET /funding_transactions/{id}
* Adds PUT /collections_screening/{transactionId}/complete
* [9.1.0]
* Adds GET /accounts/{id}/compliance_settings
* Adds POST /accounts/{id}/compliance_settings
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name='currency_cloud',
version='9.1.0',
version='9.2.0',
license='MIT',
description="Python SDK for the Currencycloud API.",
long_description='',
Expand Down
8 changes: 8 additions & 0 deletions src/currencycloud/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Client(Http):
_accounts_client = None
_balances_client = None
_beneficiaries_client = None
_collections_screening_client = None
_contacts_client = None
_conversions_client = None
_funding_client = None
Expand Down Expand Up @@ -98,6 +99,13 @@ def contacts(self):
self._contacts_client = Contacts(self.config)
return self._contacts_client

@property
def collections_screening(self):
'''Get the Collections Screening client.'''
if self._collections_screening_client is None:
self._collections_screening_client = CollectionsScreeningClient(self.config)
return self._collections_screening_client

@property
def conversions(self):
'''Get the Conversions client.'''
Expand Down
1 change: 1 addition & 0 deletions src/currencycloud/clients/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from currencycloud.clients.auth import Auth
from currencycloud.clients.balances import Balances
from currencycloud.clients.beneficiaries import Beneficiaries
from currencycloud.clients.collections_screening import CollectionsScreeningClient
from currencycloud.clients.contacts import Contacts
from currencycloud.clients.conversions import Conversions
from currencycloud.clients.funding import Funding
Expand Down
14 changes: 14 additions & 0 deletions src/currencycloud/clients/collections_screening.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'''This module provides a class for Collections Screening calls to the CC API'''

from currencycloud.http import Http
from currencycloud.resources import CollectionsScreening


class CollectionsScreeningClient(Http):
'''This class provides an interface to the Collections Screening endpoints of the CC API'''

def complete(self, transaction_id, **kwargs):
'''
Accept or reject an inbound transaction before the funds are credited to the beneficiary's account.
'''
return CollectionsScreening(self, **self.put('/v2/collections_screening/' + transaction_id + '/complete', kwargs))
6 changes: 5 additions & 1 deletion src/currencycloud/clients/funding.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'''This module provides a class for Funding calls to the CC API'''

from currencycloud.http import Http
from currencycloud.resources import PaginatedCollection, FundingAccount, PaymentChargesSettings
from currencycloud.resources import PaginatedCollection, FundingAccount, FundingTransaction, PaymentChargesSettings


class Funding(Http):
Expand All @@ -15,3 +15,7 @@ def find_funding_accounts(self, **kwargs):
response = self.get('/v2/funding_accounts/find', query=kwargs)
data = [FundingAccount(self, **fields) for fields in response['funding_accounts']]
return PaginatedCollection(data, response['pagination'])

def retrieve_funding_transaction(self, resource_id, **kwargs):
'''Get the details of an approved funding transaction with the given ID.'''
return FundingTransaction(self, **self.get('/v2/funding_transactions/' + resource_id, query=kwargs))
22 changes: 22 additions & 0 deletions src/currencycloud/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,28 @@ def execute_request(url, headers, data):
return body, response.headers
return body

def put(self, endpoint, data, authenticated=True, retry=True, return_response_headers=False, additional_headers=None):
'''Executes a PUT request.'''

url = self.__build_url(endpoint)
data = self.__encode_arrays(self.__handle_on_behalf_of(data))
headers = self.__build_headers(authenticated, additional_headers)

def execute_request(url, headers, data):
return self.session.put(url, headers=headers, data=data)

response = self.__handle_authentication_errors(execute_request,
retry,
url,
headers,
data,
authenticated)
body = self.__handle_errors('put', url, data, response)

if return_response_headers:
return body, response.headers
return body

def __build_url(self, endpoint):
return self.__environment_url() + endpoint

Expand Down
3 changes: 2 additions & 1 deletion src/currencycloud/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
from currencycloud.resources.balance import Balance, MarginBalanceTopUp
from currencycloud.resources.beneficiary import Beneficiary
from currencycloud.resources.account_verification import AccountVerification
from currencycloud.resources.collections_screening import CollectionsScreening
from currencycloud.resources.contact import Contact
from currencycloud.resources.conversion import Conversion
from currencycloud.resources.funding import FundingAccount
from currencycloud.resources.funding import FundingAccount, FundingTransaction
from currencycloud.resources.iban import Iban
from currencycloud.resources.paginated_collection import PaginatedCollection
from currencycloud.resources.payer import Payer
Expand Down
8 changes: 8 additions & 0 deletions src/currencycloud/resources/collections_screening.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'''This module provides the object representation of a CurrencyCloud Collections Screening'''

from currencycloud.resources.resource import Resource


class CollectionsScreening(Resource):
'''This class represents a CurrencyCloud Collections Screening result'''
pass
4 changes: 4 additions & 0 deletions src/currencycloud/resources/funding.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ class FundingAccount(Resource):
'''This class represents a CurrencyCloud Funding Account'''
pass

class FundingTransaction(Resource):
'''This class represents a CurrencyCloud Funding Transaction'''
pass

2 changes: 1 addition & 1 deletion src/currencycloud/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '9.1.0'
VERSION = '9.2.0'
4 changes: 2 additions & 2 deletions tests/fixtures/vcr_cassettes/accounts/can_get_current.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"Connection": "keep-alive",
"Content-Length": "104",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0"
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0"
},
"method": "POST",
"uri": "https://devapi.currencycloud.com/v2/authenticate/api"
Expand Down Expand Up @@ -56,7 +56,7 @@
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Cookie": "__cfduid=de80fc864b341e306dc9603ce66028f4d1494837748",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0",
"X-Auth-Token": "08c092fed3a7e97ada698e5ec60c3e4a"
},
"method": "GET",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"Connection": "keep-alive",
"Content-Length": "104",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0"
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0"
},
"method": "POST",
"uri": "https://devapi.currencycloud.com/v2/authenticate/api"
Expand Down Expand Up @@ -56,7 +56,7 @@
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Cookie": "__cfduid=de80fc864b341e306dc9603ce66028f4d1494837748",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0",
"X-Auth-Token": "08c092fed3a7e97ada698e5ec60c3e4a"
},
"method": "GET",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"Connection": "keep-alive",
"Content-Length": "104",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0"
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0"
},
"method": "POST",
"uri": "https://devapi.currencycloud.com/v2/authenticate/api"
Expand Down Expand Up @@ -58,7 +58,7 @@
"Content-Length": "15",
"Content-Type": "application/x-www-form-urlencoded",
"Cookie": "__cfduid=d58dbc311d1d46e40db08a3ba059e1d221494839075",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0",
"X-Auth-Token": "a32102935874276433e4f751af0ea2bc"
},
"method": "POST",
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/vcr_cassettes/accounts/create.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"Connection": "keep-alive",
"Content-Length": "104",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0"
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0"
},
"method": "POST",
"uri": "https://devapi.currencycloud.com/v2/authenticate/api"
Expand Down Expand Up @@ -58,7 +58,7 @@
"Content-Length": "127",
"Content-Type": "application/x-www-form-urlencoded",
"Cookie": "__cfduid=d1023b9b38e629ad2f2e5ef55be081ace1494838748",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0",
"X-Auth-Token": "32978c7fb01658be81ed35b981eb2788"
},
"method": "POST",
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/vcr_cassettes/accounts/find.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"Connection": "keep-alive",
"Content-Length": "104",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0"
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0"
},
"method": "POST",
"uri": "https://devapi.currencycloud.com/v2/authenticate/api"
Expand Down Expand Up @@ -56,7 +56,7 @@
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Cookie": "__cfduid=d7cfc1e64f20a082985f27bc80f2cf81c1494838434",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0",
"X-Auth-Token": "9a80cab6e3b509c64ed7243228ec3c47",
"Content-Type": "application/x-www-form-urlencoded"
},
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/vcr_cassettes/accounts/retrieve.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"Connection": "keep-alive",
"Content-Length": "104",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0"
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0"
},
"method": "POST",
"uri": "https://devapi.currencycloud.com/v2/authenticate/api"
Expand Down Expand Up @@ -56,7 +56,7 @@
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Cookie": "__cfduid=d2b8a349b255349ccb6b57169052223d61494838551",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0",
"X-Auth-Token": "35030987b149058b383f8f00ceeb7d4e"
},
"method": "GET",
Expand Down
8 changes: 4 additions & 4 deletions tests/fixtures/vcr_cassettes/accounts/update.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"Connection": "keep-alive",
"Content-Length": "104",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0"
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0"
},
"method": "POST",
"uri": "https://devapi.currencycloud.com/v2/authenticate/api"
Expand Down Expand Up @@ -56,7 +56,7 @@
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Cookie": "__cfduid=d58dbc311d1d46e40db08a3ba059e1d221494839075",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0",
"X-Auth-Token": "a32102935874276433e4f751af0ea2bc"
},
"method": "GET",
Expand Down Expand Up @@ -101,7 +101,7 @@
"Content-Length": "15",
"Content-Type": "application/x-www-form-urlencoded",
"Cookie": "__cfduid=d58dbc311d1d46e40db08a3ba059e1d221494839075",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0",
"X-Auth-Token": "a32102935874276433e4f751af0ea2bc"
},
"method": "POST",
Expand Down Expand Up @@ -144,7 +144,7 @@
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Cookie": "__cfduid=d58dbc311d1d46e40db08a3ba059e1d221494839075",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0",
"X-Auth-Token": "a32102935874276433e4f751af0ea2bc"
},
"method": "GET",
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/vcr_cassettes/actions/can_create.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"Connection": "keep-alive",
"Content-Length": "104",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0"
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0"
},
"method": "POST",
"uri": "https://devapi.currencycloud.com/v2/authenticate/api"
Expand Down Expand Up @@ -58,7 +58,7 @@
"Content-Length": "481",
"Content-Type": "application/x-www-form-urlencoded",
"Cookie": "__cfduid=dd5b98d90ef5b860793bce8e793a6435d1494591745",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0",
"X-Auth-Token": "e2ada368147b8e119b599451410a444d"
},
"method": "POST",
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/vcr_cassettes/actions/can_current.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"Connection": "keep-alive",
"Content-Length": "104",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0"
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0"
},
"method": "POST",
"uri": "https://devapi.currencycloud.com/v2/authenticate/api"
Expand Down Expand Up @@ -56,7 +56,7 @@
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Cookie": "__cfduid=d35cd73279dac1e8f6c3e824cbe4649951494591999",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0",
"X-Auth-Token": "d90740f703c292a2cb7078b849db226f"
},
"method": "GET",
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/vcr_cassettes/actions/can_delete.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"Connection": "keep-alive",
"Content-Length": "104",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0"
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0"
},
"method": "POST",
"uri": "https://devapi.currencycloud.com/v2/authenticate/api"
Expand Down Expand Up @@ -57,7 +57,7 @@
"Connection": "keep-alive",
"Content-Length": "0",
"Cookie": "__cfduid=db1a46383508d96a762411cb9b6e6be6b1494591753",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0",
"X-Auth-Token": "65b373a3c6177b14592242ee02b71b4c"
},
"method": "POST",
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/vcr_cassettes/actions/can_find.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"Connection": "keep-alive",
"Content-Length": "104",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0"
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0"
},
"method": "POST",
"uri": "https://devapi.currencycloud.com/v2/authenticate/api"
Expand Down Expand Up @@ -57,7 +57,7 @@
"Connection": "keep-alive",
"Cookie": "__cfduid=d1cbd05c915ee5568fc94e3cb7dc0f78b1494591749",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0",
"X-Auth-Token": "4d1e20b567320c5145a737bfe42c52a8"
},
"method": "POST",
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/vcr_cassettes/actions/can_first.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"Connection": "keep-alive",
"Content-Length": "104",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0"
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0"
},
"method": "POST",
"uri": "https://devapi.currencycloud.com/v2/authenticate/api"
Expand Down Expand Up @@ -56,7 +56,7 @@
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Cookie": "__cfduid=de78c85c5809773ca3cc58550601a77d31494592400",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0",
"Content-Type": "application/x-www-form-urlencoded",
"X-Auth-Token": "21cd42704e029210d70be102fc4e7523"
},
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/vcr_cassettes/actions/can_retrieve.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"Connection": "keep-alive",
"Content-Length": "104",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0"
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0"
},
"method": "POST",
"uri": "https://devapi.currencycloud.com/v2/authenticate/api"
Expand Down Expand Up @@ -56,7 +56,7 @@
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Cookie": "__cfduid=daf78fc7a733917bd9da969829aaacd0e1494591747",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.1.0",
"User-Agent": "CurrencyCloudSDK/2.0 Python/9.2.0",
"X-Auth-Token": "977ba095cee10fc80b8746c238181ff4"
},
"method": "GET",
Expand Down
Loading
Loading