230 |
230 |
raise UnknownPaymentException('Received unknown payment response')
|
231 |
231 |
else:
|
232 |
232 |
logger.debug(
|
233 |
|
'lingo: backend "%s" received payment response with id %%s' % self,
|
|
233 |
'lingo: backend "%s" received payment response with id %s',
|
|
234 |
self,
|
234 |
235 |
response.order_id,
|
235 |
236 |
extra=eopayment_response_to_extra_info(
|
236 |
237 |
response, lingo_transaction_id=transaction.pk, user=transaction.user
|
... | ... | |
901 |
902 |
return basket_item
|
902 |
903 |
|
903 |
904 |
def handle_backend_response(self, response, callback=True):
|
904 |
|
logger.debug('lingo: regie "%s" handling response for transaction "%%s"' % self.regie, self.order_id)
|
|
905 |
logger.debug('lingo: regie "%s" handling response for transaction "%s"', self.regie, self.order_id)
|
905 |
906 |
if self.status == response.result:
|
906 |
907 |
# return early if self status didn't change (it means the
|
907 |
908 |
# payment service sent the response both as server to server and
|
... | ... | |
911 |
912 |
if not self.is_running():
|
912 |
913 |
logger.info(
|
913 |
914 |
'lingo: regie "%s" received payment notification on existing '
|
914 |
|
'transaction, status changed, "%%s" (%%s) -> "%%s" (%%s)' % self.regie,
|
|
915 |
'transaction, status changed, "%s" (%s) -> "%s" (%s)',
|
|
916 |
self.regie,
|
915 |
917 |
status_label(self.status),
|
916 |
918 |
self.status,
|
917 |
919 |
status_label(response.result),
|
... | ... | |
922 |
924 |
# we accept unsigned cancellation requests as some platforms do
|
923 |
925 |
# that :/
|
924 |
926 |
logger.warning(
|
925 |
|
'lingo: regie "%s" received unsigned payment response with id %%s' % self.regie,
|
|
927 |
'lingo: regie "%s" received unsigned payment response with id %s',
|
|
928 |
self.regie,
|
926 |
929 |
response.order_id,
|
927 |
930 |
)
|
928 |
931 |
raise UnsignedPaymentException(self, 'Received unsigned payment response')
|
... | ... | |
939 |
942 |
# XXX: don't know if it can happen, but we would like to know when it does
|
940 |
943 |
# as for differed payments there can be multiple notifications.
|
941 |
944 |
logger.error(
|
942 |
|
'lingo: regie "%s" new transaction_date for transaction %%s(%%s) was %%s, received %%s'
|
943 |
|
% self.regie,
|
|
945 |
'lingo: regie "%s" new transaction_date for transaction %s(%s) was %s, received %s',
|
|
946 |
self.regie,
|
944 |
947 |
self.order_id,
|
945 |
948 |
self.id,
|
946 |
949 |
self.bank_transaction_date,
|
... | ... | |
950 |
953 |
self.save()
|
951 |
954 |
|
952 |
955 |
logger.info(
|
953 |
|
'lingo: regie "%s" received %s payment notification for transaction %%s(%%s)'
|
954 |
|
% (self.regie, 'synchronous' if callback else 'asynchronous'),
|
|
956 |
'lingo: regie "%s" received %s payment notification for transaction %s(%s)',
|
|
957 |
self.regie,
|
|
958 |
'synchronous' if callback else 'asynchronous',
|
955 |
959 |
self.order_id,
|
956 |
960 |
self.id,
|
957 |
961 |
extra=eopayment_response_to_extra_info(response),
|
... | ... | |
979 |
983 |
except Exception as e:
|
980 |
984 |
# ignore errors, it will be retried later on if it fails
|
981 |
985 |
logger.warning(
|
982 |
|
'lingo: regie "%s" error in sync notification for basket item %%s '
|
983 |
|
'and transaction %%s, %%s' % self.regie,
|
|
986 |
'lingo: regie "%s" error in sync notification for basket item %s '
|
|
987 |
'and transaction %s, %s',
|
|
988 |
self.regie,
|
984 |
989 |
item.id,
|
985 |
990 |
self.order_id,
|
986 |
991 |
e,
|
... | ... | |
1015 |
1020 |
except eopayment.PaymentException:
|
1016 |
1021 |
if ignore_errors:
|
1017 |
1022 |
logger.warning(
|
1018 |
|
'lingo: regie "%s" polling backend for transaction "%%s(%%s)" failed' % self.regie,
|
|
1023 |
'lingo: regie "%s" polling backend for transaction "%s(%s)" failed',
|
|
1024 |
self.regie,
|
1019 |
1025 |
self.order_id,
|
1020 |
1026 |
self.id,
|
1021 |
1027 |
exc_info=True,
|
... | ... | |
1024 |
1030 |
raise PaymentException('polling failed')
|
1025 |
1031 |
|
1026 |
1032 |
logger.debug(
|
1027 |
|
'lingo: regie "%s" polling backend for transaction "%%s(%%s)"' % self.regie,
|
|
1033 |
'lingo: regie "%s" polling backend for transaction "%s(%s)"',
|
|
1034 |
self.regie,
|
1028 |
1035 |
self.order_id,
|
1029 |
1036 |
self.id,
|
1030 |
1037 |
)
|