ChristianGabs / btcpay-fossbilling

Apache License 2.0
1 stars 2 forks source link

Payment Method allow empty(any) or make multiselect and please include BTC_LightningLike #4

Open petzsch opened 4 months ago

petzsch commented 4 months ago

Currenty I can only choose one payment method, but it should be possible to choose during btcpay checkout which payment method to use.

For this a multi select box would be needed and the Payment array should be filled with wall selected values:

i.e.: $paymentMethods = ['BTC', 'BTC_LightningLike'];

I've currently made the adjustment within the database table pay_gateway: ... "payment_method":"BTC_LightningLike"}

Would be awesome if this was officially supported.

ChristianGabs commented 4 months ago

Hi @petzsch

Thank you for your feedback, I will have look, if you have already a solution feel free to raise a PR if not I will do some testing on my side and update here when is done.

thanks

petzsch commented 4 months ago

done.

Thanks for providing this Payment Adapter. 👍

petzsch commented 4 months ago

Talked with @ndeet about this and he suggested to use getPaymentMethods() to build the list of available paymeht methods. (only possible once api details have been provided)

Also I created a PR von FossBilling to allow multiple select for the payment methods. Doing combined selects for all possible combinations of payment methods is not feasable. :-)

https://github.com/FOSSBilling/FOSSBilling/pull/2366

I'll create a seperate PR, once the above got merged.

ChristianGabs commented 4 months ago

Hi @petzsch I know that was the main reason I setup manualy but possible to use a javascript to override the manual option when is provided.

Let see how your PR will go and possible I will run more testing on my side.

Thanks

ChristianGabs commented 3 months ago

Keep this Open in case your PR will go and release on FOSS on new version

petzsch commented 3 months ago

It's not as straight forward as I hoped. Problem is that the getConfig() function is static and none of the member vars of the adapter can be read from there. So I have no idea howto get the current configured api key and store id and host_url.

Maybe I'm missing something. If you know howto get the current config, I'd be interested to hear. FossBilling on Discord doesn't seem very active. -.-

Been a pleasure working with you on the PR.

Next thing we should look at is "Tax included" which according to API doc should be the amount of tax paid for the actual invoice. So nothing that can be configured at the payment gateway level: (only relevant for the receipt visible in btcpay... could as well be left as null)

number Nullable

Represents the tax amount in the invoice currency. This information will appear in the invoice details view. During invoice creation, the value is automatically rounded to significant digits and ensured not to be greater than the invoice's price.

ChristianGabs commented 3 months ago

Hi @petzsch I notice your message, I know what you trying to do in regards of that getting the "getPaymentMethods()" but you're limited if you look on "AdapterAbstract" the only abstract and static is getConfig() where that will be use for backend.

The only way possible is build that in the config but again one issue is static function.

I will keep in touch with you on discord I will DM you