Ignore:
Timestamp:
11 Jun 2020, 09:41:40 (4 years ago)
Author:
Henrik Bettermann
Message:

Interswitch changed their system (and API). Some response parameters are missing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/helpers.py

    r15727 r16114  
    154154
    155155    # A typical JSON response
     156
     157    # old:
     158
    156159    #  {u'SplitAccounts': [],
    157160    #   u'MerchantReference':u'p4210665523377',
     
    166169    #   u'LeadBankName': None}
    167170
    168     if len(jr) < 11:
     171    # new:
     172
     173    # 'PaymentReference' is maybe missing
     174
     175    #  {u'SplitAccounts': [],
     176    #  u'MerchantReference':u'p5918633006916',
     177    #  u'TransactionDate':u'2020-06-11T09:17:37',
     178    #  u'ResponseDescription':u'Customer Cancellation',
     179    #  u'Amount': 89525000,
     180    #  u'CardNumber': u'',
     181    #  u'ResponseCode': u'Z6',
     182    #  u'BankCode': u''}
     183
     184
     185    if len(jr) < 8:
    169186        msg = _('Invalid callback: ${a}', mapping = {'a': str(jr)})
    170187        log = 'invalid callback for payment %s: %s' % (payment.p_id, str(jr))
     
    178195    payment.r_amount_approved = jr['Amount'] / 100.0
    179196    payment.r_card_num = jr['CardNumber']
    180     payment.r_pay_reference = jr['PaymentReference']
     197    payment.r_pay_reference = jr.get('PaymentReference', u'')
    181198    #payment.r_company = u'interswitch'
    182199    if payment.r_code != '00':
Note: See TracChangeset for help on using the changeset viewer.