From 992e29713c2a700226708460b3f27891787c5b8e Mon Sep 17 00:00:00 2001 From: Jonathan Cobb Date: Tue, 17 Dec 2019 20:21:25 -0500 Subject: [PATCH] claim invite codes by account+plan. updates to support UI payments --- .../cloud/payment/code/CodePaymentDriver.java | 12 ++++++------ .../cloud/payment/code/CodePaymentToken.java | 4 ++-- .../bubble/dao/bill/AccountPaymentMethodDAO.java | 7 +++++++ .../bubble/model/bill/AccountPaymentMethod.java | 1 + .../resources/account/AccountOwnedResource.java | 9 +++++++-- .../bubble/resources/account/AuthResource.java | 14 +++++++------- .../bill/AccountPaymentMethodsResource.java | 4 ++++ .../en_US/post_auth/ResourceMessages.properties | 3 ++- bubble-web | 2 +- utils/cobbzilla-utils | 2 +- 10 files changed, 38 insertions(+), 20 deletions(-) diff --git a/bubble-server/src/main/java/bubble/cloud/payment/code/CodePaymentDriver.java b/bubble-server/src/main/java/bubble/cloud/payment/code/CodePaymentDriver.java index e3ca32ea..01d224fd 100644 --- a/bubble-server/src/main/java/bubble/cloud/payment/code/CodePaymentDriver.java +++ b/bubble-server/src/main/java/bubble/cloud/payment/code/CodePaymentDriver.java @@ -42,14 +42,14 @@ public class CodePaymentDriver extends PaymentDriverBase apm.getPaymentInfo().equals(paymentInfo)) + .findFirst() + .orElse(null); + } + @Override public Object preCreate(AccountPaymentMethod paymentMethod) { if (paymentMethod.getPaymentMethodType().requiresClaim()) { final CloudService paymentService = cloudDAO.findByUuid(paymentMethod.getCloud()); diff --git a/bubble-server/src/main/java/bubble/model/bill/AccountPaymentMethod.java b/bubble-server/src/main/java/bubble/model/bill/AccountPaymentMethod.java index 895d85d4..775aa6b3 100644 --- a/bubble-server/src/main/java/bubble/model/bill/AccountPaymentMethod.java +++ b/bubble-server/src/main/java/bubble/model/bill/AccountPaymentMethod.java @@ -65,6 +65,7 @@ public class AccountPaymentMethod extends IdentifiableBase implements HasAccount @Type(type=ENCRYPTED_STRING) @Column(updatable=false, columnDefinition="varchar("+(100000+ENC_PAD)+") NOT NULL") @Getter @Setter private String paymentInfo; + public boolean hasPaymentInfo () { return paymentInfo != null; } public static final String DEFAULT_MASKED_PAYMENT_INFO = "XXXX-".repeat(3)+"XXXX"; @Type(type=ENCRYPTED_STRING) @Column(updatable=false, columnDefinition="varchar("+(100+ENC_PAD)+") NOT NULL") diff --git a/bubble-server/src/main/java/bubble/resources/account/AccountOwnedResource.java b/bubble-server/src/main/java/bubble/resources/account/AccountOwnedResource.java index e087dbd8..a133051c 100644 --- a/bubble-server/src/main/java/bubble/resources/account/AccountOwnedResource.java +++ b/bubble-server/src/main/java/bubble/resources/account/AccountOwnedResource.java @@ -111,9 +111,12 @@ public class AccountOwnedResource locales = new HashMap<>(); + final List locales = new ArrayList<>(); final String langHeader = normalizeLangHeader(req); - if (langHeader != null) locales.put(ACCEPT_LANGUAGE, langHeader); + if (langHeader != null) locales.add(langHeader); final String remoteHost = getRemoteHost(req); try { @@ -365,7 +363,9 @@ public class AuthResource { if (loc != null) { final List found = LocaleUtil.getDefaultLocales(loc.getCountry()); for (int i=0; i list(ContainerRequest ctx) { return super.list(ctx).stream().filter(AccountPaymentMethod::notDeleted).collect(Collectors.toList()); } diff --git a/bubble-server/src/main/resources/message_templates/server/en_US/post_auth/ResourceMessages.properties b/bubble-server/src/main/resources/message_templates/server/en_US/post_auth/ResourceMessages.properties index e920c4eb..d5702d3f 100644 --- a/bubble-server/src/main/resources/message_templates/server/en_US/post_auth/ResourceMessages.properties +++ b/bubble-server/src/main/resources/message_templates/server/en_US/post_auth/ResourceMessages.properties @@ -30,8 +30,8 @@ table_row_networks_action_view=View table_row_networks_action_start=Start table_row_networks_action_stop=Stop table_row_networks_action_delete=Delete -empty_networks=Create your first Bubble! button_label_new_network=Create Bubble +message_empty_networks=Create your first Bubble! # New Network page form_label_title_new_network=New Bubble @@ -71,6 +71,7 @@ payment_description_free=Enjoy Bubble for FREE! # Payment fields field_payment_invite_code=Invitation Code button_label_submit_invite_code=Use Invite Code +message_verified_invite_code=Invite Code Successfully Verified # Error messages from API server err.accountContactsJson.length=Account contacts length violation diff --git a/bubble-web b/bubble-web index a7a0fbb2..f1432a51 160000 --- a/bubble-web +++ b/bubble-web @@ -1 +1 @@ -Subproject commit a7a0fbb20bc83b243bb5f99ee219a1be2c0fbeed +Subproject commit f1432a512d90c5e3986393da247916f034a8513a diff --git a/utils/cobbzilla-utils b/utils/cobbzilla-utils index 51b557f2..dd0fcf4c 160000 --- a/utils/cobbzilla-utils +++ b/utils/cobbzilla-utils @@ -1 +1 @@ -Subproject commit 51b557f242ea52ed339ac6469adbc42b8873a3e9 +Subproject commit dd0fcf4cd9a5b1f1ccaff29697494e9c5930bd06