Skip to content

Commit 5619614

Browse files
committed
Renamed all package and classes to , updated version and package info
1 parent 8f1f39a commit 5619614

37 files changed

+383
-384
lines changed

docs/README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,14 @@
3636
Create a client for the Trolley Python API
3737

3838

39-
client = Configuration.gateway("YOUR-PUBLIC-API","YOUR-PRIVATE-API","production")
39+
client = Configuration.gateway("ACCESS_KEY","SECRET_KEY")
4040

4141
**Parameters:**
4242

4343
| Param | Type | Description |
4444
| ------ | ------ | ------ |
45-
| publicKey | [String] | The public key |
46-
| secretKey | [String] | The secret key |
47-
| enviroment | [String] | The enviroment that should be used |
45+
| ACCESS_KEY | [String] | The public key |
46+
| SECRET_KEY | [String] | The secret key |
4847

4948

5049

paymentrails/__init__.py

-9
This file was deleted.

setup.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
from setuptools import setup
22

33
setup (
4-
name='paymentrails',
5-
version='0.2',
6-
packages=["paymentrails", "paymentrails.exceptions"],
7-
package_data={"paymentrails": ["ssl/*"]},
4+
name='trolleyhq',
5+
version='1.0.0',
6+
packages=["trolley", "trolley.exceptions"],
7+
package_data={"trolley": ["ssl/*"]},
88
install_requires=['requests>=2.13.0'],
99
author='Trolley',
1010
author_email='[email protected]',
1111
summary='Trolley Python SDK',
12-
url='',
13-
license='',
12+
url='https://www.trolley.com',
13+
license='MIT',
1414
long_description='A native Python SDK for the Trolley API',
1515
)

test/integration/BatchTest.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
sys.path.append(os.path.abspath('.'))
77

8-
from paymentrails.configuration import Configuration
9-
from paymentrails.recipient import Recipient
10-
from paymentrails.recipient_account import RecipientAccount
11-
from paymentrails.batch import Batch
12-
from paymentrails.payment import Payment
8+
from trolley.configuration import Configuration
9+
from trolley.recipient import Recipient
10+
from trolley.recipient_account import RecipientAccount
11+
from trolley.batch import Batch
12+
from trolley.payment import Payment
1313
from TestSetup import TestSetup
1414

1515

test/integration/RecipientTest.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
sys.path.append(os.path.abspath('.'))
77

8-
from paymentrails.configuration import Configuration
9-
from paymentrails.recipient import Recipient
10-
from paymentrails.recipient_account import RecipientAccount
8+
from trolley.configuration import Configuration
9+
from trolley.recipient import Recipient
10+
from trolley.recipient_account import RecipientAccount
1111
from TestSetup import TestSetup
1212

1313

test/integration/TestSetup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
sys.path.append(os.path.abspath('.'))
55

6-
from paymentrails.configuration import Configuration
6+
from trolley.configuration import Configuration
77
from dotenv import dotenv_values
88

99
class TestSetup:

test/unit/testBalances.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
sys.path.append(os.path.abspath('.'))
66

7-
import paymentrails.configuration
8-
import paymentrails.balances
7+
import trolley.configuration
8+
import trolley.balances
99
from mock import MagicMock, Mock, patch
1010

1111

12-
import paymentrails.exceptions.notFoundException
13-
import paymentrails.exceptions.invalidFieldException
12+
import trolley.exceptions.notFoundException
13+
import trolley.exceptions.invalidFieldException
1414

1515

1616
def fake_find():
@@ -30,11 +30,11 @@ def setUp(self):
3030
private_key = ("privatekey")
3131

3232
def test_retrieve_payoutMethod(self):
33-
paymentrails.configuration.Configuration.set_public_key(
33+
trolley.configuration.Configuration.set_public_key(
3434
TestBalances.public_key)
35-
paymentrails.configuration.Configuration.set_private_key(
35+
trolley.configuration.Configuration.set_private_key(
3636
TestBalances.private_key)
37-
response = paymentrails.balances.Balances.find()
37+
response = trolley.balances.Balances.find()
3838
status = {"ok": "true", "balances": {"USD": {"primary": "true", "amount": "10000.00",
3939
"currency": "USD", "type": "paymentrails", "accountNumber": "null"}}}
4040
self.assertEqual(response, status)

test/unit/testBatch.py

+83-83
Large diffs are not rendered by default.

test/unit/testPayment.py

+104-104
Large diffs are not rendered by default.

test/unit/testRecipient.py

+78-78
Large diffs are not rendered by default.

trolley/__init__.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from trolley.configuration import Configuration
2+
from trolley.recipient import Recipient
3+
from trolley.balances import Balances
4+
from trolley.client import Client
5+
from trolley.batch import Batch
6+
from trolley.payment import Payment
7+
from trolley.recipient_account import RecipientAccount
8+
from trolley.gateway import Gateway
9+
from trolley.batch_summary import BatchSummary

paymentrails/balances.py renamed to trolley/balances.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from paymentrails.configuration import Configuration
2-
from paymentrails.gateway import Gateway
1+
from trolley.configuration import Configuration
2+
from trolley.gateway import Gateway
33

44
class Balances:
55
"""

paymentrails/balances_gateway.py renamed to trolley/balances_gateway.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from collections import namedtuple
2-
from paymentrails.exceptions.invalidFieldException import InvalidFieldException
3-
import paymentrails.configuration
2+
from trolley.exceptions.invalidFieldException import InvalidFieldException
3+
import trolley.configuration
44

55

66
class BalancesGateway(object):
@@ -17,8 +17,8 @@ def find(self, term=""):
1717
if term is None:
1818
raise InvalidFieldException("Term cannot be None")
1919
endpoint = '/v1/balances/' + term
20-
response = paymentrails.configuration.Configuration.client(
20+
response = trolley.configuration.Configuration.client(
2121
self.config).get(endpoint)
22-
oldbalance = paymentrails.balances.Balances.factory(response)
22+
oldbalance = trolley.balances.Balances.factory(response)
2323
balance = namedtuple("Balances", oldbalance.keys())(*oldbalance.values())
2424
return balance

paymentrails/batch.py renamed to trolley/batch.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from paymentrails.configuration import Configuration
2-
from paymentrails.gateway import Gateway
1+
from trolley.configuration import Configuration
2+
from trolley.gateway import Gateway
33

44
class Batch:
55
"""
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from collections import namedtuple
2-
from paymentrails.exceptions.invalidFieldException import InvalidFieldException
3-
import paymentrails.configuration
2+
from trolley.exceptions.invalidFieldException import InvalidFieldException
3+
import trolley.configuration
44

55

66

@@ -18,19 +18,19 @@ def find(self, batchid):
1818
if batchid is None:
1919
raise InvalidFieldException("Batch id cannot be None.")
2020
endpoint = '/v1/batches/' + batchid
21-
response = paymentrails.configuration.Configuration.client(
21+
response = trolley.configuration.Configuration.client(
2222
self.config).get(endpoint)
23-
tempbatch = paymentrails.batch.Batch.factory(response)
23+
tempbatch = trolley.batch.Batch.factory(response)
2424
batch = namedtuple("Batch", tempbatch.keys())(*tempbatch.values())
2525
return batch
2626

2727
def create(self, body):
2828
if body is None:
2929
raise InvalidFieldException("Body cannot be None.")
3030
endpoint = '/v1/batches/'
31-
response = paymentrails.configuration.Configuration.client(
31+
response = trolley.configuration.Configuration.client(
3232
self.config).post(endpoint, body)
33-
tempbatch = paymentrails.batch.Batch.factory(response)
33+
tempbatch = trolley.batch.Batch.factory(response)
3434
batch = namedtuple("Batch", tempbatch.keys())(*tempbatch.values())
3535
return batch
3636

@@ -40,26 +40,26 @@ def update(self, batchid, body):
4040
if body is None:
4141
raise InvalidFieldException("Body cannot be None.")
4242
endpoint = '/v1/batches/' + batchid
43-
paymentrails.configuration.Configuration.client(
43+
trolley.configuration.Configuration.client(
4444
self.config).patch(endpoint, body)
4545
return True
4646

4747
def delete(self, batchid):
4848
if batchid is None:
4949
raise InvalidFieldException("Batch id cannot be None.")
5050
endpoint = '/v1/batches/' + batchid
51-
paymentrails.configuration.Configuration.client(
51+
trolley.configuration.Configuration.client(
5252
self.config).delete(endpoint)
5353
return True
5454
def search(self, page=1, pagenumber=10, term=""):
5555
endpoint = '/v1/batches?search=' + term + \
5656
'&page=' + str(page) + '&pageSize=' + str(pagenumber)
57-
response = paymentrails.configuration.Configuration.client(
57+
response = trolley.configuration.Configuration.client(
5858
self.config).get(endpoint)
5959
batches = []
6060
count = 0
6161
for batch in response['batches']:
62-
tempbatch = paymentrails.batch.Batch.factory(batch)
62+
tempbatch = trolley.batch.Batch.factory(batch)
6363
newbatch = namedtuple("Batch", tempbatch.keys())(*tempbatch.values())
6464
batches.insert(count, newbatch)
6565
count = count + 1
@@ -69,9 +69,9 @@ def summary(self, batchid):
6969
if batchid is None:
7070
raise InvalidFieldException("Batch id cannot be None.")
7171
endpoint = '/v1/batches/' + batchid + '/summary'
72-
response = paymentrails.configuration.Configuration.client(
72+
response = trolley.configuration.Configuration.client(
7373
self.config).get(endpoint)
74-
tempbatchsummary = paymentrails.batch_summary.BatchSummary.factory(
74+
tempbatchsummary = trolley.batch_summary.BatchSummary.factory(
7575
response)
7676
batchsummary = namedtuple("BatchSummary", tempbatchsummary.keys())(
7777
*tempbatchsummary.values())
@@ -81,18 +81,18 @@ def generate_quote(self, batchid):
8181
if batchid is None:
8282
raise InvalidFieldException("Batch id cannot be None.")
8383
endpoint = '/v1/batches/' + batchid + '/generate-quote'
84-
response = paymentrails.configuration.Configuration.client(
84+
response = trolley.configuration.Configuration.client(
8585
self.config).post(endpoint, {})
86-
tempbatch = paymentrails.batch.Batch.factory(response)
86+
tempbatch = trolley.batch.Batch.factory(response)
8787
batch = namedtuple("Batch", tempbatch.keys())(*tempbatch.values())
8888
return batch
8989

9090
def process_batch(self, batchid):
9191
if batchid is None:
9292
raise InvalidFieldException("Batch id cannot be None.")
9393
endpoint = '/v1/batches/' + batchid + '/start-processing'
94-
response = paymentrails.configuration.Configuration.client(
94+
response = trolley.configuration.Configuration.client(
9595
self.config).post(endpoint, {})
96-
tempbatch = paymentrails.batch.Batch.factory(response)
96+
tempbatch = trolley.batch.Batch.factory(response)
9797
batch = namedtuple("Batch", tempbatch.keys())(*tempbatch.values())
9898
return batch
File renamed without changes.

paymentrails/client.py renamed to trolley/client.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
import json
66
import requests
77

8-
from paymentrails.exceptions.invalidFieldException import InvalidFieldException
9-
from paymentrails.exceptions.unexpectedException import UnexpectedException
10-
from paymentrails.exceptions.notFoundException import NotFoundException
11-
from paymentrails.exceptions.authenticationException import AuthenticationException
12-
from paymentrails.exceptions.authorizationException import AuthorizationException
13-
from paymentrails.exceptions.invalidFieldException import InvalidFieldException
14-
from paymentrails.exceptions.tooManyRequestsException import TooManyRequestsException
15-
from paymentrails.exceptions.downForMaintenanceException import DownForMaintenanceException
16-
from paymentrails.exceptions.malformedException import MalformedException
17-
from paymentrails.exceptions.invalidStatusException import InvalidStatusException
18-
from paymentrails.exceptions.invalidServerConnectionException import InvalidServerConnectionException
8+
from trolley.exceptions.invalidFieldException import InvalidFieldException
9+
from trolley.exceptions.unexpectedException import UnexpectedException
10+
from trolley.exceptions.notFoundException import NotFoundException
11+
from trolley.exceptions.authenticationException import AuthenticationException
12+
from trolley.exceptions.authorizationException import AuthorizationException
13+
from trolley.exceptions.invalidFieldException import InvalidFieldException
14+
from trolley.exceptions.tooManyRequestsException import TooManyRequestsException
15+
from trolley.exceptions.downForMaintenanceException import DownForMaintenanceException
16+
from trolley.exceptions.malformedException import MalformedException
17+
from trolley.exceptions.invalidStatusException import InvalidStatusException
18+
from trolley.exceptions.invalidServerConnectionException import InvalidServerConnectionException
1919

2020

2121
class Client(object):
@@ -41,7 +41,7 @@ def sendRequest(self,endpoint,method,body=""):
4141
headers = {'Content-Type': 'application/json',
4242
'Authorization': authorization,
4343
'X-PR-Timestamp': str(timestamp),
44-
'Trolley-Source': 'python-sdk_0.2'
44+
'Trolley-Source': 'python-sdk_1.0.0'
4545
}
4646

4747
if method == "GET":

paymentrails/configuration.py renamed to trolley/configuration.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
from paymentrails.client import Client
3-
from paymentrails.gateway import Gateway
2+
from trolley.client import Client
3+
from trolley.gateway import Gateway
44
from dotenv import dotenv_values
55

66
class Configuration(object):
File renamed without changes.

paymentrails/gateway.py renamed to trolley/gateway.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from paymentrails.recipient_gateway import RecipientGateway
2-
from paymentrails.balances_gateway import BalancesGateway
3-
from paymentrails.batch_gateway import BatchGateway
4-
from paymentrails.payment_gateway import PaymentGateway
5-
from paymentrails.recipient_account_gateway import RecipientAccountGateway
6-
import paymentrails.configuration
1+
from trolley.recipient_gateway import RecipientGateway
2+
from trolley.balances_gateway import BalancesGateway
3+
from trolley.batch_gateway import BatchGateway
4+
from trolley.payment_gateway import PaymentGateway
5+
from trolley.recipient_account_gateway import RecipientAccountGateway
6+
import trolley.configuration
77

88

99
class Gateway(object):
@@ -12,10 +12,10 @@ class Gateway(object):
1212
"""
1313

1414
def __init__(self, config=None, **kwargs):
15-
if isinstance(config, paymentrails.configuration.Configuration):
15+
if isinstance(config, trolley.configuration.Configuration):
1616
self.config = config
1717
else:
18-
self.config = paymentrails.configuration.Configuration(
18+
self.config = trolley.configuration.Configuration(
1919
public_key=kwargs.get("public_key"),
2020
private_key=kwargs.get("private_key")
2121
)

paymentrails/payment.py renamed to trolley/payment.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from paymentrails.configuration import Configuration
2-
from paymentrails.gateway import Gateway
1+
from trolley.configuration import Configuration
2+
from trolley.gateway import Gateway
33

44
class Payment:
55
"""

0 commit comments

Comments
 (0)