skerkour / bloom-legacy

DEPRECATED - End-to-end encrypted Notes, Files, Calendar, Contacts... for Android, IOS, Linux & MacOS
https://bloom.sh
Other
123 stars 23 forks source link

billing: simplify by allowing a single payment method #5

Open sylvain101010 opened 3 years ago

sylvain101010 commented 3 years ago

What would you like to be changed

Change from allowing a customer to have multiple payment methods, to only one.

A customer will have either 1 payment method, on nonce, but not multiple, with one being the default one ...

Why is this needed

Because it's really unwanted complexity

sylvain101010 commented 3 years ago
Customer {
PaymentMethod *PaymentMethod
}
service:

AddPaymentMethod
ChangeDefaultPaymentMethod -> remove
FindPaymentMethodsForUser -> FindPaymentMethodForUser
FindPaymentMethodsForGroup -> FindPaymentMethodForGroup
AddPaymentMethod:

    customerPaymentMethodsCount, err := service.billingRepo.GetPaymentMethodsCountForCustomer(ctx, tx, customer.ID)
    if err != nil {
        tx.Rollback()
        return
    }

    if customerPaymentMethodsCount != 0 {
        tx.Rollback()
        err = errors.InvalidArgument("Please remove your payment method before adding a new one")
        return
    }

Comment on fait pour delete une payment method?

Tasks