I have started the development of clictopay payment plugin for indico with a friend (who has better knowledge in python than me) here :
Clictopay is a payment gateway in Tunisia (in fact, it’s the most used)
I aim to make it easier for people here to use indico.
I have already successfully packaged indico for yunohost with a good integration level and I am maintaining the package.
Your expertise would be very helpful.
I still didn’t test it, it’s in an alpha stage.
Generally it’s a good idea to look at existing payment plugins.
And at this stage I do not think it makes any sense to provide more feedback, considering that your plugin would not even load, since you have invalid imports (there is no PaymentController
in Indico, but you try to import that).
You also do stuff with current_app.config
, even though this is not something used for Indico configuration. You’d use plugin settings for this…
PS: Just out of curiosity: Did you write this yourself, or use AI/LLM for it?
I started with PayPal plugin and looked if there was any clictopay plugins written in python. All I found was in php.
I used AI to understand each function and to check consistency. And about writing, that was my friend who guided me, but he told me that I should recheck since he didn’t know indico and would have a look at it during the next weeks.
Thanks for clarifying that.
I will have to reread the whole stuff tomorrow
Oh, you mean he could have used AI for generating the code?
Happy new year to you and all the team
You were right, he used AI and I thought he had the required knowledge. I will have to start from scratch and seek someone else. Sorry for the noise
One last question : if I open registration without enabling payments, can I enable payments when the plugin will be ready, knowing that in the registration form I have added paid workshops options? I can send mailing to all people registered to proceed to payment?
As long as the Payments feature is enabled in the event, and the registration has either a base price or fields with a price, then it should work fine.
You can test it yourself by registering yourself and then checking the state which should be “Awaiting Payment” (and not “Complete”).
1 Like
Thanks a lot for your help
This is progressing. I found someone else who made it work in the development environment but the api gateway is returning “invalid amount”. The api is expecting an integer. I supposed registration.price is a decimal, so the dev tried to multiply it by 1000 (1 TND = 1000 Mill) since the api needs amount to be in Mill
So what’s the problem there? It’s up to the developer to transform the data from Indico into the format the API expects…
FWIW we do the same in the sixpay plugin:
import iso4217
def to_small_currency(large_currency_amount, iso_code):
"""Convert an amount from large currency to small currency.
:param large_currency_amount: the amount in large currency, e.g. ``2.3``
:param iso_code: the ISO currency code, e.g. ``"EUR"``
:return: the amount in small currency, e.g. ``230``
"""
validate_currency(iso_code)
exponent = iso4217.Currency(iso_code).exponent
if exponent == 0:
return large_currency_amount
return int(large_currency_amount * (10 ** exponent))
(this is sophisticated enough to support any currency, and does not blindly assume that price * 100
works - I guess for some currencies it’s price * 1000
)
And then we pass it like this to the API to_small_currency(self.registration.price, self.registration.currency)
1 Like