summaryrefslogtreecommitdiff
path: root/addons/payment_authorize/models/authorize_request.py
AgeCommit message (Collapse)Author
2021-01-05[FIX] payment_authorize: send the full reference for s2s transactionsJoren Van Onder
invoiceNumber is limited to 20 characters so if the reference in Odoo is longer we send an incomplete reference. This makes it hard to match up S2S payment.transactions in Odoo with their counterparts in the Authorize.net portal. To solve this send the full reference in the description field (which has a max length of 255 characters [1]). [1] https://developer.authorize.net/api/reference/index.html#payment-transactions-charge-a-customer-profile closes odoo/odoo#64119 Signed-off-by: jorenvo <jorenvo@users.noreply.github.com>
2020-06-30[FIX] *: correct all or improve code translation lookupMartin Trigaux
This commit fixes all issues detected by the new pylint gettext-variable test. It converts some calls to the new syntax _("Foo %s", bar) to progressively migrate the code to the new syntax. A few calls were not technically incorrect but still detected by the linter. _("Foo" + "Bar") has been converted to _("Foo" "Bar") as it has the same effect and make sure the argument is of type asteroid.Const instead of BinOp). closes odoo/odoo#53683 Related: odoo/enterprise#11467 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-04-22[FIX] payment_authorize: display errors to customersDamien Bouvy
Set the transaction to the state 'error' when Authorize.net responds with that status, as it will display a message to the customer to detail the problem. opw-2231276 X-original-commit: 005607fce4a22394a9f67cc4eaa52f8bf89780f0
2020-03-26[FIX] payment_authorize: include phone in customer profileDamien Bouvy
It is possible to define required fields from the Authorize.net backend without which no customer profile can be created. These fields include data that Odoo sometimes does not have at all (fax number, anyone?); however including the phone number is a meaningful option. Before this commit, if the 'phone number' was required by the Authorize.net configuration and was correctly set in Odoo, this still did not work because we did not include the phone number with the customer profile creation request payload. We do now. opw-2215332 closes odoo/odoo#48420 X-original-commit: 034c04efa4ccecd40f657eae97ef2b04934d570c Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2020-02-25[FIX] payment_authorize: change order of keysAtchuthan Ubendran
- Select 'capture manually' in Authorize.net Payment acquirer - Do an online transaction - Click on the Capture button at Payment transaction windows. An error message is returned: The element 'transactionRequest' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'amount' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'splitTenderId, order, lineItems...'. This because the keys `amount` and `refTransId` are inverted in `createTransactionRequest`: https://developer.authorize.net/api/reference/index.html#payment-transactions-capture-a-previously-authorized-amount A simple fix is to swtich them. Indeed, the Odoo 13.0 requirements is Python 3.6+, in which the keys order at iteration is the insertion order. Although this was officially part of the specification in 3.7, the change is already available in 3.6. Closes #45891 opw-2201667 closes odoo/odoo#46206 X-original-commit: ae3885295795f8c150bd40af266004016fd300c5 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-02-13[IMP] payment_authorize: log API responsesJoren Van Onder
Makes debugging possible without having to run the db locally and manually adding _loggers everywhere. Parts of the error are logged already, leading to messages like: ...payment_authorize.models.payment: The transaction was unsuccessful Unfortunately they don't show the reason. The entire response is something like: {'messages': {'message': [{'code': 'E00027', 'text': 'The transaction was unsuccessful.'}], 'resultCode': 'Error'}, 'transactionResponse': {'SupplementalDataQualificationIndicator': 0, 'accountNumber': '', 'accountType': '', 'authCode': '', 'avsResultCode': 'P', 'cavvResultCode': '', 'cvvResultCode': '', 'errors': [{'errorCode': '5', 'errorText': 'A valid amount is ' 'required.'}], 'refTransID': '', 'responseCode': '3', 'testRequest': '0', 'transHash': '', 'transHashSha2': '', 'transId': '0'}} Since we log the full request above, let's also log the full response. PS. this was present before but was lost with 26f3d8465d3c6f1da80c186. opw-2188889 closes odoo/odoo#45259 X-original-commit: d269bba3b9f4f4fa567a2a7084396bdf08422fa4 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-08-12[REF] payment* : state based publishingVictor Feyens
Replace website_published and environment by a generic state on payment.acquirer Payment acquirers aren't enabled by default. When setting their state to 'enabled' or 'test', it is verified the required fields for the provider are set.
2019-08-07[IMP] payment_authorize: integration with accept jsNikunj Ladava
add accept js of authorize.net to make s2s flow pci compliance after clicking on pay now button, one popup display with card inputs popup is provided by a authorize with all validation facilities After submitting details, payment flow is - get the temp token information from authorize - create a token with that temp token information in odoo - make a request to authorize for charge - after successful request, payment will be charged for that card task- 2025821
2019-08-07[IMP] payment_authorize: convert xml request to jsonNikunj Ladava
- convert XML format request to JSON - remove refund method from the request, as there is no use of it, we will never validate card as authorize.net validate card by itself, so there is no case for the refund - verify token while creating it - make verify validity field invisible in case of authorize task- 2025821
2019-07-16[FIX] payment_authorize: save payment token from form validated transactionNans Lefebvre
https://docs.python.org/3/library/stdtypes.html#truth By default, an object is considered true unless its class defines either a __bool__() method that returns False or a __len__() method that returns zero Since etree elements are iterator, they define a len function. However it turns out that customerProfileId has always no children. So bool(find(x)) is always False; the intended meaning was find(x) is None. opw 1999427 closes odoo/odoo#34922 Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-05-29[MERGE] forward port branch saas-11.3 up to 8a0e819d0bbChristophe Simonis
2019-05-28[MERGE] forward port branch 11.0 up to a20a31486cdChristophe Simonis
2019-05-21[MERGE] forward port branch saas-15 up to b1e1c78ffabDenis Ledoux
2019-05-20[FIX] payment_authorize: no customer profile don't crash transactionjev-odoo
When transaction is approved, if for any reason the `customerProfileId` is missing from the response, the transaction is aborted. It should succeed even if we cannot create a customer profile. opw-1998505 closes odoo/odoo#33501 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-01-10[MERGE] forward port branch 11.0 up to 617652bbfedChristophe Simonis
2019-01-09[FIX] payment_authorize: customer profile without emailJorge Pinna Puissant
opw-1920083 Before this commit, an error arrived when creating a customer profile without email. Now, if the email don't exists we send an empty string to Authorize. closes odoo/odoo#30075
2019-04-04[FIX] payment_authorize: >1m partner ok transactionNicolas Lempereur
When creating a customer profile in Authorize.Net we specify a field merchantCustomerId that is composed of: ODOO-{partner-id}-{8-random-characters} But the limit of this field is of 20 characters: https://developer.authorize.net/api/reference/index.html#payment-transactions So if we have 1 million partner, we may have eg. a partner 1000005 that would result in an ID `ODOO-1000005-af123c5b` that is too long and results in an error. With this changeset, the generated ID is truncated to 20 characters so this should theorically be alright for up to 9.99*10^15 partners (the postgres limit for an integer is 2.15*10^9 so this should be safe enough). opw-1962422 closes #32423 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-01-11[MERGE] forward port branch saas-11.3 up to e033114879cChristophe Simonis
2018-09-07[MERGE] forward port branch saas-11.3 up to 4850fb08385Christophe Simonis
2018-09-05[MERGE] forward port branch 11.0 up to 213759b03e5Christophe Simonis
2018-09-04[FIX] payment_authorize: add first name and last nameNicolas Martinelli
The `createCustomerProfileRequest` requires a first name and a last name for several payment processors. Reference: https://developer.authorize.net/api/reference/#customer-profiles-create-customer-profile opw-1878218 Co-authored-by: Gert Pellin <gpe@odoo.com>
2018-08-31[FIX] payment_authorize: remove incorrect fieldsNicolas Martinelli
`firstName` and `lastName` should be filled in for Australia, but the implementation is not correct since: - it assumes that the name is first name + last name, which is not the case in all countries (e.g. France) - it doesn't take into account that the name could be a company name This reverts commit 26974d4e5fe48d34294434ed52dcf8053416410e.
2018-08-31[FIX] payment_authorize: add required fields for wespac Australia (#26709)Gert Pellin
for the payment processor wespac there are required fields we do not send. required: •Card Number •Expiration Date •Amount •First Name •Last Name •Address •City •State/Province** •Zip Code (Postal Code/Postcode)** •Country •Email ** These fields are optional if the billing address is not in the U.S. or Canada. If the address is in the U.S. or Canada, the two-digit State/Province code must be provided, along with the Zip/Postal Code.
2018-05-23[REF] account,payment(_*),sale*: downgrade transactions into debug itemsqdp-odoo
It was very confusing for the user to distinct account.payment and payment.transaction. From now on, the transactions are technical objects and, in the backend, we only refer to it in log messages (Front end will be adapted in the same fashion later on). They are hidden in debug mode in accounting\configuration\payments as their purpose is now purely technical/log This commit also aims to reduce the gap between the accounting app and the transactions: account.payment objects are created/validated upon completion of transaction. To ease the capture/voiding of pending transactions, the related buttons are now displayed directly on the SO/invoice instead of the transactions. Was task: https://www.odoo.com/web#id=35857&view_type=form&model=project.task&action=333&active_id=967&menu_id=4720 Was PR #24043 [FIX] add domain based on journal to payment tokens Was opw: https://www.odoo.com/web?debug#id=1828206&view_type=form&model=project.task&menu_id=5200
2018-03-27[MERGE] forward port branch 11.0 up to b33d5af4a74Christophe Simonis
2018-03-27[FIX] payment_authorize: ZIP code is optionalNicolas Martinelli
The ZIP code is an optional field, therefore we should not block the user.
2018-03-27[FIX] payment_authorize: raise error if missing ZIPNicolas Martinelli
The ZIP code is an optional field. When saving a payment method, this generates a traceback since `partner.zip` is `False` while the field expects a `string`. opw-1829829
2018-01-25[MERGE] forward port branch 11.0 up to eefe879a37aChristophe Simonis
2018-01-24[FIX] Payment, payment_authorize: show an error if customer doesn't have a ↵fda-odoo
complete profil on authorize.net payment. If the user has no Zip code, country or city, authorize refuse the payment, but Odoo doens't show any error. The commit invite the user to log in in this case or to fill his missing information
2018-01-03[MERGE] forward port branch 11.0 up to fe22a0f9ca9Christophe Simonis
2018-01-03[FIX] authorize: add error-checkingAdrian Torres
Previous to this commit, if a user hadn't properly set up his Authorize.net credentials, when getting a response from Authorize.net's servers, we would expect some attributes to be in the response's body, but this is not the case if the credentials are wrong, thus we would have an unexpected error like "NoneType object has no attribute text" which is only a sympton of the real error (bad credentials and no error-checking). This is fixed by checking if the response body contains an error message, if it is the case we raise an UserError with the error code and the error message (which is only shown if debug mode is activated). OPW 788261
2017-12-01[FIX] payment_authorize: Avoid logging credit card credentialstbe-odoo
2017-12-01[MERGE] forward port branch 11.0 up to c201cf2b77cChristophe Simonis
2017-12-01[ADD] payments: Logging payment transaction operationstbe-odoo
- Logging data sent & received to/from payment acquirers to be able to track failed payments.
2017-11-30[MERGE] forward port branch saas-16 up to 5d7ad2b16ccChristophe Simonis
2017-11-27[FIX] payment_authorize: stop raising on 'Error' authorize statusDamien Bouvy
It seems that Authorize.net returns an 'Error' status when transactions fail (note that it can also return an Ok status for different types of failures). This is incoherent with the way the authorize requests are processed, since an Error resultCode will raise a ValidationError, rollbacking the complete cursor transaction. This makes little sense, since there should be a trace of the payment.transaction in the backend (preferably with an explanation for the failure). This fix adds an error processing step to the response handling of authorize.net - while before, it was assumed that an 'error' result meant an issue in communication/setup, now it is treated as an error in payment and the payment.transaction status is set accordingly. I've added a test for this and it was green (pinky promise), but this particular test suite is deactivated (or perhaps only on nightly, I need to check the nightly process with @nim-odoo).
2017-11-20Revert "[FIX] payment_authorize: add some debug logging"Damien Bouvy
This reverts commit fb093726d78b07a322d56b4848a361de93536b1f. In my hurry, I forgot part of this debug feature, which made it crash because I tried to stringify a element instead of a tree
2017-11-20[FIX] payment_authorize: add some debug loggingDamien Bouvy
If not [FIX], then [HELP TO FIX] at least
2017-08-20[FIX] P3: text model typesXavier Morel
* remove references to basestring & unicode (use relevant pycompat helpers) * remove some str calls (either entirely or replaced by relevant helper, either text or native) * use better API to avoid unnecessary conversions * remove some XML declarations in views
2017-08-20[FIX] P3: fix base64 and StringIO usesXavier Morel
* StringIO removed from stdlib, replace with io * try to correctly handle BytesIO/StringIO (one is for bytes the other is for text) * fix base64: Python 3 removed bytes-encoding and bytes-bytes codecs (via #encode) so replace all calls to str.encode('base64'), also b64encode is a bytes->bytes conversion so attempt to properly handle that issue #8530
2017-08-14[IMP] Payments & subscriptions: Improved Paymentstbe-odoo
- When registering a payment token, validating it using a payment of a small amount (~1.50€) followed by a refund allows ensuring that the payment method is valid (i.e. checksumming the card number simple ensure the number is valid but not that the card exists). This commit introduces a generic approach that must be implemented for each acquirer that has tokenization support. This commit also introduces a generic payment token registration/usage template that can be adapted according to one's need. - Introducing a new payment form that handles payment, deletion and adding payment method (only for server2server for the moment). - On /my/payment_method, changed strings 'Payment Acquirers' to 'Payment Methods' which is more clear. - Stripe can now be used to pay subscriptions.
2017-07-28[MERGE] forward port branch saas-16 up to b76109173a8Christophe Simonis
2017-07-28[FIX] payment_authorize: avoid crash when contact ogone without street on ↵Thibault Delavallée
partner
2017-06-27[MERGE] forward port branch saas-16 up to 278e478d552Christophe Simonis
2017-06-21[FIX] payment_authorize: wrong error message because of missing importChristophe Matthieu
2017-06-21[FIX] payment_authorize: missing importCedric Snauwaert
2017-06-01[MERGE] Forward-port saas-16 up to ba15df47cb25625cb0921cba554aa0879048c90aOlivier Dony
2017-05-29[FIX] payment_authorize: add missing translation abilityYenthe V.G
Closes #17257
2017-05-22[FIX] P3: import pattern which doesn't seem to work rightXavier Morel
``import odoo.addons.foo as bar`` doesn't seem to properly trigger the import hook in Python 3 (it blows up on decimal_precision and base). Thus convert *all* examples of that pattern to the more sensible ``from odoo.addons import foo as bar``.
2017-05-15[FIX] P3: urllib, urllib2 and urlparseXavier Morel
In Python 3, all of these were "consolidated" under urllib(.request, .parse, .errors) which is inconvenient. Since we already have hard dependencies on requests and werkzeug(.urls, which is a backport of Python 3's unicode-aware urllib.parse) migrate *everything* to that. A sticking point is urllib2.URLError, those were (mostly) replaced by the slightly more general IOError which URLError extends.