PayPal初始化,实现授权,网页支付。

This commit is contained in:
egan
2018-04-28 18:48:17 +08:00
parent bae9f4f671
commit bdb84fbbbe
20 changed files with 2509 additions and 9 deletions

View File

@@ -44,5 +44,25 @@ public class PayPalConfigStorage extends BasePayConfigStorage {
setKeyPrivate(clientSecret);
}
@Override
public boolean isAccessTokenExpired() {
if (getExpiresTime() == 0){
return true;
}
return (getExpiresTime() - System.currentTimeMillis() / 1000) <= 0;
}
/**
* 设置取消页面的url
* @param cancelUrl 取消页面的url
*/
public void setCancelUrl(String cancelUrl){
setNotifyUrl(cancelUrl);
}
/**
* 获取取消页面的url
*/
public String getCancelUrl(){
return getNotifyUrl();
}
}

View File

@@ -4,14 +4,28 @@ package com.egzosn.pay.paypal.api;
* Created by egzosn on 2018/4/8.
*/
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.egzosn.pay.common.api.BasePayService;
import com.egzosn.pay.common.api.PayConfigStorage;
import com.egzosn.pay.common.bean.*;
import com.egzosn.pay.common.bean.result.PayException;
import com.egzosn.pay.common.exception.PayErrorException;
import com.egzosn.pay.common.http.HttpHeader;
import com.egzosn.pay.common.http.HttpStringEntity;
import com.egzosn.pay.common.util.sign.encrypt.Base64;
import com.egzosn.pay.common.util.str.StringUtils;
import com.egzosn.pay.paypal.bean.PayPalTransactionType;
import com.egzosn.pay.paypal.bean.order.*;
import org.apache.http.Header;
import org.apache.http.entity.ContentType;
import org.apache.http.message.BasicHeader;
import java.awt.image.BufferedImage;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;
import java.util.*;
import java.util.concurrent.locks.Lock;
/**
* 贝宝支付配置存储
@@ -21,10 +35,97 @@ import java.util.Map;
* date 2018-4-8 22:15:09
*/
public class PayPalPayService extends BasePayService{
/**
* 沙箱环境
*/
private static final String SANDBOX_REQ_URL = "https://api.sandbox.paypal.com/v1/";
/**
* 正式测试环境
*/
private static final String REQ_URL = "https://api.paypal.com/v1/";
/**
* 获取对应的请求地址
* @return 请求地址
*/
public String getReqUrl(TransactionType transactionType){
return (payConfigStorage.isTest() ? SANDBOX_REQ_URL : REQ_URL) + transactionType.getMethod();
}
public PayPalPayService(PayConfigStorage payConfigStorage) {
super(payConfigStorage);
}
/*
* Generate a Base64 encoded String from clientID & clientSecret
*/
private String basicAuthorizationString() {
String base64ClientID = null;
try {
base64ClientID = Base64.encode(String.format("%s:%s",getPayConfigStorage().getAppid() , getPayConfigStorage().getKeyPrivate()).getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return base64ClientID;
}
/**
* 获取请求token
* @return 授权令牌
*/
public String getAccessToken() {
try {
return getAccessToken(false);
} catch (PayErrorException e) {
throw e;
}
}
/**
* 获取授权令牌
* @param forceRefresh 是否重新获取, true重新获取
* @return 新的授权令牌
* @throws PayErrorException 支付异常
*/
public String getAccessToken(boolean forceRefresh) throws PayErrorException {
Lock lock = payConfigStorage.getAccessTokenLock();
try {
lock.lock();
if (forceRefresh) {
payConfigStorage.expireAccessToken();
}
if (payConfigStorage.isAccessTokenExpired()) {
if (null == payConfigStorage.getAccessToken()){
Map<String, String> header = new HashMap<>();
header.put("Authorization", "Basic " + basicAuthorizationString());
header.put("Accept", "application/json");
header.put("Content-Type", "application/x-www-form-urlencoded");
try {
HttpStringEntity entity = new HttpStringEntity("grant_type=client_credentials", header);
JSONObject resp = getHttpRequestTemplate().postForObject(getReqUrl(PayPalTransactionType.AUTHORIZE), entity, JSONObject.class);
payConfigStorage.updateAccessToken(String.format("%s %s", resp.getString("token_type" ), resp.getString("access_token" )), resp.getLongValue("expires_in" ));
} catch (UnsupportedEncodingException e) {
throw new PayErrorException(new PayException("failure", e.getMessage()));
}
}
return payConfigStorage.getAccessToken();
}
} finally {
lock.unlock();
}
return payConfigStorage.getAccessToken();
}
@Override
public boolean verify(Map<String, Object> params) {
return false;
@@ -40,9 +141,54 @@ public class PayPalPayService extends BasePayService{
return false;
}
/**
* 获取授权请求头
* @return 授权请求头
*/
private HttpHeader authHeader(){
List<Header> headers = new ArrayList<>();
headers.add(new BasicHeader("Authorization", getAccessToken()));
headers.add(new BasicHeader("PayPal-Request-Id", UUID.randomUUID().toString()));
return new HttpHeader(headers);
}
@Override
public Map<String, Object> orderInfo(PayOrder order) {
return null;
Amount amount = new Amount();
if (null == order.getCurType()){
order.setCurType(CurType.USD);
}
amount.setCurrency(order.getCurType().name());
amount.setTotal(order.getPrice().setScale(2, BigDecimal.ROUND_HALF_UP).toString());
Transaction transaction = new Transaction();
if (!StringUtils.isEmpty(order.getSubject())){
transaction.setDescription(order.getSubject());
}else {
transaction.setDescription(order.getBody());
}
transaction.setAmount(amount);
List<Transaction> transactions = new ArrayList<>();
transactions.add(transaction);
Payer payer = new Payer();
payer.setPaymentMethod("paypal");
Payment payment = new Payment();
payment.setIntent(order.getTransactionType().getType());
payment.setPayer(payer);
payment.setTransactions(transactions);
RedirectUrls redirectUrls = new RedirectUrls();
redirectUrls.setCancelUrl(payConfigStorage.getNotifyUrl());
redirectUrls.setReturnUrl(payConfigStorage.getReturnUrl());
payment.setRedirectUrls(redirectUrls);
HttpStringEntity entity = new HttpStringEntity(JSON.toJSONString(payment), ContentType.APPLICATION_JSON);
entity.setHeaders(authHeader());
JSONObject resp = getHttpRequestTemplate().postForObject(getReqUrl(order.getTransactionType()), entity, JSONObject.class);
return resp;
}
@Override
@@ -57,7 +203,15 @@ public class PayPalPayService extends BasePayService{
@Override
public String buildRequest(Map<String, Object> orderInfo, MethodType method) {
return null;
if (orderInfo instanceof JSONObject){
Payment payment = ((JSONObject) orderInfo).toJavaObject(Payment.class);
for(Links links : payment.getLinks()){
if(links.getRel().equals("approval_url")){
return String.format("<script type=\"text/javascript\">location.href=\"%s\"</script>",links.getHref() );
}
}
}
return "<script type=\"text/javascript\">location.href=\"/\"</script>" ;
}
@Override
@@ -69,25 +223,50 @@ public class PayPalPayService extends BasePayService{
public Map<String, Object> microPay(PayOrder order) {
return null;
}
/**
* 交易查询接口
*
* @param tradeNo 支付平台订单号
* @param outTradeNo 商户单号
* @return 返回查询回来的结果集,支付方原值返回
*/
@Override
public Map<String, Object> query(String tradeNo, String outTradeNo) {
return null;
JSONObject resp = getHttpRequestTemplate().getForObject(String.format(getReqUrl(PayPalTransactionType.ORDERS), tradeNo), authHeader(), JSONObject.class);
return resp;
}
@Override
public Map<String, Object> close(String tradeNo, String outTradeNo) {
return null;
}
/**
* 申请退款接口
* 废弃
* @param tradeNo 支付平台订单号
* @param outTradeNo 商户单号
* @param refundAmount 退款金额
* @param totalAmount 总金额
* @return 返回支付方申请退款后的结果
* @see #refund(RefundOrder)
*/
@Deprecated
@Override
public Map<String, Object> refund(String tradeNo, String outTradeNo, BigDecimal refundAmount, BigDecimal totalAmount) {
return null;
return refund(new RefundOrder( tradeNo, outTradeNo, refundAmount, totalAmount));
}
/**
* 申请退款接口
*
* @param refundOrder 退款订单信息
* @return 返回支付方申请退款后的结果
*/
@Override
public Map<String, Object> refund(RefundOrder refundOrder) {
return null;
JSONObject resp = getHttpRequestTemplate().getForObject(String.format(getReqUrl(PayPalTransactionType.REFUND), refundOrder.getTradeNo()), authHeader(), JSONObject.class);
return resp;
}
@Override

View File

@@ -0,0 +1,56 @@
package com.egzosn.pay.paypal.bean;
import com.egzosn.pay.common.bean.TransactionType;
/**
* 贝宝交易类型
* <pre>
* 说明交易类型主要用于支付接口调用参数所需
*
*
*
* </pre>
*
* @author egan
*
* email egzosn@gmail.com
* date 2018/04/28 11:10
*/
public enum PayPalTransactionType implements TransactionType {
/**
* 获取token
*/
AUTHORIZE("oauth2/token"),
/**
* 付款 网页支付
*/
sale("payments/payment"),
REFUND("payments/refund/{refundId}"),
PAYOUT("payments/payouts/{payoutBatchId}"),
ORDERS("payments/orders/{orderId}"),
;
private String method;
private PayPalTransactionType(String method) {
this.method = method;
}
@Override
public String getType() {
return this.name();
}
/* *
* 获取接口名称
* @return 接口名称
*/
@Override
public String getMethod() {
return this.method;
}
}

View File

@@ -0,0 +1,54 @@
package com.egzosn.pay.paypal.bean.order;
public class Amount {
/**
* 3-letter [currency code](https://developer.paypal.com/docs/integration/direct/rest_api_payment_country_currency_support/). PayPal does not support all currencies.
*/
private String currency;
/**
* Total amount charged from the payer to the payee. In case of a refund, this is the refunded amount to the original payer from the payee. 10 characters max with support for 2 decimal places.
*/
private String total;
/**
* Additional details of the payment amount.
*/
private Details details;
/**
* Default Constructor
*/
public Amount() {
}
/**
* Parameterized Constructor
*/
public Amount(String currency, String total) {
this.currency = currency;
this.total = total;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public String getTotal() {
return total;
}
public void setTotal(String total) {
this.total = total;
}
public Details getDetails() {
return details;
}
public void setDetails(Details details) {
this.details = details;
}
}

View File

@@ -0,0 +1,265 @@
package com.egzosn.pay.paypal.bean.order;
public class CartBase {
/**
* Merchant identifier to the purchase unit. Optional parameter
*/
private String referenceId;
/**
* Amount being collected.
*/
private Amount amount;
/**
* Recipient of the funds in this transaction.
*/
private Payee payee;
/**
* Description of what is being paid for.
*/
private String description;
/**
* Note to the recipient of the funds in this transaction.
*/
private String noteToPayee;
/**
* free-form field for the use of clients
*/
private String custom;
/**
* invoice number to track this payment
*/
private String invoiceNumber;
/**
* Soft descriptor used when charging this funding source. If length exceeds max length, the value will be truncated
*/
private String softDescriptor;
/**
* Soft descriptor city used when charging this funding source. If length exceeds max length, the value will be truncated. Only supported when the `payment_method` is set to `credit_card`
*/
private String softDescriptorCity;
/**
* URL to send payment notifications
*/
private String notifyUrl;
/**
* Url on merchant site pertaining to this payment.
*/
private String orderUrl;
/**
* Default Constructor
*/
public CartBase() {
}
/**
* Parameterized Constructor
*/
public CartBase(Amount amount) {
this.amount = amount;
}
/**
* Merchant identifier to the purchase unit. Optional parameter
*/
@SuppressWarnings("all")
public String getReferenceId() {
return this.referenceId;
}
/**
* Amount being collected.
*/
@SuppressWarnings("all")
public Amount getAmount() {
return this.amount;
}
/**
* Recipient of the funds in this transaction.
*/
@SuppressWarnings("all")
public Payee getPayee() {
return this.payee;
}
/**
* Description of what is being paid for.
*/
@SuppressWarnings("all")
public String getDescription() {
return this.description;
}
/**
* Note to the recipient of the funds in this transaction.
*/
@SuppressWarnings("all")
public String getNoteToPayee() {
return this.noteToPayee;
}
/**
* free-form field for the use of clients
*/
@SuppressWarnings("all")
public String getCustom() {
return this.custom;
}
/**
* invoice number to track this payment
*/
@SuppressWarnings("all")
public String getInvoiceNumber() {
return this.invoiceNumber;
}
/**
* Soft descriptor used when charging this funding source. If length exceeds max length, the value will be truncated
*/
@SuppressWarnings("all")
public String getSoftDescriptor() {
return this.softDescriptor;
}
/**
* Soft descriptor city used when charging this funding source. If length exceeds max length, the value will be truncated. Only supported when the `payment_method` is set to `credit_card`
*/
@SuppressWarnings("all")
public String getSoftDescriptorCity() {
return this.softDescriptorCity;
}
/**
* URL to send payment notifications
*/
@SuppressWarnings("all")
public String getNotifyUrl() {
return this.notifyUrl;
}
/**
* Url on merchant site pertaining to this payment.
*/
@SuppressWarnings("all")
public String getOrderUrl() {
return this.orderUrl;
}
/**
* Merchant identifier to the purchase unit. Optional parameter
* @return this
*/
@SuppressWarnings("all")
public CartBase setReferenceId(final String referenceId) {
this.referenceId = referenceId;
return this;
}
/**
* Amount being collected.
* @return this
*/
@SuppressWarnings("all")
public CartBase setAmount(final Amount amount) {
this.amount = amount;
return this;
}
/**
* Recipient of the funds in this transaction.
* @return this
*/
@SuppressWarnings("all")
public CartBase setPayee(final Payee payee) {
this.payee = payee;
return this;
}
/**
* Description of what is being paid for.
* @return this
*/
@SuppressWarnings("all")
public CartBase setDescription(final String description) {
this.description = description;
return this;
}
/**
* Note to the recipient of the funds in this transaction.
* @return this
*/
@SuppressWarnings("all")
public CartBase setNoteToPayee(final String noteToPayee) {
this.noteToPayee = noteToPayee;
return this;
}
/**
* free-form field for the use of clients
* @return this
*/
@SuppressWarnings("all")
public CartBase setCustom(final String custom) {
this.custom = custom;
return this;
}
/**
* invoice number to track this payment
* @return this
*/
@SuppressWarnings("all")
public CartBase setInvoiceNumber(final String invoiceNumber) {
this.invoiceNumber = invoiceNumber;
return this;
}
/**
* Soft descriptor used when charging this funding source. If length exceeds max length, the value will be truncated
* @return this
*/
@SuppressWarnings("all")
public CartBase setSoftDescriptor(final String softDescriptor) {
this.softDescriptor = softDescriptor;
return this;
}
/**
* Soft descriptor city used when charging this funding source. If length exceeds max length, the value will be truncated. Only supported when the `payment_method` is set to `credit_card`
* @return this
*/
@SuppressWarnings("all")
public CartBase setSoftDescriptorCity(final String softDescriptorCity) {
this.softDescriptorCity = softDescriptorCity;
return this;
}
/**
* URL to send payment notifications
* @return this
*/
@SuppressWarnings("all")
public CartBase setNotifyUrl(final String notifyUrl) {
this.notifyUrl = notifyUrl;
return this;
}
/**
* Url on merchant site pertaining to this payment.
* @return this
*/
@SuppressWarnings("all")
public CartBase setOrderUrl(final String orderUrl) {
this.orderUrl = orderUrl;
return this;
}
}

View File

@@ -0,0 +1,111 @@
package com.egzosn.pay.paypal.bean.order;
import com.alibaba.fastjson.annotation.JSONField;
public class Details {
/**
* Amount of the subtotal of the items. **Required** if line items are specified. 10 characters max, with support for 2 decimal places.
*/
private String subtotal;
/**
* Amount charged for shipping. 10 characters max with support for 2 decimal places.
*/
private String shipping;
/**
* Amount charged for tax. 10 characters max with support for 2 decimal places.
*/
private String tax;
/**
* Amount being charged for the handling fee. Only supported when the `payment_method` is set to `paypal`.
*/
@JSONField(name = "handling_fee")
private String handlingFee;
/**
* Amount being discounted for the shipping fee. Only supported when the `payment_method` is set to `paypal`.
*/
@JSONField(name = "shipping_discount")
private String shippingDiscount;
/**
* Amount being charged for the insurance fee. Only supported when the `payment_method` is set to `paypal`.
*/
private String insurance;
/**
* Amount being charged as gift wrap fee.
*/
@JSONField(name = "gift_wrap")
private String giftWrap;
/**
* Fee charged by PayPal. In case of a refund, this is the fee amount refunded to the original receipient of the payment.
*/
private String fee;
/**
* Default Constructor
*/
public Details() {
}
public String getSubtotal() {
return subtotal;
}
public void setSubtotal(String subtotal) {
this.subtotal = subtotal;
}
public String getShipping() {
return shipping;
}
public void setShipping(String shipping) {
this.shipping = shipping;
}
public String getTax() {
return tax;
}
public void setTax(String tax) {
this.tax = tax;
}
public String getHandlingFee() {
return handlingFee;
}
public void setHandlingFee(String handlingFee) {
this.handlingFee = handlingFee;
}
public String getShippingDiscount() {
return shippingDiscount;
}
public void setShippingDiscount(String shippingDiscount) {
this.shippingDiscount = shippingDiscount;
}
public String getInsurance() {
return insurance;
}
public void setInsurance(String insurance) {
this.insurance = insurance;
}
public String getGiftWrap() {
return giftWrap;
}
public void setGiftWrap(String giftWrap) {
this.giftWrap = giftWrap;
}
public String getFee() {
return fee;
}
public void setFee(String fee) {
this.fee = fee;
}
}

View File

@@ -0,0 +1,173 @@
// Generated by delombok at Thu Nov 16 13:48:05 CST 2017
package com.egzosn.pay.paypal.bean.order;
import java.util.List;
public class Error {
/**
* Human readable, unique name of the error.
*/
private String name;
/**
* Message describing the error.
*/
private String message;
/**
* Additional details of the error
*/
private List<ErrorDetails> details;
/**
* URI for detailed information related to this error for the developer.
*/
private String informationLink;
/**
* PayPal internal identifier used for correlation purposes.
*/
private String debugId;
/**
* @deprecated This property is not available publicly
* PayPal internal error code.
*/
@Deprecated
private String code;
/**
* Default Constructor
*/
public Error() {
}
/**
* Parameterized Constructor
*/
public Error(String name, String message, String informationLink, String debugId) {
this.name = name;
this.message = message;
this.informationLink = informationLink;
this.debugId = debugId;
}
public String toString() {
return "name: " + this.name + "\tmessage: " + this.message + "\tdetails: " + this.details + "\tdebug-id: " + this.debugId + "\tinformation-link: " + this.informationLink;
}
/**
* Human readable, unique name of the error.
*/
@SuppressWarnings("all")
public String getName() {
return this.name;
}
/**
* Message describing the error.
*/
@SuppressWarnings("all")
public String getMessage() {
return this.message;
}
/**
* Additional details of the error
*/
@SuppressWarnings("all")
public List<ErrorDetails> getDetails() {
return this.details;
}
/**
* URI for detailed information related to this error for the developer.
*/
@SuppressWarnings("all")
public String getInformationLink() {
return this.informationLink;
}
/**
* PayPal internal identifier used for correlation purposes.
*/
@SuppressWarnings("all")
public String getDebugId() {
return this.debugId;
}
/**
* @deprecated This property is not available publicly
* PayPal internal error code.
*/
@Deprecated
@SuppressWarnings("all")
public String getCode() {
return this.code;
}
/**
* Human readable, unique name of the error.
* @return this
*/
@SuppressWarnings("all")
public Error setName(final String name) {
this.name = name;
return this;
}
/**
* Message describing the error.
* @return this
*/
@SuppressWarnings("all")
public Error setMessage(final String message) {
this.message = message;
return this;
}
/**
* Additional details of the error
* @return this
*/
@SuppressWarnings("all")
public Error setDetails(final List<ErrorDetails> details) {
this.details = details;
return this;
}
/**
* URI for detailed information related to this error for the developer.
* @return this
*/
@SuppressWarnings("all")
public Error setInformationLink(final String informationLink) {
this.informationLink = informationLink;
return this;
}
/**
* PayPal internal identifier used for correlation purposes.
* @return this
*/
@SuppressWarnings("all")
public Error setDebugId(final String debugId) {
this.debugId = debugId;
return this;
}
/**
* @deprecated This property is not available publicly
* PayPal internal error code.
* @return this
*/
@Deprecated
@SuppressWarnings("all")
public Error setCode(final String code) {
this.code = code;
return this;
}
}

View File

@@ -0,0 +1,67 @@
// Generated by delombok at Thu Nov 16 13:48:05 CST 2017
package com.egzosn.pay.paypal.bean.order;
public class ErrorDetails {
/**
* Name of the field that caused the error.
*/
private String field;
/**
* Reason for the error.
*/
private String issue;
/**
* Default Constructor
*/
public ErrorDetails() {
}
/**
* Parameterized Constructor
*/
public ErrorDetails(String field, String issue) {
this.field = field;
this.issue = issue;
}
/**
* Name of the field that caused the error.
*/
@SuppressWarnings("all")
public String getField() {
return this.field;
}
/**
* Reason for the error.
*/
@SuppressWarnings("all")
public String getIssue() {
return this.issue;
}
/**
* Name of the field that caused the error.
* @return this
*/
@SuppressWarnings("all")
public ErrorDetails setField(final String field) {
this.field = field;
return this;
}
/**
* Reason for the error.
* @return this
*/
@SuppressWarnings("all")
public ErrorDetails setIssue(final String issue) {
this.issue = issue;
return this;
}
}

View File

@@ -0,0 +1,137 @@
package com.egzosn.pay.paypal.bean.order;
public class FmfDetails{
/**
* Type of filter.
*/
private String filterType;
/**
* Filter Identifier.
*/
private String filterId;
/**
* Name of the filter
*/
private String name;
/**
* Description of the filter.
*/
private String description;
/**
* Type of filter.
*/
public String getFilterType() {
return this.filterType;
}
/**
* Filter Identifier.
*/
public String getFilterId() {
return this.filterId;
}
/**
* Name of the filter
*/
public String getName() {
return this.name;
}
/**
* Description of the filter.
*/
public String getDescription() {
return this.description;
}
/**
* Type of filter.
* @return this
*/
public FmfDetails setFilterType(final String filterType) {
this.filterType = filterType;
return this;
}
/**
* Filter Identifier.
* @return this
*/
public FmfDetails setFilterId(final String filterId) {
this.filterId = filterId;
return this;
}
/**
* Name of the filter
* @return this
*/
public FmfDetails setName(final String name) {
this.name = name;
return this;
}
/**
* Description of the filter.
* @return this
*/
public FmfDetails setDescription(final String description) {
this.description = description;
return this;
}
@Override
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof FmfDetails)) return false;
final FmfDetails other = (FmfDetails) o;
if (!other.canEqual((Object) this)) return false;
if (!super.equals(o)) return false;
final Object this$filterType = this.getFilterType();
final Object other$filterType = other.getFilterType();
if (this$filterType == null ? other$filterType != null : !this$filterType.equals(other$filterType)) return false;
final Object this$filterId = this.getFilterId();
final Object other$filterId = other.getFilterId();
if (this$filterId == null ? other$filterId != null : !this$filterId.equals(other$filterId)) return false;
final Object this$name = this.getName();
final Object other$name = other.getName();
if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false;
final Object this$description = this.getDescription();
final Object other$description = other.getDescription();
if (this$description == null ? other$description != null : !this$description.equals(other$description)) return false;
return true;
}
protected boolean canEqual(final Object other) {
return other instanceof FmfDetails;
}
@Override
public int hashCode() {
final int PRIME = 59;
int result = 1;
result = result * PRIME + super.hashCode();
final Object $filterType = this.getFilterType();
result = result * PRIME + ($filterType == null ? 43 : $filterType.hashCode());
final Object $filterId = this.getFilterId();
result = result * PRIME + ($filterId == null ? 43 : $filterId.hashCode());
final Object $name = this.getName();
result = result * PRIME + ($name == null ? 43 : $name.hashCode());
final Object $description = this.getDescription();
result = result * PRIME + ($description == null ? 43 : $description.hashCode());
return result;
}
}

View File

@@ -0,0 +1,65 @@
package com.egzosn.pay.paypal.bean.order;
public class Links {
/**
*/
private String href;
/**
*/
private String rel;
/**
*/
private String method;
/**
*/
private String enctype;
/**
* Default Constructor
*/
public Links() {
}
/**
* Parameterized Constructor
*/
public Links(String href, String rel) {
this.href = href;
this.rel = rel;
}
public String getHref() {
return href;
}
public void setHref(String href) {
this.href = href;
}
public String getRel() {
return rel;
}
public void setRel(String rel) {
this.rel = rel;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public String getEnctype() {
return enctype;
}
public void setEnctype(String enctype) {
this.enctype = enctype;
}
}

View File

@@ -0,0 +1,316 @@
// Generated by delombok at Thu Nov 16 13:48:05 CST 2017
package com.egzosn.pay.paypal.bean.order;
import java.util.List;
public class Order {
/**
* Identifier of the order transaction.
*/
private String id;
/**
* Identifier to the purchase unit associated with this object. Obsolete. Use one in cart_base.
*/
private String purchaseUnitReferenceId;
/**
* Amount being collected.
*/
private Amount amount;
/**
* specifies payment mode of the transaction
*/
private String paymentMode;
/**
* State of the order transaction.
*/
private String state;
/**
* Reason code for the transaction state being Pending or Reversed. This field will replace pending_reason field eventually. Only supported when the `payment_method` is set to `paypal`.
*/
private String reasonCode;
/**
* The level of seller protection in force for the transaction.
*/
private String protectionEligibility;
/**
* The kind of seller protection in force for the transaction. This property is returned only when the `protection_eligibility` property is set to `ELIGIBLE`or `PARTIALLY_ELIGIBLE`. Only supported when the `payment_method` is set to `paypal`. Allowed values:<br> `ITEM_NOT_RECEIVED_ELIGIBLE`- Sellers are protected against claims for items not received.<br> `UNAUTHORIZED_PAYMENT_ELIGIBLE`- Sellers are protected against claims for unauthorized payments.<br> One or both of the allowed values can be returned.
*/
private String protectionEligibilityType;
/**
* ID of the Payment resource that this transaction is based on.
*/
private String parentPayment;
/**
* Fraud Management Filter (FMF) details applied for the payment that could result in accept/deny/pending action.
*/
private FmfDetails fmfDetails;
/**
* Time the resource was created in UTC ISO8601 format.
*/
private String createTime;
/**
* Time the resource was last updated in UTC ISO8601 format.
*/
private String updateTime;
/**
*/
private List<Links> links;
/**
* Default Constructor
*/
public Order() {
}
/**
* Parameterized Constructor
*/
public Order(Amount amount) {
this.amount = amount;
}
/**
* Identifier of the order transaction.
*/
public String getId() {
return this.id;
}
/**
* Identifier to the purchase unit associated with this object. Obsolete. Use one in cart_base.
*/
public String getPurchaseUnitReferenceId() {
return this.purchaseUnitReferenceId;
}
/**
* Amount being collected.
*/
public Amount getAmount() {
return this.amount;
}
/**
* specifies payment mode of the transaction
*/
public String getPaymentMode() {
return this.paymentMode;
}
/**
* State of the order transaction.
*/
public String getState() {
return this.state;
}
/**
* Reason code for the transaction state being Pending or Reversed. This field will replace pending_reason field eventually. Only supported when the `payment_method` is set to `paypal`.
*/
public String getReasonCode() {
return this.reasonCode;
}
/**
* The level of seller protection in force for the transaction.
*/
public String getProtectionEligibility() {
return this.protectionEligibility;
}
/**
* The kind of seller protection in force for the transaction. This property is returned only when the `protection_eligibility` property is set to `ELIGIBLE`or `PARTIALLY_ELIGIBLE`. Only supported when the `payment_method` is set to `paypal`. Allowed values:<br> `ITEM_NOT_RECEIVED_ELIGIBLE`- Sellers are protected against claims for items not received.<br> `UNAUTHORIZED_PAYMENT_ELIGIBLE`- Sellers are protected against claims for unauthorized payments.<br> One or both of the allowed values can be returned.
*/
public String getProtectionEligibilityType() {
return this.protectionEligibilityType;
}
/**
* ID of the Payment resource that this transaction is based on.
*/
public String getParentPayment() {
return this.parentPayment;
}
/**
* Fraud Management Filter (FMF) details applied for the payment that could result in accept/deny/pending action.
*/
public FmfDetails getFmfDetails() {
return this.fmfDetails;
}
/**
* Time the resource was created in UTC ISO8601 format.
*/
public String getCreateTime() {
return this.createTime;
}
/**
* Time the resource was last updated in UTC ISO8601 format.
*/
public String getUpdateTime() {
return this.updateTime;
}
/**
*/
public List<Links> getLinks() {
return this.links;
}
/**
* Identifier of the order transaction.
* @return this
*/
public Order setId(final String id) {
this.id = id;
return this;
}
/**
* Identifier to the purchase unit associated with this object. Obsolete. Use one in cart_base.
* @return this
*/
public Order setPurchaseUnitReferenceId(final String purchaseUnitReferenceId) {
this.purchaseUnitReferenceId = purchaseUnitReferenceId;
return this;
}
/**
* Amount being collected.
* @return this
*/
public Order setAmount(final Amount amount) {
this.amount = amount;
return this;
}
/**
* specifies payment mode of the transaction
* @return this
*/
public Order setPaymentMode(final String paymentMode) {
this.paymentMode = paymentMode;
return this;
}
/**
* State of the order transaction.
* @return this
*/
public Order setState(final String state) {
this.state = state;
return this;
}
/**
* Reason code for the transaction state being Pending or Reversed. This field will replace pending_reason field eventually. Only supported when the `payment_method` is set to `paypal`.
* @return this
*/
public Order setReasonCode(final String reasonCode) {
this.reasonCode = reasonCode;
return this;
}
/**
* The level of seller protection in force for the transaction.
* @return this
*/
public Order setProtectionEligibility(final String protectionEligibility) {
this.protectionEligibility = protectionEligibility;
return this;
}
/**
* The kind of seller protection in force for the transaction. This property is returned only when the `protection_eligibility` property is set to `ELIGIBLE`or `PARTIALLY_ELIGIBLE`. Only supported when the `payment_method` is set to `paypal`. Allowed values:<br> `ITEM_NOT_RECEIVED_ELIGIBLE`- Sellers are protected against claims for items not received.<br> `UNAUTHORIZED_PAYMENT_ELIGIBLE`- Sellers are protected against claims for unauthorized payments.<br> One or both of the allowed values can be returned.
* @return this
*/
public Order setProtectionEligibilityType(final String protectionEligibilityType) {
this.protectionEligibilityType = protectionEligibilityType;
return this;
}
/**
* ID of the Payment resource that this transaction is based on.
* @return this
*/
public Order setParentPayment(final String parentPayment) {
this.parentPayment = parentPayment;
return this;
}
/**
* Fraud Management Filter (FMF) details applied for the payment that could result in accept/deny/pending action.
* @return this
*/
public Order setFmfDetails(final FmfDetails fmfDetails) {
this.fmfDetails = fmfDetails;
return this;
}
/**
* Time the resource was created in UTC ISO8601 format.
* @return this
*/
public Order setCreateTime(final String createTime) {
this.createTime = createTime;
return this;
}
/**
* Time the resource was last updated in UTC ISO8601 format.
* @return this
*/
public Order setUpdateTime(final String updateTime) {
this.updateTime = updateTime;
return this;
}
/**
*
* @return this
*/
public Order setLinks(final List<Links> links) {
this.links = links;
return this;
}
}

View File

@@ -0,0 +1,205 @@
// Generated by delombok at Thu Nov 16 13:48:05 CST 2017
package com.egzosn.pay.paypal.bean.order;
import com.alibaba.fastjson.annotation.JSONField;
public class Payee {
/**
* Email Address associated with the Payee's PayPal Account. If the provided email address is not associated with any PayPal Account, the payee can only receive PayPal Wallet Payments. Direct Credit Card Payments will be denied due to card compliance requirements.
*/
private String email;
/**
* Encrypted PayPal account identifier for the Payee.
*/
@JSONField(name = "merchant_id")
private String merchantId;
/**
* First Name of the Payee.
*/
@JSONField(name = "first_name")
private String firstName;
/**
* Last Name of the Payee.
*/
@JSONField(name = "last_name")
private String lastName;
/**
* Unencrypted PayPal account Number of the Payee
*/
@JSONField(name = "account_number")
private String accountNumber;
/**
* Information related to the Payee.
*/
private Phone phone;
/**
* Default Constructor
*/
public Payee() {
}
/**
* Email Address associated with the Payee's PayPal Account. If the provided email address is not associated with any PayPal Account, the payee can only receive PayPal Wallet Payments. Direct Credit Card Payments will be denied due to card compliance requirements.
*/
@SuppressWarnings("all")
public String getEmail() {
return this.email;
}
/**
* Encrypted PayPal account identifier for the Payee.
*/
@SuppressWarnings("all")
public String getMerchantId() {
return this.merchantId;
}
/**
* First Name of the Payee.
*/
@SuppressWarnings("all")
public String getFirstName() {
return this.firstName;
}
/**
* Last Name of the Payee.
*/
@SuppressWarnings("all")
public String getLastName() {
return this.lastName;
}
/**
* Unencrypted PayPal account Number of the Payee
*/
@SuppressWarnings("all")
public String getAccountNumber() {
return this.accountNumber;
}
/**
* Information related to the Payee.
*/
@SuppressWarnings("all")
public Phone getPhone() {
return this.phone;
}
/**
* Email Address associated with the Payee's PayPal Account. If the provided email address is not associated with any PayPal Account, the payee can only receive PayPal Wallet Payments. Direct Credit Card Payments will be denied due to card compliance requirements.
* @return this
*/
@SuppressWarnings("all")
public Payee setEmail(final String email) {
this.email = email;
return this;
}
/**
* Encrypted PayPal account identifier for the Payee.
* @return this
*/
@SuppressWarnings("all")
public Payee setMerchantId(final String merchantId) {
this.merchantId = merchantId;
return this;
}
/**
* First Name of the Payee.
* @return this
*/
@SuppressWarnings("all")
public Payee setFirstName(final String firstName) {
this.firstName = firstName;
return this;
}
/**
* Last Name of the Payee.
* @return this
*/
@SuppressWarnings("all")
public Payee setLastName(final String lastName) {
this.lastName = lastName;
return this;
}
/**
* Unencrypted PayPal account Number of the Payee
* @return this
*/
@SuppressWarnings("all")
public Payee setAccountNumber(final String accountNumber) {
this.accountNumber = accountNumber;
return this;
}
/**
* Information related to the Payee.
* @return this
*/
@SuppressWarnings("all")
public Payee setPhone(final Phone phone) {
this.phone = phone;
return this;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof Payee)) return false;
final Payee other = (Payee) o;
if (!other.canEqual((Object) this)) return false;
if (!super.equals(o)) return false;
final Object this$email = this.getEmail();
final Object other$email = other.getEmail();
if (this$email == null ? other$email != null : !this$email.equals(other$email)) return false;
final Object this$merchantId = this.getMerchantId();
final Object other$merchantId = other.getMerchantId();
if (this$merchantId == null ? other$merchantId != null : !this$merchantId.equals(other$merchantId)) return false;
final Object this$firstName = this.getFirstName();
final Object other$firstName = other.getFirstName();
if (this$firstName == null ? other$firstName != null : !this$firstName.equals(other$firstName)) return false;
final Object this$lastName = this.getLastName();
final Object other$lastName = other.getLastName();
if (this$lastName == null ? other$lastName != null : !this$lastName.equals(other$lastName)) return false;
final Object this$accountNumber = this.getAccountNumber();
final Object other$accountNumber = other.getAccountNumber();
if (this$accountNumber == null ? other$accountNumber != null : !this$accountNumber.equals(other$accountNumber)) return false;
final Object this$phone = this.getPhone();
final Object other$phone = other.getPhone();
if (this$phone == null ? other$phone != null : !this$phone.equals(other$phone)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof Payee;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
result = result * PRIME + super.hashCode();
final Object $email = this.getEmail();
result = result * PRIME + ($email == null ? 43 : $email.hashCode());
final Object $merchantId = this.getMerchantId();
result = result * PRIME + ($merchantId == null ? 43 : $merchantId.hashCode());
final Object $firstName = this.getFirstName();
result = result * PRIME + ($firstName == null ? 43 : $firstName.hashCode());
final Object $lastName = this.getLastName();
result = result * PRIME + ($lastName == null ? 43 : $lastName.hashCode());
final Object $accountNumber = this.getAccountNumber();
result = result * PRIME + ($accountNumber == null ? 43 : $accountNumber.hashCode());
final Object $phone = this.getPhone();
result = result * PRIME + ($phone == null ? 43 : $phone.hashCode());
return result;
}
}

View File

@@ -0,0 +1,34 @@
package com.egzosn.pay.paypal.bean.order;
import com.alibaba.fastjson.annotation.JSONField;
import java.util.List;
public class Payer {
/**
* Payment method being used - PayPal Wallet payment, Bank Direct Debit or Direct Credit card.
*/
@JSONField(name = "payment_method")
private String paymentMethod;
/**
* Transactional details including the amount and item details.
*/
private List<Transaction> transactions;
public String getPaymentMethod() {
return paymentMethod;
}
public void setPaymentMethod(String paymentMethod) {
this.paymentMethod = paymentMethod;
}
public List<Transaction> getTransactions() {
return transactions;
}
public void setTransactions(List<Transaction> transactions) {
this.transactions = transactions;
}
}

View File

@@ -0,0 +1,211 @@
package com.egzosn.pay.paypal.bean.order;
import com.alibaba.fastjson.annotation.JSONField;
import java.util.List;
/**
* 贝宝付款订单
* <pre>
* 说明付款订单信息
*
*
*
* </pre>
*
* @author egan
*
* email egzosn@gmail.com
* date 2018/04/28 11:09
*/
public class Payment {
/**
* Identifier of the payment resource created.
*/
private String id;
/**
* Payment intent.
*/
private String intent;
/**
* Source of the funds for this payment represented by a PayPal account or a direct credit card.
*/
private Payer payer;
/**
* Receiver of funds for this payment. **Readonly for PayPal external REST payments.**
*/
private Payee payee;
/**
* ID of the cart to execute the payment.
*/
private String cart;
/**
* Transactional details including the amount and item details.
*/
private List<Transaction> transactions;
/**
* Applicable for advanced payments like multi seller payment (MSP) to support partial failures
*/
@JSONField(name = "failed_transactions")
private List<Error> failedTransactions;
/**
* The state of the payment, authorization, or order transaction. The value is:<ul><li><code>created</code>. The transaction was successfully created.</li><li><code>approved</code>. The buyer approved the transaction.</li><li><code>failed</code>. The transaction request failed.</li></ul>
*/
private String state;
/**
* PayPal generated identifier for the merchant's payment experience profile. Refer to [this](https://developer.paypal.com/docs/api/#payment-experience) link to create experience profile ID.
*/
@JSONField(name = "experience_profile_id")
private String experienceProfileId;
/**
* free-form field for the use of clients to pass in a message to the payer
*/
@JSONField(name = "note_to_payer")
private String noteToPayer;
/**
* Set of redirect URLs you provide only for PayPal-based payments.
*/
@JSONField(name = "redirect_urls")
private RedirectUrls redirectUrls;
/**
* Failure reason code returned when the payment failed for some valid reasons.
*/
@JSONField(name = "failure_reason")
private String failureReason;
/**
* Payment creation time as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6).
*/
@JSONField(name = "create_time")
private String createTime;
/**
* Payment update time as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6).
*/
@JSONField(name = "update_time")
private String updateTime;
/**
*/
private List<Links> links;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getIntent() {
return intent;
}
public void setIntent(String intent) {
this.intent = intent;
}
public Payer getPayer() {
return payer;
}
public void setPayer(Payer payer) {
this.payer = payer;
}
public Payee getPayee() {
return payee;
}
public void setPayee(Payee payee) {
this.payee = payee;
}
public String getCart() {
return cart;
}
public void setCart(String cart) {
this.cart = cart;
}
public List<Transaction> getTransactions() {
return transactions;
}
public void setTransactions(List<Transaction> transactions) {
this.transactions = transactions;
}
public List<Error> getFailedTransactions() {
return failedTransactions;
}
public void setFailedTransactions(List<Error> failedTransactions) {
this.failedTransactions = failedTransactions;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getExperienceProfileId() {
return experienceProfileId;
}
public void setExperienceProfileId(String experienceProfileId) {
this.experienceProfileId = experienceProfileId;
}
public String getNoteToPayer() {
return noteToPayer;
}
public void setNoteToPayer(String noteToPayer) {
this.noteToPayer = noteToPayer;
}
public RedirectUrls getRedirectUrls() {
return redirectUrls;
}
public void setRedirectUrls(RedirectUrls redirectUrls) {
this.redirectUrls = redirectUrls;
}
public String getFailureReason() {
return failureReason;
}
public void setFailureReason(String failureReason) {
this.failureReason = failureReason;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public List<Links> getLinks() {
return links;
}
public void setLinks(List<Links> links) {
this.links = links;
}
}

View File

@@ -0,0 +1,130 @@
// Generated by delombok at Thu Nov 16 13:48:05 CST 2017
package com.egzosn.pay.paypal.bean.order;
import com.alibaba.fastjson.annotation.JSONField;
public class Phone{
/**
* Country code (from in E.164 format)
*/
@JSONField(name = "country_code")
private String countryCode;
/**
* In-country phone number (from in E.164 format)
*/
@JSONField(name = "national_number")
private String nationalNumber;
/**
* Phone extension
*/
private String extension;
/**
* Default Constructor
*/
public Phone() {
}
/**
* Parameterized Constructor
*/
public Phone(String countryCode, String nationalNumber) {
this.countryCode = countryCode;
this.nationalNumber = nationalNumber;
}
/**
* Country code (from in E.164 format)
*/
@SuppressWarnings("all")
public String getCountryCode() {
return this.countryCode;
}
/**
* In-country phone number (from in E.164 format)
*/
@SuppressWarnings("all")
public String getNationalNumber() {
return this.nationalNumber;
}
/**
* Phone extension
*/
@SuppressWarnings("all")
public String getExtension() {
return this.extension;
}
/**
* Country code (from in E.164 format)
* @return this
*/
@SuppressWarnings("all")
public Phone setCountryCode(final String countryCode) {
this.countryCode = countryCode;
return this;
}
/**
* In-country phone number (from in E.164 format)
* @return this
*/
@SuppressWarnings("all")
public Phone setNationalNumber(final String nationalNumber) {
this.nationalNumber = nationalNumber;
return this;
}
/**
* Phone extension
* @return this
*/
@SuppressWarnings("all")
public Phone setExtension(final String extension) {
this.extension = extension;
return this;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof Phone)) return false;
final Phone other = (Phone) o;
if (!other.canEqual((Object) this)) return false;
if (!super.equals(o)) return false;
final Object this$countryCode = this.getCountryCode();
final Object other$countryCode = other.getCountryCode();
if (this$countryCode == null ? other$countryCode != null : !this$countryCode.equals(other$countryCode)) return false;
final Object this$nationalNumber = this.getNationalNumber();
final Object other$nationalNumber = other.getNationalNumber();
if (this$nationalNumber == null ? other$nationalNumber != null : !this$nationalNumber.equals(other$nationalNumber)) return false;
final Object this$extension = this.getExtension();
final Object other$extension = other.getExtension();
if (this$extension == null ? other$extension != null : !this$extension.equals(other$extension)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof Phone;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
result = result * PRIME + super.hashCode();
final Object $countryCode = this.getCountryCode();
result = result * PRIME + ($countryCode == null ? 43 : $countryCode.hashCode());
final Object $nationalNumber = this.getNationalNumber();
result = result * PRIME + ($nationalNumber == null ? 43 : $nationalNumber.hashCode());
final Object $extension = this.getExtension();
result = result * PRIME + ($extension == null ? 43 : $extension.hashCode());
return result;
}
}

View File

@@ -0,0 +1,95 @@
// Generated by delombok at Thu Nov 16 13:48:05 CST 2017
package com.egzosn.pay.paypal.bean.order;
import com.alibaba.fastjson.annotation.JSONField;
public class RedirectUrls{
/**
* Url where the payer would be redirected to after approving the payment. **Required for PayPal account payments.**
*/
@JSONField(name = "return_url")
private String returnUrl;
/**
* Url where the payer would be redirected to after canceling the payment. **Required for PayPal account payments.**
*/
@JSONField(name = "cancel_url")
private String cancelUrl;
/**
* Default Constructor
*/
public RedirectUrls() {
}
/**
* Url where the payer would be redirected to after approving the payment. **Required for PayPal account payments.**
*/
@SuppressWarnings("all")
public String getReturnUrl() {
return this.returnUrl;
}
/**
* Url where the payer would be redirected to after canceling the payment. **Required for PayPal account payments.**
*/
@SuppressWarnings("all")
public String getCancelUrl() {
return this.cancelUrl;
}
/**
* Url where the payer would be redirected to after approving the payment. **Required for PayPal account payments.**
* @return this
*/
@SuppressWarnings("all")
public RedirectUrls setReturnUrl(final String returnUrl) {
this.returnUrl = returnUrl;
return this;
}
/**
* Url where the payer would be redirected to after canceling the payment. **Required for PayPal account payments.**
* @return this
*/
@SuppressWarnings("all")
public RedirectUrls setCancelUrl(final String cancelUrl) {
this.cancelUrl = cancelUrl;
return this;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof RedirectUrls)) return false;
final RedirectUrls other = (RedirectUrls) o;
if (!other.canEqual((Object) this)) return false;
if (!super.equals(o)) return false;
final Object this$returnUrl = this.getReturnUrl();
final Object other$returnUrl = other.getReturnUrl();
if (this$returnUrl == null ? other$returnUrl != null : !this$returnUrl.equals(other$returnUrl)) return false;
final Object this$cancelUrl = this.getCancelUrl();
final Object other$cancelUrl = other.getCancelUrl();
if (this$cancelUrl == null ? other$cancelUrl != null : !this$cancelUrl.equals(other$cancelUrl)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof RedirectUrls;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
result = result * PRIME + super.hashCode();
final Object $returnUrl = this.getReturnUrl();
result = result * PRIME + ($returnUrl == null ? 43 : $returnUrl.hashCode());
final Object $cancelUrl = this.getCancelUrl();
result = result * PRIME + ($cancelUrl == null ? 43 : $cancelUrl.hashCode());
return result;
}
}

View File

@@ -0,0 +1,300 @@
// Generated by delombok at Thu Nov 16 13:48:05 CST 2017
package com.egzosn.pay.paypal.bean.order;
import java.util.List;
public class Refund {
/**
* ID of the refund transaction. 17 characters max.
*/
private String id;
/**
* Details including both refunded amount (to payer) and refunded fee (to payee). 10 characters max.
*/
private Amount amount;
/**
* State of the refund.
*/
private String state;
/**
* Reason description for the Sale transaction being refunded.
*/
private String reason;
/**
* Your own invoice or tracking ID number. Character length and limitations: 127 single-byte alphanumeric characters.
*/
private String invoiceNumber;
/**
* ID of the Sale transaction being refunded.
*/
private String saleId;
/**
* ID of the sale transaction being refunded.
*/
private String captureId;
/**
* ID of the payment resource on which this transaction is based.
*/
private String parentPayment;
/**
* Description of what is being refunded for.
*/
private String description;
/**
* Time of refund as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6).
*/
private String createTime;
/**
* Time that the resource was last updated.
*/
private String updateTime;
/**
* The reason code for the refund state being pending
*/
private String reasonCode;
/**
*/
private List<Links> links;
/**
* Default Constructor
*/
public Refund() {
}
/**
* ID of the refund transaction. 17 characters max.
*/
public String getId() {
return this.id;
}
/**
* Details including both refunded amount (to payer) and refunded fee (to payee). 10 characters max.
*/
public Amount getAmount() {
return this.amount;
}
/**
* State of the refund.
*/
public String getState() {
return this.state;
}
/**
* Reason description for the Sale transaction being refunded.
*/
public String getReason() {
return this.reason;
}
/**
* Your own invoice or tracking ID number. Character length and limitations: 127 single-byte alphanumeric characters.
*/
public String getInvoiceNumber() {
return this.invoiceNumber;
}
/**
* ID of the Sale transaction being refunded.
*/
public String getSaleId() {
return this.saleId;
}
/**
* ID of the sale transaction being refunded.
*/
public String getCaptureId() {
return this.captureId;
}
/**
* ID of the payment resource on which this transaction is based.
*/
public String getParentPayment() {
return this.parentPayment;
}
/**
* Description of what is being refunded for.
*/
public String getDescription() {
return this.description;
}
/**
* Time of refund as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6).
*/
public String getCreateTime() {
return this.createTime;
}
/**
* Time that the resource was last updated.
*/
public String getUpdateTime() {
return this.updateTime;
}
/**
* The reason code for the refund state being pending
*/
public String getReasonCode() {
return this.reasonCode;
}
/**
*/
public List<Links> getLinks() {
return this.links;
}
/**
* ID of the refund transaction. 17 characters max.
* @return this
*/
public Refund setId(final String id) {
this.id = id;
return this;
}
/**
* Details including both refunded amount (to payer) and refunded fee (to payee). 10 characters max.
* @return this
*/
public Refund setAmount(final Amount amount) {
this.amount = amount;
return this;
}
/**
* State of the refund.
* @return this
*/
public Refund setState(final String state) {
this.state = state;
return this;
}
/**
* Reason description for the Sale transaction being refunded.
* @return this
*/
public Refund setReason(final String reason) {
this.reason = reason;
return this;
}
/**
* Your own invoice or tracking ID number. Character length and limitations: 127 single-byte alphanumeric characters.
* @return this
*/
public Refund setInvoiceNumber(final String invoiceNumber) {
this.invoiceNumber = invoiceNumber;
return this;
}
/**
* ID of the Sale transaction being refunded.
* @return this
*/
public Refund setSaleId(final String saleId) {
this.saleId = saleId;
return this;
}
/**
* ID of the sale transaction being refunded.
* @return this
*/
public Refund setCaptureId(final String captureId) {
this.captureId = captureId;
return this;
}
/**
* ID of the payment resource on which this transaction is based.
* @return this
*/
public Refund setParentPayment(final String parentPayment) {
this.parentPayment = parentPayment;
return this;
}
/**
* Description of what is being refunded for.
* @return this
*/
public Refund setDescription(final String description) {
this.description = description;
return this;
}
/**
* Time of refund as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6).
* @return this
*/
public Refund setCreateTime(final String createTime) {
this.createTime = createTime;
return this;
}
/**
* Time that the resource was last updated.
* @return this
*/
public Refund setUpdateTime(final String updateTime) {
this.updateTime = updateTime;
return this;
}
/**
* The reason code for the refund state being pending
* @return this
*/
public Refund setReasonCode(final String reasonCode) {
this.reasonCode = reasonCode;
return this;
}
/**
*
* @return this
*/
public Refund setLinks(final List<Links> links) {
this.links = links;
return this;
}
}

View File

@@ -0,0 +1,36 @@
package com.egzosn.pay.paypal.bean.order;
public class RelatedResources{
/**
* Order transaction
*/
private Order order;
/**
* Refund transaction
*/
private Refund refund;
/**
* Default Constructor
*/
public RelatedResources() {
}
public Order getOrder() {
return order;
}
public void setOrder(Order order) {
this.order = order;
}
public Refund getRefund() {
return refund;
}
public void setRefund(Refund refund) {
this.refund = refund;
}
}

View File

@@ -0,0 +1,19 @@
package com.egzosn.pay.paypal.bean.order;
import java.util.List;
public class Transaction extends CartBase{
/**
* List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment.
*/
private List<RelatedResources> relatedResources;
/**
* Default Constructor
*/
public Transaction() {
}
}