Skip to content

Commit 0906124

Browse files
committed
iTerminal sia.eu backend support
1 parent 1487c10 commit 0906124

File tree

5 files changed

+60
-24
lines changed

5 files changed

+60
-24
lines changed

CHANGELOG.md

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

3+
## v0.6.1: 11/02/2021
4+
5+
Added support for new (sia.eu) Poštová banka's iTerminal service sandbox and production environments
6+
(available as `PBIterminal2` driver / `ITERMINAL2` service).
7+
38
## v0.6.0: 25/06/2020
49

510
Added missing keyword support for ComfortPay service.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2019 BACKBONE, s.r.o.
1+
Copyright (c) 2021 BACKBONE, s.r.o.
22
http://www.backbone.sk/en/
33

44
Permission is hereby granted, free of charge, to any person obtaining a copy of

README.md

Lines changed: 52 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Cheddar Bindings for Python
22

3-
A Python wrapper for Cheddar's application interface. Cheddar is a payment gateway for processing and executing transactions within a neat and universal API.
3+
A Python wrapper for Cheddar's application interface. Cheddar is a payment gateway for processing and executing
4+
transactions within a neat and universal API.
45

56
At the moment, the following payment methods and services are supported by the Cheddar service and this library:
67

@@ -13,7 +14,8 @@ At the moment, the following payment methods and services are supported by the C
1314
- GP webpay – Global Payments Europe, s.r.o.
1415
- PayPal – PayPal (Europe) S.à r.l. et Cie, S.C.A.
1516

16-
To see what is new or changed in the current version, check out the [changelog](https://github.com/backbonesk/cheddar-python/blob/master/CHANGELOG.md).
17+
To see what is new or changed in the current version, check out the
18+
[changelog](https://github.com/backbonesk/cheddar-python/blob/master/CHANGELOG.md).
1719

1820
## Setup
1921

@@ -33,7 +35,8 @@ For the API client to work you would need Python 2.7+ or Python 3.4+.
3335

3436
## Usage
3537

36-
First off, you need to require the library and provide authentication information by providing your user handle and shared secret you got from the provider.
38+
First off, you need to require the library and provide authentication information by providing your user handle and
39+
shared secret you got from the provider.
3740

3841
```python
3942
import cheddar
@@ -47,17 +50,23 @@ client = cheddar.Cheddar(
4750
)
4851
```
4952

50-
In case you'd like to use the sandbox mode use `cheddar.Environment.Sandbox` when creating configuration object. You can also create your own environment pointing to any valid URL with Cheddar instance running:
53+
In case you'd like to use the sandbox mode use `cheddar.Environment.Sandbox` when creating configuration object. You
54+
can also create your own environment pointing to any valid URL with Cheddar instance running:
5155

5256
my_test_environment = cheddar.Environment("test", "https://my.cheddar.test")
5357

54-
**Please note** that only VÚB eCard, iTerminal, GP webpay and PayPal currently allow for using their test environments so in case of other providers production URLs will be used! When using sandbox with supported bank or financial institution never use real world credit cards / accounts for testing payment methods implementation (they will not work). Always use virtual testing cards / accounts provided for this purpose by the payment institution.
58+
**Please note** that only VÚB eCard, iTerminal, GP webpay and PayPal currently allow for using their test environments
59+
so in case of other providers production URLs will be used! When using sandbox with supported bank or financial
60+
institution never use real world credit cards / accounts for testing payment methods implementation (they will not
61+
work). Always use virtual testing cards / accounts provided for this purpose by the payment institution.
5562

5663
### Creating a transaction
5764

5865
It is quite simple to instantiate a payment.
5966

60-
Here’s a quick piece of example code to get you started which will call the Cheddar service and retrieve UUID – universal identifier of the transaction and set the transaction status to `none` (see next section for more on transaction statuses).
67+
Here’s a quick piece of example code to get you started which will call the Cheddar service and retrieve UUID –
68+
universal identifier of the transaction and set the transaction status to `none` (see next section for more on
69+
transaction statuses).
6170

6271
```python
6372
payment = client.payments.create(
@@ -75,7 +84,8 @@ payment = client.payments.create(
7584
)
7685
```
7786

78-
When using the wrapper in web context, the user's IP is automatically added to the data array from the environment variables. If you wish to provide your own, add `payer_ip_address` key with valid address as a value.
87+
When using the wrapper in web context, the user's IP is automatically added to the data array from the environment
88+
variables. If you wish to provide your own, add `payer_ip_address` key with valid address as a value.
7989

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

@@ -89,9 +99,11 @@ First argument is a service provider, which can currently be one of the followin
8999
|`cheddar.Service.ECARD`|eCard, VÚB|
90100
|`cheddar.Service.PAYPAL`|PayPal Payments Standard, PayPal|
91101
|`cheddar.Service.GPWEBPAY`|GP webpay, Global Payments Europe|
92-
|`cheddar.Service.ITERMINAL`|iTerminal, Poštová banka|
102+
|`cheddar.Service.ITERMINAL`|iTerminal, Poštová banka (firstdata.lv backend)|
103+
|`cheddar.Service.ITERMINAL2`|iTerminal, Poštová banka (sia.eu backend)|
93104

94-
Second argument to the function call is an associative array of configuration options. Which options have to be used and which have no effect at all depends on the service provider. The next table lists all possible attributes:
105+
Second argument to the function call is an associative array of configuration options. Which options have to be used
106+
and which have no effect at all depends on the service provider. The next table lists all possible attributes:
95107

96108
| Attribute name | Data type | Required? | Notes |
97109
|:---------------|:---------:|:---------:|:------|
@@ -110,13 +122,21 @@ Second argument to the function call is an associative array of configuration op
110122
|`cpp_cart_border_color`|string| |HEX code of colour at PayPal<br>_applicable only to PayPal transactions_|
111123
|`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_|
112124

113-
Note that all of the supported currencies are available as a simple constant on `cheddar.Currency` class to make it easier in code.
125+
Note that all of the supported currencies are available as a simple constant on `cheddar.Currency` class to make it
126+
easier in code.
114127

115-
After the call you can inspect the returning `Payment` object, which is described in the `Getting transaction details` part of this document.
128+
After the call you can inspect the returning `Payment` object, which is described in the `Getting transaction details`
129+
part of this document.
116130

117-
To get to the URL of a payments gateway at the bank where the payment is processed just redirect the user to value of `payment.redirect_url` property.
131+
To get to the URL of a payments gateway at the bank where the payment is processed just redirect the user to value of
132+
`payment.redirect_url` property.
118133

119-
After the payment process at the payment gateway is finished, you will be redirected to the URL you specified in `return_url` / `callback` parameter during the create call in the example above. The URL will have two more GET parameters added - `uuid`, for the payment identifier and `status`, for the current status of the payment transaction (for some payment methods this may change in time, and you will be notified about the change to the URL you specified in the `notification_url` parameter [see the `Asynchronous transaction notifications` part of this document for more info])
134+
After the payment process at the payment gateway is finished, you will be redirected to the URL you specified in
135+
`return_url` / `callback` parameter during the create call in the example above. The URL will have two more GET
136+
parameters added - `uuid`, for the payment identifier and `status`, for the current status of the payment transaction
137+
(for some payment methods this may change in time, and you will be notified about the change to the URL you specified
138+
in the `notification_url` parameter
139+
[see the `Asynchronous transaction notifications` part of this document for more info])
120140

121141

122142
#### Allowed transaction statuses
@@ -161,17 +181,21 @@ Afterwards you can inspect the returning object, which contains these properties
161181

162182
### Asynchronous transaction notifications
163183

164-
Transactions may have a `notification_url` attribute (in case of PayPal and ComfortPay the attribute is mandatory), that will receive a ping on every change to a transaction (in case of PayPal or ComfortPay it is also the only way to find out the status of the payment).
184+
Transactions may have a `notification_url` attribute (in case of PayPal and ComfortPay the attribute is mandatory),
185+
that will receive a ping on every change to a transaction (in case of PayPal or ComfortPay it is also the only way to
186+
find out the status of the payment).
165187

166-
Cheddar calls the value of `notification_url` attribute as POST request with GET attributes `uuid` and `signature` (which needs to be verified) and `application/json` body with full payment details as explained in the previous section.
188+
Cheddar calls the value of `notification_url` attribute as POST request with GET attributes `uuid` and `signature`
189+
(which needs to be verified) and `application/json` body with full payment details as explained in the previous section.
167190

168191
To validate the signature, you need to call the following:
169192

170193
```python
171194
is_valid = client.messages.validate(uuid, signature);
172195
```
173196

174-
In case the signature is incorrect a `cheddar.errors.MessageIntegrityError` is thrown, otherwise the function returns `true`. After a successful validation you can trust the json-encoded body of the request.
197+
In case the signature is incorrect a `cheddar.errors.MessageIntegrityError` is thrown, otherwise the function returns
198+
`true`. After a successful validation you can trust the json-encoded body of the request.
175199

176200
The JSON-encoded body will look something like this:
177201

@@ -209,7 +233,8 @@ The JSON-encoded body will look something like this:
209233

210234
### Updating planned transaction
211235

212-
The next use case is the ability to change date and / or amount of a next planned periodical payment. The output of the call is summary of the planned payment including its UUID.
236+
The next use case is the ability to change date and / or amount of a next planned periodical payment. The output of
237+
the call is summary of the planned payment including its UUID.
213238

214239
```python
215240
import datetime
@@ -220,13 +245,17 @@ payment = client.payments.update(uuid, [
220245
]);
221246
```
222247

223-
However, also the status of the planned payment might be changed – from `none` to `cancelled` or the other way. Just make sure that the `charge_on` attribute is set to correct value or explicitly set it, when changing the status.
248+
However, also the status of the planned payment might be changed – from `none` to `cancelled` or the other way. Just
249+
make sure that the `charge_on` attribute is set to correct value or explicitly set it, when changing the status.
224250

225251
### Refunding transactions
226252

227-
With Poštová banka’s iTerminal service you might once request a refund on executed transaction in part, or in full. In case of Tatra banka's CardPay service you might request as many refunds as you'd like until sum of all prior refunds reaches the amount of the original transaction.
253+
With Poštová banka’s iTerminal service you might once request a refund on executed transaction in part, or in full. In
254+
case of Tatra banka's CardPay service you might request as many refunds as you'd like until sum of all prior refunds
255+
reaches the amount of the original transaction.
228256

229-
The `reason` is more informative and should be one of either `requested_by_customer`, `fraudelent`, `duplicate` or `unknown` (default). Currency has to be the same as when executing the original payment.
257+
The `reason` is more informative and should be one of either `requested_by_customer`, `fraudelent`, `duplicate` or
258+
`unknown` (default). Currency has to be the same as when executing the original payment.
230259

231260
```python
232261
payment = client.payments.refund(uuid, [
@@ -252,11 +281,12 @@ Run the linter with:
252281

253282
make lint
254283

255-
The client library uses Black for code formatting. Code must be formatted with Black before PRs are submitted. Run the formatter with:
284+
The client library uses Black for code formatting. Code must be formatted with Black before PRs are submitted. Run the
285+
formatter with:
256286

257287
make fmt
258288

259289

260290
---
261291

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

cheddar/resources/service.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ class Service(object):
1313
PAYPAL = "paypal"
1414
GPWEBPAY = "gpwebpay"
1515
ITERMINAL = "iterminal"
16+
ITERMINAL2 = "iterminal2"

cheddar/version.py

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

0 commit comments

Comments
 (0)