Only one mandate per account: mandate stored as an account custom field instead of on the payment method
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 18/100
Research direction
Start in src/main/java/org/killbill/billing/plugin/gocardless/GoCardlessPaymentPluginApi.java: addPaymentMethod writes the account custom field near L340 and getMandateId reads it back at L141. Copy the table shape from a sibling plugin's DDL under src/main/resources, add gocardless_payment_methods/gocardless_responses keyed on kb_payment_method_id, resolve the mandate from kbPaymentMethodId in purchasePayment, and implement getPaymentMethods/getPaymentMethodDetail/deletePaymentMethod/resetPaymentMethods. Done when a second payment method keeps its own mandate and existing GOCARDLESS_MANDATE_ID custom fields migrate onto the account's default method.
Written by the indexing model from the issue text.
Description
Problem
The GoCardless mandate is stored as a single account-level custom field named GOCARDLESS_MANDATE_ID, rather than being associated with the Kill Bill payment method.
Written in addPaymentMethod:
Read back in getMandateId, which returns the first match and stops:
Consequences
- One mandate per Kill Bill account, permanently. Adding a second payment method attempts to add a second custom field with the same name on the same account, which
CustomFieldApiExceptions — so the second mandate cannot be stored at all. kbPaymentMethodIdis ignored on the payment path.purchasePaymentresolves the mandate fromkbAccountId, never from the payment method it was actually asked to charge. If an account somehow ended up with two payment methods, both would charge the same mandate.- No multi-scheme support. A customer cannot hold, say, a BACS mandate and a SEPA mandate, which is a normal requirement for a business collecting across the UK and the EU.
deletePaymentMethodis a no-op, so the custom field outlives the payment method and the account is left permanently pinned to a stale mandate.getPaymentMethodsalways returns an empty list andgetPaymentMethodDetailreturns an emptyGoCardlessPaymentMethodPlugin, so the mandate is invisible to KAUI and to the API.- No plugin tables. Unlike the other Kill Bill payment plugins, there is no
gocardless_payment_methods/gocardless_responsesschema, so there is nowhere natural to put this.
Proposed work
Adopt the standard killbill-plugin-framework-java shape used by the Stripe/Adyen/Braintree plugins:
- Add DDL for
gocardless_payment_methodsandgocardless_responses(plus_transactionsif useful), keyed onkb_payment_method_id. - Store the mandate id, scheme, customer id and bank account summary on the payment method row, not on the account.
- Resolve the mandate from
kbPaymentMethodIdinpurchasePayment, not fromkbAccountId. - Implement
getPaymentMethods/getPaymentMethodDetail/deletePaymentMethod/resetPaymentMethodsagainst those tables. - Provide a migration for existing installs that moves
GOCARDLESS_MANDATE_IDcustom fields onto the account's default payment method.
Item 5 matters — the custom field is the current production storage, so this cannot be a clean break.
- Dominant language
- Java
- Stars
- 4
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from killbill/killbill-gocardless-plugin
-
Migrate from deprecated Redirect Flows to Billing Requests (blocked on gocardless-pro SDK upgrade)Open
Difficulty 4/5 3-5 days Newbie friendliness 18/100
-
Difficulty 4/5 3-5 days Newbie friendliness 33/100
-
Webhooks not implemented: processNotification is a stub, async scheme events are never recordedOpen
Difficulty 4/5 3-5 days Newbie friendliness 30/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
All issues in killbill/killbill-gocardless-plugin
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
-
RegistryExceptionHandler uses self-referencing basePackageClasses instead of a controller classOpenbug finsim-registry good-first-issue
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
status:pending type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug level:trivial
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
exoego/keycloak-fuhito#666 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
hammy275/immersive-mc#669 ·