diff --git a/bubble-server/src/main/java/bubble/cloud/payment/stripe/StripePaymentDriver.java b/bubble-server/src/main/java/bubble/cloud/payment/stripe/StripePaymentDriver.java index 7f8b35b6..917ab00d 100644 --- a/bubble-server/src/main/java/bubble/cloud/payment/stripe/StripePaymentDriver.java +++ b/bubble-server/src/main/java/bubble/cloud/payment/stripe/StripePaymentDriver.java @@ -8,10 +8,8 @@ import bubble.notify.payment.PaymentValidationResult; import com.stripe.Stripe; import com.stripe.exception.CardException; import com.stripe.exception.StripeException; -import com.stripe.model.Card; -import com.stripe.model.Charge; -import com.stripe.model.Customer; -import com.stripe.model.Refund; +import com.stripe.model.*; +import com.stripe.param.EventListParams; import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.cobbzilla.wizard.cache.redis.RedisService; @@ -72,6 +70,15 @@ public class StripePaymentDriver extends PaymentDriverBase cloudDriverClasses - = ClasspathScanner.scan(CloudServiceDriver.class, CloudServiceDriver.CLOUD_DRIVER_PACKAGE).stream() + = ClasspathScanner.scan(CloudServiceDriver.class, CLOUD_DRIVER_PACKAGE).stream() + .filter(c -> !c.getName().contains(".delegate.")) .map(Class::getName) .collect(Collectors.toList()); diff --git a/bubble-server/src/main/java/bubble/service/boot/ActivationService.java b/bubble-server/src/main/java/bubble/service/boot/ActivationService.java index 0d71e502..3696f265 100644 --- a/bubble-server/src/main/java/bubble/service/boot/ActivationService.java +++ b/bubble-server/src/main/java/bubble/service/boot/ActivationService.java @@ -15,6 +15,7 @@ import bubble.model.cloud.*; import bubble.server.BubbleConfiguration; import lombok.Getter; import lombok.extern.slf4j.Slf4j; +import org.cobbzilla.util.collection.ArrayUtil; import org.cobbzilla.util.handlebars.HandlebarsUtil; import org.cobbzilla.wizard.api.CrudOperation; import org.cobbzilla.wizard.client.ApiClientBase; @@ -280,7 +281,14 @@ public class ActivationService { @Getter(lazy=true) private final CloudService[] cloudDefaults = initCloudDefaults(); private CloudService[] initCloudDefaults() { - return json(HandlebarsUtil.apply(configuration.getHandlebars(), stream2string("models/dist/cloudService.json"), configuration.getEnvCtx()), CloudService[].class); + final CloudService[] standardServices = loadCloudServices("cloudService"); + return configuration.paymentsEnabled() + ? ArrayUtil.concat(standardServices, loadCloudServices("cloudService_payment")) + : standardServices; + } + + private CloudService[] loadCloudServices(final String services) { + return json(HandlebarsUtil.apply(configuration.getHandlebars(), stream2string("models/defaults/" + services + ".json"), configuration.getEnvCtx()), CloudService[].class); } @Getter(lazy=true) private final Map cloudDefaultsMap = initCloudDefaultsMap(); diff --git a/bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties b/bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties index e1982034..cd728845 100644 --- a/bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties +++ b/bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties @@ -170,7 +170,9 @@ field_label_plan=Plan field_label_region=Location field_label_footprint=Footprint field_label_paymentMethod=Payment -message_auto_detecting=Auto-Detecting... +err_noPaymentMethods=No payment methods are configured. Contact the administrator of this system. +msg_km_distance_away=km away +message_auto_detecting=Auto-Detecting... (refresh page if this gets stuck) button_label_customize=Customize button_label_use_default=Use Default button_label_create_new_network=Create New Bubble diff --git a/bubble-server/src/main/resources/models/dist/bubbleFootprint.json b/bubble-server/src/main/resources/models/defaults/bubbleFootprint.json similarity index 100% rename from bubble-server/src/main/resources/models/dist/bubbleFootprint.json rename to bubble-server/src/main/resources/models/defaults/bubbleFootprint.json diff --git a/bubble-server/src/main/resources/models/dist/bubblePlan.json b/bubble-server/src/main/resources/models/defaults/bubblePlan.json similarity index 100% rename from bubble-server/src/main/resources/models/dist/bubblePlan.json rename to bubble-server/src/main/resources/models/defaults/bubblePlan.json diff --git a/bubble-server/src/main/resources/models/dist/cloudService.json b/bubble-server/src/main/resources/models/defaults/cloudService.json similarity index 100% rename from bubble-server/src/main/resources/models/dist/cloudService.json rename to bubble-server/src/main/resources/models/defaults/cloudService.json diff --git a/bubble-server/src/main/resources/models/defaults/cloudService_payment.json b/bubble-server/src/main/resources/models/defaults/cloudService_payment.json new file mode 100644 index 00000000..6232cfe4 --- /dev/null +++ b/bubble-server/src/main/resources/models/defaults/cloudService_payment.json @@ -0,0 +1,34 @@ +[ + { + "name": "StripePayments", + "type": "payment", + "priority": 100, + "driverClass": "bubble.cloud.payment.stripe.StripePaymentDriver", + "driverConfig": { + "publicApiKey": "{{STRIPE_PUBLIC_API_KEY}}" + }, + "credentials": { + "params": [ {"name": "secretApiKey", "value": "{{STRIPE_SECRET_API_KEY}}"} ] + }, + "template": true + }, + + { + "name": "InviteCode", + "type": "payment", + "priority": 200, + "driverClass": "bubble.cloud.payment.code.CodePaymentDriver", + "driverConfig": {}, + "credentials": {}, + "template": true + }, + + { + "name": "FreePlay", + "type": "payment", + "driverClass": "bubble.cloud.payment.free.FreePaymentDriver", + "driverConfig": {}, + "credentials": {}, + "template": true + } +] \ No newline at end of file diff --git a/bubble-server/src/main/resources/models/dist/ruleDriver.json b/bubble-server/src/main/resources/models/defaults/ruleDriver.json similarity index 100% rename from bubble-server/src/main/resources/models/dist/ruleDriver.json rename to bubble-server/src/main/resources/models/defaults/ruleDriver.json diff --git a/bubble-server/src/main/resources/models/manifest-defaults.json b/bubble-server/src/main/resources/models/manifest-defaults.json new file mode 100644 index 00000000..59282e15 --- /dev/null +++ b/bubble-server/src/main/resources/models/manifest-defaults.json @@ -0,0 +1,7 @@ +[ + "defaults/bubbleFootprint", + "defaults/bubblePlan", + "defaults/ruleDriver", + "manifest-app-analytics", + "manifest-app-user-block" +] \ No newline at end of file diff --git a/bubble-server/src/main/resources/models/manifest-dist.json b/bubble-server/src/main/resources/models/manifest-dist.json deleted file mode 100644 index 1ab3808e..00000000 --- a/bubble-server/src/main/resources/models/manifest-dist.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - "dist/bubbleFootprint", - "dist/bubblePlan", - "dist/ruleDriver", - "manifest-app-analytics", - "manifest-app-user-block" -] \ No newline at end of file diff --git a/bubble-web b/bubble-web index 64b1c3d0..d88048fc 160000 --- a/bubble-web +++ b/bubble-web @@ -1 +1 @@ -Subproject commit 64b1c3d02c922fd3f77f66ec77ba9fb055259c6f +Subproject commit d88048fcfec07cc1a92ba8c598b5fbd88b8d5eb6