From c253598c94efad7863fea262bc9e671ac23b50be Mon Sep 17 00:00:00 2001 From: Landon Baer <55096622+LandonBaer721@users.noreply.github.com> Date: Mon, 18 Oct 2021 10:27:48 -0400 Subject: [PATCH] WIP: square backend support --- pom.xml | 6 +++ .../nucleus/client/SquareClient.java | 25 +++++++++++ .../segment/SquarePaymentGatewayService.java | 42 +++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 src/main/java/com/impactupgrade/nucleus/client/SquareClient.java create mode 100644 src/main/java/com/impactupgrade/nucleus/service/segment/SquarePaymentGatewayService.java diff --git a/pom.xml b/pom.xml index 79a503ee8..516ba2afa 100644 --- a/pom.xml +++ b/pom.xml @@ -38,6 +38,12 @@ + + com.squareup + square + 2021-09-15 + compile + com.impactupgrade.integration mailchimp-jvm-client diff --git a/src/main/java/com/impactupgrade/nucleus/client/SquareClient.java b/src/main/java/com/impactupgrade/nucleus/client/SquareClient.java new file mode 100644 index 000000000..eb81cc470 --- /dev/null +++ b/src/main/java/com/impactupgrade/nucleus/client/SquareClient.java @@ -0,0 +1,25 @@ +package com.impactupgrade.nucleus.client; + +import com.impactupgrade.nucleus.environment.Environment; +import com.stripe.net.RequestOptions; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class SquareClient { + + private static final Logger log = LogManager.getLogger(StripeClient.class.getName()); + + protected final RequestOptions requestOptions; + + public SquareClient(Environment env) { +// requestOptions = RequestOptions.builder().setApiKey(env.getConfig().square.secretKey).build(); + requestOptions = RequestOptions.builder().build(); + } + + public SquareClient(RequestOptions requestOptions) { + this.requestOptions = requestOptions; + } + + + +} diff --git a/src/main/java/com/impactupgrade/nucleus/service/segment/SquarePaymentGatewayService.java b/src/main/java/com/impactupgrade/nucleus/service/segment/SquarePaymentGatewayService.java new file mode 100644 index 000000000..d7893f84b --- /dev/null +++ b/src/main/java/com/impactupgrade/nucleus/service/segment/SquarePaymentGatewayService.java @@ -0,0 +1,42 @@ +package com.impactupgrade.nucleus.service.segment; + +import com.impactupgrade.nucleus.environment.Environment; +import com.impactupgrade.nucleus.model.ManageDonationEvent; +import com.impactupgrade.nucleus.model.PaymentGatewayDeposit; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.util.Date; +import java.util.List; + +public class SquarePaymentGatewayService implements PaymentGatewayService { + + private static final Logger log = LogManager.getLogger(StripePaymentGatewayService.class); + + protected Environment env; + + @Override + public String name() { return "square"; } + + @Override + public void init(Environment env) { + this.env = env; + } + + + @Override + public List getDeposits(Date startDate, Date endDate) throws Exception { + // TODO: + return null; + } + + @Override + public void updateSubscription(ManageDonationEvent manageDonationEvent) throws Exception { + // TODO: + } + + @Override + public void closeSubscription(ManageDonationEvent manageDonationEvent) throws Exception { + // TODO: + } +}