Quellcode durchsuchen

add payment cloud configs, rename cloud config model dir. add stripe driver test

tags/v0.1.6
Jonathan Cobb vor 4 Jahren
Ursprung
Commit
79d3536085
12 geänderte Dateien mit 72 neuen und 16 gelöschten Zeilen
  1. +11
    -4
      bubble-server/src/main/java/bubble/cloud/payment/stripe/StripePaymentDriver.java
  2. +7
    -2
      bubble-server/src/main/java/bubble/server/BubbleConfiguration.java
  3. +9
    -1
      bubble-server/src/main/java/bubble/service/boot/ActivationService.java
  4. +3
    -1
      bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties
  5. +0
    -0
      bubble-server/src/main/resources/models/defaults/bubbleFootprint.json
  6. +0
    -0
      bubble-server/src/main/resources/models/defaults/bubblePlan.json
  7. +0
    -0
      bubble-server/src/main/resources/models/defaults/cloudService.json
  8. +34
    -0
      bubble-server/src/main/resources/models/defaults/cloudService_payment.json
  9. +0
    -0
      bubble-server/src/main/resources/models/defaults/ruleDriver.json
  10. +7
    -0
      bubble-server/src/main/resources/models/manifest-defaults.json
  11. +0
    -7
      bubble-server/src/main/resources/models/manifest-dist.json
  12. +1
    -1
      bubble-web

+ 11
- 4
bubble-server/src/main/java/bubble/cloud/payment/stripe/StripePaymentDriver.java Datei anzeigen

@@ -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<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) {
final String info = accountPaymentMethod.getPaymentInfo();
if (info == null) return new PaymentValidationResult("err.paymentInfo.required");


+ 7
- 2
bubble-server/src/main/java/bubble/server/BubbleConfiguration.java Datei anzeigen

@@ -41,11 +41,15 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver;

import java.beans.Transient;
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.stream.Collectors;

import static bubble.ApiConstants.*;
import static bubble.cloud.CloudServiceDriver.CLOUD_DRIVER_PACKAGE;
import static bubble.model.cloud.BubbleNetwork.TAG_ALLOW_REGISTRATION;
import static bubble.server.BubbleServer.getConfigurationSource;
import static java.util.Collections.emptyMap;
@@ -239,7 +243,8 @@ public class BubbleConfiguration extends PgRestServerConfiguration
}

@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)
.collect(Collectors.toList());



+ 9
- 1
bubble-server/src/main/java/bubble/service/boot/ActivationService.java Datei anzeigen

@@ -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<String, CloudService> cloudDefaultsMap = initCloudDefaultsMap();


+ 3
- 1
bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties Datei anzeigen

@@ -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... <small>(refresh page if this gets stuck)</small>
button_label_customize=Customize
button_label_use_default=Use Default
button_label_create_new_network=Create New Bubble


bubble-server/src/main/resources/models/dist/bubbleFootprint.json → bubble-server/src/main/resources/models/defaults/bubbleFootprint.json Datei anzeigen


bubble-server/src/main/resources/models/dist/bubblePlan.json → bubble-server/src/main/resources/models/defaults/bubblePlan.json Datei anzeigen


bubble-server/src/main/resources/models/dist/cloudService.json → bubble-server/src/main/resources/models/defaults/cloudService.json Datei anzeigen


+ 34
- 0
bubble-server/src/main/resources/models/defaults/cloudService_payment.json Datei anzeigen

@@ -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
}
]

bubble-server/src/main/resources/models/dist/ruleDriver.json → bubble-server/src/main/resources/models/defaults/ruleDriver.json Datei anzeigen


+ 7
- 0
bubble-server/src/main/resources/models/manifest-defaults.json Datei anzeigen

@@ -0,0 +1,7 @@
[
"defaults/bubbleFootprint",
"defaults/bubblePlan",
"defaults/ruleDriver",
"manifest-app-analytics",
"manifest-app-user-block"
]

+ 0
- 7
bubble-server/src/main/resources/models/manifest-dist.json Datei anzeigen

@@ -1,7 +0,0 @@
[
"dist/bubbleFootprint",
"dist/bubblePlan",
"dist/ruleDriver",
"manifest-app-analytics",
"manifest-app-user-block"
]

+ 1
- 1
bubble-web

@@ -1 +1 @@
Subproject commit 64b1c3d02c922fd3f77f66ec77ba9fb055259c6f
Subproject commit d88048fcfec07cc1a92ba8c598b5fbd88b8d5eb6

Laden…
Abbrechen
Speichern