iyzico/iyzipay-python

UnicodeEncodeError

Closed this issue · 1 comments

Hi!, I am trying to integrate iyzipay with openedx which is running on python 2.7.

  • I tried to use the version 1.0.32 from PyPI
  • I also tried the latest release from GitHub which is 1.0.37

Whenever I try to pass special characters i.e some Turkish characters like Ö, It throws this error
UnicodeEncodeError: 'ascii' codec can't encode character u'\xd6' in position 1: ordinal not in range(128)

The input that I'm passing is,

u'shippingAddress': {u'city': u'G\xd6KHAN', u'address': u'G\xd6KHAN', u'contactName': u'G\xd6KHANG\xd6KHAN', u'country': u'Republic of Turkey'}

The full stack trace of the error is,

payment = iyzipay.Payment().create(request_iyzico, options)
File "/edx/app/ecommerce/venvs/ecommerce/src/iyzipay-python/iyzipay/iyzipay_resource.py", line 290, in create
pki = self.to_pki_string_create(request)
File "/edx/app/ecommerce/venvs/ecommerce/src/iyzipay-python/iyzipay/iyzipay_resource.py", line 305, in to_pki_string_create
pki_builder.append('paymentCard', self.payment_card_pki(request.get('paymentCard')))
File "/edx/app/ecommerce/venvs/ecommerce/src/iyzipay-python/iyzipay/iyzipay_resource.py", line 158, in payment_card_pki
pki_builder.append('cardHolderName', payment_card.get('cardHolderName'))
File "/edx/app/ecommerce/venvs/ecommerce/src/iyzipay-python/iyzipay/pki_builder.py", line 7, in append
self.append_key_value(key, value)
File "/edx/app/ecommerce/venvs/ecommerce/src/iyzipay-python/iyzipay/pki_builder.py", line 26, in append_key_value
self.request_string = self.request_string + key + "=" + str(value) + ","
UnicodeEncodeError: 'ascii' codec can't encode character u'\xd6' in position 1: ordinal not in range(128)

I Know you guys don't support python 2.7 anymore, but if you guys suggest a version that we can use to integrate with python 2.7, it would be really helpful.
P.S: We are looking to onboard 3000 students in our platform. They are going to purchase programs via iyzipay.

Hello @duraiganesh0,

Unfortunately we do not support python 2.7 anymore. Supported version of python after version 3.6+.

Closing the issue due to timed out.