Changeset 17241 for main/kofacustom.nigeria
- Timestamp:
- 26 Dec 2022, 08:13:49 (23 months ago)
- Location:
- main/kofacustom.nigeria/branches/uli-paypal/src/kofacustom/nigeria/paypal
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.nigeria/branches/uli-paypal/src/kofacustom/nigeria/paypal/applicantsbrowser.py
r17240 r17241 144 144 submit_button = _('Pay now') 145 145 146 amount='10' 146 # Nigerian Naira would be "NGN" but is not supported with 147 # most paypal accounts 148 currency_code = 'USD' 147 149 148 150 @property … … 150 152 return self.context.r_payment_link 151 153 152 def create_paypal_order(self ):154 def create_paypal_order(self, currency_code): 153 155 if self.context.r_pay_reference or self.context.p_state == 'paid': 154 156 return _("Payment ticket can't be re-sent to Paypal.") … … 164 166 # The success url... 165 167 self.responseurl = self.url(self.context, 'capture_paypal_payment') 166 # Nigerian Naira would be "NGN" but is not supported with 167 # most paypal accounts 168 amount = Amount(value=self.context.amount_auth, currency_code="USD") 168 amount = Amount(value=self.context.amount_auth, currency_code=self.currency_code) 169 169 purchase_units = [ 170 170 PurchaseUnit(description=self.context.p_id, amount=amount) … … 195 195 self.paypal_error = u'' 196 196 if not self.context.r_payment_link: 197 self.paypal_error = self.create_paypal_order( )197 self.paypal_error = self.create_paypal_order(self.currency_code) 198 198 if self.paypal_error: 199 199 self.flash(error, type='danger') -
main/kofacustom.nigeria/branches/uli-paypal/src/kofacustom/nigeria/paypal/rest.py
r17239 r17241 83 83 json_data["payment_source"]["paypal"][ 84 84 "experience_context"]["notify_url"] = notify_url 85 response = requests.post( 86 'https://api-m.sandbox.paypal.com/v2/checkout/orders', 85 config = getUtility(IPaypalConfig) 86 url = "%s/v2/checkout/orders" % PAYPAL_REST_URLS[config['mode']] 87 response = requests.post(url, 87 88 headers=headers, json=json_data) 88 89 try:
Note: See TracChangeset for help on using the changeset viewer.