Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic methods v1.9 #13

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Conversation

zbohm
Copy link
Contributor

@zbohm zbohm commented Jul 25, 2022

Minimální aktualizace současného kódu tak, aby fungoval na API 1.9.
Modul kvůli jiné hešovací funkci již nefunguje s API 1.7.

Aktualizace zahrnuje komit z PR #10 opravující zavírání otevřených souborů. Dále zahrnuje PR #11 pro logování komunikace s API.

  • U podpisů natavena hešovací funkce SHA256 místo původní SHA.
  • Do funcke payment_init doplněny další paramerty pro API. Funkce ale zůstává kompatibilní s verzí 0.7.0.
  • Funkce oneclick_init a oneclick_start odstraněny. Tím je klient uzpůsoben jen k základním metodám. Jiné metody, jako je OneClick, se budou se řešit později.
  • Do HTTP_STATUSES doplněny HTTP návratové kódy 401 a 503.

Minimal update of current code to work on API 1.9.
The module no longer works with API 1.7 due to a different hash function.

The update includes a commit from PR #10 fixing the closing of open files. It also includes PR #11 for logging communication with the API.

  • Use SHA256 hashing function for signatures instead of the unsafe SHA.
  • Additional parameters for the API have been added to the payment_init function. But the function remains compatible with version 0.7.0.
  • Functions oneclick_init and oneclick_start removed. This means that the client implements only Basic Payment. Other payments methods, such as OneClick, will be added later.
  • Added HTTP return codes 401 and 503 to HTTP_STATUSES.

zbohm and others added 4 commits October 5, 2021 10:07
Minimal update of current code to work on API 1.9.
The module no longer works with API 1.7 due to a different hash function.

 * Use `SHA256` hashing function for signatures instead of the unsafe `SHA`.
 * Additional parameters for the API have been added to the `payment_init` function. But the function remains compatible with version 0.7.0.
 * Functions `oneclick_init` and `oneclick_start` removed. This means that the client implements only Basic Payment. Other payments methods, such as OneClick, will be added later.
 * Added HTTP return codes 401 and 503 to `HTTP_STATUSES`.
@zbohm
Copy link
Contributor Author

zbohm commented Jul 25, 2022

Funkce button aktualizována na API 1.9 a přejmenována na button_init. Tím je kromě Basic Payments implementována i část Methods for ČSOB Payment Button.

@tdivis
Copy link

tdivis commented Sep 15, 2022

I'm missing the update of RETURN_CODES as there was quite a few changes in 1.8 and 1.9 judging from changleog

403: 'Forbidden',
404: 'Not Found',
405: 'Method Not Allowed',
429: 'Too Many Requests',
503: 'Service Unavailable'
500: 'Internal Server Error',
503: 'Service Unavailable',
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this HTTP_STATUSES variable used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it is not in use anywhere yet.

pycsob/client.py Outdated
@@ -71,9 +68,10 @@ def payment_init(self, order_no, total_amount, return_url, description, cart=Non
:param total_amount:
:param return_url: URL to be returned to from payment gateway
:param cart: items in cart, currently min one item, max two as mentioned in CSOB spec
:param description: order description
:param description: product name
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add that it's only used for the cart item name if cart is emtpy.

Copy link

@tdivis tdivis Sep 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be changelog entry with incompatible and other changes/migration guide.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring and Changelog have been updated.

'PyscobSession' -> 'PycsobSession' (as CSOB is the bank name)
'payment/init' request: 'payOperation' with value 'customPayment'
  and 'customExpiry' items already supported
'payment/init' response: add 'customerCode' item
zbohm and others added 3 commits August 2, 2023 14:38
* Sign properly complex data

Compose message from input data for signing accounting for nested
sequences and mappings.

* fixup - Correction from code review

* fixup - Fix typo

* fixup - Fix typo in docstring

* fixup - Code review (round 2)

* fixup - Add docs comment to enums

* fixup - Unnecessary trimming

* fixup - strip after trimming

* Correction from review - round 3

* fixup - Corrections from review (round 4)

* fixup - Change date/time related fields

* fixup - Custom formatting should have higher priority

* fixup - Add docstrings

* Improve type annotations

* Use all amounts always as integers

* fixup - README and type annotation

* fixup - Add enumerations

* Remove Python 3.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants