Ignore:
Timestamp:
26 Dec 2022, 08:13:49 (23 months ago)
Author:
Henrik Bettermann
Message:

Ease customization.

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  
    144144    submit_button = _('Pay now')
    145145
    146     amount='10'
     146    # Nigerian Naira would be "NGN" but is not supported with
     147    # most paypal accounts
     148    currency_code = 'USD'
    147149
    148150    @property
     
    150152        return self.context.r_payment_link
    151153
    152     def create_paypal_order(self):
     154    def create_paypal_order(self, currency_code):
    153155        if self.context.r_pay_reference or self.context.p_state == 'paid':
    154156            return _("Payment ticket can't be re-sent to Paypal.")
     
    164166        # The success url...
    165167        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)
    169169        purchase_units = [
    170170                PurchaseUnit(description=self.context.p_id, amount=amount)
     
    195195        self.paypal_error = u''
    196196        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)
    198198        if self.paypal_error:
    199199            self.flash(error, type='danger')
  • main/kofacustom.nigeria/branches/uli-paypal/src/kofacustom/nigeria/paypal/rest.py

    r17239 r17241  
    8383        json_data["payment_source"]["paypal"][
    8484                "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,
    8788            headers=headers, json=json_data)
    8889    try:
Note: See TracChangeset for help on using the changeset viewer.