Changeset 14804 for main/waeup.kofa/trunk/src
- Timestamp:
- 18 Aug 2017, 06:43:53 (7 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/batching.py
r13873 r14804 360 360 factory_name = 'waeup.ApplicantOnlinePayment' 361 361 362 location_fields = ['applicant_id', 'p_id']362 location_fields = ['applicant_id',] 363 363 364 364 @property 365 365 def available_fields(self): 366 366 af = sorted(list(set( 367 self.location_fields + getFields(self.iface).keys()))) 367 self.location_fields + getFields(self.iface).keys())) + 368 ['p_id',]) 368 369 af.remove('display_item') 369 370 return af 371 372 def checkHeaders(self, headerfields, mode='ignore'): 373 super(ApplicantOnlinePaymentProcessor, self).checkHeaders(headerfields) 374 if mode in ('update', 'remove') and not 'p_id' in headerfields: 375 raise FatalCSVError( 376 "Need p_id for import in update and remove modes!") 377 return True 370 378 371 379 def parentsExist(self, row, site): -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/sample_payment_data.csv
r13872 r14804 1 1 applicant_id,p_state,p_category,p_id,p_session,r_amount_approved,amount_auth,creation_date,type 2 dp2011_1234,failed,application,,2016,19500.1,10500.1,2011-11-25 20:16:33.757 WAT,online 2 3 dp2011_1234,paid,application,p1266236341955,2015,19500.1,19500.1,2010-11-25 20:16:33.757 WAT,online -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_batching.py
r13873 r14804 530 530 num, num_warns, fin_file, fail_file = self.processor.doImport( 531 531 self.csv_file, PAYMENT_HEADER_FIELDS,'create') 532 self.assertEqual(num_warns, 1)532 self.assertEqual(num_warns,2) 533 533 fail_file = open(fail_file).read() 534 534 self.assertTrue('Payment has already been made' in fail_file) … … 538 538 num, num_warns, fin_file, fail_file = self.processor.doImport( 539 539 self.csv_file, PAYMENT_HEADER_FIELDS,'create') 540 # Both records can be imported now. 540 541 self.assertEqual(num_warns,0) 542 # One with imported and known p_id ... 541 543 payment = self.processor.getEntry(dict(applicant_id='dp2011_1234', 542 544 p_id='p1266236341955'), self.app) … … 548 550 self.assertEqual(cdate, '2010-11-25 21:16:33') 549 551 self.assertEqual(str(payment.creation_date.tzinfo),'UTC') 552 # ... the other one with generated p_id. 553 p_id_failed = self.applicant2.keys()[1] 554 payment_failed = self.processor.getEntry(dict(applicant_id='dp2011_1234', 555 p_id=p_id_failed), self.app) 556 self.assertEqual(payment_failed.p_state, 'failed') 557 self.assertEqual(payment_failed.amount_auth, 10500.1) 550 558 shutil.rmtree(os.path.dirname(fin_file)) 551 559 logcontent = open(self.logfile).read() … … 553 561 self.assertTrue( 554 562 'INFO - system - ApplicantOnlinePayment Processor - dp2011_1234 - ' 555 'previous update cancelled' 556 in logcontent) 563 'previous update cancelled' in logcontent) 557 564 self.assertTrue( 558 565 'INFO - system - ApplicantOnlinePayment Processor - ' … … 560 567 'creation_date=2010-11-25 21:16:33.757000+00:00, ' 561 568 'r_amount_approved=19500.1, p_category=application, ' 562 'amount_auth=19500.1, p_session=2015, p_state=paid' 563 in logcontent) 569 'amount_auth=19500.1, p_session=2015, p_state=paid' in logcontent) 570 self.assertTrue( 571 'INFO - system - ApplicantOnlinePayment Processor - ' 572 'sample_payment_data - dp2011_1234 - updated: p_id=%s, ' 573 'creation_date=2011-11-25 21:16:33.757000+00:00, ' 574 'r_amount_approved=19500.1, p_category=application, ' 575 'amount_auth=10500.1, p_session=2016, p_state=failed' 576 % p_id_failed in logcontent) -
main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py
r14654 r14804 748 748 749 749 The `checkConversion` method checks the format of the payment identifier. 750 In create mode it does also ensures that same p_iddoes not exist750 In create mode it does also ensures that same `p_id` does not exist 751 751 elsewhere. It must be portal-wide unique. 752 752
Note: See TracChangeset for help on using the changeset viewer.