Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow stripe to collect billing address #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,16 @@ public Result createSession(@Named("kbAccountId") final UUID kbAccountId,
@Named("cancelUrl") final Optional<String> cancelUrl,
@Named("kbInvoiceId") final Optional<String> kbInvoiceId,
@Named("paymentMethodTypes") final Optional<List<String>> paymentMethodTypes,
@Local @Named("killbill_tenant") final Tenant tenant) throws JsonProcessingException, PaymentPluginApiException {
@Local @Named("killbill_tenant") final Tenant tenant,
@Named("billingAddressCollection") final Optional<String> billingAddressCollection) throws JsonProcessingException, PaymentPluginApiException {
final CallContext context = new PluginCallContext(StripeActivator.PLUGIN_NAME, clock.getClock().getUTCNow(), kbAccountId, tenant.getId());
final ImmutableList<PluginProperty> customFields = ImmutableList.of(
new PluginProperty("kb_account_id", kbAccountId.toString(), false),
new PluginProperty("kb_invoice_id", kbInvoiceId.orElse(null), false),
new PluginProperty("success_url", successUrl.orElse("https://example.com/success?sessionId={CHECKOUT_SESSION_ID}"), false),
new PluginProperty("cancel_url", cancelUrl.orElse("https://example.com/cancel"), false),
new PluginProperty("payment_method_types", paymentMethodTypes.orElse(null), false));
new PluginProperty("payment_method_types", paymentMethodTypes.orElse(null), false),
new PluginProperty("billing_address_collection", billingAddressCollection.orElse("auto"), false));
final HostedPaymentPageFormDescriptor hostedPaymentPageFormDescriptor = stripePaymentPluginApi.buildFormDescriptor(kbAccountId,
customFields,
ImmutableList.of(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ public HostedPaymentPageFormDescriptor buildFormDescriptor(final UUID kbAccountI
params.put("mode", "setup");
params.put("success_url", PluginProperties.getValue("success_url", "https://example.com/success?sessionId={CHECKOUT_SESSION_ID}", customFields));
params.put("cancel_url", PluginProperties.getValue("cancel_url", "https://example.com/cancel", customFields));
params.put("billing_address_collection", PluginProperties.getValue("billing_address_collection", "auto", customFields));
final StripeConfigProperties stripeConfigProperties = stripeConfigPropertiesConfigurationHandler.getConfigurable(context.getTenantId());

try {
Expand Down