Ignore:
Timestamp:
18 Aug 2017, 07:41:11 (7 years ago)
Author:
Henrik Bettermann
Message:

Wow, Remita has modified the software. get_JSON_POST_response can only be called once with th esame same orderId to retrieve the RRR. Also the trailing whitespace disappeared. Last but not least lineitems are no longer part of the transaction status request response.

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

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/applicantsbrowser.py

    r14798 r14805  
    214214    serviceTypeId = SERVICETYPEID
    215215
    216     orderId = '3456346346'
     216    #orderId = '3456346346'
    217217    init_url = '/remita/ecomm/split/init.reg'
    218218    amount='1000'
     
    275275        if not module_activated(self.context.__parent__.__parent__.year):
    276276            return
     277        self.orderId = self.context.p_id
    277278        error = self.init_update()
    278279        if error:
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/studentsbrowser.py

    r14798 r14805  
    222222    serviceTypeId = SERVICETYPEID
    223223
    224     orderId = '3456346346'
     224    #orderId = '3456346346'
    225225    init_url = '/remita/ecomm/split/init.reg'
    226226    amount='1000'
     
    290290        if not module_activated(self.context.student.current_session):
    291291            return
     292        self.orderId = self.context.p_id
    292293        error = self.init_update()
    293294        if error:
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/tests.py

    r14801 r14805  
    8484                fullname='Anton Meier', email='am@xxx.de',
    8585                lineitems=self.lineitems)
    86         self.rrr = resp['RRR'].rstrip()
     86        return resp
    8787
    8888    @external_test
    8989    def test_get_JSON_POST_response(self):
    90         self._get_transaction_data()
     90        resp = self._get_transaction_data()
     91        self.rrr = resp['RRR']
     92        assert resp == {
     93            u'status': u'Payment Reference generated',
     94            u'orderID': self.orderId,
     95            u'RRR': self.rrr,
     96            u'statuscode': u'025'}
    9197        resp = get_JSON_POST_response(
    9298                merchantId=self.merchantId, serviceTypeId=self.serviceTypeId,
     
    97103                lineitems=self.lineitems)
    98104        assert resp == {
    99             u'status': u'RRR Already Exist for the orderId',
    100             u'orderID': self.orderId,
    101             u'RRR': self.rrr + ' ',  # strange trailing whitespace which
    102                                      # obviously does not belong to the RRR
    103             u'statuscode': u'055'}
     105            u'status': u'Duplicate Order Ref',
     106            u'statuscode': u'028'}
    104107
    105108        resp = get_payment_status_via_rrr(
     
    113116        assert resp['status'] == '021'
    114117        assert resp['amount'] == self.amount
    115         assert resp['lineitems'] == [
    116             {u'status': u'021', u'lineItemsId': u'itemid1'},
    117             {u'status': u'021', u'lineItemsId': u'itemid2'}]
    118118        assert resp['RRR'] == self.rrr
    119119        assert resp['message'] == u'Transaction Pending'
     
    200200        self.browser.getLink("Pay via Remita").click()
    201201        # The RRR has been retrieved
    202         self.assertTrue('<input name="rrr" type="hidden" value="%s">' % self.rrr
     202        self.assertTrue('<input name="rrr" type="hidden" value="%s">'
     203            % self.payment.r_pay_reference
    203204            in self.browser.contents)
    204205        self.assertTrue(
    205206            'action="http://www.remitademo.net/remita/ecomm/finalize.reg"'
    206207            in self.browser.contents)
    207         self.assertEqual(self.payment.r_pay_reference, self.rrr)
    208208        self.assertEqual(self.payment.r_company, 'remita')
    209209        # Retrieval has been logged
     
    214214            'zope.mgr - kofacustom.nigeria.remita.studentsbrowser.RemitaPageStudent'
    215215            ' - K1000000 - RRR retrieved: %s, ServiceTypeId: %s'
    216             % (self.rrr, self.serviceTypeId) in logcontent)
     216            % (self.payment.r_pay_reference, self.serviceTypeId) in logcontent)
    217217
    218218        # Means of testing end here.
     
    385385        self.browser.getLink("Pay via Remita").click()
    386386        # The RRR has been retrieved
    387         self.assertTrue('<input name="rrr" type="hidden" value="%s">' % self.rrr
    388             in self.browser.contents)
    389         self.assertEqual(self.payment.r_pay_reference, self.rrr)
     387        self.assertTrue('<input name="rrr" type="hidden" value="%s">'
     388            % self.payment.r_pay_reference
     389            in self.browser.contents)
    390390        self.assertEqual(self.payment.r_company, 'remita')
    391391        # Retrieval has been logged
     
    396396            'zope.mgr - kofacustom.nigeria.remita.applicantsbrowser.RemitaPageApplicant'
    397397            ' - %s - RRR retrieved: %s, ServiceTypeId: %s'
    398             % (self.applicant.applicant_id, self.rrr, self.serviceTypeId)
     398            % (self.applicant.applicant_id,
     399               self.payment.r_pay_reference,
     400               self.serviceTypeId)
    399401            in logcontent)
    400402        # Means of testing end here.
Note: See TracChangeset for help on using the changeset viewer.