2checkout / 2checkout-python Goto Github PK
View Code? Open in Web Editor NEW2Checkout Python Library
License: MIT License
2Checkout Python Library
License: MIT License
When running the tests, there are five tests failing:
test_1_auth (__main__.AuthorizationTest) ... FAIL
test_1_retrieve (__main__.CompanyTest) ... ok
test_1_create (__main__.ContactTest) ... ok
test_1_create (__main__.CouponTest) ... ok
test_2_find (__main__.CouponTest) ... ok
test_3_update (__main__.CouponTest) ... ok
test_4_delete (__main__.CouponTest) ... ok
test_1_check (__main__.NotificationTest) ... ok
test_1_create (__main__.OptionTest) ... ok
test_2_find (__main__.OptionTest) ... ok
test_3_update (__main__.OptionTest) ... ok
test_4_delete (__main__.OptionTest) ... ok
test_5_list (__main__.OptionTest) ... ok
test_1_check (__main__.PassbackTest) ... ok
test_1_pending (__main__.PaymentTest) ... FAIL
test_2_list (__main__.PaymentTest) ... ok
test_1_create (__main__.ProductTest) ... ok
test_2_find (__main__.ProductTest) ... ok
test_3_update (__main__.ProductTest) ... ok
test_4_delete (__main__.ProductTest) ... ok
test_5_list (__main__.ProductTest) ... ok
test_1_find_sale (__main__.SaleTest) ... ok
test_2_list_sale (__main__.SaleTest) ... ok
test_3_refund_sale (__main__.SaleTest) ... FAIL
test_4_refund_invoice (__main__.SaleTest) ... FAIL
test_5_refund_lineitem (__main__.SaleTest) ... FAIL
test_6_stop_sale (__main__.SaleTest) ... ok
test_7_comment (__main__.SaleTest) ... ok
test_7_stop_invoice (__main__.SaleTest) ... ok
test_8_ship (__main__.SaleTest) ... ok
test_9_reauth (__main__.SaleTest) ... ok
Hello everybody,
I have got issue, and i don't know how to solve it. When I click submit button in my form to authorize payments, i get "Payment Authorization Failed: Payment method is not supported. Please use a different payment method." error. This is 609 code. I have not ideas how to solve, because i think it is on 2checkout's side or i passed invalid params. Please correct me!
P.S. I've already read information from https://verifone.cloud/docs/2checkout/API-Integration/Legacy-API-versions/Legacy-2Checkout-API/Payment-API/Create-a-sale
acct/list_payment and others are missing.
There is a problem when the application must simultaneously use the API with a variety of sellers (with different private_key, seller_id, username, password) and modes (sandbox/production).
I'd suggest not directly using the Api object and class methods and instead passing an instance of an Api object (with proper instance methods) to the Charge, Company, Contact, Coupon, etc. class methods.
I can work in this enhancement if anyone cares to merge it, as we definitely need multiple of our clients have their own 2Checkout API keys.
After installation I get an ImportError
:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/vagrant/2checkout-python/twocheckout/__init__.py", line 1, in <module>
from sale import Sale
ImportError: No module named 'sale'
The complete file structure is not correct if I look into __init__.py
, because there are only python files in the twocheckout
folder and no other folders like here:
from sale import Sale
from api_request import Api
from util import Util
from passback import Passback
from ins import Notification
from product import Product
from option import Option
from coupon import Coupon
from contact import Contact
from company import Company
from charge import Charge
from payment import Payment
from error import TwocheckoutError
So If I then cd 2checkout-python/twocheckout
and do the import twocheckout
from there it works, but then gives me errors in the further work process:
AttributeError: module 'twocheckout' has no attribute 'Api'
What should I do? I am using python3
and I have installed it as described here:
Or is this instruction wrong? Because there is no difference to the python2 instruction?
Please advise
The following seems to be fixed in master branch
File "/opt/odoo/11.0/env/lib/python3.6/site-packages/twocheckout/api_request.py", line 40,
in call
result = raw_data.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf3 in position 1239: invalid
continuation byte
Suddenly getting this error during authorization request:
File "C:\Users\Nik\AppData\Local\Programs\Python\Python39\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\Nik\AppData\Local\Programs\Python\Python39\Lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I'm using the exact same test code as before:
@blueprint.route('/order', methods=['POST'])
def order():
# Setup credentials and environment
twocheckout.Api.auth_credentials({
'private_key': 'my-private-key',
'seller_id': 'my-id'
})
# Setup arguments for authorization request
args = {
'merchantOrderId': '123',
'token': request.form["token"],
'currency': 'USD',
'total': '1.00',
'billingAddr': {
'name': 'Testing Tester',
'addrLine1': '123 Test St',
'city': 'Columbus',
'state': 'OH',
'zipCode': '43123',
'country': 'USA',
'email': '[email protected]',
'phoneNumber': '555-555-5555'
}
}
# Make authorization request
try:
result = twocheckout.Charge.authorize(args)
return result.responseCode
except TwocheckoutError as error:
return error.msg`
Anyone knows how to resolve it?
I'm getting an error:
.........\site-packages\twocheckout\__init__.py", line 1, in <module>
from sale import Sale
ModuleNotFoundError: No module named 'sale'
Even if I remove sale reference from init.py file, just for testing, I'm getting a new error for the next line:
\venv\lib\site-packages\twocheckout\__init__.py", line 2, in <module>
from api_request import Api
ModuleNotFoundError: No module named 'api_request'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.