[10765] | 1 | ## $Id: browser.py 14964 2018-03-08 20:42:40Z henrik $ |
---|
| 2 | ## |
---|
| 3 | ## Copyright (C) 2012 Uli Fouquet & Henrik Bettermann |
---|
| 4 | ## This program is free software; you can redistribute it and/or modify |
---|
| 5 | ## it under the terms of the GNU General Public License as published by |
---|
| 6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | ## (at your option) any later version. |
---|
| 8 | ## |
---|
| 9 | ## This program is distributed in the hope that it will be useful, |
---|
| 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | ## GNU General Public License for more details. |
---|
| 13 | ## |
---|
| 14 | ## You should have received a copy of the GNU General Public License |
---|
| 15 | ## along with this program; if not, write to the Free Software |
---|
| 16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 17 | ## |
---|
| 18 | import httplib |
---|
[12479] | 19 | import hashlib |
---|
[10765] | 20 | import grok |
---|
| 21 | from kofacustom.nigeria.interswitch.browser import ( |
---|
| 22 | InterswitchPaymentRequestWebservicePageApplicant, |
---|
[11638] | 23 | InterswitchPaymentRequestWebservicePageStudent, |
---|
[13587] | 24 | InterswitchPaymentVerifyWebservicePageApplicant, |
---|
| 25 | InterswitchPaymentVerifyWebservicePageStudent, |
---|
[11638] | 26 | InterswitchPageStudent, InterswitchPageApplicant, |
---|
[10765] | 27 | ) |
---|
[14716] | 28 | from kofacustom.dspg.students.interfaces import ICustomStudentOnlinePayment |
---|
| 29 | from kofacustom.dspg.applicants.interfaces import ICustomApplicantOnlinePayment |
---|
| 30 | from kofacustom.dspg.interfaces import MessageFactory as _ |
---|
[10765] | 31 | |
---|
[14726] | 32 | PRODUCT_ID = '7269' # must be provided by Interswitch |
---|
[14749] | 33 | SITE_NAME = 'dspg.waeup.org' |
---|
[14879] | 34 | PROVIDER_ACCT = '2028964403' |
---|
| 35 | PROVIDER_BANK_ID = '8' |
---|
[10765] | 36 | PROVIDER_ITEM_NAME = 'BT Education' |
---|
[14722] | 37 | INSTITUTION_NAME = 'Delta State Polytechnic Ogwashi-Uku' |
---|
[10765] | 38 | CURRENCY = '566' |
---|
[14727] | 39 | GATEWAY_AMT = 250.0 |
---|
[10765] | 40 | |
---|
[14726] | 41 | POST_ACTION = 'https://webpay.interswitchng.com/paydirect/pay' |
---|
| 42 | #POST_ACTION = 'https://sandbox.interswitchng.com/webpay/pay' |
---|
| 43 | HOST = 'webpay.interswitchng.com' |
---|
| 44 | #HOST = 'sandbox.interswitchng.com' |
---|
| 45 | URL = '/paydirect/api/v1/gettransaction.json' |
---|
| 46 | #URL = '/webpay/api/v1/gettransaction.json' |
---|
[14276] | 47 | |
---|
[12479] | 48 | httplib.HTTPSConnection.debuglevel = 0 |
---|
| 49 | HTTPS = True |
---|
[10765] | 50 | |
---|
[14859] | 51 | SPECIAL_PAYMENT_PARAMS = { |
---|
[14864] | 52 | |
---|
| 53 | 'carryover1': ('101', 500.0, '1012808851', '117'), |
---|
| 54 | 'carryover5': ('101', 500.0, '1012808851', '117'), |
---|
| 55 | 'carryover6': ('101', 500.0, '1012808851', '117'), |
---|
| 56 | 'carryover7': ('101', 500.0, '1012808851', '117'), |
---|
| 57 | 'carryover8': ('101', 500.0, '1012808851', '117'), |
---|
| 58 | 'carryover9': ('101', 500.0, '1012808851', '117'), |
---|
| 59 | 'carryover10': ('101', 500.0, '1012808851', '117'), |
---|
[14868] | 60 | 'carryover11': ('101', 500.0, '1012808851', '117'), |
---|
| 61 | 'carryover12': ('101', 500.0, '1012808851', '117'), |
---|
[14869] | 62 | 'balance': ('101', 500.0, '1012808851', '117'), |
---|
[14864] | 63 | |
---|
[14859] | 64 | 'certificate': ('111', 500.0, '1012808851', '117'), |
---|
| 65 | 'state_result': ('112', 500.0, '1012808851', '117'), |
---|
| 66 | 'transcript_local': ('113', 500.0, '1012808851', '117'), |
---|
| 67 | 'transcript_foreign': ('114', 500.0, '1012808851', '117'), |
---|
| 68 | 'ver_result': ('115', 500.0, '1012808851', '117'), |
---|
| 69 | 'change_course': ('116', 500.0, '1012808851', '117'), |
---|
| 70 | 'change_inst': ('117', 500.0, '1012808851', '117'), |
---|
| 71 | 'jamb_reject': ('118', 500.0, '1012808851', '117'), |
---|
| 72 | 'cert_of_cert': ('119', 500.0, '1012808851', '117'), |
---|
| 73 | 'ref_let': ('120', 500.0, '1012808851', '117'), |
---|
| 74 | 'proc_cert': ('121', 500.0, '1012808851', '117'), |
---|
| 75 | 'loss_idcard': ('122', 9.0, '1012808851', '117'), |
---|
| 76 | 'loss_examcard': ('123', 4.5, '1012808851', '117'), |
---|
| 77 | 'loss_result': ('124', 500.0, '1012808851', '117'), |
---|
| 78 | 'loss_receipt': ('125', 500.0, '1012808851', '117'), |
---|
| 79 | 'loss_clearance': ('126', 500.0, '1012808851', '117'), |
---|
| 80 | 'conv_brochure': ('127', 500.0, '1012808851', '117'), |
---|
| 81 | 'hnd_certificate': ('128', 500.0, '1012808851', '117'), |
---|
| 82 | 'hnd_state_result': ('129', 500.0, '1012808851', '117'), |
---|
| 83 | 'hnd_transcript_local': ('130', 500.0, '1012808851', '117'), |
---|
| 84 | 'hnd_transcript_foreign': ('131', 500.0, '1012808851', '117'), |
---|
| 85 | 'staff_loss_idcard': ('132', 9.0, '1012808851', '117'), |
---|
| 86 | 'hnd_conv_brochure': ('133', 500.0, '1012808851', '117'), |
---|
| 87 | 'pgd_state_result': ('134', 500.0, '1012808851', '117'), |
---|
| 88 | 'pgd_conv_brochure': ('135', 500.0, '1012808851', '117'), |
---|
| 89 | 'pgd_certificate': ('136', 500.0, '1012808851', '117'), |
---|
| 90 | 'log_book': ('137', 4.5, '1012808851', '117'), |
---|
| 91 | 'pgd_transcript_foreign': ('138', 500.0, '1012808851', '117'), |
---|
| 92 | 'pgd_transcript_local': ('139', 500.0, '1012808851', '117'), |
---|
| 93 | 'jamb_regularization': ('140', 500.0, '1012808851', '117'), |
---|
| 94 | 'utme_registration': ('142', 9.0, '1012808851', '117'), |
---|
| 95 | 'utme_cbt': ('143', 9.0, '1012808851', '117'), |
---|
| 96 | 'nysc_id_card': ('144', 9.0, '1012808851', '117'), |
---|
| 97 | 'ijmb_result': ('147', 500.0, '1012808851', '117'), |
---|
| 98 | } |
---|
| 99 | |
---|
[14862] | 100 | |
---|
[14875] | 101 | # Not yet readily configured. Bank account numbers are |
---|
[14862] | 102 | # contradictory. pay_item_ids are not yet assigned. |
---|
| 103 | |
---|
[11638] | 104 | class CustomInterswitchPageStudent(InterswitchPageStudent): |
---|
[10765] | 105 | """ View which sends a POST request to the Interswitch |
---|
| 106 | CollegePAY payment gateway. |
---|
| 107 | """ |
---|
| 108 | grok.context(ICustomStudentOnlinePayment) |
---|
| 109 | action = POST_ACTION |
---|
| 110 | site_name = SITE_NAME |
---|
| 111 | currency = CURRENCY |
---|
| 112 | product_id = PRODUCT_ID |
---|
[14875] | 113 | mac = 'D43ED93B7A307B152C7111D04E1F384428057CD1E75428D3A4C5631C28ACB9C8C822A88CA76DEDC5F9A520CF4BFDB2824FF8B207AAFC667DF3CBB13685B66627' |
---|
| 114 | pay_item_id = '000' |
---|
[10765] | 115 | |
---|
| 116 | def update(self): |
---|
[12979] | 117 | error = self.init_update() |
---|
| 118 | if error: |
---|
| 119 | self.flash(error, type='danger') |
---|
| 120 | self.redirect(self.url(self.context, '@@index')) |
---|
| 121 | return |
---|
[11647] | 122 | student = self.student |
---|
| 123 | xmldict = self.xmldict |
---|
[10765] | 124 | # Provider data |
---|
| 125 | xmldict['detail_ref'] = self.context.p_id |
---|
| 126 | xmldict['provider_acct'] = PROVIDER_ACCT |
---|
| 127 | xmldict['provider_bank_id'] = PROVIDER_BANK_ID |
---|
| 128 | xmldict['provider_item_name'] = PROVIDER_ITEM_NAME |
---|
| 129 | # Institution data |
---|
[14875] | 130 | xmldict['institution_acct'] = '00000000' |
---|
| 131 | xmldict['institution_bank_id'] = '00' |
---|
[10765] | 132 | xmldict['institution_amt'] = '0.0' |
---|
[14875] | 133 | provider_amt = 0.0 |
---|
[14961] | 134 | tech_fee = 0.0 |
---|
[14862] | 135 | if self.context.p_category.startswith('schoolfee'): |
---|
| 136 | self.pay_item_id = '102' |
---|
[14875] | 137 | provider_amt = 2800.0 |
---|
[14961] | 138 | tech_fee = 1200.0 |
---|
[14889] | 139 | if student.faccode == 'SPAT': |
---|
| 140 | xmldict['institution_acct'] = '1012808851' |
---|
[14875] | 141 | xmldict['institution_bank_id'] = '117' |
---|
[14889] | 142 | elif student.current_mode in ('nd_ft', 'hnd_ft'): |
---|
[14953] | 143 | xmldict['institution_acct'] = '0010761873' |
---|
| 144 | xmldict['institution_bank_id'] = '11' |
---|
[14862] | 145 | elif self.context.p_category == 'clearance': |
---|
| 146 | self.pay_item_id = '103' |
---|
[14875] | 147 | provider_amt = 500.0 |
---|
[14889] | 148 | if student.faccode == 'SPAT': |
---|
| 149 | xmldict['institution_acct'] = '1012808851' |
---|
[14875] | 150 | xmldict['institution_bank_id'] = '117' |
---|
[14889] | 151 | elif student.current_mode == 'nd_ft': |
---|
[14875] | 152 | xmldict['institution_acct'] = '2004402644' |
---|
| 153 | xmldict['institution_bank_id'] = '8' |
---|
[14942] | 154 | elif self.context.p_category == 'gown': |
---|
| 155 | self.pay_item_id = '102' # We use school fee item id. |
---|
| 156 | xmldict['institution_acct'] = '2006612782' |
---|
| 157 | xmldict['institution_bank_id'] = '8' |
---|
[14862] | 158 | elif self.context.p_category in SPECIAL_PAYMENT_PARAMS.keys(): |
---|
| 159 | self.pay_item_id = SPECIAL_PAYMENT_PARAMS[self.context.p_category][0] |
---|
| 160 | provider_amt = SPECIAL_PAYMENT_PARAMS[self.context.p_category][1] |
---|
| 161 | xmldict['institution_acct'] = SPECIAL_PAYMENT_PARAMS[self.context.p_category][2] |
---|
| 162 | xmldict['institution_bank_id'] = SPECIAL_PAYMENT_PARAMS[self.context.p_category][3] |
---|
[10765] | 163 | xmldict['provider_amt'] = 100 * provider_amt |
---|
[14961] | 164 | xmldict['tech_fee'] = 100 * tech_fee |
---|
[12511] | 165 | xmldict['institution_item_name'] = self.context.category |
---|
[10765] | 166 | xmldict['institution_name'] = INSTITUTION_NAME |
---|
[14889] | 167 | xmldict['institution_amt'] = institution_amt = 100 * ( |
---|
[14961] | 168 | self.context.amount_auth - provider_amt - tech_fee - GATEWAY_AMT) |
---|
| 169 | |
---|
[10765] | 170 | if provider_amt == 0: |
---|
| 171 | xmltext = """<payment_item_detail> |
---|
| 172 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> |
---|
| 173 | <item_detail item_id="1" item_name="%(institution_item_name)s" item_amt="%(institution_amt)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" /> |
---|
| 174 | </item_details> |
---|
| 175 | </payment_item_detail>""" % xmldict |
---|
[14961] | 176 | elif tech_fee == 0: |
---|
| 177 | xmltext = """<payment_item_detail> |
---|
| 178 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> |
---|
| 179 | <item_detail item_id="1" item_name="%(institution_item_name)s" item_amt="%(institution_amt)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" /> |
---|
| 180 | <item_detail item_id="2" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" /> |
---|
| 181 | </item_details> |
---|
| 182 | </payment_item_detail>""" % xmldict |
---|
[10765] | 183 | else: |
---|
| 184 | xmltext = """<payment_item_detail> |
---|
| 185 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> |
---|
| 186 | <item_detail item_id="1" item_name="%(institution_item_name)s" item_amt="%(institution_amt)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" /> |
---|
| 187 | <item_detail item_id="2" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" /> |
---|
[14962] | 188 | <item_detail item_id="3" item_name="Technology Fee" item_amt="%(tech_fee)d" bank_id="307" acct_num="5100189030" /> |
---|
[10765] | 189 | </item_details> |
---|
| 190 | </payment_item_detail>""" % xmldict |
---|
[14889] | 191 | |
---|
| 192 | # isouaba: All certificates in SPAT are part time thus any payments |
---|
| 193 | # coming from those certificates (Application, Acceptance, school fees |
---|
| 194 | # etc) 40% should be split to keystone account. |
---|
| 195 | if student.faccode == 'SPAT': |
---|
| 196 | xmldict['institution_amt_2'] = 0.4 * institution_amt |
---|
| 197 | xmldict['institution_amt_1'] = 0.6 * institution_amt |
---|
| 198 | if provider_amt == 0: |
---|
| 199 | xmltext = """<payment_item_detail> |
---|
| 200 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> |
---|
| 201 | <item_detail item_id="1" item_name="%(institution_item_name)s 1" item_amt="%(institution_amt_1)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" /> |
---|
| 202 | <item_detail item_id="2" item_name="%(institution_item_name)s 2" item_amt="%(institution_amt_2)d" bank_id="123" acct_num="1002883141" /> |
---|
| 203 | </item_details> |
---|
| 204 | </payment_item_detail>""" % xmldict |
---|
[14964] | 205 | elif tech_fee == 0: |
---|
| 206 | xmltext = """<payment_item_detail> |
---|
| 207 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> |
---|
| 208 | <item_detail item_id="1" item_name="%(institution_item_name)s 1" item_amt="%(institution_amt_1)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" /> |
---|
| 209 | <item_detail item_id="2" item_name="%(institution_item_name)s 2" item_amt="%(institution_amt_2)d" bank_id="123" acct_num="1002883141" /> |
---|
| 210 | <item_detail item_id="3" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" /> |
---|
| 211 | </item_details> |
---|
| 212 | </payment_item_detail>""" % xmldict |
---|
[14889] | 213 | else: |
---|
| 214 | xmltext = """<payment_item_detail> |
---|
| 215 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> |
---|
| 216 | <item_detail item_id="1" item_name="%(institution_item_name)s 1" item_amt="%(institution_amt_1)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" /> |
---|
| 217 | <item_detail item_id="2" item_name="%(institution_item_name)s 2" item_amt="%(institution_amt_2)d" bank_id="123" acct_num="1002883141" /> |
---|
| 218 | <item_detail item_id="3" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" /> |
---|
[14964] | 219 | <item_detail item_id="4" item_name="Technology Fee" item_amt="%(tech_fee)d" bank_id="307" acct_num="5100189030" /> |
---|
[14889] | 220 | </item_details> |
---|
| 221 | </payment_item_detail>""" % xmldict |
---|
[14921] | 222 | # dep_sug payments are treated completely separately. The following lines |
---|
| 223 | # override the configuration above. |
---|
| 224 | if self.context.p_category == 'dep_sug': |
---|
| 225 | self.pay_item_id = '102' # We use school fee item id |
---|
| 226 | # amount_auth is being ignored. However, the sum of all split payments |
---|
| 227 | # must coincide with the amount_auth configured in students/utils.py |
---|
[14938] | 228 | xmldict['amt1'] = 100 * 1000 |
---|
[14921] | 229 | xmldict['amt2'] = 100 * 500 |
---|
| 230 | xmldict['amt3'] = 100 * 900 |
---|
| 231 | xmldict['amt4'] = 100 * 500 |
---|
[14938] | 232 | |
---|
[14940] | 233 | xmltext = """<payment_item_detail> |
---|
[14921] | 234 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> |
---|
| 235 | <item_detail item_id="1" item_name="SUG" item_amt="%(amt1)d" bank_id="11" acct_num="0038079930" /> |
---|
| 236 | <item_detail item_id="2" item_name="Students Welfare" item_amt="%(amt2)d" bank_id="11" acct_num="0037892949" /> |
---|
| 237 | <item_detail item_id="3" item_name="Anti-Cult Book" item_amt="%(amt3)d" bank_id="11" acct_num="0037892949" /> |
---|
[14938] | 238 | <item_detail item_id="4" item_name="NADESSTU" item_amt="%(amt4)d" bank_id="11" acct_num="0036375968" /> |
---|
[14921] | 239 | </item_details> |
---|
| 240 | </payment_item_detail>""" % xmldict |
---|
[14940] | 241 | |
---|
| 242 | # if student.faccode == 'SPAT': |
---|
| 243 | # xmltext = """<payment_item_detail> |
---|
| 244 | #<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> |
---|
| 245 | #<item_detail item_id="1" item_name="Students Welfare" item_amt="%(amt2)d" bank_id="11" acct_num="0037892949" /> |
---|
| 246 | #<item_detail item_id="2" item_name="Anti-Cult Book" item_amt="%(amt3)d" bank_id="11" acct_num="0037892949" /> |
---|
| 247 | #</item_details> |
---|
| 248 | #</payment_item_detail>""" % xmldict |
---|
| 249 | |
---|
[10765] | 250 | self.xml_data = """<input type="hidden" name="xml_data" value='%s' />""" % xmltext |
---|
| 251 | self.context.provider_amt = provider_amt |
---|
| 252 | self.context.gateway_amt = GATEWAY_AMT |
---|
[12479] | 253 | hashargs = ( |
---|
| 254 | self.context.p_id + |
---|
| 255 | PRODUCT_ID + |
---|
| 256 | self.pay_item_id + |
---|
| 257 | str(int(self.amount_auth)) + |
---|
| 258 | self.site_redirect_url + |
---|
| 259 | self.mac) |
---|
| 260 | self.hashvalue = hashlib.sha512(hashargs).hexdigest() |
---|
[10765] | 261 | return |
---|
| 262 | |
---|
[11638] | 263 | class CustomInterswitchPageApplicant(InterswitchPageApplicant): |
---|
[10765] | 264 | """ View which sends a POST request to the Interswitch |
---|
| 265 | CollegePAY payment gateway. |
---|
| 266 | """ |
---|
| 267 | grok.context(ICustomApplicantOnlinePayment) |
---|
| 268 | action = POST_ACTION |
---|
| 269 | site_name = SITE_NAME |
---|
| 270 | currency = CURRENCY |
---|
[14729] | 271 | pay_item_id = '101' # must be provided by Interswitch |
---|
[10765] | 272 | product_id = PRODUCT_ID |
---|
[14730] | 273 | mac = 'D43ED93B7A307B152C7111D04E1F384428057CD1E75428D3A4C5631C28ACB9C8C822A88CA76DEDC5F9A520CF4BFDB2824FF8B207AAFC667DF3CBB13685B66627' |
---|
[10765] | 274 | |
---|
| 275 | def update(self): |
---|
[12979] | 276 | error = self.init_update() |
---|
| 277 | if error: |
---|
| 278 | self.flash(error, type='danger') |
---|
| 279 | self.redirect(self.url(self.context, '@@index')) |
---|
| 280 | return |
---|
[10765] | 281 | xmldict = {} |
---|
[14731] | 282 | provider_amt = 500.0 |
---|
[14859] | 283 | gateway_amt = GATEWAY_AMT |
---|
[14810] | 284 | xmldict['institution_acct'] = '00000000' |
---|
| 285 | xmldict['institution_bank_id'] = '00' |
---|
| 286 | if self.applicant.__parent__.application_category in ('ndft', 'hndft'): |
---|
| 287 | xmldict['institution_acct'] = '0010761873' |
---|
[14815] | 288 | xmldict['institution_bank_id'] = '11' |
---|
[14810] | 289 | elif self.applicant.__parent__.application_category in ( |
---|
| 290 | 'ndpt', 'hndpt', 'ndwe', 'hndwe'): |
---|
| 291 | xmldict['institution_acct'] = '1015220292' |
---|
| 292 | xmldict['institution_bank_id'] = '117' |
---|
[14859] | 293 | elif self.applicant.applicant_id.startswith('special'): |
---|
| 294 | if self.context.p_category in SPECIAL_PAYMENT_PARAMS.keys(): |
---|
| 295 | self.pay_item_id = SPECIAL_PAYMENT_PARAMS[self.context.p_category][0] |
---|
| 296 | provider_amt = SPECIAL_PAYMENT_PARAMS[self.context.p_category][1] |
---|
| 297 | xmldict['institution_acct'] = SPECIAL_PAYMENT_PARAMS[self.context.p_category][2] |
---|
| 298 | xmldict['institution_bank_id'] = SPECIAL_PAYMENT_PARAMS[self.context.p_category][3] |
---|
| 299 | if self.pay_item_id in ('122', '123', '132', '137', '141', |
---|
| 300 | '142', '143', '144', '146', '147',): |
---|
| 301 | gateway_amt = round(0.015 * self.context.amount_auth, 2) |
---|
[10765] | 302 | xmldict['detail_ref'] = self.context.p_id |
---|
| 303 | xmldict['provider_amt'] = 100 * provider_amt |
---|
| 304 | xmldict['provider_acct'] = PROVIDER_ACCT |
---|
| 305 | xmldict['provider_bank_id'] = PROVIDER_BANK_ID |
---|
| 306 | xmldict['provider_item_name'] = PROVIDER_ITEM_NAME |
---|
[14889] | 307 | xmldict['institution_amt'] = institution_amt = 100 * ( |
---|
| 308 | self.context.amount_auth - provider_amt - gateway_amt) |
---|
[12511] | 309 | xmldict['institution_item_name'] = self.context.category |
---|
[10765] | 310 | xmldict['institution_name'] = INSTITUTION_NAME |
---|
| 311 | xmltext = """<payment_item_detail> |
---|
| 312 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s"> |
---|
| 313 | <item_detail item_id="1" item_name="%(institution_item_name)s" item_amt="%(institution_amt)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" /> |
---|
| 314 | <item_detail item_id="2" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" /> |
---|
| 315 | </item_details> |
---|
| 316 | </payment_item_detail>""" % xmldict |
---|
[14889] | 317 | |
---|
| 318 | # isouaba: All certificates in SPAT are part time thus any payments |
---|
| 319 | # coming from those certificates (Application, Acceptance, school fees |
---|
| 320 | # etc) 40% should be split to keystone account. |
---|
| 321 | if self.applicant.__parent__.application_category in ( |
---|
| 322 | 'ndpt', 'hndpt', 'ndwe', 'hndwe'): |
---|
| 323 | xmldict['institution_amt_2'] = 0.4 * institution_amt |
---|
| 324 | xmldict['institution_amt_1'] = 0.6 * institution_amt |
---|
| 325 | xmltext = """<payment_item_detail> |
---|
| 326 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s"> |
---|
| 327 | <item_detail item_id="1" item_name="%(institution_item_name)s 1" item_amt="%(institution_amt_1)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" /> |
---|
| 328 | <item_detail item_id="2" item_name="%(institution_item_name)s 2" item_amt="%(institution_amt_2)d" bank_id="123" acct_num="1002883141" /> |
---|
| 329 | <item_detail item_id="3" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" /> |
---|
| 330 | </item_details> |
---|
| 331 | </payment_item_detail>""" % xmldict |
---|
| 332 | |
---|
[10765] | 333 | self.xml_data = """<input type="hidden" name="xml_data" value='%s' />""" % xmltext |
---|
| 334 | self.context.provider_amt = provider_amt |
---|
| 335 | self.context.gateway_amt = GATEWAY_AMT |
---|
[12479] | 336 | |
---|
| 337 | hashargs = ( |
---|
| 338 | self.context.p_id + |
---|
| 339 | PRODUCT_ID + |
---|
| 340 | self.pay_item_id + |
---|
| 341 | str(int(self.amount_auth)) + |
---|
| 342 | self.site_redirect_url + |
---|
| 343 | self.mac) |
---|
| 344 | self.hashvalue = hashlib.sha512(hashargs).hexdigest() |
---|
[10765] | 345 | return |
---|
| 346 | |
---|
[11638] | 347 | class CustomInterswitchPaymentRequestWebservicePageStudent( |
---|
[10765] | 348 | InterswitchPaymentRequestWebservicePageStudent): |
---|
[13587] | 349 | """Request webservice view for the CollegePAY gateway |
---|
[10765] | 350 | """ |
---|
| 351 | grok.context(ICustomStudentOnlinePayment) |
---|
| 352 | product_id = PRODUCT_ID |
---|
| 353 | gateway_host = HOST |
---|
| 354 | gateway_url = URL |
---|
[14875] | 355 | mac = 'D43ED93B7A307B152C7111D04E1F384428057CD1E75428D3A4C5631C28ACB9C8C822A88CA76DEDC5F9A520CF4BFDB2824FF8B207AAFC667DF3CBB13685B66627' |
---|
[10765] | 356 | |
---|
[13587] | 357 | class CustomInterswitchPaymentVerifyWebservicePageStudent( |
---|
| 358 | InterswitchPaymentVerifyWebservicePageStudent): |
---|
| 359 | """Payment verify view for the CollegePAY gateway |
---|
| 360 | """ |
---|
| 361 | grok.context(ICustomStudentOnlinePayment) |
---|
| 362 | product_id = PRODUCT_ID |
---|
| 363 | gateway_host = HOST |
---|
| 364 | gateway_url = URL |
---|
[14875] | 365 | mac = 'D43ED93B7A307B152C7111D04E1F384428057CD1E75428D3A4C5631C28ACB9C8C822A88CA76DEDC5F9A520CF4BFDB2824FF8B207AAFC667DF3CBB13685B66627' |
---|
[13587] | 366 | |
---|
[11638] | 367 | class CustomInterswitchPaymentRequestWebservicePageApplicant( |
---|
[10765] | 368 | InterswitchPaymentRequestWebservicePageApplicant): |
---|
[13587] | 369 | """Request webservice view for the CollegePAY gateway |
---|
[10765] | 370 | """ |
---|
| 371 | grok.context(ICustomApplicantOnlinePayment) |
---|
| 372 | product_id = PRODUCT_ID |
---|
| 373 | gateway_host = HOST |
---|
[12479] | 374 | gateway_url = URL |
---|
[14730] | 375 | mac = 'D43ED93B7A307B152C7111D04E1F384428057CD1E75428D3A4C5631C28ACB9C8C822A88CA76DEDC5F9A520CF4BFDB2824FF8B207AAFC667DF3CBB13685B66627' |
---|
[13587] | 376 | |
---|
| 377 | class CustomInterswitchPaymentVerifyWebservicePageApplicant( |
---|
| 378 | InterswitchPaymentVerifyWebservicePageApplicant): |
---|
| 379 | """Payment verify view for the CollegePAY gateway |
---|
| 380 | """ |
---|
| 381 | grok.context(ICustomApplicantOnlinePayment) |
---|
| 382 | product_id = PRODUCT_ID |
---|
| 383 | gateway_host = HOST |
---|
[14722] | 384 | gateway_url = URL |
---|
[14730] | 385 | mac = 'D43ED93B7A307B152C7111D04E1F384428057CD1E75428D3A4C5631C28ACB9C8C822A88CA76DEDC5F9A520CF4BFDB2824FF8B207AAFC667DF3CBB13685B66627' |
---|