Skip to content

Commit b97ec2c

Browse files
committed
Service information in transaction resource
1 parent f15d0a0 commit b97ec2c

File tree

5 files changed

+69
-56
lines changed

5 files changed

+69
-56
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ venv/
1818
.DS_Store?
1919
*.DS_Store
2020
Thumbs.db
21+
.idea/

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v0.7.0 : 09/02/2022
4+
5+
Transaction contains information about the service using `Transaction.Service` class.
6+
37
## v0.6.2 & v0.6.3: 16/06/2021
48

59
Maintenance release – previous version have been yanked and tags removed due to a security issue and

README.md

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -89,38 +89,38 @@ variables. If you wish to provide your own, add `payer_ip_address` key with vali
8989

9090
First argument is a service provider, which can currently be one of the following:
9191

92-
| Service name | Description |
93-
|:-------------|:------------|
94-
|`cheddar.Service.SPOROPAY`|SporoPay, Slovenská sporiteľňa|
95-
|`cheddar.Service.TATRAPAY`|TatraPay, Tatra banka|
96-
|`cheddar.Service.CARDPAY`|Cardpay, Tatra banka|
97-
|`cheddar.Service.COMFORTPAY`|ComfortPay (periodic payments), Tatra banka|
98-
|`cheddar.Service.EPLATBY`|ePlatby, VÚB|
99-
|`cheddar.Service.ECARD`|eCard, VÚB|
100-
|`cheddar.Service.PAYPAL`|PayPal Payments Standard, PayPal|
101-
|`cheddar.Service.GPWEBPAY`|GP webpay, Global Payments Europe|
102-
|`cheddar.Service.ITERMINAL`|iTerminal, Poštová banka (firstdata.lv backend)|
103-
|`cheddar.Service.ITERMINAL2`|iTerminal, Poštová banka (sia.eu backend)|
92+
| Service name | Description |
93+
|:-----------------------------|:------------------------------------------------|
94+
| `cheddar.Service.SPOROPAY` | SporoPay, Slovenská sporiteľňa |
95+
| `cheddar.Service.TATRAPAY` | TatraPay, Tatra banka |
96+
| `cheddar.Service.CARDPAY` | Cardpay, Tatra banka |
97+
| `cheddar.Service.COMFORTPAY` | ComfortPay (periodic payments), Tatra banka |
98+
| `cheddar.Service.EPLATBY` | ePlatby, VÚB |
99+
| `cheddar.Service.ECARD` | eCard, VÚB |
100+
| `cheddar.Service.PAYPAL` | PayPal Payments Standard, PayPal |
101+
| `cheddar.Service.GPWEBPAY` | GP webpay, Global Payments Europe |
102+
| `cheddar.Service.ITERMINAL` | iTerminal, Poštová banka (firstdata.lv backend) |
103+
| `cheddar.Service.ITERMINAL2` | iTerminal, Poštová banka (sia.eu backend) |
104104

105105
Second argument to the function call is an associative array of configuration options. Which options have to be used
106106
and which have no effect at all depends on the service provider. The next table lists all possible attributes:
107107

108-
| Attribute name | Data type | Required? | Notes |
109-
|:---------------|:---------:|:---------:|:------|
110-
|`amount`|float||amount required in the specified currency|
111-
|`currency`|string||currency code as in [ISO 4217](http://www.iso.org/iso/home/standards/currency_codes.htm)|
112-
|`variable_symbol`|string|| |
113-
|`constant_symbol`|string| | |
114-
|`card_id`|string| |optional card token in periodical payments<br>_applicable only to ComfortPay transactions_|
115-
|`payer_name`|string||customer’s name|
116-
|`payer_email`|string||customer’s email (which has to be a valid e-mail address)|
117-
|`language`|string| |customer’s language|
118-
|`description`|string| |reference for the customer|
119-
|`return_url` or `callback`|string||URL to return to after the payment<br>_iTerminal does not use this attribute since you have to set this up once for all transactions in their administration interface_|
120-
|`notification_url`|string| |URL to send notifications to<br>_required for PayPal transactions_|
121-
|`cpp_logo_image`|string| |header image at PayPal<br>_applicable only to PayPal transactions_|
122-
|`cpp_cart_border_color`|string| |HEX code of colour at PayPal<br>_applicable only to PayPal transactions_|
123-
|`periodicity`|integer| |periodicity in days, when the next periodical payment will be automatically executed; default value is 30 days<br>_applicable only to ComfortPay transactions_|
108+
| Attribute name | Data type | Required? | Notes |
109+
|:---------------------------|:---------:|:---------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
110+
| `amount` | float || amount required in the specified currency |
111+
| `currency` | string || currency code as in [ISO 4217](http://www.iso.org/iso/home/standards/currency_codes.htm) |
112+
| `variable_symbol` | string || |
113+
| `constant_symbol` | string | | |
114+
| `card_id` | string | | optional card token in periodical payments<br>_applicable only to ComfortPay transactions_ |
115+
| `payer_name` | string || customer’s name |
116+
| `payer_email` | string || customer’s email (which has to be a valid e-mail address) |
117+
| `language` | string | | customer’s language |
118+
| `description` | string | | reference for the customer |
119+
| `return_url` or `callback` | string || URL to return to after the payment<br>_iTerminal does not use this attribute since you have to set this up once for all transactions in their administration interface_ |
120+
| `notification_url` | string | | URL to send notifications to<br>_required for PayPal transactions_ |
121+
| `cpp_logo_image` | string | | header image at PayPal<br>_applicable only to PayPal transactions_ |
122+
| `cpp_cart_border_color` | string | | HEX code of colour at PayPal<br>_applicable only to PayPal transactions_ |
123+
| `periodicity` | integer | | periodicity in days, when the next periodical payment will be automatically executed; default value is 30 days<br>_applicable only to ComfortPay transactions_ |
124124

125125
Note that all of the supported currencies are available as a simple constant on `cheddar.Currency` class to make it
126126
easier in code.
@@ -141,16 +141,16 @@ in the `notification_url` parameter
141141

142142
#### Allowed transaction statuses
143143

144-
|Status name|Description|
145-
|:----------|:----------|
146-
|`none`|transaction has been created, but the user has not been redirected to bank’s payment gateway|
147-
|`in_progress`|user has been redirected to bank’s payment gateway|
148-
|`completed`|transaction has been successfully completed|
149-
|`denied` or `rejected`|transaction has been rejected by the bank (the most usual reasons include user error in inputting card details and insufficient funds)|
150-
|`timeout`|special temporary status used only by Tatra banka’s TatraPay service|
151-
|`pending`|special status for PayPal before an IPN notification has resolved the transaction status as either rejected or completed|
152-
|`cancelled`|in case of periodical payments available only with Tatra banka’s ComfortPay service this status means that planned transaction has been cancelled|
153-
|`expired`|old payment without clear result (e.g. user abandoned the payment form while at bank’s gateway)|
144+
| Status name | Description |
145+
|:-----------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------|
146+
| `none` | transaction has been created, but the user has not been redirected to bank’s payment gateway |
147+
| `in_progress` | user has been redirected to bank’s payment gateway |
148+
| `completed` | transaction has been successfully completed |
149+
| `denied` or `rejected` | transaction has been rejected by the bank (the most usual reasons include user error in inputting card details and insufficient funds) |
150+
| `timeout` | special temporary status used only by Tatra banka’s TatraPay service |
151+
| `pending` | special status for PayPal before an IPN notification has resolved the transaction status as either rejected or completed |
152+
| `cancelled` | in case of periodical payments available only with Tatra banka’s ComfortPay service this status means that planned transaction has been cancelled |
153+
| `expired` | old payment without clear result (e.g. user abandoned the payment form while at bank’s gateway) |
154154

155155
### Getting transaction details
156156

@@ -162,22 +162,22 @@ payment = client.payments.details(uuid)
162162

163163
Afterwards you can inspect the returning object, which contains these properties:
164164

165-
|Property name|Data type|Always present?|Default value|Notes|
166-
|:------------|:-------:|:-------------:|:-----------:|:----|
167-
|`uuid`|string|| | |
168-
|`status`|string||none|current transaction status (see the next table)|
169-
|`variable_symbol`|string|| |the same as was sent while creating the payment object (see previous section)|
170-
|`constant_symbol`|string||0308|payment for services|
171-
|`amount`|float||0.00|original amount of the transaction|
172-
|`refunded_amount`|float||0.00|refunded amount of the transaction|
173-
|`service_fee_amount`|float||0.00|provision for the transaction in card payments _available when using CardPay / ComfortPay and set up with PGP encrypted statements or PayPal service_|
174-
|`currency`|`Currencies`||EUR|currency of the transaction|
175-
|`periodicity`|integer| |0|number of days in which next payment will be executed|
176-
|`periodicity_no`|integer| |1|number of transaction in order (using the same variable symbol)|
177-
|`charge_on`|`Datetime`| | |when was or should be this transaction executed|
178-
|`card_expire_on`|`Datetime`| |null|date of card expiration _available only when using ComfortPay or VÚB eCard service_|
179-
|`card_no`|string| | |masked card number _available only when using ComfortPay or VÚB eCard service_|
180-
|`transaction_identifier`|string| | |internal transaction identifier of the bank _available only when using CardPay / ComfortPay, TatraPay or VÚB eCard service_|
165+
| Property name | Data type | Always present? | Default value | Notes |
166+
|:-------------------------|:------------:|:---------------:|:-------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------|
167+
| `uuid` | string || | |
168+
| `status` | string || none | current transaction status (see the next table) |
169+
| `variable_symbol` | string || | the same as was sent while creating the payment object (see previous section) |
170+
| `constant_symbol` | string || 0308 | payment for services |
171+
| `amount` | float || 0.00 | original amount of the transaction |
172+
| `refunded_amount` | float || 0.00 | refunded amount of the transaction |
173+
| `service_fee_amount` | float || 0.00 | provision for the transaction in card payments _available when using CardPay / ComfortPay and set up with PGP encrypted statements or PayPal service_ |
174+
| `currency` | `Currencies` || EUR | currency of the transaction |
175+
| `periodicity` | integer | | 0 | number of days in which next payment will be executed |
176+
| `periodicity_no` | integer | | 1 | number of transaction in order (using the same variable symbol) |
177+
| `charge_on` | `Datetime` | | | when was or should be this transaction executed |
178+
| `card_expire_on` | `Datetime` | | null | date of card expiration _available only when using ComfortPay or VÚB eCard service_ |
179+
| `card_no` | string | | | masked card number _available only when using ComfortPay or VÚB eCard service_ |
180+
| `transaction_identifier` | string | | | internal transaction identifier of the bank _available only when using CardPay / ComfortPay, TatraPay or VÚB eCard service_ |
181181

182182
### Asynchronous transaction notifications
183183

@@ -289,4 +289,4 @@ formatter with:
289289

290290
---
291291

292-
&copy; 2021 BACKBONE, s.r.o.
292+
&copy; 2022 BACKBONE, s.r.o.

cheddar/resources/transaction.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44

55

66
class Transaction(object):
7+
8+
class Service:
9+
def __init__(self, data):
10+
self.name = data.get('name')
11+
self.handle = data.get('handle')
12+
self.provider = data.get('provider')
13+
714
def __init__(self, data):
815
self.uuid = data['uuid']
916
self.type = data['type']
@@ -16,6 +23,7 @@ def __init__(self, data):
1623

1724
self.amount = data['amount']
1825
self.currency = data["currency"]
26+
self.service = self.Service(data['service']) if 'service' in data else None
1927

2028
self.iban = data['iban'] if 'iban' in data else None
2129
self.notes = data['notes'] if 'notes' in data else None

cheddar/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = "0.6.3"
1+
VERSION = "0.7.0"

0 commit comments

Comments
 (0)