Details
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/HostedPaymentPageBillingAddressJson.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/HostedPaymentPageBillingAddressJson.java
new file mode 100644
index 0000000..a294598
--- /dev/null
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/HostedPaymentPageBillingAddressJson.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2014 The Billing Project, LLC
+ *
+ * The Billing Project licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.killbill.billing.jaxrs.json;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class HostedPaymentPageBillingAddressJson extends JsonBase {
+
+ private final String city;
+ private final String address1;
+ private final String address2;
+ private final String state;
+ private final String zip;
+ private final String country;
+
+ @JsonCreator
+ public HostedPaymentPageBillingAddressJson(@JsonProperty("city") final String city,
+ @JsonProperty("address1") final String address1,
+ @JsonProperty("address2") final String address2,
+ @JsonProperty("state") final String state,
+ @JsonProperty("zip") final String zip,
+ @JsonProperty("country") final String country) {
+ this.city = city;
+ this.address1 = address1;
+ this.address2 = address2;
+ this.state = state;
+ this.zip = zip;
+ this.country = country;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public String getAddress1() {
+ return address1;
+ }
+
+ public String getAddress2() {
+ return address2;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public String getZip() {
+ return zip;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuffer sb = new StringBuffer("HostedPaymentPageBillingAddressJson{");
+ sb.append("city='").append(city).append('\'');
+ sb.append(", address1='").append(address1).append('\'');
+ sb.append(", address2='").append(address2).append('\'');
+ sb.append(", state='").append(state).append('\'');
+ sb.append(", zip='").append(zip).append('\'');
+ sb.append(", country='").append(country).append('\'');
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final HostedPaymentPageBillingAddressJson that = (HostedPaymentPageBillingAddressJson) o;
+
+ if (address1 != null ? !address1.equals(that.address1) : that.address1 != null) {
+ return false;
+ }
+ if (address2 != null ? !address2.equals(that.address2) : that.address2 != null) {
+ return false;
+ }
+ if (city != null ? !city.equals(that.city) : that.city != null) {
+ return false;
+ }
+ if (country != null ? !country.equals(that.country) : that.country != null) {
+ return false;
+ }
+ if (state != null ? !state.equals(that.state) : that.state != null) {
+ return false;
+ }
+ if (zip != null ? !zip.equals(that.zip) : that.zip != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = city != null ? city.hashCode() : 0;
+ result = 31 * result + (address1 != null ? address1.hashCode() : 0);
+ result = 31 * result + (address2 != null ? address2.hashCode() : 0);
+ result = 31 * result + (state != null ? state.hashCode() : 0);
+ result = 31 * result + (zip != null ? zip.hashCode() : 0);
+ result = 31 * result + (country != null ? country.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/HostedPaymentPageCustomerJson.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/HostedPaymentPageCustomerJson.java
new file mode 100644
index 0000000..3780c27
--- /dev/null
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/HostedPaymentPageCustomerJson.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2014 The Billing Project, LLC
+ *
+ * The Billing Project licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.killbill.billing.jaxrs.json;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class HostedPaymentPageCustomerJson extends JsonBase {
+
+ private final String firstName;
+ private final String lastName;
+ private final String email;
+ private final String phone;
+
+ @JsonCreator
+ public HostedPaymentPageCustomerJson(@JsonProperty("firstName") final String firstName,
+ @JsonProperty("lastName") final String lastName,
+ @JsonProperty("email") final String email,
+ @JsonProperty("phone") final String phone) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.email = email;
+ this.phone = phone;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public String getPhone() {
+ return phone;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuffer sb = new StringBuffer("HostedPaymentPageCustomerJson{");
+ sb.append("firstName='").append(firstName).append('\'');
+ sb.append(", lastName='").append(lastName).append('\'');
+ sb.append(", email='").append(email).append('\'');
+ sb.append(", phone='").append(phone).append('\'');
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final HostedPaymentPageCustomerJson that = (HostedPaymentPageCustomerJson) o;
+
+ if (email != null ? !email.equals(that.email) : that.email != null) {
+ return false;
+ }
+ if (firstName != null ? !firstName.equals(that.firstName) : that.firstName != null) {
+ return false;
+ }
+ if (lastName != null ? !lastName.equals(that.lastName) : that.lastName != null) {
+ return false;
+ }
+ if (phone != null ? !phone.equals(that.phone) : that.phone != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = firstName != null ? firstName.hashCode() : 0;
+ result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
+ result = 31 * result + (email != null ? email.hashCode() : 0);
+ result = 31 * result + (phone != null ? phone.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/HostedPaymentPageFieldsJson.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/HostedPaymentPageFieldsJson.java
new file mode 100644
index 0000000..2355bbe
--- /dev/null
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/HostedPaymentPageFieldsJson.java
@@ -0,0 +1,299 @@
+/*
+ * Copyright 2014 The Billing Project, LLC
+ *
+ * The Billing Project licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.killbill.billing.jaxrs.json;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+import org.killbill.billing.catalog.api.Currency;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class HostedPaymentPageFieldsJson extends JsonBase {
+
+ private final String credential2;
+ private final String credential3;
+ private final String credential4;
+ private final BigDecimal amount;
+ private final Currency currency;
+ private final String transactionType;
+ private final String authCode;
+ private final String notifyUrl;
+ private final String returnUrl;
+ private final String forwardUrl;
+ private final String cancelReturnUrl;
+ private final String redirectParam;
+ private final String accountName;
+ private final HostedPaymentPageCustomerJson customer;
+ private final HostedPaymentPageBillingAddressJson billingAddress;
+ private final String order;
+ private final String description;
+ private final String tax;
+ private final String shipping;
+ private final Map<String, String> customFields;
+
+ @JsonCreator
+ public HostedPaymentPageFieldsJson(@JsonProperty("credential2") final String credential2,
+ @JsonProperty("credential3") final String credential3,
+ @JsonProperty("credential4") final String credential4,
+ @JsonProperty("amount") final BigDecimal amount,
+ @JsonProperty("currency") final Currency currency,
+ @JsonProperty("transactionType") final String transactionType,
+ @JsonProperty("authCode") final String authCode,
+ @JsonProperty("notifyUrl") final String notifyUrl,
+ @JsonProperty("returnUrl") final String returnUrl,
+ @JsonProperty("forwardUrl") final String forwardUrl,
+ @JsonProperty("cancelReturnUrl") final String cancelReturnUrl,
+ @JsonProperty("redirectParam") final String redirectParam,
+ @JsonProperty("accountName") final String accountName,
+ @JsonProperty("customer") final HostedPaymentPageCustomerJson customer,
+ @JsonProperty("billingAddress") final HostedPaymentPageBillingAddressJson billingAddress,
+ @JsonProperty("order") final String order,
+ @JsonProperty("description") final String description,
+ @JsonProperty("tax") final String tax,
+ @JsonProperty("shipping") final String shipping,
+ @JsonProperty("customFields") final Map<String, String> customFields) {
+ this.credential2 = credential2;
+ this.credential3 = credential3;
+ this.credential4 = credential4;
+ this.amount = amount;
+ this.currency = currency;
+ this.transactionType = transactionType;
+ this.authCode = authCode;
+ this.notifyUrl = notifyUrl;
+ this.returnUrl = returnUrl;
+ this.forwardUrl = forwardUrl;
+ this.cancelReturnUrl = cancelReturnUrl;
+ this.redirectParam = redirectParam;
+ this.accountName = accountName;
+ this.customer = customer;
+ this.billingAddress = billingAddress;
+ this.order = order;
+ this.description = description;
+ this.tax = tax;
+ this.shipping = shipping;
+ this.customFields = customFields;
+ }
+
+ public String getCredential2() {
+ return credential2;
+ }
+
+ public String getCredential3() {
+ return credential3;
+ }
+
+ public String getCredential4() {
+ return credential4;
+ }
+
+ public BigDecimal getAmount() {
+ return amount;
+ }
+
+ public Currency getCurrency() {
+ return currency;
+ }
+
+ public String getTransactionType() {
+ return transactionType;
+ }
+
+ public String getAuthCode() {
+ return authCode;
+ }
+
+ public String getNotifyUrl() {
+ return notifyUrl;
+ }
+
+ public String getReturnUrl() {
+ return returnUrl;
+ }
+
+ public String getForwardUrl() {
+ return forwardUrl;
+ }
+
+ public String getCancelReturnUrl() {
+ return cancelReturnUrl;
+ }
+
+ public String getRedirectParam() {
+ return redirectParam;
+ }
+
+ public String getAccountName() {
+ return accountName;
+ }
+
+ public HostedPaymentPageCustomerJson getCustomer() {
+ return customer;
+ }
+
+ public HostedPaymentPageBillingAddressJson getBillingAddress() {
+ return billingAddress;
+ }
+
+ public String getOrder() {
+ return order;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getTax() {
+ return tax;
+ }
+
+ public String getShipping() {
+ return shipping;
+ }
+
+ public Map<String, String> getCustomFields() {
+ return customFields;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuffer sb = new StringBuffer("HostedPaymentPageFieldsJson{");
+ sb.append("credential2='").append(credential2).append('\'');
+ sb.append(", credential3='").append(credential3).append('\'');
+ sb.append(", credential4='").append(credential4).append('\'');
+ sb.append(", amount=").append(amount);
+ sb.append(", currency=").append(currency);
+ sb.append(", transactionType='").append(transactionType).append('\'');
+ sb.append(", authCode='").append(authCode).append('\'');
+ sb.append(", notifyUrl='").append(notifyUrl).append('\'');
+ sb.append(", returnUrl='").append(returnUrl).append('\'');
+ sb.append(", forwardUrl='").append(forwardUrl).append('\'');
+ sb.append(", cancelReturnUrl='").append(cancelReturnUrl).append('\'');
+ sb.append(", redirectParam='").append(redirectParam).append('\'');
+ sb.append(", accountName='").append(accountName).append('\'');
+ sb.append(", customer=").append(customer);
+ sb.append(", billingAddress=").append(billingAddress);
+ sb.append(", order='").append(order).append('\'');
+ sb.append(", description='").append(description).append('\'');
+ sb.append(", tax='").append(tax).append('\'');
+ sb.append(", shipping='").append(shipping).append('\'');
+ sb.append(", customFields=").append(customFields);
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final HostedPaymentPageFieldsJson that = (HostedPaymentPageFieldsJson) o;
+
+ if (accountName != null ? !accountName.equals(that.accountName) : that.accountName != null) {
+ return false;
+ }
+ if (amount != null ? !amount.equals(that.amount) : that.amount != null) {
+ return false;
+ }
+ if (authCode != null ? !authCode.equals(that.authCode) : that.authCode != null) {
+ return false;
+ }
+ if (billingAddress != null ? !billingAddress.equals(that.billingAddress) : that.billingAddress != null) {
+ return false;
+ }
+ if (cancelReturnUrl != null ? !cancelReturnUrl.equals(that.cancelReturnUrl) : that.cancelReturnUrl != null) {
+ return false;
+ }
+ if (credential2 != null ? !credential2.equals(that.credential2) : that.credential2 != null) {
+ return false;
+ }
+ if (credential3 != null ? !credential3.equals(that.credential3) : that.credential3 != null) {
+ return false;
+ }
+ if (credential4 != null ? !credential4.equals(that.credential4) : that.credential4 != null) {
+ return false;
+ }
+ if (currency != that.currency) {
+ return false;
+ }
+ if (customFields != null ? !customFields.equals(that.customFields) : that.customFields != null) {
+ return false;
+ }
+ if (customer != null ? !customer.equals(that.customer) : that.customer != null) {
+ return false;
+ }
+ if (description != null ? !description.equals(that.description) : that.description != null) {
+ return false;
+ }
+ if (forwardUrl != null ? !forwardUrl.equals(that.forwardUrl) : that.forwardUrl != null) {
+ return false;
+ }
+ if (notifyUrl != null ? !notifyUrl.equals(that.notifyUrl) : that.notifyUrl != null) {
+ return false;
+ }
+ if (order != null ? !order.equals(that.order) : that.order != null) {
+ return false;
+ }
+ if (redirectParam != null ? !redirectParam.equals(that.redirectParam) : that.redirectParam != null) {
+ return false;
+ }
+ if (returnUrl != null ? !returnUrl.equals(that.returnUrl) : that.returnUrl != null) {
+ return false;
+ }
+ if (shipping != null ? !shipping.equals(that.shipping) : that.shipping != null) {
+ return false;
+ }
+ if (tax != null ? !tax.equals(that.tax) : that.tax != null) {
+ return false;
+ }
+ if (transactionType != null ? !transactionType.equals(that.transactionType) : that.transactionType != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = credential2 != null ? credential2.hashCode() : 0;
+ result = 31 * result + (credential3 != null ? credential3.hashCode() : 0);
+ result = 31 * result + (credential4 != null ? credential4.hashCode() : 0);
+ result = 31 * result + (amount != null ? amount.hashCode() : 0);
+ result = 31 * result + (currency != null ? currency.hashCode() : 0);
+ result = 31 * result + (transactionType != null ? transactionType.hashCode() : 0);
+ result = 31 * result + (authCode != null ? authCode.hashCode() : 0);
+ result = 31 * result + (notifyUrl != null ? notifyUrl.hashCode() : 0);
+ result = 31 * result + (returnUrl != null ? returnUrl.hashCode() : 0);
+ result = 31 * result + (forwardUrl != null ? forwardUrl.hashCode() : 0);
+ result = 31 * result + (cancelReturnUrl != null ? cancelReturnUrl.hashCode() : 0);
+ result = 31 * result + (redirectParam != null ? redirectParam.hashCode() : 0);
+ result = 31 * result + (accountName != null ? accountName.hashCode() : 0);
+ result = 31 * result + (customer != null ? customer.hashCode() : 0);
+ result = 31 * result + (billingAddress != null ? billingAddress.hashCode() : 0);
+ result = 31 * result + (order != null ? order.hashCode() : 0);
+ result = 31 * result + (description != null ? description.hashCode() : 0);
+ result = 31 * result + (tax != null ? tax.hashCode() : 0);
+ result = 31 * result + (shipping != null ? shipping.hashCode() : 0);
+ result = 31 * result + (customFields != null ? customFields.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/JaxrsResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/JaxrsResource.java
index bdb09bf..35c1972 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/JaxrsResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/JaxrsResource.java
@@ -184,4 +184,9 @@ public interface JaxrsResource {
public static final String PAUSE = "pause";
public static final String RESUME = "resume";
+ public static final String AUTHORIZATION = "authorization";
+ public static final String CAPTURE = "capture";
+
+ public static final String HOSTED = "hosted";
+ public static final String FORM = "form";
}
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/PaymentResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/PaymentResource.java
index 9896791..c82b732 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/PaymentResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/PaymentResource.java
@@ -45,12 +45,12 @@ import org.killbill.billing.ObjectType;
import org.killbill.billing.account.api.Account;
import org.killbill.billing.account.api.AccountApiException;
import org.killbill.billing.account.api.AccountUserApi;
-import org.killbill.clock.Clock;
import org.killbill.billing.invoice.api.InvoiceApiException;
import org.killbill.billing.invoice.api.InvoicePayment;
import org.killbill.billing.invoice.api.InvoicePaymentApi;
import org.killbill.billing.jaxrs.json.ChargebackJson;
import org.killbill.billing.jaxrs.json.CustomFieldJson;
+import org.killbill.billing.jaxrs.json.HostedPaymentPageFieldsJson;
import org.killbill.billing.jaxrs.json.InvoiceItemJson;
import org.killbill.billing.jaxrs.json.PaymentJson;
import org.killbill.billing.jaxrs.json.RefundJson;
@@ -70,6 +70,7 @@ import org.killbill.billing.util.audit.AccountAuditLogs;
import org.killbill.billing.util.callcontext.CallContext;
import org.killbill.billing.util.callcontext.TenantContext;
import org.killbill.billing.util.entity.Pagination;
+import org.killbill.clock.Clock;
import com.google.common.base.Function;
import com.google.common.base.Strings;
@@ -78,6 +79,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.inject.Inject;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static javax.ws.rs.core.MediaType.WILDCARD;
@Path(JaxrsResource.PAYMENTS_PATH)
public class PaymentResource extends JaxRsResourceBase {
@@ -268,6 +270,60 @@ public class PaymentResource extends JaxRsResourceBase {
}
@POST
+ @Path("/" + AUTHORIZATION)
+ @Consumes(APPLICATION_JSON)
+ @Produces(APPLICATION_JSON)
+ public Response authorizePayment(final PaymentJson json,
+ @HeaderParam(HDR_CREATED_BY) final String createdBy,
+ @HeaderParam(HDR_REASON) final String reason,
+ @HeaderParam(HDR_COMMENT) final String comment,
+ @javax.ws.rs.core.Context final UriInfo uriInfo,
+ @javax.ws.rs.core.Context final HttpServletRequest request) throws PaymentApiException {
+ throw new UnsupportedOperationException();
+ }
+
+ @POST
+ @Path("/{paymentId:" + UUID_PATTERN + "}/" + CAPTURE)
+ @Consumes(APPLICATION_JSON)
+ @Produces(APPLICATION_JSON)
+ public Response captureAuthorization(final PaymentJson json,
+ @PathParam("paymentId") final String paymentId,
+ @HeaderParam(HDR_CREATED_BY) final String createdBy,
+ @HeaderParam(HDR_REASON) final String reason,
+ @HeaderParam(HDR_COMMENT) final String comment,
+ @javax.ws.rs.core.Context final UriInfo uriInfo,
+ @javax.ws.rs.core.Context final HttpServletRequest request) throws PaymentApiException {
+ throw new UnsupportedOperationException();
+ }
+
+ @POST
+ @Path("/{paymentId:" + UUID_PATTERN + "}/")
+ @Consumes(APPLICATION_JSON)
+ @Produces(APPLICATION_JSON)
+ public Response processPayment(final PaymentJson json,
+ @PathParam("paymentId") final String paymentId,
+ @HeaderParam(HDR_CREATED_BY) final String createdBy,
+ @HeaderParam(HDR_REASON) final String reason,
+ @HeaderParam(HDR_COMMENT) final String comment,
+ @javax.ws.rs.core.Context final UriInfo uriInfo,
+ @javax.ws.rs.core.Context final HttpServletRequest request) throws PaymentApiException {
+ throw new UnsupportedOperationException();
+ }
+
+ @DELETE
+ @Path("/{paymentId:" + UUID_PATTERN + "}/")
+ @Consumes(APPLICATION_JSON)
+ @Produces(APPLICATION_JSON)
+ public Response voidPayment(@PathParam("paymentId") final String paymentId,
+ @HeaderParam(HDR_CREATED_BY) final String createdBy,
+ @HeaderParam(HDR_REASON) final String reason,
+ @HeaderParam(HDR_COMMENT) final String comment,
+ @javax.ws.rs.core.Context final UriInfo uriInfo,
+ @javax.ws.rs.core.Context final HttpServletRequest request) throws PaymentApiException {
+ throw new UnsupportedOperationException();
+ }
+
+ @POST
@Path("/{paymentId:" + UUID_PATTERN + "}/" + REFUNDS)
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@@ -304,6 +360,36 @@ public class PaymentResource extends JaxRsResourceBase {
return uriBuilder.buildResponse(RefundResource.class, "getRefund", result.getId(), uriInfo.getBaseUri().toString());
}
+ @POST
+ @Path("/" + HOSTED + "/" + FORM + "/{gateway:" + ANYTHING_PATTERN + "}")
+ @Consumes(APPLICATION_JSON)
+ @Produces(APPLICATION_JSON)
+ // Generate form data to redirect the customer to the gateway
+ public Response createRedirectForm(final HostedPaymentPageFieldsJson json,
+ @PathParam("gateway") final String gateway,
+ @HeaderParam(HDR_CREATED_BY) final String createdBy,
+ @HeaderParam(HDR_REASON) final String reason,
+ @HeaderParam(HDR_COMMENT) final String comment,
+ @javax.ws.rs.core.Context final UriInfo uriInfo,
+ @javax.ws.rs.core.Context final HttpServletRequest request) throws PaymentApiException {
+ throw new UnsupportedOperationException();
+ }
+
+ @POST
+ @Path("/" + HOSTED)
+ @Consumes(WILDCARD)
+ @Produces(APPLICATION_JSON)
+ public Response processNotification(final String body,
+ @PathParam("gateway") final String gateway,
+ @HeaderParam(HDR_CREATED_BY) final String createdBy,
+ @HeaderParam(HDR_REASON) final String reason,
+ @HeaderParam(HDR_COMMENT) final String comment,
+ @javax.ws.rs.core.Context final UriInfo uriInfo,
+ @javax.ws.rs.core.Context final HttpServletRequest request) throws PaymentApiException {
+ // Note: the body is opaque here, as it comes from the gateway. The associated payment plugin will now how to deserialize it though
+ throw new UnsupportedOperationException();
+ }
+
@GET
@Path("/{paymentId:" + UUID_PATTERN + "}/" + CUSTOM_FIELDS)
@Produces(APPLICATION_JSON)