@@ -8,10 +8,8 @@ import bubble.notify.payment.PaymentValidationResult; | |||||
import com.stripe.Stripe; | import com.stripe.Stripe; | ||||
import com.stripe.exception.CardException; | import com.stripe.exception.CardException; | ||||
import com.stripe.exception.StripeException; | 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.Getter; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.cobbzilla.wizard.cache.redis.RedisService; | import org.cobbzilla.wizard.cache.redis.RedisService; | ||||
@@ -72,6 +70,15 @@ public class StripePaymentDriver extends PaymentDriverBase<StripePaymentDriverCo | |||||
} | } | ||||
} | } | ||||
@Override public boolean test() { | |||||
try { | |||||
Event.list(EventListParams.builder().setLimit(1L).build()); | |||||
return true; | |||||
} catch (StripeException e) { | |||||
return die("test: failed "); | |||||
} | |||||
} | |||||
@Override public PaymentValidationResult validate(AccountPaymentMethod accountPaymentMethod) { | @Override public PaymentValidationResult validate(AccountPaymentMethod accountPaymentMethod) { | ||||
final String info = accountPaymentMethod.getPaymentInfo(); | final String info = accountPaymentMethod.getPaymentInfo(); | ||||
if (info == null) return new PaymentValidationResult("err.paymentInfo.required"); | if (info == null) return new PaymentValidationResult("err.paymentInfo.required"); | ||||
@@ -41,11 +41,15 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver; | |||||
import java.beans.Transient; | import java.beans.Transient; | ||||
import java.io.File; | import java.io.File; | ||||
import java.util.*; | |||||
import java.util.Arrays; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
import java.util.Properties; | |||||
import java.util.concurrent.atomic.AtomicReference; | import java.util.concurrent.atomic.AtomicReference; | ||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
import static bubble.ApiConstants.*; | import static bubble.ApiConstants.*; | ||||
import static bubble.cloud.CloudServiceDriver.CLOUD_DRIVER_PACKAGE; | |||||
import static bubble.model.cloud.BubbleNetwork.TAG_ALLOW_REGISTRATION; | import static bubble.model.cloud.BubbleNetwork.TAG_ALLOW_REGISTRATION; | ||||
import static bubble.server.BubbleServer.getConfigurationSource; | import static bubble.server.BubbleServer.getConfigurationSource; | ||||
import static java.util.Collections.emptyMap; | import static java.util.Collections.emptyMap; | ||||
@@ -239,7 +243,8 @@ public class BubbleConfiguration extends PgRestServerConfiguration | |||||
} | } | ||||
@Getter(lazy=true) private final List<String> cloudDriverClasses | @Getter(lazy=true) private final List<String> 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) | .map(Class::getName) | ||||
.collect(Collectors.toList()); | .collect(Collectors.toList()); | ||||
@@ -15,6 +15,7 @@ import bubble.model.cloud.*; | |||||
import bubble.server.BubbleConfiguration; | import bubble.server.BubbleConfiguration; | ||||
import lombok.Getter; | import lombok.Getter; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.cobbzilla.util.collection.ArrayUtil; | |||||
import org.cobbzilla.util.handlebars.HandlebarsUtil; | import org.cobbzilla.util.handlebars.HandlebarsUtil; | ||||
import org.cobbzilla.wizard.api.CrudOperation; | import org.cobbzilla.wizard.api.CrudOperation; | ||||
import org.cobbzilla.wizard.client.ApiClientBase; | import org.cobbzilla.wizard.client.ApiClientBase; | ||||
@@ -280,7 +281,14 @@ public class ActivationService { | |||||
@Getter(lazy=true) private final CloudService[] cloudDefaults = initCloudDefaults(); | @Getter(lazy=true) private final CloudService[] cloudDefaults = initCloudDefaults(); | ||||
private CloudService[] 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<String, CloudService> cloudDefaultsMap = initCloudDefaultsMap(); | @Getter(lazy=true) private final Map<String, CloudService> cloudDefaultsMap = initCloudDefaultsMap(); | ||||
@@ -170,7 +170,9 @@ field_label_plan=Plan | |||||
field_label_region=Location | field_label_region=Location | ||||
field_label_footprint=Footprint | field_label_footprint=Footprint | ||||
field_label_paymentMethod=Payment | 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... <small>(refresh page if this gets stuck)</small> | |||||
button_label_customize=Customize | button_label_customize=Customize | ||||
button_label_use_default=Use Default | button_label_use_default=Use Default | ||||
button_label_create_new_network=Create New Bubble | button_label_create_new_network=Create New Bubble | ||||
@@ -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 | |||||
} | |||||
] |
@@ -0,0 +1,7 @@ | |||||
[ | |||||
"defaults/bubbleFootprint", | |||||
"defaults/bubblePlan", | |||||
"defaults/ruleDriver", | |||||
"manifest-app-analytics", | |||||
"manifest-app-user-block" | |||||
] |
@@ -1,7 +0,0 @@ | |||||
[ | |||||
"dist/bubbleFootprint", | |||||
"dist/bubblePlan", | |||||
"dist/ruleDriver", | |||||
"manifest-app-analytics", | |||||
"manifest-app-user-block" | |||||
] |
@@ -1 +1 @@ | |||||
Subproject commit 64b1c3d02c922fd3f77f66ec77ba9fb055259c6f | |||||
Subproject commit d88048fcfec07cc1a92ba8c598b5fbd88b8d5eb6 |