Ignore:
Timestamp:
14 May 2024, 08:46:27 (6 months ago)
Author:
Henrik Bettermann
Message:

Use serviceCode.

Location:
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/credobrowser.py

    r17730 r17783  
    138138    gateway_amt = 0.0 # is being added by Etranzact
    139139
     140    serviceCode = None
     141
    140142    def init_update(self):
    141143        if self.context.p_state == 'paid':
     
    176178    def pay(self, **data):
    177179        success, url_or_message = initiate_payment(
    178             self.context, self.host, self.callbackUrl, self.api_public_key)
     180            self.context, self.host, self.callbackUrl,
     181            self.api_public_key, self.serviceCode)
    179182        if success:
    180183            self.redirect(url_or_message, trusted=True)
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/helpers.py

    r17754 r17783  
    289289# Etranzact Credo payments helper functions
    290290
    291 def get_JSON_response_initialize(payment, host, callbackUrl, public_api_key):
     291def get_JSON_response_initialize(payment, host, callbackUrl,
     292                                 public_api_key, serviceCode):
    292293    headers={
    293294        'Content-Type':'application/JSON',
     
    311312        'customerPhoneNumber': phone,
    312313        'bearer': '0',
     314        'serviceCode': serviceCode,
    313315        }
    314316    try:
     
    346348
    347349
    348 def initiate_payment(payment, host, callbackUrl, public_api_key):
    349     response = get_JSON_response_initialize(payment, host, callbackUrl, public_api_key)
     350def initiate_payment(payment, host, callbackUrl, public_api_key, serviceCode):
     351    response = get_JSON_response_initialize(
     352        payment, host, callbackUrl, public_api_key, serviceCode)
    350353    if response.get('error', None):
    351354        return False, response['error']
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/tests.py

    r17730 r17783  
    363363        public_api_key = API_PUBLIC_KEY
    364364        callbackUrl = 'aa.aa.aa'
    365         response = get_JSON_response_initialize(self.payment2, CREDO_HOST, callbackUrl, public_api_key)
     365        response = get_JSON_response_initialize(self.payment2, CREDO_HOST, callbackUrl, public_api_key, None)
    366366
    367367        ## A typical response
     
    379379
    380380        # Payment already exists
    381         self.assertEqual(response, {'error': {u'reference': u'Reference must be unique'}})
     381        self.assertEqual(response, {'error': u'Reference must be unique. '})
    382382
    383383        #self.assertEqual(response['status'], 200)
     
    436436        public_api_key = API_PUBLIC_KEY
    437437        callbackUrl = 'aa.aa.aa'
    438         response = get_JSON_response_initialize(self.payment2, CREDO_HOST, callbackUrl, public_api_key)
     438        response = get_JSON_response_initialize(self.payment2, CREDO_HOST, callbackUrl, public_api_key, None)
    439439
    440440        # Payment already exists
    441         self.assertEqual(response, {'error': {u'reference': u'Reference must be unique'}})
     441        self.assertEqual(response, {'error': u'Reference must be unique. '})
    442442
    443443        #self.assertEqual(response['status'], 200)
Note: See TracChangeset for help on using the changeset viewer.