├── allegro-sdk ├── pom.xml ├── readme.md └── src │ └── main │ └── java │ └── io │ └── github │ ├── AllegroClient.java │ ├── AllegroOrderClient.java │ ├── dto │ ├── FulfillmentDTO.java │ ├── InvoicesDTO.java │ ├── OrderEventDTO.java │ ├── OrdersDTO.java │ └── ShipmentDTO.java │ └── vo │ ├── AllegroToken.java │ ├── CheckoutForms.java │ ├── EventStats.java │ ├── IdVO.java │ ├── Invoices.java │ ├── OrderCarriers.java │ ├── Shipment.java │ ├── checkoutform │ ├── Buyer.java │ ├── BuyerAddress.java │ ├── CheckoutForm.java │ ├── Company.java │ ├── Delivery.java │ ├── DeliveryAddress.java │ ├── Fulfillment.java │ ├── Guaranteed.java │ ├── Invoice.java │ ├── InvoiceAddress.java │ ├── LineItems.java │ ├── Method.java │ ├── Offer.java │ ├── PaidAmount.java │ ├── Payment.java │ ├── PickupPoint.java │ ├── Reconciliation.java │ ├── SelectedAdditionalServices.java │ ├── ShipmentSummary.java │ ├── Summary.java │ ├── Surcharges.java │ └── Time.java │ └── orderevent │ ├── Buyer.java │ ├── CheckoutForm.java │ ├── Events.java │ ├── LineItems.java │ ├── Offer.java │ ├── Order.java │ ├── OrderEvent.java │ ├── OriginalPrice.java │ └── Seller.java ├── amazon-sdk ├── pom.xml └── src │ └── main │ └── java │ └── io │ └── github │ ├── AmazonClient.java │ ├── dto │ ├── OrdersDTO.java │ └── ShipmentDTO.java │ └── vo │ ├── AmazonError.java │ ├── AmazonResponse.java │ ├── AmazonToken.java │ └── order │ ├── AmazonBuyerInfo.java │ ├── AmazonOrder.java │ ├── AmazonOrderItems.java │ └── AmazonShippingAddress.java ├── paypal-sdk ├── pom.xml └── src │ └── main │ └── java │ └── io │ └── github │ ├── PayPalClient.java │ ├── dto │ ├── BalancesDTO.java │ └── TransactionsDTO.java │ └── vo │ ├── Address.java │ ├── AuctionInfo.java │ ├── Balances.java │ ├── BalancesVO.java │ ├── CartInfo.java │ ├── CryptoBalances.java │ ├── Email.java │ ├── IncentiveInfo.java │ ├── Links.java │ ├── PayPalAccessToken.java │ ├── PayerInfo.java │ ├── PayerName.java │ ├── ShippingInfo.java │ ├── ShopInfoAddress.java │ ├── StoreInfo.java │ ├── TotalBalance.java │ ├── TransactionAmount.java │ ├── TransactionDetails.java │ ├── TransactionDetailsVO.java │ ├── TransactionInfo.java │ └── UserInfo.java ├── pom.xml ├── readme.md ├── walmart-sdk ├── pom.xml └── src │ └── main │ └── java │ └── io │ └── github │ └── marketplace │ ├── WalmartClient.java │ ├── WalmartOrderClient.java │ ├── dto │ ├── CancelDTO.java │ ├── OrdersDTO.java │ ├── RefundDTO.java │ └── ShipmentDTO.java │ └── vo │ ├── CarrierName.java │ ├── Charge.java │ ├── ChargeAmount.java │ ├── Charges.java │ ├── Elements.java │ ├── Fulfillment.java │ ├── Item.java │ ├── Meta.java │ ├── Order.java │ ├── OrderLine.java │ ├── OrderLineQuantity.java │ ├── OrderLineStatus.java │ ├── OrderLineStatuses.java │ ├── OrderLines.java │ ├── OrderList.java │ ├── OrderShipment.java │ ├── PostalAddress.java │ ├── ReturnCenterAddress.java │ ├── ShipNode.java │ ├── ShippingInfo.java │ ├── StatusQuantity.java │ ├── Tax.java │ ├── TaxAmount.java │ ├── TrackingInfo.java │ ├── WalmartOrder.java │ ├── WalmartOrders.java │ └── WalmartToken.java └── wish-sdk ├── pom.xml └── src └── main └── java └── io └── github ├── WishClient.java ├── WishOrderClient.java ├── dto ├── ModifyAddressDTO.java ├── OrdersDTO.java ├── RefundDTO.java ├── ShippingCarriersDTO.java ├── TrackingDTO.java └── UpdateLtlDTO.java └── vo ├── Amount.java ├── CarrierSubsidies.java ├── CustomerPaidPricesDetail.java ├── EuVatCustomsDeclaration.java ├── FbwFees.java ├── FbwInformation.java ├── FulfillmentRecords.java ├── FulfillmentRequirements.java ├── FullAddress.java ├── GeneralPaymentDetails.java ├── InvoiceAmountInAuthorityCurrency.java ├── InvoiceAmountInCustomerCurrency.java ├── LotInformation.java ├── MerchantResponsibleAmount.java ├── NameVO.java ├── OrderPayment.java ├── PaymentTotal.java ├── PhoneNumber.java ├── Product.java ├── ProductInformation.java ├── ProductShippingPrice.java ├── RefundAmount.java ├── Refunds.java ├── RequiredVatNumbers.java ├── RevShare.java ├── ShippingCostInAuthorityCurrency.java ├── ShippingCostInCustomerCurrency.java ├── ShippingDetail.java ├── ShippingMerchantPayment.java ├── ShippingReimbursements.java ├── TaxInformation.java ├── TrackingInformation.java ├── TransactionTax.java ├── Vat.java ├── VatAmount.java ├── VatInformation.java ├── VatPayer.java ├── Voec.java ├── WarehouseInformation.java ├── Weight.java ├── WishDownloadJob.java ├── WishOrder.java └── WishToken.java /allegro-sdk/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | cross-border-electronic-commerce 7 | io.github 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | allegro-sdk 13 | 14 | 15 | 8 16 | 8 17 | 18 | 19 | 20 | org.projectlombok 21 | lombok 22 | 1.18.22 23 | 24 | 25 | org.springframework 26 | spring-web 27 | 5.3.16 28 | 29 | 30 | com.fasterxml.jackson.core 31 | jackson-databind 32 | 2.13.2 33 | 34 | 35 | org.junit.jupiter 36 | junit-jupiter 37 | 5.5.2 38 | compile 39 | 40 | 41 | -------------------------------------------------------------------------------- /allegro-sdk/readme.md: -------------------------------------------------------------------------------- 1 | Allegro 2 | =========== 3 | 4 |

Allegro波兰电商平台是东欧最大拍卖网站.成立于1999年,于2020年在华沙证券交易所(WSE)上市。作为波兰认知度最高的品牌之Allegro是波兰最受欢迎的在线购物平台,同时也是波兰本土最大电商平台。Allegro目前主要面向消费者,但现已开通面向所有欧盟消费者的销售业务,并将持续扩张中东欧市场。平台以超高的月访问量跻身全球十大电商平台排名,是欧洲市场主要的蓝海平台之一。

5 | 6 | Allegro开发平台: https://developer.allegro.pl/documentation/ -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/AllegroClient.java: -------------------------------------------------------------------------------- 1 | package io.github; 2 | 3 | import io.github.vo.AllegroToken; 4 | import org.springframework.http.HttpEntity; 5 | import org.springframework.http.HttpHeaders; 6 | import org.springframework.http.HttpMethod; 7 | import org.springframework.http.ResponseEntity; 8 | import org.springframework.web.client.RestOperations; 9 | 10 | import java.net.URI; 11 | 12 | /** 13 | * Created by EalenXie on 2022/3/18 12:57 14 | * https://developer.allegro.pl/documentation/#section/Authentication 15 | * 16 | */ 17 | public abstract class AllegroClient { 18 | 19 | 20 | private final RestOperations restOperations; 21 | /** 22 | * Allegro 认证服务器的域名 https://api.allegro.pl 23 | */ 24 | public static final String AUTH_HOST = "https://allegro.pl"; 25 | /** 26 | * Allegro 认证服务器的域名(沙箱环境) https://allegro.pl.allegrosandbox.pl 27 | * https://developer.allegro.pl/about/#%c5%9brodowisko-testowe 28 | */ 29 | public static final String AUTH_SANDBOX_HOST = "https://allegro.pl.allegrosandbox.pl"; 30 | /** 31 | * Allegro 资源服务器的域名 https://api.allegro.pl 32 | */ 33 | public static final String API_HOST = "https://api.allegro.pl"; 34 | /** 35 | * Allegro 资源服务器的域名(沙箱环境) https://api.allegro.pl.allegrosandbox.pl 36 | */ 37 | public static final String API_SANDBOX_HOST = "https://api.allegro.pl.allegrosandbox.pl"; 38 | 39 | /** 40 | * 是否沙箱环境 41 | */ 42 | private boolean sandBox = false; 43 | 44 | public boolean isSandBox() { 45 | return sandBox; 46 | } 47 | 48 | public void setSandBox(boolean sandBox) { 49 | this.sandBox = sandBox; 50 | } 51 | 52 | protected AllegroClient(RestOperations restOperations) { 53 | this.restOperations = restOperations; 54 | } 55 | 56 | public RestOperations getRestOperations() { 57 | return restOperations; 58 | } 59 | 60 | /** 61 | * 获取包含认证的Allegro Bearer 标准请求头 62 | * 63 | * @param accessToken 令牌 64 | */ 65 | public HttpHeaders getBearerHeaders(String accessToken) { 66 | HttpHeaders bearTokenHeader = new HttpHeaders(); 67 | bearTokenHeader.setBearerAuth(accessToken); 68 | bearTokenHeader.set("Content-Type", "application/vnd.allegro.public.v1+json"); 69 | bearTokenHeader.set("Accept", "application/vnd.allegro.public.v1+json"); 70 | return bearTokenHeader; 71 | } 72 | 73 | /** 74 | * 获取包含认证的 Basic 标准请求头 75 | * 76 | * @param clientId 客户端Id 77 | * @param clientSecret 客户端密钥 78 | */ 79 | public HttpHeaders getBasicHeaders(String clientId, String clientSecret) { 80 | HttpHeaders basicHeader = new HttpHeaders(); 81 | basicHeader.setBasicAuth(clientId, clientSecret); 82 | return basicHeader; 83 | } 84 | 85 | /** 86 | * 获取授权地址 文档: https://developer.allegro.pl/auth/#autoryzacja-u%c5%bcytkownika 87 | * 88 | * @param clientId 客户端Id 89 | * @param redirectUri 重定向URL 90 | * @return 获取授权地址, 用户在此生成的地址上进行授权, 获取到code 91 | */ 92 | public String authorize(String clientId, String redirectUri) { 93 | return String.format("%s/auth/oauth/authorize?response_type=code&client_id=%s&redirect_uri=%s", isSandBox() ? AUTH_SANDBOX_HOST : AUTH_HOST, clientId, redirectUri); 94 | } 95 | 96 | /** 97 | * 授权码模式获取accessToken 文档: https://developer.allegro.pl/auth/#autoryzacja-u%c5%bcytkownika 98 | * 99 | * @param clientId 客户端Id 100 | * @param clientSecret 客户端密钥 101 | * @param code 授权码 102 | * @param redirectUri 重定向地址 103 | */ 104 | public ResponseEntity accessToken(String clientId, String clientSecret, String code, String redirectUri) { 105 | HttpHeaders headers = getBasicHeaders(clientId, clientSecret); 106 | return restOperations.exchange(URI.create(String.format("%s/auth/oauth/token?grant_type=authorization_code&code=%s&redirect_uri=%s", isSandBox() ? AUTH_SANDBOX_HOST : AUTH_HOST, code, redirectUri)), HttpMethod.POST, new HttpEntity<>(null, headers), AllegroToken.class); 107 | } 108 | 109 | /** 110 | * 刷新令牌 文档:https://developer.allegro.pl/auth/#przed%c5%82u%c5%bcenie-wa%c5%bcno%c5%9bci-tokena 111 | * 112 | * @param clientId 客户端Id 113 | * @param clientSecret 客户端密钥 114 | * @param refreshToken 刷新令牌 115 | * @param redirectUri 重定向地址 116 | */ 117 | public ResponseEntity refreshToken(String clientId, String clientSecret, String refreshToken, String redirectUri) { 118 | HttpHeaders headers = getBasicHeaders(clientId, clientSecret); 119 | return restOperations.exchange(URI.create(String.format("%s/auth/oauth/token?grant_type=refresh_token&refresh_token=%s&redirect_uri=%s", isSandBox() ? AUTH_SANDBOX_HOST : AUTH_HOST, refreshToken, redirectUri)), HttpMethod.POST, new HttpEntity<>(null, headers), AllegroToken.class); 120 | } 121 | 122 | 123 | } 124 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/AllegroOrderClient.java: -------------------------------------------------------------------------------- 1 | package io.github; 2 | 3 | 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import io.github.dto.*; 6 | import io.github.vo.*; 7 | import io.github.vo.checkoutform.CheckoutForm; 8 | import io.github.vo.orderevent.OrderEvent; 9 | import org.springframework.http.HttpEntity; 10 | import org.springframework.http.HttpHeaders; 11 | import org.springframework.http.HttpMethod; 12 | import org.springframework.http.ResponseEntity; 13 | import org.springframework.util.LinkedMultiValueMap; 14 | import org.springframework.web.client.RestOperations; 15 | import org.springframework.web.client.RestTemplate; 16 | import org.springframework.web.util.UriComponentsBuilder; 17 | 18 | import java.net.URI; 19 | import java.util.Map; 20 | 21 | /** 22 | * Created by EalenXie on 2022/2/21 12:59 23 | * 接口文档地址 : https://developer.allegro.pl/documentation 24 | * https://developer.allegro.pl/documentation/#tag/Order-management 25 | */ 26 | public class AllegroOrderClient extends AllegroClient { 27 | 28 | private final ObjectMapper mapper; 29 | 30 | public AllegroOrderClient() { 31 | this(new RestTemplate()); 32 | } 33 | 34 | public AllegroOrderClient(RestOperations restOperations) { 35 | this(new ObjectMapper(), restOperations); 36 | } 37 | 38 | public AllegroOrderClient(ObjectMapper objectMapper, RestOperations restOperations) { 39 | super(restOperations); 40 | this.mapper = objectMapper; 41 | } 42 | 43 | /** 44 | * 获取用户订单 45 | * 接口文档 https://developer.allegro.pl/documentation/#operation/getListOfOrdersUsingGET 46 | * 47 | * @param dto 用户订单查询参数 48 | * @param accessToken 令牌 49 | * @return {@link CheckoutForms} 订单详情 50 | */ 51 | public ResponseEntity userOrders(OrdersDTO dto, String accessToken) { 52 | HttpHeaders headers = getBearerHeaders(accessToken); 53 | @SuppressWarnings("unchecked") Map args = mapper.convertValue(dto, Map.class); 54 | UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(String.format("%s/order/checkout-forms", isSandBox() ? API_SANDBOX_HOST : API_HOST)); 55 | LinkedMultiValueMap req = new LinkedMultiValueMap<>(); 56 | req.setAll(args); 57 | builder.queryParams(req); 58 | URI uri = builder.build().encode().toUri(); 59 | return getRestOperations().exchange(uri, HttpMethod.GET, new HttpEntity<>(null, headers), CheckoutForms.class); 60 | } 61 | 62 | 63 | /** 64 | * 获取订单详情 65 | * 接口文档 https://developer.allegro.pl/documentation/#operation/getOrdersDetailsUsingGET 66 | * 67 | * @param orderId 订单Id 68 | * @param accessToken 令牌 69 | * @return {@link CheckoutForm} 订单详情 70 | */ 71 | public ResponseEntity ordersDetails(String orderId, String accessToken) { 72 | HttpHeaders headers = getBearerHeaders(accessToken); 73 | return getRestOperations().exchange(URI.create(String.format("%s/order/checkout-forms/%s", isSandBox() ? API_SANDBOX_HOST : API_HOST, orderId)), HttpMethod.GET, new HttpEntity<>(null, headers), CheckoutForm.class); 74 | } 75 | 76 | /** 77 | * 订单标记发货 78 | * https://developer.allegro.pl/documentation/#operation/createOrderShipmentsUsingPOST 79 | * 80 | * @param orderId 订单Id 81 | * @param dto 标记发货请求参数 82 | * @param accessToken 请求token 83 | * @return {@link Shipment} 标记发货 84 | */ 85 | public ResponseEntity shipments(String orderId, ShipmentDTO dto, String accessToken) { 86 | HttpHeaders headers = getBearerHeaders(accessToken); 87 | HttpEntity mapHttpEntity = new HttpEntity<>(dto, headers); 88 | return getRestOperations().exchange(String.format("%s/order/checkout-forms/%s/shipments", isSandBox() ? API_SANDBOX_HOST : API_HOST, orderId), HttpMethod.POST, mapHttpEntity, Shipment.class); 89 | } 90 | 91 | /** 92 | * 获取物流追踪号 93 | * https://developer.allegro.pl/documentation/#operation/getOrderShipmentsUsingGET 94 | * 95 | * @param orderId 订单Id 96 | * @param accessToken 请求token 97 | * @return {@link Shipment} 物流返回对象 98 | */ 99 | public ResponseEntity shipments(String orderId, String accessToken) { 100 | HttpHeaders headers = getBearerHeaders(accessToken); 101 | return getRestOperations().exchange(String.format("%s/order/checkout-forms/%s/shipments", isSandBox() ? API_SANDBOX_HOST : API_HOST, orderId), HttpMethod.GET, new HttpEntity<>(null, headers), Shipment.class); 102 | } 103 | 104 | 105 | /** 106 | * https://developer.allegro.pl/documentation/#operation/getOrderEventsUsingGET 107 | * 108 | * @param dto 事件查询参数 109 | * @param accessToken 请求token 110 | * @return {@link OrderEvent} 111 | */ 112 | public ResponseEntity events(OrderEventDTO dto, String accessToken) { 113 | HttpHeaders headers = getBearerHeaders(accessToken); 114 | @SuppressWarnings("unchecked") Map args = mapper.convertValue(dto, Map.class); 115 | UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(String.format("%s/order/events", isSandBox() ? API_SANDBOX_HOST : API_HOST)); 116 | LinkedMultiValueMap req = new LinkedMultiValueMap<>(); 117 | req.setAll(args); 118 | builder.queryParams(req); 119 | return getRestOperations().exchange(builder.build().encode().toUri(), HttpMethod.GET, new HttpEntity<>(null, headers), OrderEvent.class); 120 | } 121 | 122 | /** 123 | * https://developer.allegro.pl/documentation/#operation/getOrderEventsStatisticsUsingGET 124 | * 125 | * @param accessToken 请求token 126 | * @return {@link EventStats} 127 | */ 128 | public ResponseEntity eventStats(String accessToken) { 129 | HttpHeaders headers = getBearerHeaders(accessToken); 130 | return getRestOperations().exchange(String.format("%s/order/event-stats", isSandBox() ? API_SANDBOX_HOST : API_HOST), HttpMethod.GET, new HttpEntity<>(null, headers), EventStats.class); 131 | } 132 | 133 | 134 | /** 135 | * https://developer.allegro.pl/documentation/#operation/getOrdersCarriersUsingGET 136 | * 137 | * @param accessToken 请求token 138 | * @return {@link OrderCarriers} 139 | */ 140 | public ResponseEntity orderCarriers(String accessToken) { 141 | HttpHeaders headers = getBearerHeaders(accessToken); 142 | return getRestOperations().exchange(String.format("%s/order/carriers", isSandBox() ? API_SANDBOX_HOST : API_HOST), HttpMethod.GET, new HttpEntity<>(null, headers), OrderCarriers.class); 143 | } 144 | 145 | 146 | /** 147 | * 修改订单状态 148 | * https://developer.allegro.pl/documentation/#operation/setOrderFulfillmentUsingPUT 149 | * 150 | * @param orderId 订单Id 151 | * @param dto 修改订单状态请求参数 152 | * @param accessToken 请求token 153 | */ 154 | public ResponseEntity fulfillment(String orderId, FulfillmentDTO dto, String accessToken) { 155 | getRestOperations().put(String.format("%s/order/checkout-forms/%s/fulfillment", isSandBox() ? API_SANDBOX_HOST : API_HOST, orderId), new HttpEntity<>(dto, getBearerHeaders(accessToken))); 156 | return ResponseEntity.ok().build(); 157 | } 158 | 159 | /** 160 | * 发票 161 | * https://developer.allegro.pl/documentation/#operation/getOrderShipmentsUsingGET 162 | * 163 | * @param orderId 订单Id 164 | * @param accessToken 请求token 165 | * @return {@link Invoices} 发票 166 | */ 167 | public ResponseEntity invoices(String orderId, String accessToken) { 168 | HttpHeaders headers = getBearerHeaders(accessToken); 169 | return getRestOperations().exchange(String.format("%s/order/checkout-forms/%s/invoices", isSandBox() ? API_SANDBOX_HOST : API_HOST, orderId), HttpMethod.GET, new HttpEntity<>(null, headers), Invoices.class); 170 | } 171 | 172 | 173 | /** 174 | * 新增发票 175 | * https://developer.allegro.pl/documentation/#operation/addOrderInvoicesMetadata 176 | * 177 | * @param orderId 订单Id 178 | * @param dto 发票请求参数 179 | * @param accessToken 请求token 180 | * @return {@link IdVO} IdVO 181 | */ 182 | public ResponseEntity invoices(String orderId, InvoicesDTO dto, String accessToken) { 183 | HttpHeaders headers = getBearerHeaders(accessToken); 184 | return getRestOperations().exchange(String.format("%s/order/checkout-forms/%s/invoices", isSandBox() ? API_SANDBOX_HOST : API_HOST, orderId), HttpMethod.POST, new HttpEntity<>(dto, headers), IdVO.class); 185 | } 186 | 187 | 188 | } 189 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/dto/FulfillmentDTO.java: -------------------------------------------------------------------------------- 1 | package io.github.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/18 14:57 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class FulfillmentDTO { 13 | 14 | 15 | @JsonProperty("status") 16 | private String status; 17 | @JsonProperty("shipmentSummary") 18 | private ShipmentSummary shipmentSummary; 19 | 20 | @NoArgsConstructor 21 | @Data 22 | public static class ShipmentSummary { 23 | @JsonProperty("lineItemsSent") 24 | private String lineItemsSent; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/dto/InvoicesDTO.java: -------------------------------------------------------------------------------- 1 | package io.github.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/18 15:17 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class InvoicesDTO { 13 | 14 | 15 | @JsonProperty("file") 16 | private File file; 17 | @JsonProperty("invoiceNumber") 18 | private String invoiceNumber; 19 | 20 | @NoArgsConstructor 21 | @Data 22 | public static class File { 23 | @JsonProperty("name") 24 | private String name; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/dto/OrderEventDTO.java: -------------------------------------------------------------------------------- 1 | package io.github.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/18 13:24 9 | */ 10 | @Getter 11 | @Setter 12 | public class OrderEventDTO { 13 | @JsonInclude(JsonInclude.Include.NON_NULL) 14 | private String from; 15 | @JsonInclude(JsonInclude.Include.NON_NULL) 16 | private String type; 17 | @JsonInclude(JsonInclude.Include.NON_NULL) 18 | private Integer limit; 19 | } 20 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/dto/OrdersDTO.java: -------------------------------------------------------------------------------- 1 | package io.github.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | /** 9 | * Created by EalenXie on 2022/2/21 16:05 10 | */ 11 | @Getter 12 | @Setter 13 | public class OrdersDTO { 14 | @JsonInclude(JsonInclude.Include.NON_NULL) 15 | private String offset; 16 | 17 | @JsonInclude(JsonInclude.Include.NON_NULL) 18 | private String limit; 19 | 20 | @JsonInclude(JsonInclude.Include.NON_NULL) 21 | private String status; 22 | 23 | @JsonInclude(JsonInclude.Include.NON_NULL) 24 | @JsonProperty("fulfillment.status") 25 | private String fulfillmentStatus; 26 | 27 | @JsonInclude(JsonInclude.Include.NON_NULL) 28 | @JsonProperty("fulfillment.shipmentSummary.lineItemsSent") 29 | private String lineItemsSent; 30 | 31 | @JsonInclude(JsonInclude.Include.NON_NULL) 32 | @JsonProperty("lineItems.boughtAt.lte") 33 | private String boughtAtLte; 34 | 35 | @JsonInclude(JsonInclude.Include.NON_NULL) 36 | @JsonProperty("lineItems.boughtAt.gte") 37 | private String boughtAtGte; 38 | 39 | @JsonInclude(JsonInclude.Include.NON_NULL) 40 | @JsonProperty("payment.id") 41 | private String paymentId; 42 | 43 | @JsonInclude(JsonInclude.Include.NON_NULL) 44 | @JsonProperty("surcharges.id") 45 | private String surchargesId; 46 | 47 | @JsonInclude(JsonInclude.Include.NON_NULL) 48 | @JsonProperty("delivery.method.id") 49 | private String deliveryMethodId; 50 | 51 | @JsonInclude(JsonInclude.Include.NON_NULL) 52 | @JsonProperty("buyer.login") 53 | private String buyerLogin; 54 | 55 | @JsonInclude(JsonInclude.Include.NON_NULL) 56 | @JsonProperty("updatedAt.lte") 57 | private String updatedAtLte; 58 | 59 | @JsonInclude(JsonInclude.Include.NON_NULL) 60 | @JsonProperty("updatedAt.gte") 61 | private String updatedAtGte; 62 | /** 63 | * "lineItems.boughtAt" "-lineItems.boughtAt" "updatedAt" "-updatedAt" 64 | */ 65 | @JsonInclude(JsonInclude.Include.NON_NULL) 66 | private String sort; 67 | 68 | } 69 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/dto/ShipmentDTO.java: -------------------------------------------------------------------------------- 1 | package io.github.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by EalenXie on 2022/3/16 10:48 12 | */ 13 | @NoArgsConstructor 14 | @Data 15 | public class ShipmentDTO { 16 | 17 | 18 | @JsonProperty("carrierId") 19 | private String carrierId; 20 | @JsonProperty("waybill") 21 | private String waybill; 22 | @JsonProperty("carrierName") 23 | private String carrierName; 24 | @JsonProperty("lineItems") 25 | private List lineItems; 26 | 27 | @NoArgsConstructor 28 | @Data 29 | @AllArgsConstructor 30 | public static class LineItems { 31 | @JsonProperty("id") 32 | private String id; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/AllegroToken.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/2/21 14:15 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class AllegroToken { 13 | 14 | @JsonProperty("access_token") 15 | private String accessToken; 16 | @JsonProperty("token_type") 17 | private String tokenType; 18 | @JsonProperty("refresh_token") 19 | private String refreshToken; 20 | @JsonProperty("expires_in") 21 | private Integer expiresIn; 22 | @JsonProperty("scope") 23 | private String scope; 24 | @JsonProperty("allegro_api") 25 | private Boolean allegroApi; 26 | @JsonProperty("jti") 27 | private String jti; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/CheckoutForms.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import io.github.vo.checkoutform.CheckoutForm; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by EalenXie on 2022/2/21 15:59 12 | */ 13 | @NoArgsConstructor 14 | @Data 15 | public class CheckoutForms { 16 | 17 | @JsonProperty("checkoutForms") 18 | private List checkoutFormList; 19 | @JsonProperty("count") 20 | private Integer count; 21 | @JsonProperty("totalCount") 22 | private Integer totalCount; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/EventStats.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/18 13:30 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class EventStats { 13 | 14 | 15 | @JsonProperty("latestEvent") 16 | private LatestEvent latestEvent; 17 | 18 | @NoArgsConstructor 19 | @Data 20 | public static class LatestEvent { 21 | @JsonProperty("id") 22 | private String id; 23 | @JsonProperty("occurredAt") 24 | private String occurredAt; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/IdVO.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/18 15:20 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class IdVO { 13 | 14 | @JsonProperty("id") 15 | private String id; 16 | } 17 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/Invoices.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/18 15:05 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class Invoices { 15 | 16 | 17 | @JsonProperty("invoices") 18 | private List invoicesList; 19 | 20 | @NoArgsConstructor 21 | @Data 22 | public static class InvoicesDTO { 23 | @JsonProperty("id") 24 | private String id; 25 | @JsonProperty("invoiceNumber") 26 | private String invoiceNumber; 27 | @JsonProperty("createdAt") 28 | private String createdAt; 29 | @JsonProperty("file") 30 | private FileDTO file; 31 | @JsonProperty("eptVerification") 32 | private EptVerificationDTO eptVerification; 33 | 34 | @NoArgsConstructor 35 | @Data 36 | public static class FileDTO { 37 | @JsonProperty("name") 38 | private String name; 39 | @JsonProperty("uploadedAt") 40 | private String uploadedAt; 41 | @JsonProperty("securityVerification") 42 | private SecurityVerificationDTO securityVerification; 43 | 44 | @NoArgsConstructor 45 | @Data 46 | public static class SecurityVerificationDTO { 47 | @JsonProperty("status") 48 | private String status; 49 | @JsonProperty("verifiedAt") 50 | private String verifiedAt; 51 | } 52 | } 53 | 54 | @NoArgsConstructor 55 | @Data 56 | public static class EptVerificationDTO { 57 | @JsonProperty("status") 58 | private String status; 59 | @JsonProperty("verifiedAt") 60 | private String verifiedAt; 61 | @JsonProperty("reasons") 62 | private List reasons; 63 | 64 | @NoArgsConstructor 65 | @Data 66 | public static class ReasonsDTO { 67 | @JsonProperty("id") 68 | private String id; 69 | @JsonProperty("message") 70 | private String message; 71 | } 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/OrderCarriers.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/18 14:43 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class OrderCarriers { 15 | 16 | 17 | @JsonProperty("carriers") 18 | private List carriers; 19 | 20 | @NoArgsConstructor 21 | @Data 22 | public static class Carriers { 23 | @JsonProperty("id") 24 | private String id; 25 | @JsonProperty("name") 26 | private String name; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/Shipment.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/16 10:51 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class Shipment { 15 | 16 | @JsonProperty("id") 17 | private String id; 18 | @JsonProperty("waybill") 19 | private String waybill; 20 | @JsonProperty("carrierId") 21 | private String carrierId; 22 | @JsonProperty("carrierName") 23 | private String carrierName; 24 | @JsonProperty("lineItems") 25 | private List lineItems; 26 | @JsonProperty("createdAt") 27 | private String createdAt; 28 | 29 | @NoArgsConstructor 30 | @Data 31 | public static class LineItems { 32 | @JsonProperty("id") 33 | private String id; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/Buyer.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Buyer { 13 | @JsonProperty("id") 14 | private String id; 15 | @JsonProperty("email") 16 | private String email; 17 | @JsonProperty("login") 18 | private String login; 19 | @JsonProperty("firstName") 20 | private String firstName; 21 | @JsonProperty("lastName") 22 | private String lastName; 23 | @JsonProperty("companyName") 24 | private Object companyName; 25 | @JsonProperty("guest") 26 | private Boolean guest; 27 | @JsonProperty("personalIdentity") 28 | private String personalIdentity; 29 | @JsonProperty("phoneNumber") 30 | private Object phoneNumber; 31 | @JsonProperty("address") 32 | private BuyerAddress address; 33 | } 34 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/BuyerAddress.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class BuyerAddress { 13 | @JsonProperty("street") 14 | private String street; 15 | @JsonProperty("city") 16 | private String city; 17 | @JsonProperty("postCode") 18 | private String postCode; 19 | @JsonProperty("countryCode") 20 | private String countryCode; 21 | } 22 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/CheckoutForm.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/24 14:39 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class CheckoutForm { 15 | 16 | @JsonProperty("id") 17 | private String id; 18 | @JsonProperty("messageToSeller") 19 | private String messageToSeller; 20 | @JsonProperty("buyer") 21 | private Buyer buyer; 22 | @JsonProperty("payment") 23 | private Payment payment; 24 | @JsonProperty("status") 25 | private String status; 26 | @JsonProperty("fulfillment") 27 | private Fulfillment fulfillment; 28 | @JsonProperty("delivery") 29 | private Delivery delivery; 30 | @JsonProperty("invoice") 31 | private Invoice invoice; 32 | @JsonProperty("lineItems") 33 | private List lineItems; 34 | @JsonProperty("surcharges") 35 | private List surcharges; 36 | @JsonProperty("discounts") 37 | private List discounts; 38 | @JsonProperty("summary") 39 | private Summary summary; 40 | @JsonProperty("updatedAt") 41 | private String updatedAt; 42 | @JsonProperty("revision") 43 | private String revision; 44 | } 45 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/Company.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Company { 13 | @JsonProperty("name") 14 | private String name; 15 | @JsonProperty("taxId") 16 | private Object taxId; 17 | } 18 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/Delivery.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Delivery { 13 | @JsonProperty("address") 14 | private DeliveryAddress address; 15 | @JsonProperty("method") 16 | private Method method; 17 | @JsonProperty("pickupPoint") 18 | private PickupPoint pickupPoint; 19 | @JsonProperty("cost") 20 | private PaidAmount cost; 21 | @JsonProperty("time") 22 | private Time time; 23 | @JsonProperty("smart") 24 | private Boolean smart; 25 | @JsonProperty("calculatedNumberOfPackages") 26 | private Integer calculatedNumberOfPackages; 27 | } 28 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/DeliveryAddress.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class DeliveryAddress { 13 | @JsonProperty("firstName") 14 | private String firstName; 15 | @JsonProperty("lastName") 16 | private String lastName; 17 | @JsonProperty("street") 18 | private String street; 19 | @JsonProperty("city") 20 | private String city; 21 | @JsonProperty("zipCode") 22 | private String zipCode; 23 | @JsonProperty("countryCode") 24 | private String countryCode; 25 | @JsonProperty("companyName") 26 | private Object companyName; 27 | @JsonProperty("phoneNumber") 28 | private Object phoneNumber; 29 | @JsonProperty("modifiedAt") 30 | private Object modifiedAt; 31 | } 32 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/Fulfillment.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Fulfillment { 13 | @JsonProperty("status") 14 | private String status; 15 | @JsonProperty("shipmentSummary") 16 | private ShipmentSummary shipmentSummary; 17 | } 18 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/Guaranteed.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Guaranteed { 13 | @JsonProperty("from") 14 | private String from; 15 | @JsonProperty("to") 16 | private String to; 17 | } 18 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/Invoice.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Invoice { 13 | @JsonProperty("required") 14 | private Boolean required; 15 | @JsonProperty("address") 16 | private InvoiceAddress address; 17 | @JsonProperty("dueDate") 18 | private String dueDate; 19 | } 20 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/InvoiceAddress.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class InvoiceAddress { 13 | @JsonProperty("street") 14 | private String street; 15 | @JsonProperty("city") 16 | private String city; 17 | @JsonProperty("zipCode") 18 | private String zipCode; 19 | @JsonProperty("countryCode") 20 | private String countryCode; 21 | @JsonProperty("company") 22 | private Company company; 23 | @JsonProperty("naturalPerson") 24 | private Buyer naturalPerson; 25 | } 26 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/LineItems.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/24 14:39 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class LineItems { 15 | @JsonProperty("id") 16 | private String id; 17 | @JsonProperty("offer") 18 | private Offer offer; 19 | @JsonProperty("quantity") 20 | private Integer quantity; 21 | @JsonProperty("originalPrice") 22 | private PaidAmount originalPrice; 23 | @JsonProperty("price") 24 | private PaidAmount price; 25 | @JsonProperty("reconciliation") 26 | private Reconciliation reconciliation; 27 | @JsonProperty("selectedAdditionalServices") 28 | private List selectedAdditionalServices; 29 | @JsonProperty("boughtAt") 30 | private String boughtAt; 31 | } 32 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/Method.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Method { 13 | @JsonProperty("id") 14 | private String id; 15 | @JsonProperty("name") 16 | private String name; 17 | } 18 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/Offer.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Offer { 13 | @JsonProperty("id") 14 | private String id; 15 | @JsonProperty("name") 16 | private String name; 17 | @JsonProperty("external") 18 | private Buyer external; 19 | } 20 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/PaidAmount.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class PaidAmount { 13 | @JsonProperty("amount") 14 | private String amount; 15 | @JsonProperty("currency") 16 | private String currency; 17 | } 18 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/Payment.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Payment { 13 | @JsonProperty("id") 14 | private String id; 15 | @JsonProperty("type") 16 | private String type; 17 | @JsonProperty("provider") 18 | private String provider; 19 | @JsonProperty("finishedAt") 20 | private String finishedAt; 21 | @JsonProperty("paidAmount") 22 | private PaidAmount paidAmount; 23 | @JsonProperty("reconciliation") 24 | private PaidAmount reconciliation; 25 | } 26 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/PickupPoint.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class PickupPoint { 13 | @JsonProperty("id") 14 | private String id; 15 | @JsonProperty("name") 16 | private String name; 17 | @JsonProperty("description") 18 | private String description; 19 | @JsonProperty("address") 20 | private DeliveryAddress address; 21 | } 22 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/Reconciliation.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Reconciliation { 13 | @JsonProperty("value") 14 | private PaidAmount value; 15 | @JsonProperty("type") 16 | private String type; 17 | @JsonProperty("quantity") 18 | private Integer quantity; 19 | } 20 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/SelectedAdditionalServices.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class SelectedAdditionalServices { 13 | @JsonProperty("definitionId") 14 | private String definitionId; 15 | @JsonProperty("name") 16 | private String name; 17 | @JsonProperty("price") 18 | private PaidAmount price; 19 | @JsonProperty("quantity") 20 | private Integer quantity; 21 | } 22 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/ShipmentSummary.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class ShipmentSummary { 13 | @JsonProperty("lineItemsSent") 14 | private String lineItemsSent; 15 | } 16 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/Summary.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Summary { 13 | @JsonProperty("totalToPay") 14 | private PaidAmount totalToPay; 15 | } 16 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/Surcharges.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Surcharges { 13 | @JsonProperty("id") 14 | private String id; 15 | @JsonProperty("type") 16 | private String type; 17 | @JsonProperty("provider") 18 | private String provider; 19 | @JsonProperty("finishedAt") 20 | private String finishedAt; 21 | @JsonProperty("paidAmount") 22 | private PaidAmount paidAmount; 23 | @JsonProperty("reconciliation") 24 | private PaidAmount reconciliation; 25 | } 26 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/checkoutform/Time.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.checkoutform; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 14:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Time { 13 | @JsonProperty("guaranteed") 14 | private Guaranteed guaranteed; 15 | } 16 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/orderevent/Buyer.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.orderevent; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:08 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Buyer { 13 | @JsonProperty("id") 14 | private String id; 15 | @JsonProperty("email") 16 | private String email; 17 | @JsonProperty("login") 18 | private String login; 19 | @JsonProperty("guest") 20 | private Boolean guest; 21 | } 22 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/orderevent/CheckoutForm.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.orderevent; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:08 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class CheckoutForm { 13 | @JsonProperty("id") 14 | private String id; 15 | @JsonProperty("revision") 16 | private String revision; 17 | } 18 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/orderevent/Events.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.orderevent; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:08 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Events { 13 | @JsonProperty("id") 14 | private String id; 15 | @JsonProperty("order") 16 | private Order order; 17 | @JsonProperty("type") 18 | private String type; 19 | @JsonProperty("occurredAt") 20 | private String occurredAt; 21 | } 22 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/orderevent/LineItems.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.orderevent; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:08 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class LineItems { 13 | @JsonProperty("id") 14 | private String id; 15 | @JsonProperty("offer") 16 | private Offer offer; 17 | @JsonProperty("quantity") 18 | private Integer quantity; 19 | @JsonProperty("originalPrice") 20 | private OriginalPrice originalPrice; 21 | @JsonProperty("price") 22 | private OriginalPrice price; 23 | @JsonProperty("boughtAt") 24 | private String boughtAt; 25 | } 26 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/orderevent/Offer.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.orderevent; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:08 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Offer { 13 | @JsonProperty("id") 14 | private String id; 15 | @JsonProperty("name") 16 | private String name; 17 | @JsonProperty("external") 18 | private Seller external; 19 | } 20 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/orderevent/Order.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.orderevent; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/24 15:08 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class Order { 15 | @JsonProperty("seller") 16 | private Seller seller; 17 | @JsonProperty("buyer") 18 | private Buyer buyer; 19 | @JsonProperty("lineItems") 20 | private List lineItems; 21 | @JsonProperty("checkoutForm") 22 | private CheckoutForm checkoutForm; 23 | } 24 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/orderevent/OrderEvent.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.orderevent; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/24 14:48 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class OrderEvent { 15 | 16 | @JsonProperty("events") 17 | private List events; 18 | } 19 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/orderevent/OriginalPrice.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.orderevent; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:08 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class OriginalPrice { 13 | @JsonProperty("amount") 14 | private String amount; 15 | @JsonProperty("currency") 16 | private String currency; 17 | } 18 | -------------------------------------------------------------------------------- /allegro-sdk/src/main/java/io/github/vo/orderevent/Seller.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.orderevent; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:08 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Seller { 13 | @JsonProperty("id") 14 | private String id; 15 | } 16 | -------------------------------------------------------------------------------- /amazon-sdk/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | cross-border-electronic-commerce 7 | io.github 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | amazon-sdk 13 | 14 | 15 | 8 16 | 8 17 | 18 | 19 | 20 | org.projectlombok 21 | lombok 22 | 1.18.22 23 | 24 | 25 | org.springframework 26 | spring-web 27 | 5.3.16 28 | 29 | 30 | com.fasterxml.jackson.core 31 | jackson-databind 32 | 2.13.2 33 | 34 | 35 | -------------------------------------------------------------------------------- /amazon-sdk/src/main/java/io/github/AmazonClient.java: -------------------------------------------------------------------------------- 1 | package io.github; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import io.github.dto.OrdersDTO; 5 | import io.github.dto.ShipmentDTO; 6 | import io.github.vo.AmazonResponse; 7 | import io.github.vo.AmazonToken; 8 | import io.github.vo.order.AmazonBuyerInfo; 9 | import io.github.vo.order.AmazonOrder; 10 | import io.github.vo.order.AmazonOrderItems; 11 | import io.github.vo.order.AmazonShippingAddress; 12 | import org.springframework.core.ParameterizedTypeReference; 13 | import org.springframework.http.*; 14 | import org.springframework.util.LinkedMultiValueMap; 15 | import org.springframework.web.client.RestOperations; 16 | import org.springframework.web.client.RestTemplate; 17 | import org.springframework.web.util.UriComponentsBuilder; 18 | 19 | import java.net.URI; 20 | import java.util.Map; 21 | 22 | /** 23 | * Created by EalenXie on 2022/2/22 10:13 24 | * 亚马逊订单api https://developer-docs.amazon.com/sp-api/docs/orders-api-v0-reference 25 | */ 26 | public class AmazonClient { 27 | 28 | private final ObjectMapper mapper; 29 | 30 | 31 | private final RestOperations restOperations; 32 | /** 33 | * Amazon 授权地址 https://sellercentral.amazon.com/apps/authorize/consent 34 | */ 35 | private static final String AUTHORIZE_URL = "https://sellercentral.amazon.com/apps/authorize/consent"; 36 | /** 37 | * Amazon 认证接口地址 https://api.amazon.com/auth/o2/token 38 | */ 39 | private static final String TOKEN_URL = "https://api.amazon.com/auth/o2/token"; 40 | /** 41 | * Amazon selling partner(SP) Host地址 https://sellingpartnerapi-na.amazon.com 42 | */ 43 | private static final String SELLING_PARTNER_HOST = "https://sellingpartnerapi-na.amazon.com"; 44 | 45 | 46 | public AmazonClient() { 47 | this(new RestTemplate()); 48 | } 49 | 50 | public AmazonClient(RestOperations restOperations) { 51 | this(new ObjectMapper(), restOperations); 52 | } 53 | 54 | public AmazonClient(ObjectMapper objectMapper, RestOperations restOperations) { 55 | this.mapper = objectMapper; 56 | this.restOperations = restOperations; 57 | } 58 | 59 | 60 | /** 61 | * 获取包含认证的 Bearer 标准请求头 62 | * 63 | * @param accessToken 令牌 64 | */ 65 | public HttpHeaders getBearerHeaders(String accessToken) { 66 | HttpHeaders bearTokenHeader = new HttpHeaders(); 67 | bearTokenHeader.setBearerAuth(accessToken); 68 | return bearTokenHeader; 69 | } 70 | 71 | /** 72 | * 获取包含认证的 Basic 标准请求头 73 | * 74 | * @param clientId 客户端Id 75 | * @param clientSecret 客户端密钥 76 | */ 77 | public HttpHeaders getBasicHeaders(String clientId, String clientSecret) { 78 | HttpHeaders basicHeader = new HttpHeaders(); 79 | basicHeader.setBasicAuth(clientId, clientSecret); 80 | return basicHeader; 81 | } 82 | 83 | /** 84 | * 获取授权地址 文档: https://developer-docs.amazon.com/sp-api/docs/website-authorization-workflow 85 | * 86 | * @param applicationId 应用Id 87 | * @param state 应用程序生成的状态值。 88 | * @param version 如果您包含该参数version=beta,则工作流会授权处于草稿状态的应用程序。如果您不包含该参数,则工作流程会授权在 Amazon Seller Central Partner Network 上发布的应用程序。 89 | */ 90 | public String authorize(String applicationId, String state, String version) { 91 | StringBuilder sb = new StringBuilder(); 92 | sb.append(String.format("%s?application_id=%s&state=%s", AUTHORIZE_URL, applicationId, state)); 93 | if (version != null && version.length() > 0) { 94 | sb.append(String.format("&version=%s", version)); 95 | } 96 | return sb.toString(); 97 | } 98 | 99 | 100 | /** 101 | * 授权码模式获取accessToken 文档: https://developer-docs.amazon.com/sp-api/docs/website-authorization-workflow 102 | * 103 | * @param clientId 客户端Id 104 | * @param clientSecret 客户端密钥 105 | * @param code 授权码 106 | * @param redirectUri 重定向地址 107 | */ 108 | public ResponseEntity accessToken(String clientId, String clientSecret, String code, String redirectUri) { 109 | HttpHeaders headers = getBasicHeaders(clientId, clientSecret); 110 | return restOperations.exchange(URI.create(String.format("%s?grant_type=authorization_code&code=%s&redirect_uri=%s", TOKEN_URL, code, redirectUri)), HttpMethod.POST, new HttpEntity<>(null, headers), AmazonToken.class); 111 | } 112 | 113 | 114 | /** 115 | * 获取订单 116 | * https://developer-docs.amazon.com/sp-api/docs/orders-api-v0-reference#get-ordersv0ordersorderid 117 | * 118 | * @param orderId 亚马逊订单ID 119 | */ 120 | public ResponseEntity> getOrder(String orderId, String nextToken) { 121 | return restOperations.exchange(URI.create(String.format("%s/orders/v0/orders/%s?nextToken=%s", SELLING_PARTNER_HOST, orderId, nextToken)), HttpMethod.GET, new HttpEntity<>(null, new HttpHeaders()), new ParameterizedTypeReference>() { 122 | }); 123 | } 124 | 125 | /** 126 | * 获取订单列表 127 | * https://developer-docs.amazon.com/sp-api/docs/orders-api-v0-reference#get-ordersv0orders 128 | */ 129 | public ResponseEntity> getOrders(OrdersDTO dto) { 130 | @SuppressWarnings("unchecked") Map args = mapper.convertValue(dto, Map.class); 131 | UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(String.format("%s/orders/v0/orders", SELLING_PARTNER_HOST)); 132 | LinkedMultiValueMap req = new LinkedMultiValueMap<>(); 133 | req.setAll(args); 134 | builder.queryParams(req); 135 | URI uri = builder.build().encode().toUri(); 136 | return restOperations.exchange(uri, HttpMethod.GET, new HttpEntity<>(null, new HttpHeaders()), new ParameterizedTypeReference>() { 137 | }); 138 | } 139 | 140 | /** 141 | * 获取订单购买信息 142 | * https://developer-docs.amazon.com/sp-api/docs/orders-api-v0-reference#get-ordersv0ordersorderidbuyerinfo 143 | * 144 | * @param orderId 亚马逊订单ID 145 | */ 146 | public ResponseEntity> orderBuyerInfo(String orderId, String nextToken) { 147 | return restOperations.exchange(URI.create(String.format("%s/orders/v0/orders/%s/buyerInfo?nextToken=%s", SELLING_PARTNER_HOST, orderId, nextToken)), HttpMethod.GET, new HttpEntity<>(null, new HttpHeaders()), new ParameterizedTypeReference>() { 148 | }); 149 | } 150 | 151 | /** 152 | * 获取订单地址信息 153 | * https://developer-docs.amazon.com/sp-api/docs/orders-api-v0-reference#get-ordersv0ordersorderidaddress 154 | * 155 | * @param orderId 亚马逊订单ID 156 | */ 157 | public ResponseEntity> orderAddress(String orderId, String nextToken) { 158 | return restOperations.exchange(URI.create(String.format("%s/orders/v0/orders/%s/address?nextToken=%s", SELLING_PARTNER_HOST, orderId, nextToken)), HttpMethod.GET, new HttpEntity<>(null, new HttpHeaders()), new ParameterizedTypeReference>() { 159 | }); 160 | } 161 | 162 | /** 163 | * 获取订单Item列表 164 | * https://developer-docs.amazon.com/sp-api/docs/orders-api-v0-reference#get-ordersv0ordersorderidorderitems 165 | */ 166 | public ResponseEntity> getOrderItems(String orderId, String nextToken) { 167 | return restOperations.exchange(URI.create(String.format("%s/orders/v0/orders/%s/orderItems?nextToken=%s", SELLING_PARTNER_HOST, orderId, nextToken)), HttpMethod.GET, new HttpEntity<>(null, new HttpHeaders()), new ParameterizedTypeReference>() { 168 | }); 169 | } 170 | 171 | 172 | /** 173 | * 更新发货状态 174 | * https://developer-docs.amazon.com/sp-api/docs/orders-api-v0-reference#post-ordersv0ordersorderidshipment 175 | */ 176 | public ResponseEntity shipment(String orderId, String nextToken, ShipmentDTO dto) { 177 | HttpHeaders headers = new HttpHeaders(); 178 | headers.setContentType(MediaType.APPLICATION_JSON); 179 | HttpEntity httpEntity = new HttpEntity<>(dto, headers); 180 | return restOperations.exchange(URI.create(String.format("%s/orders/v0/orders/%s/shipment?nextToken=%s", SELLING_PARTNER_HOST, orderId, nextToken)), HttpMethod.POST, httpEntity, Void.class); 181 | } 182 | 183 | } 184 | -------------------------------------------------------------------------------- /amazon-sdk/src/main/java/io/github/dto/OrdersDTO.java: -------------------------------------------------------------------------------- 1 | package io.github.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | import org.springframework.lang.NonNull; 8 | 9 | /** 10 | * Created by EalenXie on 2022/2/22 14:54 11 | */ 12 | @Getter 13 | @Setter 14 | public class OrdersDTO { 15 | 16 | 17 | @JsonInclude(JsonInclude.Include.NON_NULL) 18 | @JsonProperty("CreatedAfter") 19 | private String createdAfter; 20 | @JsonInclude(JsonInclude.Include.NON_NULL) 21 | @JsonProperty("CreatedBefore") 22 | private String createdBefore; 23 | @JsonInclude(JsonInclude.Include.NON_NULL) 24 | @JsonProperty("LastUpdatedAfter") 25 | private String lastUpdatedAfter; 26 | @JsonInclude(JsonInclude.Include.NON_NULL) 27 | @JsonProperty("LastUpdatedBefore") 28 | private String lastUpdatedBefore; 29 | @JsonInclude(JsonInclude.Include.NON_NULL) 30 | @JsonProperty("OrderStatuses") 31 | private String[] orderStatuses; 32 | 33 | @NonNull 34 | @JsonProperty("MarketplaceIds") 35 | private String[] marketplaceIds; 36 | 37 | @JsonInclude(JsonInclude.Include.NON_NULL) 38 | @JsonProperty("FulfillmentChannels") 39 | private String[] fulfillmentChannels; 40 | @JsonInclude(JsonInclude.Include.NON_NULL) 41 | @JsonProperty("PaymentMethods") 42 | private String[] paymentMethods; 43 | @JsonInclude(JsonInclude.Include.NON_NULL) 44 | @JsonProperty("BuyerEmail") 45 | private String buyerEmail; 46 | @JsonInclude(JsonInclude.Include.NON_NULL) 47 | @JsonProperty("SellerOrderId") 48 | private String sellerOrderId; 49 | @JsonInclude(JsonInclude.Include.NON_NULL) 50 | @JsonProperty("MaxResultsPerPage") 51 | private Integer maxResultsPerPage; 52 | @JsonInclude(JsonInclude.Include.NON_NULL) 53 | @JsonProperty("EasyShipShipmentStatuses") 54 | private String[] easyShipShipmentStatuses; 55 | 56 | @JsonProperty("NextToken") 57 | private String nextToken; 58 | 59 | @JsonInclude(JsonInclude.Include.NON_NULL) 60 | @JsonProperty("AmazonOrderIds") 61 | private String[] amazonOrderIds; 62 | @JsonInclude(JsonInclude.Include.NON_NULL) 63 | @JsonProperty("ActualFulfillmentSupplySourceId") 64 | private String actualFulfillmentSupplySourceId; 65 | @JsonInclude(JsonInclude.Include.NON_NULL) 66 | @JsonProperty("IsISPU") 67 | private Boolean isISPU; 68 | @JsonInclude(JsonInclude.Include.NON_NULL) 69 | @JsonProperty("StoreChainStoreId") 70 | private String storeChainStoreId; 71 | } 72 | -------------------------------------------------------------------------------- /amazon-sdk/src/main/java/io/github/dto/ShipmentDTO.java: -------------------------------------------------------------------------------- 1 | package io.github.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/2/22 17:49 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class ShipmentDTO { 15 | 16 | 17 | @JsonProperty("marketplaceId") 18 | private String marketplaceId; 19 | @JsonProperty("shipmentStatus") 20 | private String shipmentStatus; 21 | @JsonProperty("orderItems") 22 | private List orderItems; 23 | 24 | @NoArgsConstructor 25 | @Data 26 | public static class OrderItem { 27 | @JsonProperty("orderItemId") 28 | private String orderItemId; 29 | @JsonProperty("quantity") 30 | private Integer quantity; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /amazon-sdk/src/main/java/io/github/vo/AmazonError.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | /** 7 | * Created by EalenXie on 2022/2/22 12:21 8 | */ 9 | @Getter 10 | @Setter 11 | public class AmazonError { 12 | private String code; 13 | private String message; 14 | } 15 | -------------------------------------------------------------------------------- /amazon-sdk/src/main/java/io/github/vo/AmazonResponse.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | import lombok.Setter; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by EalenXie on 2022/2/22 12:20 12 | */ 13 | @Getter 14 | @Setter 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | public class AmazonResponse { 18 | 19 | T payload; 20 | 21 | private List errors; 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /amazon-sdk/src/main/java/io/github/vo/AmazonToken.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/2/22 11:03 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class AmazonToken { 13 | @JsonProperty("access_token") 14 | private String accessToken; 15 | @JsonProperty("token_type") 16 | private String tokenType; 17 | @JsonProperty("expires_in") 18 | private Integer expiresIn; 19 | @JsonProperty("refresh_token") 20 | private String refreshToken; 21 | } 22 | -------------------------------------------------------------------------------- /amazon-sdk/src/main/java/io/github/vo/order/AmazonBuyerInfo.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.order; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/2/22 15:39 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class AmazonBuyerInfo { 15 | 16 | 17 | @JsonProperty("AmazonOrderId") 18 | private String amazonOrderId; 19 | @JsonProperty("BuyerEmail") 20 | private String buyerEmail; 21 | @JsonProperty("BuyerName") 22 | private String buyerName; 23 | @JsonProperty("BuyerCounty") 24 | private String buyerCounty; 25 | @JsonProperty("BuyerTaxInfo") 26 | private BuyerTaxInfo buyerTaxInfo; 27 | @JsonProperty("PurchaseOrderNumber") 28 | private String purchaseOrderNumber; 29 | 30 | @NoArgsConstructor 31 | @Data 32 | public static class BuyerTaxInfo { 33 | @JsonProperty("CompanyLegalName") 34 | private String companyLegalName; 35 | @JsonProperty("TaxingRegion") 36 | private String taxingRegion; 37 | @JsonProperty("TaxClassifications") 38 | private List taxClassifications; 39 | 40 | @NoArgsConstructor 41 | @Data 42 | public static class TaxClassification { 43 | @JsonProperty("Name") 44 | private String name; 45 | @JsonProperty("Value") 46 | private String value; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /amazon-sdk/src/main/java/io/github/vo/order/AmazonOrder.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.order; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/2/22 12:32 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class AmazonOrder { 15 | 16 | 17 | /** 18 | * 亚马逊定义的订单标识符 19 | */ 20 | @JsonProperty("AmazonOrderId") 21 | private String amazonOrderId; 22 | 23 | /** 24 | * 上次更新订单的日期。 25 | */ 26 | @JsonProperty("LastUpdateDate") 27 | private String lastUpdateDate; 28 | /** 29 | * 当前订单状态。 30 | */ 31 | @JsonProperty("OrderStatus") 32 | private String orderStatus; 33 | /** 34 | * 创建订单的日期。 35 | */ 36 | @JsonProperty("PurchaseDate") 37 | private String purchaseDate; 38 | /** 39 | * 卖家定义的订单标识符。 40 | */ 41 | @JsonProperty("SellerOrderId") 42 | private String sellerOrderId; 43 | /** 44 | * 订单是由亚马逊 (AFN) 还是由卖家 (MFN) 完成的。 45 | */ 46 | @JsonProperty("FulfillmentChannel") 47 | private String fulfillmentChannel; 48 | /** 49 | * 订单中第一项的销售渠道。 50 | */ 51 | @JsonProperty("SalesChannel") 52 | private String salesChannel; 53 | /** 54 | * 订单中第一项的订单渠道。 55 | */ 56 | @JsonProperty("OrderChannel") 57 | private String orderChannel; 58 | /** 59 | * 订单的发货服务级别。 60 | */ 61 | @JsonProperty("ShipServiceLevel") 62 | private String shipServiceLevel; 63 | /** 64 | * 此订单的总费用。 65 | */ 66 | @JsonProperty("OrderTotal") 67 | private OrderTotal orderTotal; 68 | /** 69 | * 运送的物品数量。。 70 | */ 71 | @JsonProperty("NumberOfItemsShipped") 72 | private Integer numberOfItemsShipped; 73 | /** 74 | * 未发货的商品数量。。。 75 | */ 76 | @JsonProperty("NumberOfItemsUnshipped") 77 | private Integer numberOfItemsUnshipped; 78 | /** 79 | * 可选 有关货到付款 (COD) 订单的子付款方式的信息。 80 | */ 81 | @JsonProperty("PaymentExecutionDetail") 82 | private List paymentExecutionDetail; 83 | /** 84 | * 订单的付款方式。此住宿仅限于货到付款 (COD) 和便利店 (CVS) 付款方式。 85 | */ 86 | @JsonProperty("PaymentMethod") 87 | private String paymentMethod; 88 | /** 89 | * 订单的付款方式列表。 90 | */ 91 | @JsonProperty("PaymentMethodDetails") 92 | private List paymentMethodDetails; 93 | /** 94 | * 下订单的市场的标识符。 95 | */ 96 | @JsonProperty("MarketplaceId") 97 | private String marketplaceId; 98 | /** 99 | * 订单的发货服务级别类别。 100 | *

101 | * 可能的值:Expedited、FreeEconomy、NextDay、SameDay、SecondDay、Scheduled、Standard。 102 | */ 103 | @JsonProperty("ShipmentServiceLevelCategory") 104 | private String shipmentServiceLevelCategory; 105 | /** 106 | * 亚马逊 Easy Ship 订单的状态。此属性仅适用于 Amazon Easy Ship 订单。 107 | *

108 | * 可能的值:PendingPickUp、LabelCanceled、PickedUp、OutForDelivery、Damaged、Delivered、RejectedByBuyer、Undeliverable、ReturnedToSeller、ReturningToSeller 109 | */ 110 | @JsonProperty("EasyShipShipmentStatus") 111 | private String easyShipShipmentStatus; 112 | /** 113 | * 亚马逊结账 (CBA) 的自定义发货标签。 114 | */ 115 | @JsonProperty("CbaDisplayableShippingLabel") 116 | private String cbaDisplayableShippingLabel; 117 | /** 118 | * 订单的类型。 119 | */ 120 | @JsonProperty("OrderType") 121 | private String orderType; 122 | /** 123 | * 最早发货日期 124 | */ 125 | @JsonProperty("EarliestShipDate") 126 | private String earliestShipDate; 127 | /** 128 | * 最新发货日期 129 | */ 130 | @JsonProperty("LatestShipDate") 131 | private String latestShipDate; 132 | /** 133 | * 最早交货日期 134 | */ 135 | @JsonProperty("EarliestDeliveryDate") 136 | private String earliestDeliveryDate; 137 | /** 138 | * 最新交货日期 139 | */ 140 | @JsonProperty("LatestDeliveryDate") 141 | private String latestDeliveryDate; 142 | /** 143 | * 如果为 true,则该订单是 Amazon Business 订单。亚马逊商业订单是买家是经过验证的商业买家的订单。 144 | */ 145 | @JsonProperty("IsBusinessOrder") 146 | private Boolean isBusinessOrder; 147 | /** 148 | * 如果为真,则该订单是卖家自配送的 Amazon Prime 订单。 149 | */ 150 | @JsonProperty("IsPrime") 151 | private Boolean isPrime; 152 | /** 153 | *如果为真,则订单具有优先配送服务水平协议。有关优先配送订单的更多信息,请参阅适用于您的商城的卖家平台帮助中的“优先配送选项”。 154 | */ 155 | @JsonProperty("IsPremiumOrder") 156 | private Boolean isPremiumOrder; 157 | /** 158 | * 如果为真,则订单为 GlobalExpress 订单。 159 | */ 160 | @JsonProperty("IsGlobalExpressEnabled") 161 | private Boolean isGlobalExpressEnabled; 162 | /** 163 | * 正在被替换的订单的订单 ID 值。仅当 IsReplacementOrder = true 时返回。 164 | */ 165 | @JsonProperty("ReplacedOrderId") 166 | private String replacedOrderId; 167 | /** 168 | * 如果为真,这是一个替换订单 169 | */ 170 | @JsonProperty("IsReplacementOrder") 171 | private Boolean isReplacementOrder; 172 | /** 173 | * 表示卖方必须以预计发货日期回复买方的日期。仅针对 Sourcing on Demand 订单退货。 174 | */ 175 | @JsonProperty("PromiseResponseDueDate") 176 | private String promiseResponseDueDate; 177 | /** 178 | * 如果为真,则为订单设置预计发货日期。仅针对 Sourcing on Demand 订单退货。 179 | */ 180 | @JsonProperty("IsEstimatedShipDateSet") 181 | private Boolean isEstimatedShipDateSet; 182 | /** 183 | * 如果为真,则此订单中的商品由 Amazon Business EU SARL (ABEU) 购买并转售。通过购买并立即转售您的商品,ABEU 成为记录卖家,将您的库存出售给不会从第三方卖家购买的客户。 184 | */ 185 | @JsonProperty("IsSoldByAB") 186 | private Boolean isSoldByAB; 187 | /** 188 | * 如果为真,则此订单中的商品由 Amazon Business EU SARL (ABEU) 购买并转售。通过购买并立即转售您的商品,ABEU 成为记录卖家,将您的库存出售给不会从第三方卖家购买的客户。 189 | */ 190 | @JsonProperty("IsIBA") 191 | private Boolean isIBA; 192 | /** 193 | * 194 | */ 195 | @JsonProperty("DefaultShipFromLocationAddress") 196 | private DefaultShipFromLocationAddress defaultShipFromLocationAddress; 197 | @JsonProperty("BuyerInvoicePreference") 198 | private String buyerInvoicePreference; 199 | @JsonProperty("BuyerTaxInformation") 200 | private BuyerTaxInformation buyerTaxInformation; 201 | @JsonProperty("FulfillmentInstruction") 202 | private FulfillmentInstruction fulfillmentInstruction; 203 | @JsonProperty("IsISPU") 204 | private Boolean isISPU; 205 | @JsonProperty("MarketplaceTaxInfo") 206 | private MarketplaceTaxInfo marketplaceTaxInfo; 207 | @JsonProperty("SellerDisplayName") 208 | private String sellerDisplayName; 209 | @JsonProperty("ShippingAddress") 210 | private ShippingAddress shippingAddress; 211 | @JsonProperty("BuyerInfo") 212 | private BuyerInfo buyerInfo; 213 | @JsonProperty("AutomatedShippingSettings") 214 | private AutomatedShippingSettings automatedShippingSettings; 215 | 216 | @NoArgsConstructor 217 | @Data 218 | public static class OrderTotal { 219 | @JsonProperty("CurrencyCode") 220 | private String currencyCode; 221 | @JsonProperty("Amount") 222 | private String amount; 223 | } 224 | 225 | @NoArgsConstructor 226 | @Data 227 | public static class DefaultShipFromLocationAddress { 228 | @JsonProperty("Name") 229 | private String name; 230 | @JsonProperty("AddressLine1") 231 | private String addressLine1; 232 | @JsonProperty("AddressLine2") 233 | private String addressLine2; 234 | @JsonProperty("AddressLine3") 235 | private String addressLine3; 236 | @JsonProperty("City") 237 | private String city; 238 | @JsonProperty("County") 239 | private String county; 240 | @JsonProperty("District") 241 | private String district; 242 | @JsonProperty("StateOrRegion") 243 | private String stateOrRegion; 244 | @JsonProperty("Municipality") 245 | private String municipality; 246 | @JsonProperty("PostalCode") 247 | private String postalCode; 248 | @JsonProperty("CountryCode") 249 | private String countryCode; 250 | @JsonProperty("Phone") 251 | private String phone; 252 | @JsonProperty("AddressType") 253 | private String addressType; 254 | } 255 | 256 | @NoArgsConstructor 257 | @Data 258 | public static class BuyerTaxInformation { 259 | @JsonProperty("BuyerLegalCompanyName") 260 | private String buyerLegalCompanyName; 261 | @JsonProperty("BuyerBusinessAddress") 262 | private String buyerBusinessAddress; 263 | @JsonProperty("BuyerTaxRegistrationId") 264 | private String buyerTaxRegistrationId; 265 | @JsonProperty("BuyerTaxOffice") 266 | private String buyerTaxOffice; 267 | } 268 | 269 | @NoArgsConstructor 270 | @Data 271 | public static class FulfillmentInstruction { 272 | @JsonProperty("FulfillmentSupplySourceId") 273 | private String fulfillmentSupplySourceId; 274 | } 275 | 276 | @NoArgsConstructor 277 | @Data 278 | public static class MarketplaceTaxInfo { 279 | @JsonProperty("TaxClassifications") 280 | private List taxClassifications; 281 | 282 | @NoArgsConstructor 283 | @Data 284 | public static class TaxClassifications { 285 | @JsonProperty("Name") 286 | private String name; 287 | @JsonProperty("Value") 288 | private String value; 289 | } 290 | } 291 | 292 | @NoArgsConstructor 293 | @Data 294 | public static class ShippingAddress { 295 | @JsonProperty("Name") 296 | private String name; 297 | @JsonProperty("AddressLine1") 298 | private String addressLine1; 299 | @JsonProperty("AddressLine2") 300 | private String addressLine2; 301 | @JsonProperty("AddressLine3") 302 | private String addressLine3; 303 | @JsonProperty("City") 304 | private String city; 305 | @JsonProperty("County") 306 | private String county; 307 | @JsonProperty("District") 308 | private String district; 309 | @JsonProperty("StateOrRegion") 310 | private String stateOrRegion; 311 | @JsonProperty("Municipality") 312 | private String municipality; 313 | @JsonProperty("PostalCode") 314 | private String postalCode; 315 | @JsonProperty("CountryCode") 316 | private String countryCode; 317 | @JsonProperty("Phone") 318 | private String phone; 319 | @JsonProperty("AddressType") 320 | private String addressType; 321 | } 322 | 323 | @NoArgsConstructor 324 | @Data 325 | public static class BuyerInfo { 326 | @JsonProperty("BuyerEmail") 327 | private String buyerEmail; 328 | @JsonProperty("BuyerName") 329 | private String buyerName; 330 | @JsonProperty("BuyerCounty") 331 | private String buyerCounty; 332 | @JsonProperty("BuyerTaxInfo") 333 | private BuyerTaxInfo buyerTaxInfo; 334 | @JsonProperty("PurchaseOrderNumber") 335 | private String purchaseOrderNumber; 336 | 337 | @NoArgsConstructor 338 | @Data 339 | public static class BuyerTaxInfo { 340 | @JsonProperty("CompanyLegalName") 341 | private String companyLegalName; 342 | @JsonProperty("TaxingRegion") 343 | private String taxingRegion; 344 | @JsonProperty("TaxClassifications") 345 | private List taxClassifications; 346 | 347 | @NoArgsConstructor 348 | @Data 349 | public static class TaxClassifications { 350 | @JsonProperty("Name") 351 | private String name; 352 | @JsonProperty("Value") 353 | private String value; 354 | } 355 | } 356 | } 357 | 358 | @NoArgsConstructor 359 | @Data 360 | public static class AutomatedShippingSettings { 361 | @JsonProperty("HasAutomatedShippingSettings") 362 | private Boolean hasAutomatedShippingSettings; 363 | @JsonProperty("AutomatedCarrier") 364 | private String automatedCarrier; 365 | @JsonProperty("AutomatedShipMethod") 366 | private String automatedShipMethod; 367 | } 368 | 369 | @NoArgsConstructor 370 | @Data 371 | public static class PaymentExecutionDetail { 372 | @JsonProperty("Payment") 373 | private Payment payment; 374 | @JsonProperty("PaymentMethod") 375 | private String paymentMethod; 376 | 377 | @NoArgsConstructor 378 | @Data 379 | public static class Payment { 380 | @JsonProperty("CurrencyCode") 381 | private String currencyCode; 382 | @JsonProperty("Amount") 383 | private String amount; 384 | } 385 | } 386 | } 387 | -------------------------------------------------------------------------------- /amazon-sdk/src/main/java/io/github/vo/order/AmazonOrderItems.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.order; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/2/22 15:16 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class AmazonOrderItems { 15 | 16 | @JsonProperty("AmazonOrderId") 17 | private String amazonOrderId; 18 | @JsonProperty("NextToken") 19 | private String nextToken; 20 | @JsonProperty("OrderItems") 21 | private List orderItems; 22 | /** 23 | * Created by EalenXie on 2022/2/22 15:18 24 | */ 25 | @NoArgsConstructor 26 | @Data 27 | public static class AmazonOrderItem { 28 | 29 | @JsonProperty("ASIN") 30 | private String asin; 31 | @JsonProperty("OrderItemId") 32 | private String orderItemId; 33 | @JsonProperty("QuantityOrdered") 34 | private Integer quantityOrdered; 35 | @JsonProperty("SellerSKU") 36 | private String sellerSKU; 37 | @JsonProperty("Title") 38 | private String title; 39 | @JsonProperty("QuantityShipped") 40 | private Integer quantityShipped; 41 | @JsonProperty("ProductInfo") 42 | private ProductInfo productInfo; 43 | @JsonProperty("PointsGranted") 44 | private PointsGranted pointsGranted; 45 | @JsonProperty("ItemPrice") 46 | private ItemPrice itemPrice; 47 | @JsonProperty("ShippingPrice") 48 | private ShippingPrice shippingPrice; 49 | @JsonProperty("ItemTax") 50 | private ItemTax itemTax; 51 | @JsonProperty("ShippingTax") 52 | private ShippingTax shippingTax; 53 | @JsonProperty("ShippingDiscount") 54 | private ShippingDiscount shippingDiscount; 55 | @JsonProperty("ShippingDiscountTax") 56 | private ShippingDiscountTax shippingDiscountTax; 57 | @JsonProperty("PromotionDiscount") 58 | private PromotionDiscount promotionDiscount; 59 | @JsonProperty("PromotionDiscountTax") 60 | private PromotionDiscountTax promotionDiscountTax; 61 | @JsonProperty("PromotionIds") 62 | private List promotionIds; 63 | @JsonProperty("CODFee") 64 | private CODFee cODFee; 65 | @JsonProperty("CODFeeDiscount") 66 | private CODFeeDiscount cODFeeDiscount; 67 | @JsonProperty("IsGift") 68 | private Boolean isGift; 69 | @JsonProperty("ConditionNote") 70 | private String conditionNote; 71 | @JsonProperty("ConditionId") 72 | private String conditionId; 73 | @JsonProperty("ConditionSubtypeId") 74 | private String conditionSubtypeId; 75 | @JsonProperty("ScheduledDeliveryStartDate") 76 | private String scheduledDeliveryStartDate; 77 | @JsonProperty("ScheduledDeliveryEndDate") 78 | private String scheduledDeliveryEndDate; 79 | @JsonProperty("PriceDesignation") 80 | private String priceDesignation; 81 | @JsonProperty("TaxCollection") 82 | private TaxCollection taxCollection; 83 | @JsonProperty("SerialNumberRequired") 84 | private Boolean serialNumberRequired; 85 | @JsonProperty("IsTransparency") 86 | private Boolean isTransparency; 87 | @JsonProperty("IossNumber") 88 | private String iossNumber; 89 | @JsonProperty("StoreChainStoreId") 90 | private String storeChainStoreId; 91 | @JsonProperty("DeemedResellerCategory") 92 | private String deemedResellerCategory; 93 | @JsonProperty("BuyerInfo") 94 | private BuyerInfo buyerInfo; 95 | 96 | @NoArgsConstructor 97 | @Data 98 | public static class ProductInfo { 99 | @JsonProperty("NumberOfItems") 100 | private Integer numberOfItems; 101 | } 102 | 103 | @NoArgsConstructor 104 | @Data 105 | public static class PointsGranted { 106 | @JsonProperty("PointsNumber") 107 | private Integer pointsNumber; 108 | @JsonProperty("PointsMonetaryValue") 109 | private PointsGranted.PointsMonetaryValue pointsMonetaryValue; 110 | 111 | @NoArgsConstructor 112 | @Data 113 | public static class PointsMonetaryValue { 114 | @JsonProperty("CurrencyCode") 115 | private String currencyCode; 116 | @JsonProperty("Amount") 117 | private String amount; 118 | } 119 | } 120 | 121 | @NoArgsConstructor 122 | @Data 123 | public static class ItemPrice { 124 | @JsonProperty("CurrencyCode") 125 | private String currencyCode; 126 | @JsonProperty("Amount") 127 | private String amount; 128 | } 129 | 130 | @NoArgsConstructor 131 | @Data 132 | public static class ShippingPrice { 133 | @JsonProperty("CurrencyCode") 134 | private String currencyCode; 135 | @JsonProperty("Amount") 136 | private String amount; 137 | } 138 | 139 | @NoArgsConstructor 140 | @Data 141 | public static class ItemTax { 142 | @JsonProperty("CurrencyCode") 143 | private String currencyCode; 144 | @JsonProperty("Amount") 145 | private String amount; 146 | } 147 | 148 | @NoArgsConstructor 149 | @Data 150 | public static class ShippingTax { 151 | @JsonProperty("CurrencyCode") 152 | private String currencyCode; 153 | @JsonProperty("Amount") 154 | private String amount; 155 | } 156 | 157 | @NoArgsConstructor 158 | @Data 159 | public static class ShippingDiscount { 160 | @JsonProperty("CurrencyCode") 161 | private String currencyCode; 162 | @JsonProperty("Amount") 163 | private String amount; 164 | } 165 | 166 | @NoArgsConstructor 167 | @Data 168 | public static class ShippingDiscountTax { 169 | @JsonProperty("CurrencyCode") 170 | private String currencyCode; 171 | @JsonProperty("Amount") 172 | private String amount; 173 | } 174 | 175 | @NoArgsConstructor 176 | @Data 177 | public static class PromotionDiscount { 178 | @JsonProperty("CurrencyCode") 179 | private String currencyCode; 180 | @JsonProperty("Amount") 181 | private String amount; 182 | } 183 | 184 | @NoArgsConstructor 185 | @Data 186 | public static class PromotionDiscountTax { 187 | @JsonProperty("CurrencyCode") 188 | private String currencyCode; 189 | @JsonProperty("Amount") 190 | private String amount; 191 | } 192 | 193 | @NoArgsConstructor 194 | @Data 195 | public static class CODFee { 196 | @JsonProperty("CurrencyCode") 197 | private String currencyCode; 198 | @JsonProperty("Amount") 199 | private String amount; 200 | } 201 | 202 | @NoArgsConstructor 203 | @Data 204 | public static class CODFeeDiscount { 205 | @JsonProperty("CurrencyCode") 206 | private String currencyCode; 207 | @JsonProperty("Amount") 208 | private String amount; 209 | } 210 | 211 | @NoArgsConstructor 212 | @Data 213 | public static class TaxCollection { 214 | @JsonProperty("Model") 215 | private String model; 216 | @JsonProperty("ResponsibleParty") 217 | private String responsibleParty; 218 | } 219 | 220 | @NoArgsConstructor 221 | @Data 222 | public static class BuyerInfo { 223 | @JsonProperty("BuyerCustomizedInfo") 224 | private BuyerInfo.BuyerCustomizedInfo buyerCustomizedInfo; 225 | @JsonProperty("GiftWrapPrice") 226 | private BuyerInfo.GiftWrapPrice giftWrapPrice; 227 | @JsonProperty("GiftWrapTax") 228 | private BuyerInfo.GiftWrapTax giftWrapTax; 229 | @JsonProperty("GiftMessageText") 230 | private String giftMessageText; 231 | @JsonProperty("GiftWrapLevel") 232 | private String giftWrapLevel; 233 | 234 | @NoArgsConstructor 235 | @Data 236 | public static class BuyerCustomizedInfo { 237 | @JsonProperty("value") 238 | private String value; 239 | } 240 | 241 | @NoArgsConstructor 242 | @Data 243 | public static class GiftWrapPrice { 244 | @JsonProperty("CurrencyCode") 245 | private String currencyCode; 246 | @JsonProperty("Amount") 247 | private String amount; 248 | } 249 | 250 | @NoArgsConstructor 251 | @Data 252 | public static class GiftWrapTax { 253 | @JsonProperty("CurrencyCode") 254 | private String currencyCode; 255 | @JsonProperty("Amount") 256 | private String amount; 257 | } 258 | } 259 | } 260 | 261 | } 262 | -------------------------------------------------------------------------------- /amazon-sdk/src/main/java/io/github/vo/order/AmazonShippingAddress.java: -------------------------------------------------------------------------------- 1 | package io.github.vo.order; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/2/22 16:42 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class AmazonShippingAddress { 13 | 14 | @JsonProperty("AmazonOrderId") 15 | private String amazonOrderId; 16 | @JsonProperty("ShippingAddress") 17 | private ShippingAddress shippingAddress; 18 | 19 | @NoArgsConstructor 20 | @Data 21 | public static class ShippingAddress { 22 | @JsonProperty("Name") 23 | private String name; 24 | @JsonProperty("AddressLine1") 25 | private String addressLine1; 26 | @JsonProperty("AddressLine2") 27 | private String addressLine2; 28 | @JsonProperty("AddressLine3") 29 | private String addressLine3; 30 | @JsonProperty("City") 31 | private String city; 32 | @JsonProperty("County") 33 | private String county; 34 | @JsonProperty("District") 35 | private String district; 36 | @JsonProperty("StateOrRegion") 37 | private String stateOrRegion; 38 | @JsonProperty("Municipality") 39 | private String municipality; 40 | @JsonProperty("PostalCode") 41 | private String postalCode; 42 | @JsonProperty("CountryCode") 43 | private String countryCode; 44 | @JsonProperty("Phone") 45 | private String phone; 46 | @JsonProperty("AddressType") 47 | private String addressType; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /paypal-sdk/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | cross-border-electronic-commerce 7 | io.github 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | paypal-sdk 13 | 14 | 15 | 8 16 | 8 17 | 18 | 19 | 20 | 21 | 22 | org.projectlombok 23 | lombok 24 | 1.18.22 25 | 26 | 27 | org.springframework 28 | spring-web 29 | 5.3.16 30 | 31 | 32 | com.fasterxml.jackson.core 33 | jackson-databind 34 | 2.13.2 35 | 36 | 37 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/PayPalClient.java: -------------------------------------------------------------------------------- 1 | package io.github; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | 5 | import io.github.dto.TransactionsDTO; 6 | import io.github.vo.BalancesVO; 7 | import io.github.vo.PayPalAccessToken; 8 | import io.github.vo.TransactionDetailsVO; 9 | import io.github.vo.UserInfo; 10 | import lombok.extern.slf4j.Slf4j; 11 | import org.springframework.http.*; 12 | import org.springframework.util.LinkedMultiValueMap; 13 | import org.springframework.web.client.RestOperations; 14 | import org.springframework.web.client.RestTemplate; 15 | import org.springframework.web.util.UriComponentsBuilder; 16 | 17 | import java.net.URI; 18 | import java.util.Collections; 19 | import java.util.SortedMap; 20 | 21 | /** 22 | * Created by EalenXie on 2022/3/29 11:36 23 | * https://developer.paypal.com/ 24 | */ 25 | @Slf4j 26 | @SuppressWarnings("all") 27 | public class PayPalClient { 28 | 29 | private final RestOperations restOperations; 30 | 31 | private final ObjectMapper mapper = new ObjectMapper(); 32 | /** 33 | * 是否沙箱环境 34 | */ 35 | private boolean sandBox = true; 36 | /** 37 | * 沙箱环境认证接口地址 38 | */ 39 | private static final String HOST_SANDBOX = "https://api-m.sandbox.paypal.com/v1"; 40 | /** 41 | * 正式环境接口地址 42 | */ 43 | private static final String HOST = "https://api-m.paypal.com"; 44 | 45 | 46 | public PayPalClient() { 47 | this(new RestTemplate()); 48 | } 49 | 50 | public PayPalClient(RestOperations restOperations) { 51 | this.restOperations = restOperations; 52 | } 53 | 54 | 55 | public boolean isSandBox() { 56 | return sandBox; 57 | } 58 | 59 | public void setSandBox(boolean sandBox) { 60 | this.sandBox = sandBox; 61 | } 62 | 63 | public HttpHeaders getBearerHeader(String accessToken) { 64 | HttpHeaders headers = new HttpHeaders(); 65 | headers.setBearerAuth(accessToken); 66 | return headers; 67 | } 68 | 69 | public HttpHeaders getBasicHeader(String clientId, String clientSecret) { 70 | HttpHeaders headers = new HttpHeaders(); 71 | headers.setBasicAuth(clientId, clientSecret); 72 | return headers; 73 | } 74 | 75 | 76 | /** 77 | * 客户端模式获取访问令牌 78 | * https://developer.paypal.com/api/rest/authentication/ 79 | * 80 | * @param accessToken 访问令牌 81 | * @param accountId 账号id 82 | * @param dto 请求参数 83 | */ 84 | public ResponseEntity clientCredentialsAcessToken(String clientId, String clientSecret) { 85 | HttpHeaders headers = getBasicHeader(clientId, clientSecret); 86 | headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON)); 87 | headers.set("Accept-Language", "en_US"); 88 | UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(String.format("%s/oauth2/token", sandBox ? HOST_SANDBOX : HOST)); 89 | builder.queryParam("grant_type", "client_credentials"); 90 | URI uri = builder.build().encode().toUri(); 91 | return restOperations.exchange(uri, HttpMethod.POST, new HttpEntity<>(null, headers), PayPalAccessToken.class); 92 | } 93 | 94 | /** 95 | * 显示付款项目的详细信息 96 | *

97 | *

98 | * https://developer.paypal.com/docs/api/referenced-payouts/v1/#referenced-payouts_get_batch_details 99 | * 100 | * @param payoutsItemId 101 | * @return 102 | */ 103 | public ResponseEntity clientReferencedPayoutsItems(String payoutsItemId, String token) { 104 | HttpHeaders headers = new HttpHeaders(); 105 | headers.set("Content-Type", "application/json"); 106 | headers.setBearerAuth(token); 107 | headers.set("PayPal-Partner-Attribution-Id", "bn1234"); 108 | UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(String.format("%s/payments/referenced-payouts-items/%s", sandBox ? HOST_SANDBOX : HOST, payoutsItemId)); 109 | URI uri = builder.build().encode().toUri(); 110 | return restOperations.exchange(uri, HttpMethod.GET, new HttpEntity<>(null, headers), Object.class); 111 | } 112 | 113 | /** 114 | * 显示付款项目的详细信息 115 | *

116 | *

117 | * https://developer.paypal.com/docs/api/referenced-payouts/v1/#referenced-payouts_get_batch_details 118 | * 119 | * @param payoutsItemId 120 | * @return 121 | */ 122 | public ResponseEntity getUserInfo(String token) { 123 | HttpHeaders headers = new HttpHeaders(); 124 | headers.setContentType(MediaType.APPLICATION_JSON); 125 | headers.setBearerAuth(token); 126 | UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(String.format("%s/identity/oauth2/userinfo?schema=paypalv1.1", sandBox ? HOST_SANDBOX : HOST)); 127 | return restOperations.exchange(builder.build().toUri(), HttpMethod.GET, new HttpEntity<>(null, headers), UserInfo.class); 128 | } 129 | 130 | 131 | /** 132 | * 列出交易 133 | * https://developer.paypal.com/docs/api/transaction-search/v1/#transactions_get 134 | * 135 | * @param token 访问令牌 136 | * @param dto 请求参数封装的对象TransactionsDTO 137 | * @return 138 | */ 139 | public ResponseEntity transactions(String token, TransactionsDTO dto) { 140 | HttpHeaders headers = new HttpHeaders(); 141 | headers.setContentType(MediaType.APPLICATION_JSON); 142 | headers.setBearerAuth(token); 143 | //访问路径 144 | UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(String.format("%s/reporting/transactions", sandBox ? HOST_SANDBOX : HOST)); 145 | //判断dto不能为空 146 | if (dto != null) { 147 | @SuppressWarnings("unchecked") SortedMap sortedMap = mapper.convertValue(dto, SortedMap.class); 148 | LinkedMultiValueMap queryParams = new LinkedMultiValueMap<>(); 149 | if (!sortedMap.isEmpty()) { 150 | queryParams.setAll(sortedMap); 151 | builder.queryParams(queryParams); 152 | } 153 | } 154 | return restOperations.exchange(builder.build().toUri(), HttpMethod.GET, new HttpEntity<>(null, headers), TransactionDetailsVO.class); 155 | } 156 | 157 | /** 158 | * 列出所有余额 159 | * https://developer.paypal.com/docs/api/transaction-search/v1/#transactions_get 160 | * 161 | * @param token 访问令牌 162 | * @param currencCode 通过PayPal 交易货币的三字符 ISO-4217 货币代码过滤响应中的交易。 163 | * @param dasOfTimeto 在提供的日期时间在响应中列出余额,如果未提供,将返回系统中最后刷新的余额 164 | * @param includeCryptoCurrencies 是否包括加密货币:false 或 true 165 | * @return 166 | */ 167 | public ResponseEntity balances(String token, String currencCode, String asOfTime, String includeCryptoCurrencies) { 168 | HttpHeaders headers = new HttpHeaders(); 169 | headers.setContentType(MediaType.APPLICATION_JSON); 170 | headers.setBearerAuth(token); 171 | //访问路径 172 | UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(String.format("%s/reporting/balances", sandBox ? HOST_SANDBOX : HOST)); 173 | //判断入参不能为空 174 | if (asOfTime != null && currencCode != null) { 175 | //将请求参数按指定排序生成url参数 176 | LinkedMultiValueMap queryParams = new LinkedMultiValueMap<>(); 177 | queryParams.put("currency_code", Collections.singletonList(currencCode)); 178 | queryParams.put("as_of_time", Collections.singletonList(asOfTime)); 179 | queryParams.put("include_crypto_currencies", Collections.singletonList(includeCryptoCurrencies)); 180 | builder.queryParams(queryParams); 181 | } 182 | return restOperations.exchange(builder.build().toUri(), HttpMethod.GET, new HttpEntity<>(null, headers), BalancesVO.class); 183 | } 184 | 185 | 186 | /** 187 | * 列出参考批次付款中的项目 188 | *

189 | * https://developer.paypal.com/docs/api/referenced-payouts/v1/#referenced-payouts_get_batch_details 190 | * 191 | * @param payoutsBatchId 192 | * @param token 193 | * @return 194 | */ 195 | public ResponseEntity clientReferencedPayouts(String payoutsBatchId, String token) { 196 | HttpHeaders headers = new HttpHeaders(); 197 | headers.setContentType(MediaType.APPLICATION_JSON); 198 | headers.setBearerAuth(token); 199 | UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(String.format("%s/payments/referenced-payouts/%s", sandBox ? HOST_SANDBOX : HOST, payoutsBatchId)); 200 | return restOperations.exchange(builder.encode().build().toUri(), HttpMethod.GET, new HttpEntity<>(null, headers), Object.class); 201 | } 202 | } 203 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/dto/BalancesDTO.java: -------------------------------------------------------------------------------- 1 | package io.github.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | @Getter 9 | @Setter 10 | public class BalancesDTO { 11 | 12 | /** 13 | * PayPal 交易 ID 14 | * 有效的交易 ID 长度为 17 个字符,除了订单编号,长度为 19 个字符。 15 | */ 16 | @JsonInclude(JsonInclude.Include.NON_NULL) 17 | @JsonProperty("transaction_id") 18 | private String transactionId; 19 | 20 | /** 21 | * PayPal 交易类型 22 | * 请参阅事务事件代码 23 | * https://developer.paypal.com/docs/transaction-search/transaction-event-codes/ 24 | */ 25 | @JsonInclude(JsonInclude.Include.NON_NULL) 26 | @JsonProperty("transaction_type") 27 | private String transactionType; 28 | } 29 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/dto/TransactionsDTO.java: -------------------------------------------------------------------------------- 1 | package io.github.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | @Getter 9 | @Setter 10 | public class TransactionsDTO { 11 | 12 | /** 13 | * PayPal 交易 ID 14 | * 有效的交易 ID 长度为 17 个字符,除了订单编号,长度为 19 个字符。 15 | */ 16 | @JsonInclude(JsonInclude.Include.NON_NULL) 17 | @JsonProperty("transaction_id") 18 | private String transactionId; 19 | 20 | /** 21 | * PayPal 交易类型 22 | * 请参阅事务事件代码 23 | * https://developer.paypal.com/docs/transaction-search/transaction-event-codes/ 24 | */ 25 | @JsonInclude(JsonInclude.Include.NON_NULL) 26 | @JsonProperty("transaction_type") 27 | private String transactionType; 28 | 29 | /** 30 | * PayPal 交易状态 31 | * 状态码描述 32 | * D PayPal 或商家规则拒绝交易。 33 | * P 交易待定。交易已创建,但在状态更改为 之前等待另一个支付流程完成,例如 ACH 交易S。 34 | * S 交易成功完成,没有拒绝并且在任何未决状态之后。 35 | * V 成功的交易被撤销,资金被退还给原始发件人。 36 | */ 37 | @JsonInclude(JsonInclude.Include.NON_NULL) 38 | @JsonProperty("transaction_status") 39 | private String transactionStatus; 40 | 41 | /** 42 | * 总交易金额范围 43 | * 指定范围为 TO ,其中是 PayPal 交易总额的下限, 是交易总额的上限。指定较低面额的金额。 44 | * 例如,要搜索从 $5.00 到 $10.05 的交易,请指定[500 TO 1005]。 45 | */ 46 | @JsonInclude(JsonInclude.Include.NON_NULL) 47 | @JsonProperty("transaction_amount") 48 | private String transactionAmount; 49 | 50 | /** 51 | * PayPal 交易货币 52 | */ 53 | @JsonInclude(JsonInclude.Include.NON_NULL) 54 | @JsonProperty("transaction_currency") 55 | private String transactionCurrency; 56 | 57 | /** 58 | * 开始时间 59 | * 采用Internet 日期和时间格式。需要秒数。小数秒是可选的。 60 | * 最小长度:20. 61 | * 最大长度:64. 62 | */ 63 | @JsonProperty("start_date") 64 | private String startDate; 65 | 66 | /** 67 | * 结束时间 68 | * 采用Internet 日期和时间格式。需要秒数。小数秒是可选的。支持的最大范围为 31 天。 69 | * 最小长度:20. 70 | * 最大长度:64. 71 | */ 72 | @JsonProperty("end_date") 73 | private String endDate; 74 | 75 | /** 76 | * 支付工具类型 77 | * 值是: 78 | * CREDITCARD. 返回具有相应值的直接信用卡交易。 79 | * DEBITCARD. 返回具有相应值的借记卡交易。 80 | */ 81 | @JsonInclude(JsonInclude.Include.NON_NULL) 82 | @JsonProperty("payment_instrument_type") 83 | private String paymentInstrumentType; 84 | 85 | /** 86 | * 商店 ID 87 | */ 88 | @JsonInclude(JsonInclude.Include.NON_NULL) 89 | @JsonProperty("store_id") 90 | private String storeId; 91 | 92 | /** 93 | * 终端 ID 94 | */ 95 | @JsonInclude(JsonInclude.Include.NON_NULL) 96 | @JsonProperty("terminal_id") 97 | private String terminalId; 98 | 99 | /** 100 | * 指示响应中出现的字段 101 | * 有效字段为: 102 | * transaction_info. 交易信息。包括收款人的 PayPal 账户 ID、PayPal 生成的交易 ID、PayPal 生成的基本 ID、PayPal 参考 ID 类型、交易事件代码、交易发起和最后更新的日期和时间,交易金额,包括 PayPal 费用、任何折扣、保险、交易状态以及有关交易的其他信息。 103 | * payer_info. 付款人信息。包括 PayPal 客户帐户 ID 和付款人的电子邮件地址、主要电话号码、姓名、国家/地区代码、地址以及付款人是否经过验证。 104 | * shipping_info. 运输信息。包括收件人姓名、此订单的送货方式、此订单的送货地址以及与此订单关联的辅助地址。 105 | * auction_info. 拍卖信息。包括拍卖网站的名称、拍卖网站的 URL、在拍卖中进行购买的客户的 ID 以及拍卖结束的日期和时间。 106 | * cart_info. 购物车信息。包括一系列商品详细信息,商品金额或运费是否已含税,以及 PayPal 生成的发票的发票 ID。 107 | * incentive_info. 一系列激励细节对象。每个对象包括诸如特别优惠或优惠券之类的激励、激励金额以及标识商家忠诚度或激励计划的激励计划代码。 108 | * store_info. 店铺信息。包括商户ID和商户收银台终端ID。 109 | */ 110 | @JsonInclude(JsonInclude.Include.NON_NULL) 111 | @JsonProperty("fields") 112 | private String fields; 113 | 114 | /** 115 | * 响应是仅包括影响余额的交易还是所有交易。值是: 116 | * Y. 默认。响应仅包括余额交易。 117 | * N. 响应包括所有事务。 118 | */ 119 | @JsonInclude(JsonInclude.Include.NON_NULL) 120 | @JsonProperty("balance_affecting_records_only") 121 | private String balanceAffectingRecordsOnly; 122 | 123 | /** 124 | * 分页大小 125 | */ 126 | @JsonInclude(JsonInclude.Include.NON_NULL) 127 | @JsonProperty("page_size") 128 | private String pageSize; 129 | 130 | /** 131 | * 页码 132 | */ 133 | @JsonInclude(JsonInclude.Include.NON_NULL) 134 | @JsonProperty("page") 135 | private String page; 136 | } 137 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/Address.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * @author 小小怪下士 9 | * @version 1.0.0 10 | */ 11 | @NoArgsConstructor 12 | @Data 13 | public class Address { 14 | @JsonProperty("street_address") 15 | private String streetAddress; 16 | @JsonProperty("locality") 17 | private String locality; 18 | @JsonProperty("region") 19 | private String region; 20 | @JsonProperty("postal_code") 21 | private String postalCode; 22 | @JsonProperty("country") 23 | private String country; 24 | } 25 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/AuctionInfo.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | 6 | @NoArgsConstructor 7 | @Data 8 | public class AuctionInfo { 9 | } 10 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/Balances.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @NoArgsConstructor 8 | @Data 9 | public class Balances { 10 | 11 | /** 12 | * 所列余额的货币代码。 13 | */ 14 | @JsonProperty("currency") 15 | private String currency; 16 | 17 | /** 18 | * 表示货币是否为主要货币的可选字段。 19 | */ 20 | @JsonProperty("primary") 21 | private Boolean primary; 22 | 23 | /** 24 | * PayPal 帐户中的总金额。它是所有其他余额的总和。 25 | */ 26 | @JsonProperty("total_balance") 27 | private TotalBalance totalBalance; 28 | 29 | /** 30 | * 客户可支配的账户中的现金金额。此金额在为用户定义的用户时区中的结算截止时间捕获。 31 | */ 32 | @JsonProperty("available_balance") 33 | private TotalBalance availableBalance; 34 | 35 | /** 36 | * 账户中预扣的余额。PayPal 为客户持有的资金中当前无法由客户支配的部分。 37 | */ 38 | @JsonProperty("withheld_balance") 39 | private TotalBalance withheldBalance; 40 | } 41 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/BalancesVO.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | @NoArgsConstructor 10 | @Data 11 | public class BalancesVO { 12 | 13 | /** 14 | * 加密余额 15 | */ 16 | @JsonProperty("crypto_balances") 17 | private List cryptoBalances; 18 | 19 | /** 20 | * 余额 21 | */ 22 | @JsonProperty("balances") 23 | private List balances; 24 | 25 | /** 26 | * 账户 ID 27 | */ 28 | @JsonProperty("account_id") 29 | private String accountId; 30 | 31 | /** 32 | * 截止时间 33 | */ 34 | @JsonProperty("as_of_time") 35 | private String asOfTime; 36 | 37 | /** 38 | * 上次刷新时间 39 | */ 40 | @JsonProperty("last_refresh_time") 41 | private String lastRefreshTime; 42 | } 43 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/CartInfo.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | 6 | @NoArgsConstructor 7 | @Data 8 | public class CartInfo { 9 | } 10 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/CryptoBalances.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @NoArgsConstructor 8 | @Data 9 | public class CryptoBalances { 10 | 11 | /** 12 | * 资产符号 13 | */ 14 | @JsonProperty("asset_symbol") 15 | private String assetSymbol; 16 | 17 | /** 18 | * 数量 19 | */ 20 | @JsonProperty("quantity") 21 | private String quantity; 22 | } 23 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/Email.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * @author EalenXie 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Email { 13 | @JsonProperty("value") 14 | private String value; 15 | @JsonProperty("primary") 16 | private Boolean primary; 17 | } 18 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/IncentiveInfo.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | 6 | @NoArgsConstructor 7 | @Data 8 | public class IncentiveInfo { 9 | } 10 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/Links.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @NoArgsConstructor 8 | @Data 9 | public class Links { 10 | 11 | /** 12 | * 完整的目标 URL。 13 | * 要进行相关调用,请将该方法与此URI 模板格式的链接结合使用。对于预处理,包括$、(和)字符。这href是关键的 HATEOAS 组件,它将已完成的调用与后续调用联系起来。 14 | */ 15 | @JsonProperty("href") 16 | private String href; 17 | 18 | /** 19 | * 链接关系类型,用作明确描述链接语义的链接的 ID 。请参阅链接关系。 20 | * https://www.iana.org/assignments/link-relations/link-relations.xhtml 21 | */ 22 | @JsonProperty("rel") 23 | private String rel; 24 | 25 | /** 26 | * 进行相关调用所需的 HTTP 方法。 27 | */ 28 | @JsonProperty("method") 29 | private String method; 30 | } 31 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/PayPalAccessToken.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | /** 8 | * Created by EalenXie on 2022/4/1 10:42 9 | */ 10 | @Getter 11 | @Setter 12 | public class PayPalAccessToken { 13 | @JsonProperty("scope") 14 | private String scope; 15 | @JsonProperty("access_token") 16 | private String accessToken; 17 | @JsonProperty("token_type") 18 | private String tokenType; 19 | @JsonProperty("app_id") 20 | private String appId; 21 | @JsonProperty("expires_in") 22 | private Integer expiresIn; 23 | @JsonProperty("nonce") 24 | private String nonce; 25 | } 26 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/PayerInfo.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @NoArgsConstructor 8 | @Data 9 | public class PayerInfo { 10 | 11 | /** 12 | * PayPal 付款人 ID 13 | */ 14 | @JsonProperty("account_id") 15 | private String accountId; 16 | 17 | /** 18 | * 国际化的电子邮件地址。 19 | */ 20 | @JsonProperty("email_address") 21 | private String emailAddress; 22 | 23 | /** 24 | * 付款人的地址状态。值是: 25 | * Y. 已验证。 26 | * N. 未经审核的。 27 | */ 28 | @JsonProperty("address_status") 29 | private String addressStatus; 30 | 31 | /** 32 | * 付款人的状态。值为Y或N。 33 | */ 34 | @JsonProperty("payer_status") 35 | private String payerStatus; 36 | 37 | /** 38 | * 付款人姓名。 39 | */ 40 | @JsonProperty("payer_name") 41 | private PayerName payerName; 42 | 43 | /** 44 | * 标识付款人所在国家或地区的两字符 ISO 3166-1 代码。 45 | * https://developer.paypal.com/reference/country-codes/ 46 | */ 47 | @JsonProperty("country_code") 48 | private String countryCode; 49 | } 50 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/PayerName.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @NoArgsConstructor 8 | @Data 9 | public class PayerName { 10 | 11 | /** 12 | * 当当事人是一个人时,当事人的名字或名字。 13 | */ 14 | @JsonProperty("given_name") 15 | private String givenName; 16 | 17 | /** 18 | * 当事人为人时,当事人的姓氏或姓氏。也称为姓氏 19 | */ 20 | @JsonProperty("surname") 21 | private String surname; 22 | 23 | /** 24 | * 备用名 25 | */ 26 | @JsonProperty("alternate_full_name") 27 | private String alternateFullName; 28 | } 29 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/ShippingInfo.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @NoArgsConstructor 8 | @Data 9 | public class ShippingInfo { 10 | 11 | /** 12 | * 收件人的姓名。 13 | */ 14 | @JsonProperty("name") 15 | private String name; 16 | 17 | 18 | /** 19 | * 与此订单关联的送货地址。 20 | */ 21 | @JsonProperty("address") 22 | private ShopInfoAddress address; 23 | } 24 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/ShopInfoAddress.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @NoArgsConstructor 8 | @Data 9 | public class ShopInfoAddress { 10 | 11 | /** 12 | * 地址的第一行。例如,数字或街道。 13 | */ 14 | @JsonProperty("line1") 15 | private String line1; 16 | 17 | /** 18 | * 地址的第二行。例如,套房或公寓号码。 19 | */ 20 | @JsonProperty("line2") 21 | private String line2; 22 | 23 | /** 24 | * 城市名称。 25 | */ 26 | @JsonProperty("city") 27 | private String city; 28 | 29 | /** 30 | * 标识国家或地区的两字符 ISO 3166-1 代码。 31 | * https://developer.paypal.com/reference/country-codes/ 32 | */ 33 | @JsonProperty("country_code") 34 | private String countryCode; 35 | 36 | /** 37 | * 邮政编码,即邮政编码或等价物。通常需要具有邮政编码或同等邮政编码的国家/地区。 38 | */ 39 | @JsonProperty("postal_code") 40 | private String postalCode; 41 | } 42 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/StoreInfo.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | 6 | @NoArgsConstructor 7 | @Data 8 | public class StoreInfo { 9 | } 10 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/TotalBalance.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @NoArgsConstructor 8 | @Data 9 | public class TotalBalance { 10 | 11 | /** 12 | * 标识货币的三字符 ISO-4217 货币代码。 13 | * https://developer.paypal.com/api/rest/reference/currency-codes/ 14 | */ 15 | @JsonProperty("currency_code") 16 | private String currencyCode; 17 | 18 | /** 19 | * 值,可能是: 20 | * 像这样的货币的整数JPY通常不是小数。 21 | * 像这样的货币的小数部分TND被细分为千分之一。 22 | * 有关货币代码所需的小数位数,请参阅货币代码。 23 | * https://developer.paypal.com/reference/currency-codes/ 24 | */ 25 | @JsonProperty("value") 26 | private String value; 27 | } 28 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/TransactionAmount.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @NoArgsConstructor 8 | @Data 9 | public class TransactionAmount { 10 | 11 | /** 12 | * 通过PayPal 交易货币的三字符 ISO-4217 货币代码过滤响应中的交易。 13 | * https://developer.paypal.com/api/rest/reference/currency-codes/ 14 | */ 15 | @JsonProperty("currency_code") 16 | private String currencyCode; 17 | 18 | /** 19 | * 值,可能是: 20 | * 像这样的货币的整数JPY通常不是小数。 21 | * 像这样的货币的小数部分TND被细分为千分之一。 22 | * 有关货币代码所需的小数位数,请参阅货币代码。 23 | * https://developer.paypal.com/reference/currency-codes/ 24 | */ 25 | @JsonProperty("value") 26 | private String value; 27 | } 28 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/TransactionDetails.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @NoArgsConstructor 8 | @Data 9 | public class TransactionDetails { 10 | /** 11 | * 交易信息。 12 | */ 13 | @JsonProperty("transaction_info") 14 | private TransactionInfo transactionInfo; 15 | 16 | /** 17 | * 付款人信息。 18 | */ 19 | @JsonProperty("payer_info") 20 | private PayerInfo payerInfo; 21 | 22 | /** 23 | * 运输信息。 24 | */ 25 | @JsonProperty("shipping_info") 26 | private ShippingInfo shippingInfo; 27 | 28 | /** 29 | * 购物车信息。 30 | */ 31 | @JsonProperty("cart_info") 32 | private CartInfo cartInfo; 33 | 34 | /** 35 | * 店铺信息。 36 | */ 37 | @JsonProperty("store_info") 38 | private StoreInfo storeInfo; 39 | 40 | /** 41 | * 拍卖信息。 42 | */ 43 | @JsonProperty("auction_info") 44 | private AuctionInfo auctionInfo; 45 | 46 | /** 47 | * 激励信息。 48 | */ 49 | @JsonProperty("incentive_info") 50 | private IncentiveInfo incentiveInfo; 51 | } 52 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/TransactionDetailsVO.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | @NoArgsConstructor 10 | @Data 11 | public class TransactionDetailsVO { 12 | 13 | /** 14 | * 一组交易明细对象。 15 | */ 16 | @JsonProperty("transaction_details") 17 | private List transactionDetails; 18 | 19 | /** 20 | * 商户账号。 21 | */ 22 | @JsonProperty("account_number") 23 | private String accountNumber; 24 | 25 | /** 26 | * 上次刷新数据的日期和时间,采用Internet 日期和时间格式。 27 | */ 28 | @JsonProperty("last_refreshed_datetime") 29 | private String lastRefreshedDatetime; 30 | 31 | /** 32 | * 交易的零相对索引。 33 | */ 34 | @JsonProperty("page") 35 | private Integer page; 36 | 37 | /** 38 | * 以整数形式的事务总数,page以完整结果中指定的开头,而不仅仅是在此响应中。 39 | */ 40 | @JsonProperty("total_items") 41 | private Integer totalItems; 42 | 43 | /** 44 | * 总页数,作为integer,当total_items被划分为指定的页时page_size。 45 | */ 46 | @JsonProperty("total_pages") 47 | private Integer totalPages; 48 | 49 | /** 50 | * 一组与请求相关的HATEOAS 链接。 51 | * https://developer.paypal.com/api/rest/responses/#hateoas-links 52 | */ 53 | @JsonProperty("links") 54 | private List links; 55 | } 56 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/TransactionInfo.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @NoArgsConstructor 8 | @Data 9 | public class TransactionInfo { 10 | /** 11 | * 交易信息。 12 | */ 13 | @JsonProperty("paypal_account_id") 14 | private String paypalAccountId; 15 | 16 | /** 17 | * PayPal 生成的交易 ID 18 | */ 19 | @JsonProperty("transaction_id") 20 | private String transactionId; 21 | 22 | /** 23 | * 个五位数的交易事件代码,根据资金流动和借记或贷记对交易类型进行分类 24 | * https://developer.paypal.com/docs/transaction-search/transaction-event-codes/ 25 | */ 26 | @JsonProperty("transaction_event_code") 27 | private String transactionEventCode; 28 | 29 | /** 30 | * 在 PayPal 系统中开始处理交易的日期和时间,以付款这一方的帐户时区表示 31 | */ 32 | @JsonProperty("transaction_initiation_date") 33 | private String transactionInitiationDate; 34 | 35 | /** 36 | * 上次更改交易的日期和时间,以付款这边账户的时区表示。 37 | */ 38 | @JsonProperty("transaction_updated_date") 39 | private String transactionUpdatedDate; 40 | 41 | /** 42 | * 通过 PayPal 在发送方和接收方之间转移的全包交易总额。 43 | */ 44 | @JsonProperty("transaction_amount") 45 | private TransactionAmount transactionAmount; 46 | 47 | /** 48 | * PayPal 费用金额 49 | */ 50 | @JsonProperty("fee_amount") 51 | private TransactionAmount feeAmount; 52 | 53 | /** 54 | * 一笔保险费。保证产品的质量或交付。 55 | */ 56 | @JsonProperty("insurance_amount") 57 | private TransactionAmount insuranceAmount; 58 | 59 | /** 60 | * PayPal 或商家报告的交易运费。 61 | */ 62 | @JsonProperty("shipping_amount") 63 | private TransactionAmount shippingAmount; 64 | 65 | /** 66 | * 运费折扣。 67 | */ 68 | @JsonProperty("shipping_discount_amount") 69 | private TransactionAmount shippingDiscountAmount; 70 | 71 | /** 72 | * 交易状态的代码 73 | * D PayPal 或商家规则拒绝交易。 74 | * P 交易待定。交易已创建,但在状态更改为 之前等待另一个支付流程完成,例如 ACH 交易S。 75 | * S 交易成功完成,没有拒绝并且在任何未决状态之后。 76 | * V 成功的交易被完全撤销,资金被退还给原始发件人。 77 | */ 78 | @JsonProperty("transaction_status") 79 | private String transactionStatus; 80 | 81 | /** 82 | * 付款的主体。付款人将此值传递给收款人。付款人通过他或她发送数据的接口来控制这些数据。 83 | */ 84 | @JsonProperty("transaction_subject") 85 | private String transactionSubject; 86 | 87 | /** 88 | * 付款人传递给收款人的特殊说明。可能包含特殊的客户要求,例如运输说明。 89 | */ 90 | @JsonProperty("transaction_note") 91 | private String transactionNote; 92 | 93 | /** 94 | * 商家随交易发送的发票 ID。 95 | * 注意:如果发票 ID 与请款请求一起发送,则会报告该值。否则,上报授权交易的发票编号。 96 | */ 97 | @JsonProperty("invoice_id") 98 | private String invoiceId; 99 | 100 | /** 101 | * 商家提供的自定义文本。 102 | * 注意:通常,此字段包含使用 MassPay 类型交易进行的付款的唯一 ID。 103 | */ 104 | @JsonProperty("custom_field") 105 | private String customField; 106 | 107 | /** 108 | * 交易是否有资格获得保护 109 | * 01. 有资格的。 110 | * 02. 不容忽视 111 | * 03. 部分合格。 112 | */ 113 | @JsonProperty("protection_eligibility") 114 | private String protectionEligibility; 115 | } 116 | -------------------------------------------------------------------------------- /paypal-sdk/src/main/java/io/github/vo/UserInfo.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author EalenXie 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class UserInfo { 15 | @JsonProperty("user_id") 16 | private String userId; 17 | @JsonProperty("name") 18 | private String name; 19 | @JsonProperty("given_name") 20 | private String givenName; 21 | @JsonProperty("family_name") 22 | private String familyName; 23 | @JsonProperty("payer_id") 24 | private String payerId; 25 | @JsonProperty("address") 26 | private Address address; 27 | @JsonProperty("verified_account") 28 | private String verifiedAccount; 29 | @JsonProperty("emails") 30 | private List emails; 31 | } 32 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | io.github 8 | cross-border-electronic-commerce 9 | pom 10 | 1.0-SNAPSHOT 11 | 12 | allegro-sdk 13 | amazon-sdk 14 | wish-sdk 15 | walmart-sdk 16 | paypal-sdk 17 | 18 | 19 | 20 | 8 21 | 8 22 | 23 | 24 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | Cross-Border Electronic Commerce 2 | =========== 3 | 此项目用于对接各大跨境电商平台的接口SDK整合 4 | 5 | allegro: https://developer.allegro.pl/documentation/ 6 | 7 | amazon: https://developer-docs.amazon.com/sp-api 8 | 9 | wish: https://china-merchant.wish.com/partner-developer 10 | 11 | walmart: https://developer.walmart.com/ 12 | 13 | shopee: https://open.shopee.com/ 14 | 15 | -------------------------------------------------------------------------------- /walmart-sdk/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | cross-border-electronic-commerce 7 | io.github 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | walmart-sdk 13 | 14 | 15 | 8 16 | 8 17 | 18 | 19 | 20 | 21 | org.projectlombok 22 | lombok 23 | 1.18.22 24 | 25 | 26 | org.springframework 27 | spring-web 28 | 5.3.16 29 | 30 | 31 | com.fasterxml.jackson.core 32 | jackson-databind 33 | 2.13.2 34 | 35 | 36 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/WalmartClient.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace; 2 | 3 | import io.github.marketplace.vo.WalmartToken; 4 | import org.springframework.http.*; 5 | import org.springframework.web.client.RestOperations; 6 | import org.springframework.web.client.RestTemplate; 7 | 8 | import java.net.URI; 9 | import java.util.Collections; 10 | import java.util.UUID; 11 | 12 | /** 13 | * Created by EalenXie on 2022/3/16 14:02 14 | */ 15 | public abstract class WalmartClient { 16 | 17 | private final RestOperations restOperations; 18 | /** 19 | * Walmart Marketplace API Host地址 https://marketplace.walmartapis.com 20 | */ 21 | public static final String HOST = "https://marketplace.walmartapis.com"; 22 | /** 23 | * Walmart Marketplace API 沙箱环境地址 24 | */ 25 | public static final String SANDBOX_HOST = "https://sandbox.walmartapis.com/v3/orders/released"; 26 | /** 27 | * 沙箱模式 28 | */ 29 | private boolean sandBoxMode = false; 30 | 31 | @SuppressWarnings("all") 32 | public static final String WM_SVC_NAME = "WM_SVC.NAME"; 33 | @SuppressWarnings("all") 34 | public static final String WM_QOS_CORRELATION_ID = "WM_QOS.CORRELATION_ID"; 35 | @SuppressWarnings("all") 36 | public static final String WM_SEC_ACCESS_TOKEN = "WM_SEC.ACCESS_TOKEN"; 37 | 38 | private final String clientId; 39 | 40 | private final String clientSecret; 41 | 42 | protected WalmartClient(String clientId, String clientSecret) { 43 | this(clientId, clientSecret, new RestTemplate()); 44 | } 45 | 46 | protected WalmartClient(String clientId, String clientSecret, RestOperations restOperations) { 47 | this.restOperations = restOperations; 48 | this.clientId = clientId; 49 | this.clientSecret = clientSecret; 50 | } 51 | 52 | public String getClientId() { 53 | return clientId; 54 | } 55 | 56 | public String getClientSecret() { 57 | return clientSecret; 58 | } 59 | 60 | public RestOperations getRestOperations() { 61 | return restOperations; 62 | } 63 | 64 | public boolean isSandBoxMode() { 65 | return sandBoxMode; 66 | } 67 | 68 | public void setSandBoxMode(boolean sandBoxMode) { 69 | this.sandBoxMode = sandBoxMode; 70 | } 71 | 72 | /** 73 | * 获取accessToken 74 | * https://developer.walmart.com/api/us/mp/auth#operation/tokenAPI 75 | * 76 | * @return 访问令牌 77 | */ 78 | public ResponseEntity accessToken() { 79 | HttpHeaders headers = getCommonHeaders(); 80 | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); 81 | return getRestOperations().exchange(URI.create(String.format("%s/v3/token?grant_type=client_credentials", isSandBoxMode() ? SANDBOX_HOST : HOST)), HttpMethod.POST, new HttpEntity<>(null, headers), WalmartToken.class); 82 | } 83 | 84 | /** 85 | * 获取公共的请求头 86 | */ 87 | public HttpHeaders getCommonHeaders() { 88 | HttpHeaders headers = new HttpHeaders(); 89 | headers.setBasicAuth(getClientId(), getClientSecret()); 90 | headers.set(WM_SVC_NAME, "Walmart Marketplace"); 91 | headers.set(WM_QOS_CORRELATION_ID, UUID.randomUUID().toString()); 92 | headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON)); 93 | return headers; 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/WalmartOrderClient.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import io.github.marketplace.dto.CancelDTO; 5 | import io.github.marketplace.dto.OrdersDTO; 6 | import io.github.marketplace.dto.RefundDTO; 7 | import io.github.marketplace.dto.ShipmentDTO; 8 | import io.github.marketplace.vo.WalmartOrder; 9 | import io.github.marketplace.vo.WalmartOrders; 10 | import org.springframework.http.HttpEntity; 11 | import org.springframework.http.HttpHeaders; 12 | import org.springframework.http.HttpMethod; 13 | import org.springframework.http.ResponseEntity; 14 | import org.springframework.util.LinkedMultiValueMap; 15 | import org.springframework.web.client.RestOperations; 16 | import org.springframework.web.client.RestTemplate; 17 | import org.springframework.web.util.UriComponentsBuilder; 18 | 19 | import java.net.URI; 20 | import java.util.LinkedHashMap; 21 | import java.util.Map; 22 | 23 | /** 24 | * Created by EalenXie on 2022/3/16 14:02 25 | * https://developer.walmart.com/api/us/mp/orders 26 | */ 27 | public class WalmartOrderClient extends WalmartClient { 28 | 29 | private final ObjectMapper mapper; 30 | 31 | public WalmartOrderClient(String clientId, String clientSecret) { 32 | this(clientId, clientSecret, new RestTemplate()); 33 | } 34 | 35 | public WalmartOrderClient(String clientId, String clientSecret, RestOperations restOperations) { 36 | this(clientId, clientSecret, restOperations, new ObjectMapper()); 37 | } 38 | 39 | public WalmartOrderClient(String clientId, String clientSecret, RestOperations restOperations, ObjectMapper objectMapper) { 40 | super(clientId, clientSecret, restOperations); 41 | this.mapper = objectMapper; 42 | } 43 | 44 | /** 45 | * https://developer.walmart.com/api/us/mp/orders#operation/getAllReleasedOrders 46 | */ 47 | public ResponseEntity orders(String accessToken, OrdersDTO dto) { 48 | HttpHeaders headers = getCommonHeaders(); 49 | headers.set(WM_SEC_ACCESS_TOKEN, accessToken); 50 | @SuppressWarnings("unchecked") Map args = mapper.convertValue(dto, Map.class); 51 | UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(String.format("%s/v3/orders", isSandBoxMode() ? SANDBOX_HOST : HOST)); 52 | LinkedMultiValueMap req = new LinkedMultiValueMap<>(); 53 | req.setAll(args); 54 | builder.queryParams(req); 55 | URI uri = builder.build().encode().toUri(); 56 | return getRestOperations().exchange(uri, HttpMethod.GET, new HttpEntity<>(null, headers), WalmartOrders.class); 57 | } 58 | 59 | /** 60 | * https://developer.walmart.com/api/us/mp/orders#operation/getAnOrder 61 | */ 62 | public ResponseEntity order(String accessToken, String orderId) { 63 | HttpHeaders headers = getCommonHeaders(); 64 | headers.set(WM_SEC_ACCESS_TOKEN, accessToken); 65 | return getRestOperations().exchange(URI.create(String.format("%s/v3/orders/%s", isSandBoxMode() ? SANDBOX_HOST : HOST, orderId)), HttpMethod.GET, new HttpEntity<>(null, headers), WalmartOrder.class); 66 | } 67 | 68 | /** 69 | * https://developer.walmart.com/api/us/mp/orders#operation/getAllReleasedOrders 70 | */ 71 | public ResponseEntity releasedOrders(String accessToken) { 72 | HttpHeaders headers = getCommonHeaders(); 73 | headers.set(WM_SEC_ACCESS_TOKEN, accessToken); 74 | return getRestOperations().exchange(URI.create(String.format("%s/v3/orders/released", isSandBoxMode() ? SANDBOX_HOST : HOST)), HttpMethod.GET, new HttpEntity<>(null, headers), WalmartOrders.class); 75 | } 76 | 77 | /** 78 | * https://developer.walmart.com/api/us/mp/orders#operation/refundOrderLines 79 | */ 80 | public ResponseEntity refund(String purchaseOrderId, String accessToken, RefundDTO dto) { 81 | HttpHeaders headers = getCommonHeaders(); 82 | headers.set(WM_SEC_ACCESS_TOKEN, accessToken); 83 | return getRestOperations().exchange(String.format("%s/v3/orders/%s/refund", isSandBoxMode() ? SANDBOX_HOST : HOST, purchaseOrderId), HttpMethod.POST, new HttpEntity<>(dto, headers), WalmartOrder.class); 84 | } 85 | 86 | /** 87 | * https://developer.walmart.com/api/us/mp/orders#operation/shippingUpdates 88 | */ 89 | public ResponseEntity shipment(String purchaseOrderId, String accessToken, ShipmentDTO dto) { 90 | HttpHeaders headers = getCommonHeaders(); 91 | headers.set(WM_SEC_ACCESS_TOKEN, accessToken); 92 | return getRestOperations().exchange(String.format("%s/v3/orders/%s/shipping", isSandBoxMode() ? SANDBOX_HOST : HOST, purchaseOrderId), HttpMethod.POST, new HttpEntity<>(dto, headers), WalmartOrder.class); 93 | } 94 | 95 | /** 96 | * https://developer.walmart.com/api/us/mp/orders#operation/acknowledgeOrders 97 | */ 98 | public ResponseEntity acknowledge(String purchaseOrderId, String accessToken) { 99 | HttpHeaders headers = getCommonHeaders(); 100 | headers.set(WM_SEC_ACCESS_TOKEN, accessToken); 101 | return getRestOperations().exchange(String.format("%s/v3/orders/%s/acknowledge", isSandBoxMode() ? SANDBOX_HOST : HOST, purchaseOrderId), HttpMethod.POST, new HttpEntity<>(null, headers), WalmartOrder.class); 102 | } 103 | 104 | /** 105 | * https://developer.walmart.com/api/us/mp/orders#operation/cancelOrderLines 106 | */ 107 | public ResponseEntity cancel(String purchaseOrderId, String accessToken, CancelDTO dto) { 108 | HttpHeaders headers = getCommonHeaders(); 109 | headers.set(WM_SEC_ACCESS_TOKEN, accessToken); 110 | return getRestOperations().exchange(String.format("%s/v3/orders/%s/cancel", isSandBoxMode() ? SANDBOX_HOST : HOST, purchaseOrderId), HttpMethod.POST, new HttpEntity<>(dto, headers), WalmartOrder.class); 111 | } 112 | 113 | } 114 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/dto/CancelDTO.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/21 14:11 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class CancelDTO { 15 | 16 | @JsonProperty("orderCancellation") 17 | private OrderCancellation orderCancellation; 18 | 19 | @NoArgsConstructor 20 | @Data 21 | public static class OrderCancellation { 22 | @JsonProperty("orderLines") 23 | private OrderLines orderLines; 24 | 25 | @NoArgsConstructor 26 | @Data 27 | public static class OrderLines { 28 | @JsonProperty("orderLine") 29 | private List orderLine; 30 | 31 | @NoArgsConstructor 32 | @Data 33 | public static class OrderLine { 34 | @JsonProperty("lineNumber") 35 | private String lineNumber; 36 | @JsonProperty("orderLineStatuses") 37 | private OrderLineStatuses orderLineStatuses; 38 | 39 | @NoArgsConstructor 40 | @Data 41 | public static class OrderLineStatuses { 42 | @JsonProperty("orderLineStatus") 43 | private List orderLineStatus; 44 | 45 | @NoArgsConstructor 46 | @Data 47 | public static class OrderLineStatus { 48 | @JsonProperty("status") 49 | private String status; 50 | @JsonProperty("cancellationReason") 51 | private String cancellationReason; 52 | @JsonProperty("statusQuantity") 53 | private StatusQuantity statusQuantity; 54 | 55 | @NoArgsConstructor 56 | @Data 57 | public static class StatusQuantity { 58 | @JsonProperty("unitOfMeasurement") 59 | private String unitOfMeasurement; 60 | @JsonProperty("amount") 61 | private String amount; 62 | } 63 | } 64 | } 65 | } 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/dto/OrdersDTO.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import com.fasterxml.jackson.annotation.JsonInclude; 5 | import lombok.Data; 6 | 7 | import java.util.Date; 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/16 15:51 11 | */ 12 | @Data 13 | public class OrdersDTO { 14 | 15 | /** 16 | * 必填 17 | * The Distribution Facility “Distributor ID” which uniquely identifies each facility and is autogenerated during DSV account creation. Every time you add/update a facility in the Supplier Center, a new ID is generated 18 | */ 19 | @JsonInclude(JsonInclude.Include.NON_NULL) 20 | private Integer limit; 21 | @JsonInclude(JsonInclude.Include.NON_NULL) 22 | private String sku; 23 | @JsonInclude(JsonInclude.Include.NON_NULL) 24 | private String customerOrderId; 25 | @JsonInclude(JsonInclude.Include.NON_NULL) 26 | private String purchaseOrderId; 27 | @JsonInclude(JsonInclude.Include.NON_NULL) 28 | private String status; 29 | @JsonInclude(JsonInclude.Include.NON_NULL) 30 | @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssZ") 31 | private Date createdStartDate; 32 | @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssZ") 33 | private Date createdEndDate; 34 | @JsonInclude(JsonInclude.Include.NON_NULL) 35 | private String fromExpectedShipDate; 36 | @JsonInclude(JsonInclude.Include.NON_NULL) 37 | private String toExpectedShipDate; 38 | @JsonInclude(JsonInclude.Include.NON_NULL) 39 | private Boolean productInfo; 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/dto/RefundDTO.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/21 13:40 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class RefundDTO { 15 | 16 | @JsonProperty("orderRefund") 17 | private OrderRefund orderRefund; 18 | 19 | @NoArgsConstructor 20 | @Data 21 | public static class OrderRefund { 22 | @JsonProperty("purchaseOrderId") 23 | private String purchaseOrderId; 24 | @JsonProperty("orderLines") 25 | private OrderLines orderLines; 26 | 27 | @NoArgsConstructor 28 | @Data 29 | public static class OrderLines { 30 | @JsonProperty("orderLine") 31 | private List orderLine; 32 | 33 | @NoArgsConstructor 34 | @Data 35 | public static class OrderLine { 36 | @JsonProperty("lineNumber") 37 | private String lineNumber; 38 | @JsonProperty("refunds") 39 | private Refunds refunds; 40 | 41 | @NoArgsConstructor 42 | @Data 43 | public static class Refunds { 44 | @JsonProperty("refund") 45 | private List refund; 46 | 47 | @NoArgsConstructor 48 | @Data 49 | public static class Refund { 50 | @JsonProperty("refundComments") 51 | private String refundComments; 52 | @JsonProperty("refundCharges") 53 | private RefundCharges refundCharges; 54 | 55 | @NoArgsConstructor 56 | @Data 57 | public static class RefundCharges { 58 | @JsonProperty("refundCharge") 59 | private List refundCharge; 60 | 61 | @NoArgsConstructor 62 | @Data 63 | public static class RefundCharge { 64 | @JsonProperty("refundReason") 65 | private String refundReason; 66 | @JsonProperty("charge") 67 | private Charge charge; 68 | 69 | @NoArgsConstructor 70 | @Data 71 | public static class Charge { 72 | @JsonProperty("chargeType") 73 | private String chargeType; 74 | @JsonProperty("chargeName") 75 | private String chargeName; 76 | @JsonProperty("chargeAmount") 77 | private ChargeAmount chargeAmount; 78 | @JsonProperty("tax") 79 | private Tax tax; 80 | 81 | @NoArgsConstructor 82 | @Data 83 | public static class ChargeAmount { 84 | @JsonProperty("currency") 85 | private String currency; 86 | @JsonProperty("amount") 87 | private Double amount; 88 | } 89 | 90 | @NoArgsConstructor 91 | @Data 92 | public static class Tax { 93 | @JsonProperty("taxName") 94 | private String taxName; 95 | @JsonProperty("taxAmount") 96 | private TaxAmount taxAmount; 97 | 98 | @NoArgsConstructor 99 | @Data 100 | public static class TaxAmount { 101 | @JsonProperty("currency") 102 | private String currency; 103 | @JsonProperty("amount") 104 | private Double amount; 105 | } 106 | } 107 | } 108 | } 109 | } 110 | } 111 | } 112 | } 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/dto/ShipmentDTO.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import io.github.marketplace.vo.OrderShipment; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/21 14:01 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class ShipmentDTO { 15 | @JsonProperty("orderShipment") 16 | private OrderShipment orderShipment; 17 | } 18 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/CarrierName.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:12 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class CarrierName { 13 | @JsonProperty("carrier") 14 | private String carrier; 15 | } 16 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/Charge.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:12 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Charge { 13 | @JsonProperty("chargeType") 14 | private String chargeType; 15 | @JsonProperty("chargeName") 16 | private String chargeName; 17 | @JsonProperty("chargeAmount") 18 | private ChargeAmount chargeAmount; 19 | @JsonProperty("tax") 20 | private Tax tax; 21 | } 22 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/ChargeAmount.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:12 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class ChargeAmount { 13 | @JsonProperty("currency") 14 | private String currency; 15 | @JsonProperty("amount") 16 | private Integer amount; 17 | } 18 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/Charges.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/24 15:12 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class Charges { 15 | @JsonProperty("charge") 16 | private List charge; 17 | } 18 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/Elements.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/24 15:17 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class Elements { 15 | @JsonProperty("order") 16 | private List order; 17 | } 18 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/Fulfillment.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:12 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Fulfillment { 13 | @JsonProperty("fulfillmentOption") 14 | private String fulfillmentOption; 15 | @JsonProperty("shipMethod") 16 | private String shipMethod; 17 | @JsonProperty("pickUpDateTime") 18 | private Long pickUpDateTime; 19 | } 20 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/Item.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:12 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Item { 13 | @JsonProperty("productName") 14 | private String productName; 15 | @JsonProperty("sku") 16 | private String sku; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/Meta.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:17 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Meta { 13 | @JsonProperty("totalCount") 14 | private Integer totalCount; 15 | @JsonProperty("limit") 16 | private Integer limit; 17 | @JsonProperty("nextCursor") 18 | private String nextCursor; 19 | } 20 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/Order.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:12 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Order { 13 | @JsonProperty("purchaseOrderId") 14 | private String purchaseOrderId; 15 | @JsonProperty("customerOrderId") 16 | private String customerOrderId; 17 | @JsonProperty("customerEmailId") 18 | private String customerEmailId; 19 | @JsonProperty("orderType") 20 | private String orderType; 21 | @JsonProperty("originalCustomerOrderID") 22 | private String originalCustomerOrderID; 23 | @JsonProperty("orderDate") 24 | private Long orderDate; 25 | @JsonProperty("shippingInfo") 26 | private ShippingInfo shippingInfo; 27 | @JsonProperty("orderLines") 28 | private OrderLines orderLines; 29 | @JsonProperty("shipNode") 30 | private ShipNode shipNode; 31 | } 32 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/OrderLine.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:12 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class OrderLine { 13 | @JsonProperty("lineNumber") 14 | private String lineNumber; 15 | @JsonProperty("item") 16 | private Item item; 17 | @JsonProperty("charges") 18 | private Charges charges; 19 | @JsonProperty("orderLineQuantity") 20 | private OrderLineQuantity orderLineQuantity; 21 | @JsonProperty("statusDate") 22 | private Long statusDate; 23 | @JsonProperty("orderLineStatuses") 24 | private OrderLineStatuses orderLineStatuses; 25 | @JsonProperty("fulfillment") 26 | private Fulfillment fulfillment; 27 | } 28 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/OrderLineQuantity.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:12 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class OrderLineQuantity { 13 | @JsonProperty("unitOfMeasurement") 14 | private String unitOfMeasurement; 15 | @JsonProperty("amount") 16 | private String amount; 17 | } 18 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/OrderLineStatus.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:12 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class OrderLineStatus { 13 | @JsonProperty("status") 14 | private String status; 15 | @JsonProperty("statusQuantity") 16 | private OrderLineQuantity statusQuantity; 17 | @JsonProperty("trackingInfo") 18 | private TrackingInfo trackingInfo; 19 | @JsonProperty("returnCenterAddress") 20 | private ReturnCenterAddress returnCenterAddress; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/OrderLineStatuses.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/24 15:12 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class OrderLineStatuses { 15 | @JsonProperty("orderLineStatus") 16 | private List orderLineStatus; 17 | } 18 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/OrderLines.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/24 15:12 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class OrderLines { 15 | @JsonProperty("orderLine") 16 | private List orderLine; 17 | } 18 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/OrderList.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:17 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class OrderList { 13 | @JsonProperty("meta") 14 | private Meta meta; 15 | @JsonProperty("elements") 16 | private Elements elements; 17 | } 18 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/OrderShipment.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class OrderShipment { 13 | @JsonProperty("orderLines") 14 | private OrderLines orderLines; 15 | } 16 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/PostalAddress.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:12 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class PostalAddress { 13 | @JsonProperty("name") 14 | private String name; 15 | @JsonProperty("address1") 16 | private String address1; 17 | @JsonProperty("city") 18 | private String city; 19 | @JsonProperty("state") 20 | private String state; 21 | @JsonProperty("postalCode") 22 | private String postalCode; 23 | @JsonProperty("country") 24 | private String country; 25 | @JsonProperty("addressType") 26 | private String addressType; 27 | } 28 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/ReturnCenterAddress.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:39 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class ReturnCenterAddress { 13 | @JsonProperty("name") 14 | private String name; 15 | @JsonProperty("address1") 16 | private String address1; 17 | @JsonProperty("city") 18 | private String city; 19 | @JsonProperty("state") 20 | private String state; 21 | @JsonProperty("postalCode") 22 | private String postalCode; 23 | @JsonProperty("country") 24 | private String country; 25 | @JsonProperty("dayPhone") 26 | private String dayPhone; 27 | @JsonProperty("emailId") 28 | private String emailId; 29 | } 30 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/ShipNode.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:12 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class ShipNode { 13 | @JsonProperty("type") 14 | private String type; 15 | } 16 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/ShippingInfo.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:12 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class ShippingInfo { 13 | @JsonProperty("phone") 14 | private String phone; 15 | @JsonProperty("estimatedDeliveryDate") 16 | private Long estimatedDeliveryDate; 17 | @JsonProperty("estimatedShipDate") 18 | private Long estimatedShipDate; 19 | @JsonProperty("methodCode") 20 | private String methodCode; 21 | @JsonProperty("postalAddress") 22 | private PostalAddress postalAddress; 23 | } 24 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/StatusQuantity.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @NoArgsConstructor 8 | @Data 9 | public class StatusQuantity { 10 | @JsonProperty("unitOfMeasurement") 11 | private String unitOfMeasurement; 12 | @JsonProperty("amount") 13 | private String amount; 14 | } -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/Tax.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:12 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Tax { 13 | @JsonProperty("taxName") 14 | private String taxName; 15 | @JsonProperty("taxAmount") 16 | private TaxAmount taxAmount; 17 | } 18 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/TaxAmount.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:12 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class TaxAmount { 13 | @JsonProperty("currency") 14 | private String currency; 15 | @JsonProperty("amount") 16 | private Double amount; 17 | } 18 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/TrackingInfo.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:12 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class TrackingInfo { 13 | @JsonProperty("shipDateTime") 14 | private Long shipDateTime; 15 | @JsonProperty("carrierName") 16 | private CarrierName carrierName; 17 | @JsonProperty("methodCode") 18 | private String methodCode; 19 | @JsonProperty("trackingNumber") 20 | private String trackingNumber; 21 | @JsonProperty("trackingURL") 22 | private String trackingURL; 23 | } 24 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/WalmartOrder.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:11 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class WalmartOrder { 13 | @JsonProperty("order") 14 | private Order order; 15 | } 16 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/WalmartOrders.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:15 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class WalmartOrders { 13 | 14 | 15 | @JsonProperty("list") 16 | private OrderList list; 17 | } 18 | -------------------------------------------------------------------------------- /walmart-sdk/src/main/java/io/github/marketplace/vo/WalmartToken.java: -------------------------------------------------------------------------------- 1 | package io.github.marketplace.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/16 15:08 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class WalmartToken { 13 | 14 | @JsonProperty("access_token") 15 | private String accessToken; 16 | @JsonProperty("token_type") 17 | private String tokenType; 18 | @JsonProperty("expires_in") 19 | private Integer expiresIn; 20 | } 21 | -------------------------------------------------------------------------------- /wish-sdk/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | cross-border-electronic-commerce 7 | io.github 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | wish-sdk 13 | 14 | 15 | 8 16 | 8 17 | 18 | 19 | 20 | org.projectlombok 21 | lombok 22 | 1.18.22 23 | 24 | 25 | org.springframework 26 | spring-web 27 | 5.3.16 28 | 29 | 30 | com.fasterxml.jackson.core 31 | jackson-databind 32 | 2.13.2 33 | 34 | 35 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/WishClient.java: -------------------------------------------------------------------------------- 1 | package io.github; 2 | 3 | import io.github.vo.WishToken; 4 | import org.springframework.http.HttpEntity; 5 | import org.springframework.http.HttpHeaders; 6 | import org.springframework.http.HttpMethod; 7 | import org.springframework.http.ResponseEntity; 8 | import org.springframework.web.client.RestOperations; 9 | import org.springframework.web.client.RestTemplate; 10 | 11 | import java.net.URI; 12 | 13 | 14 | /** 15 | * Created by EalenXie on 2022/2/23 9:51 16 | */ 17 | public abstract class WishClient { 18 | 19 | 20 | private final RestOperations restOperations; 21 | /** 22 | * Wish Host 地址 https://merchant.wish.co 23 | */ 24 | public static final String HOST = "https://merchant.wish.com"; 25 | 26 | /** 27 | * Wish Host 地址(沙箱环境) https://sandbox.merchant.wish.com 28 | */ 29 | public static final String SANDBOX_HOST = "https://sandbox.merchant.wish.com"; 30 | /** 31 | * 是否是沙箱环境 32 | */ 33 | private boolean sandbox = false; 34 | 35 | public boolean isSandbox() { 36 | return sandbox; 37 | } 38 | 39 | public void setSandbox(boolean sandbox) { 40 | this.sandbox = sandbox; 41 | } 42 | 43 | protected WishClient() { 44 | this(new RestTemplate()); 45 | } 46 | 47 | protected WishClient(RestOperations restOperations) { 48 | this.restOperations = restOperations; 49 | } 50 | 51 | public RestOperations getRestOperations() { 52 | return restOperations; 53 | } 54 | 55 | /** 56 | * 获取授权地址 文档: https://china-merchant.wish.com/documentation/api/v3/reference#section/Authentication 57 | * 58 | * @param state 应用程序生成的状态值。 59 | */ 60 | public String authorize(String clientId, String state) { 61 | return String.format("%s/v3/oauth/authorize?client_id=%s&state=%s", isSandbox() ? SANDBOX_HOST : HOST, clientId, state); 62 | } 63 | 64 | /** 65 | * 获取包含认证的 Bearer 标准请求头 66 | * 67 | * @param accessToken 令牌 68 | */ 69 | public HttpHeaders getBearerHeaders(String accessToken) { 70 | HttpHeaders bearTokenHeader = new HttpHeaders(); 71 | bearTokenHeader.setBearerAuth(accessToken); 72 | return bearTokenHeader; 73 | } 74 | 75 | /** 76 | * 获取包含认证的 Basic 标准请求头 77 | * 78 | * @param clientId 客户端Id 79 | * @param clientSecret 客户端密钥 80 | */ 81 | public HttpHeaders getBasicHeaders(String clientId, String clientSecret) { 82 | HttpHeaders basicHeader = new HttpHeaders(); 83 | basicHeader.setBasicAuth(clientId, clientSecret); 84 | return basicHeader; 85 | } 86 | 87 | /** 88 | * 授权码模式获取accessToken 文档: https://china-merchant.wish.com/documentation/api/v3/reference#operation/oauthAccessToken 89 | * 90 | * @param clientId 客户端Id 91 | * @param clientSecret 客户端密钥 92 | * @param code 授权码 93 | * @param redirectUri 重定向地址 94 | */ 95 | public ResponseEntity accessToken(String clientId, String clientSecret, String code, String redirectUri) { 96 | HttpHeaders headers = getBasicHeaders(clientId, clientSecret); 97 | return restOperations.exchange(URI.create(String.format("%s/api/v3/oauth/access_token?grant_type=authorization_code&code=%s&redirect_uri=%s", isSandbox() ? SANDBOX_HOST : HOST, code, redirectUri)), HttpMethod.POST, new HttpEntity<>(null, headers), WishToken.class); 98 | } 99 | 100 | 101 | } 102 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/WishOrderClient.java: -------------------------------------------------------------------------------- 1 | package io.github; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import io.github.dto.*; 5 | import io.github.vo.NameVO; 6 | import io.github.vo.WishDownloadJob; 7 | import io.github.vo.WishOrder; 8 | import org.springframework.core.ParameterizedTypeReference; 9 | import org.springframework.http.*; 10 | import org.springframework.util.LinkedMultiValueMap; 11 | import org.springframework.web.client.RestOperations; 12 | import org.springframework.web.client.RestTemplate; 13 | import org.springframework.web.util.UriComponentsBuilder; 14 | 15 | import java.net.URI; 16 | import java.util.List; 17 | import java.util.Map; 18 | 19 | /** 20 | * Created by EalenXie on 2022/2/23 9:51 21 | * https://china-merchant.wish.com/documentation/api/v3/reference#tag/Orders 22 | */ 23 | public class WishOrderClient extends WishClient { 24 | 25 | private final ObjectMapper mapper; 26 | 27 | public WishOrderClient() { 28 | this(new RestTemplate()); 29 | } 30 | 31 | public WishOrderClient(RestOperations restOperations) { 32 | this(new ObjectMapper(), restOperations); 33 | } 34 | 35 | public WishOrderClient(ObjectMapper objectMapper, RestOperations restOperations) { 36 | super(restOperations); 37 | this.mapper = objectMapper; 38 | } 39 | 40 | /** 41 | * 获取订单详情 42 | * 接口文档 https://china-merchant.wish.com/documentation/api/v3/reference#operation/GetOrder 43 | * 44 | * @param orderId 订单Id 45 | * @param accessToken 令牌 46 | * @return {@link WishOrder} 订单详情 47 | */ 48 | public ResponseEntity getOrder(String orderId, String accessToken) { 49 | HttpHeaders headers = getBearerHeaders(accessToken); 50 | return getRestOperations().exchange(URI.create(String.format("%s/api/v3/orders/%s", isSandbox() ? SANDBOX_HOST : HOST, orderId)), HttpMethod.GET, new HttpEntity<>(null, headers), WishOrder.class); 51 | } 52 | 53 | /** 54 | * 获取订单列表 55 | * 接口文档 https://china-merchant.wish.com/documentation/api/v3/reference#operation/GetMultipleOrders 56 | * 57 | * @param dto 订单请求参数 58 | * @param accessToken 令牌 59 | * @return {@link WishOrder} 订单详情 60 | */ 61 | public ResponseEntity> getOrders(OrdersDTO dto, String accessToken) { 62 | HttpHeaders headers = getBearerHeaders(accessToken); 63 | LinkedMultiValueMap req = queryParam(dto); 64 | UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(String.format("%s/api/v3/orders", isSandbox() ? SANDBOX_HOST : HOST)).queryParams(req); 65 | return getRestOperations().exchange(builder.build().encode().toUri(), HttpMethod.GET, new HttpEntity<>(null, headers), new ParameterizedTypeReference>() { 66 | }); 67 | } 68 | 69 | public LinkedMultiValueMap queryParam(Object dto) { 70 | @SuppressWarnings("unchecked") Map args = mapper.convertValue(dto, Map.class); 71 | LinkedMultiValueMap req = new LinkedMultiValueMap<>(); 72 | req.setAll(args); 73 | return req; 74 | } 75 | 76 | 77 | /** 78 | * 获取货运公司 79 | * 接口文档 https://china-merchant.wish.com/documentation/api/v3/reference#operation/GetShippingCarriers 80 | * 81 | * @param dto 请求参数 82 | * @param accessToken 令牌 83 | * @return {@link NameVO} 物流公司 84 | */ 85 | public ResponseEntity> shippingCarriers(ShippingCarriersDTO dto, String accessToken) { 86 | HttpHeaders headers = getBearerHeaders(accessToken); 87 | LinkedMultiValueMap req = queryParam(dto); 88 | UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(String.format("%s/api/v3/shipping_carriers", isSandbox() ? SANDBOX_HOST : HOST)).queryParams(req); 89 | return getRestOperations().exchange(builder.build().encode().toUri(), HttpMethod.GET, new HttpEntity<>(null, headers), new ParameterizedTypeReference>() { 90 | }); 91 | } 92 | 93 | 94 | /** 95 | * 批量获取订单下载 96 | * 接口文档 https://china-merchant.wish.com/documentation/api/v3/reference#operation/downloadOrders 97 | * 98 | * @param dto 请求参数 99 | * @param accessToken 令牌 100 | * @return {@link WishDownloadJob} 订单下载信息 101 | */ 102 | public ResponseEntity batchDownloadOrders(OrdersDTO dto, String accessToken) { 103 | HttpHeaders headers = getBearerHeaders(accessToken); 104 | LinkedMultiValueMap req = queryParam(dto); 105 | UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(String.format("%s/api/v3/bulk_get", isSandbox() ? SANDBOX_HOST : HOST)).queryParams(req); 106 | return getRestOperations().exchange(builder.build().encode().toUri(), HttpMethod.POST, new HttpEntity<>(null, headers), WishDownloadJob.class); 107 | } 108 | 109 | 110 | /** 111 | * 获取订单下载 112 | * 接口文档 https://china-merchant.wish.com/documentation/api/v3/reference#operation/getOrderDownloadJob 113 | * 114 | * @param accessToken 令牌 115 | * @return {@link WishDownloadJob} 订单下载信息 116 | */ 117 | public ResponseEntity batchDownloadJobStatus(String jobId, String accessToken) { 118 | HttpHeaders headers = getBearerHeaders(accessToken); 119 | return getRestOperations().exchange(String.format("%s/api/v3/bulk_get/%s", isSandbox() ? SANDBOX_HOST : HOST, jobId), HttpMethod.GET, new HttpEntity<>(null, headers), WishDownloadJob.class); 120 | } 121 | 122 | /** 123 | * 发货或更新跟踪订单。 此操作为异步操作。 124 | * 接口文档 https://china-merchant.wish.com/documentation/api/v3/reference#operation/ShipOrder 125 | * 126 | * @param orderId 订单id 127 | * @param dto 请求参数 128 | * @param accessToken 令牌 129 | * @return {@link WishOrder} 发货返回信息 130 | */ 131 | public ResponseEntity shipOrUpdateTracking(String orderId, TrackingDTO dto, String accessToken) { 132 | HttpHeaders headers = getBearerHeaders(accessToken); 133 | headers.setContentType(MediaType.APPLICATION_JSON); 134 | HttpEntity httpEntity = new HttpEntity<>(dto, headers); 135 | return getRestOperations().exchange(String.format("%s/api/v3/orders/%s/tracking", isSandbox() ? SANDBOX_HOST : HOST, orderId), HttpMethod.PUT, httpEntity, WishOrder.class); 136 | } 137 | 138 | /** 139 | * 获取退货原因 140 | * 接口文档 https://china-merchant.wish.com/documentation/api/v3/reference#operation/GetValidRefundReasons 141 | * 142 | * @param orderId 订单id 143 | * @param accessToken 令牌 144 | */ 145 | public ResponseEntity> refundReasons(String orderId, String accessToken) { 146 | HttpHeaders headers = getBearerHeaders(accessToken); 147 | return getRestOperations().exchange(String.format("%s/api/v3/orders/%s/refund_reasons", isSandbox() ? SANDBOX_HOST : HOST, orderId), HttpMethod.GET, new HttpEntity<>(null, headers), new ParameterizedTypeReference>() { 148 | }); 149 | } 150 | 151 | /** 152 | * 取消订单 153 | * 接口文档 https://china-merchant.wish.com/documentation/api/v3/reference#operation/RefundOrder 154 | * 155 | * @param orderId 订单id 156 | * @param dto 请求参数 157 | * @param accessToken 令牌 158 | * @return {@link WishOrder} 取消订单返回结果 159 | */ 160 | public ResponseEntity refund(String orderId, RefundDTO dto, String accessToken) { 161 | HttpHeaders headers = getBearerHeaders(accessToken); 162 | headers.setContentType(MediaType.APPLICATION_JSON); 163 | return getRestOperations().exchange(String.format("%s/api/v3/orders/%s/refund", isSandbox() ? SANDBOX_HOST : HOST, orderId), HttpMethod.PUT, new HttpEntity<>(dto, headers), WishOrder.class); 164 | } 165 | 166 | 167 | /** 168 | * 更新订单 169 | * 接口文档 https://china-merchant.wish.com/documentation/api/v3/reference#operation/UpdateOrder 170 | * 171 | * @param orderId 订单Id 172 | * @param accessToken 令牌 173 | * @return {@link WishOrder} 订单返回信息 174 | */ 175 | public ResponseEntity updateLTLOrder(String orderId, UpdateLtlDTO dto, String accessToken) { 176 | HttpHeaders headers = getBearerHeaders(accessToken); 177 | return getRestOperations().exchange(URI.create(String.format("%s/api/v3/orders/%s", isSandbox() ? SANDBOX_HOST : HOST, orderId)), HttpMethod.PUT, new HttpEntity<>(dto, headers), WishOrder.class); 178 | } 179 | 180 | /** 181 | * 修改物流地址 182 | * 接口文档 https://china-merchant.wish.com/documentation/api/v3/reference#operation/ModifyAddress 183 | * 184 | * @param orderId 订单Id 185 | * @param accessToken 令牌 186 | * @return {@link WishOrder} 订单返回信息 187 | */ 188 | public ResponseEntity modifyAddress(String orderId, ModifyAddressDTO dto, String accessToken) { 189 | HttpHeaders headers = getBearerHeaders(accessToken); 190 | return getRestOperations().exchange(URI.create(String.format("%s/api/v3/orders/%s/address", isSandbox() ? SANDBOX_HOST : HOST, orderId)), HttpMethod.PUT, new HttpEntity<>(dto, headers), WishOrder.class); 191 | } 192 | 193 | } 194 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/dto/ModifyAddressDTO.java: -------------------------------------------------------------------------------- 1 | package io.github.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/21 15:23 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class ModifyAddressDTO { 13 | 14 | 15 | @JsonProperty("city") 16 | private String city; 17 | @JsonProperty("country") 18 | private String country; 19 | @JsonProperty("street_address3") 20 | private String streetAddress3; 21 | @JsonProperty("street_address2") 22 | private String streetAddress2; 23 | @JsonProperty("street_address1") 24 | private String streetAddress1; 25 | @JsonProperty("zipcode") 26 | private String zipcode; 27 | @JsonProperty("state") 28 | private String state; 29 | @JsonProperty("country_code") 30 | private String countryCode; 31 | @JsonProperty("phone_number") 32 | private PhoneNumber phoneNumber; 33 | @JsonProperty("region") 34 | private String region; 35 | 36 | @NoArgsConstructor 37 | @Data 38 | public static class PhoneNumber { 39 | @JsonProperty("number") 40 | private String number; 41 | @JsonProperty("country_code") 42 | private String countryCode; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/dto/OrdersDTO.java: -------------------------------------------------------------------------------- 1 | package io.github.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | /** 9 | * Created by EalenXie on 2022/2/23 13:55 10 | */ 11 | @Getter 12 | @Setter 13 | public class OrdersDTO { 14 | @JsonInclude(JsonInclude.Include.NON_NULL) 15 | private Integer limit; 16 | @JsonProperty("order_type") 17 | @JsonInclude(JsonInclude.Include.NON_NULL) 18 | private String orderType; 19 | @JsonProperty("released_at_max") 20 | @JsonInclude(JsonInclude.Include.NON_NULL) 21 | private String releasedAtMax; 22 | @JsonProperty("released_at_min") 23 | @JsonInclude(JsonInclude.Include.NON_NULL) 24 | private String releasedAtMin; 25 | @JsonProperty("sort_by") 26 | @JsonInclude(JsonInclude.Include.NON_NULL) 27 | private String sortBy; 28 | @JsonProperty("states") 29 | @JsonInclude(JsonInclude.Include.NON_NULL) 30 | private String[] states; 31 | @JsonProperty("updated_at_max") 32 | @JsonInclude(JsonInclude.Include.NON_NULL) 33 | private String updatedAtMax; 34 | @JsonProperty("updated_at_min") 35 | @JsonInclude(JsonInclude.Include.NON_NULL) 36 | private String updatedAtMin; 37 | } 38 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/dto/RefundDTO.java: -------------------------------------------------------------------------------- 1 | package io.github.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/21 15:14 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class RefundDTO { 13 | 14 | @JsonProperty("refund_reason_note") 15 | private String refundReasonNote; 16 | @JsonProperty("refund_reason") 17 | private String refundReason; 18 | } 19 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/dto/ShippingCarriersDTO.java: -------------------------------------------------------------------------------- 1 | package io.github.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/18 16:37 9 | */ 10 | @Getter 11 | @Setter 12 | public class ShippingCarriersDTO { 13 | 14 | @JsonProperty("dest_country_code") 15 | private String destCountryCode; 16 | @JsonProperty("order_type") 17 | private String orderType; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/dto/TrackingDTO.java: -------------------------------------------------------------------------------- 1 | package io.github.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/18 16:56 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class TrackingDTO { 13 | 14 | 15 | @JsonProperty("tracking_number") 16 | private String trackingNumber; 17 | @JsonProperty("origin_country") 18 | private String originCountry; 19 | @JsonProperty("ship_note") 20 | private String shipNote; 21 | @JsonProperty("shipping_provider") 22 | private String shippingProvider; 23 | } 24 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/dto/UpdateLtlDTO.java: -------------------------------------------------------------------------------- 1 | package io.github.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/21 15:19 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class UpdateLtlDTO { 13 | 14 | @JsonProperty("delivery_receipt_file_url") 15 | private String deliveryReceiptFileUrl; 16 | @JsonProperty("delivered_at") 17 | private String deliveredAt; 18 | @JsonProperty("tracking_url") 19 | private String trackingUrl; 20 | } 21 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/Amount.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | 13 | public class Amount { 14 | @SuppressWarnings("all") 15 | @JsonProperty("amount") 16 | private Double amount; 17 | @JsonProperty("currency_code") 18 | private String currencyCode; 19 | } 20 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/CarrierSubsidies.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class CarrierSubsidies { 13 | @JsonProperty("subsidy") 14 | private Amount subsidy; 15 | @JsonProperty("carrier_name") 16 | private String carrierName; 17 | } 18 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/CustomerPaidPricesDetail.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class CustomerPaidPricesDetail { 13 | @JsonProperty("total") 14 | private Amount total; 15 | @JsonProperty("product_price") 16 | private Amount productPrice; 17 | @JsonProperty("product_price_total") 18 | private Amount productPriceTotal; 19 | @JsonProperty("shipping_price") 20 | private Amount shippingPrice; 21 | @JsonProperty("shipping_price_total") 22 | private Amount shippingPriceTotal; 23 | } 24 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/EuVatCustomsDeclaration.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class EuVatCustomsDeclaration { 13 | @JsonProperty("product") 14 | private Product product; 15 | @JsonProperty("merchant_identity") 16 | private String merchantIdentity; 17 | @JsonProperty("vat_paid_in_authority_currency") 18 | private Amount vatPaidInAuthorityCurrency; 19 | @JsonProperty("vat_paid_in_customer_currency") 20 | private Amount vatPaidInCustomerCurrency; 21 | @JsonProperty("shipping_cost_in_customer_currency") 22 | private ShippingCostInCustomerCurrency shippingCostInCustomerCurrency; 23 | @JsonProperty("customer_identity") 24 | private String customerIdentity; 25 | @JsonProperty("vat_payer") 26 | private VatPayer vatPayer; 27 | @JsonProperty("merchant_address") 28 | private ShippingDetail merchantAddress; 29 | @JsonProperty("invoice_amount_in_customer_currency") 30 | private InvoiceAmountInCustomerCurrency invoiceAmountInCustomerCurrency; 31 | @JsonProperty("shipping_cost_in_authority_currency") 32 | private ShippingCostInAuthorityCurrency shippingCostInAuthorityCurrency; 33 | @JsonProperty("invoice_amount_in_authority_currency") 34 | private InvoiceAmountInAuthorityCurrency invoiceAmountInAuthorityCurrency; 35 | @JsonProperty("customer_address") 36 | private ShippingDetail customerAddress; 37 | @JsonProperty("merchant_name") 38 | private String merchantName; 39 | @JsonProperty("platform_status") 40 | private String platformStatus; 41 | @JsonProperty("customer_name") 42 | private String customerName; 43 | } 44 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/FbwFees.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class FbwFees { 13 | @JsonProperty("amount") 14 | private Amount amount; 15 | @JsonProperty("fee_name") 16 | private String feeName; 17 | @JsonProperty("fee_type") 18 | private String feeType; 19 | } 20 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/FbwInformation.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/24 15:47 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class FbwInformation { 15 | @JsonProperty("fbw_warehouse_code") 16 | private String fbwWarehouseCode; 17 | @JsonProperty("fbw_fees") 18 | private List fbwFees; 19 | @JsonProperty("lot_information") 20 | private List lotInformation; 21 | } 22 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/FulfillmentRecords.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class FulfillmentRecords { 13 | @JsonProperty("event_type") 14 | private String eventType; 15 | @JsonProperty("event_time") 16 | private String eventTime; 17 | } 18 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/FulfillmentRequirements.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class FulfillmentRequirements { 13 | @JsonProperty("expected_ship_time") 14 | private String expectedShipTime; 15 | @JsonProperty("expected_delivery_time") 16 | private String expectedDeliveryTime; 17 | } 18 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/FullAddress.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class FullAddress { 13 | @JsonProperty("shipping_detail") 14 | private ShippingDetail shippingDetail; 15 | } 16 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/GeneralPaymentDetails.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class GeneralPaymentDetails { 13 | @JsonProperty("shipping_merchant_payment") 14 | private ShippingMerchantPayment shippingMerchantPayment; 15 | @JsonProperty("payment_total") 16 | private PaymentTotal paymentTotal; 17 | @JsonProperty("product_price") 18 | private Amount productPrice; 19 | @JsonProperty("product_merchant_payment") 20 | private Amount productMerchantPayment; 21 | @JsonProperty("product_shipping_price") 22 | private ProductShippingPrice productShippingPrice; 23 | @JsonProperty("product_quantity") 24 | private Integer productQuantity; 25 | @JsonProperty("customer_paid_prices_detail") 26 | private CustomerPaidPricesDetail customerPaidPricesDetail; 27 | } 28 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/InvoiceAmountInAuthorityCurrency.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class InvoiceAmountInAuthorityCurrency { 13 | @JsonProperty("amount") 14 | private Double amount; 15 | @JsonProperty("currency_code") 16 | private String currencyCode; 17 | } 18 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/InvoiceAmountInCustomerCurrency.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class InvoiceAmountInCustomerCurrency { 13 | @JsonProperty("amount") 14 | private Double amount; 15 | @JsonProperty("currency_code") 16 | private String currencyCode; 17 | } 18 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/LotInformation.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class LotInformation { 13 | @JsonProperty("lot_id") 14 | private String lotId; 15 | @JsonProperty("quantity") 16 | private Integer quantity; 17 | } 18 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/MerchantResponsibleAmount.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class MerchantResponsibleAmount { 13 | @JsonProperty("amount") 14 | private Double amount; 15 | @JsonProperty("currency_code") 16 | private String currencyCode; 17 | } 18 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/NameVO.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/18 16:35 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class NameVO { 13 | 14 | @JsonProperty("name") 15 | private String name; 16 | } 17 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/OrderPayment.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/24 15:47 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class OrderPayment { 15 | @JsonProperty("carrier_subsidies") 16 | private List carrierSubsidies; 17 | @JsonProperty("shipping_reimbursements") 18 | private List shippingReimbursements; 19 | @JsonProperty("rev_share") 20 | private RevShare revShare; 21 | @JsonProperty("general_payment_details") 22 | private GeneralPaymentDetails generalPaymentDetails; 23 | } 24 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/PaymentTotal.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class PaymentTotal { 13 | @JsonProperty("amount") 14 | private Double amount; 15 | @JsonProperty("currency_code") 16 | private String currencyCode; 17 | } 18 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/PhoneNumber.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class PhoneNumber { 13 | @JsonProperty("number") 14 | private String number; 15 | @JsonProperty("country_code") 16 | private String countryCode; 17 | } 18 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/Product.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Product { 13 | @JsonProperty("name") 14 | private String name; 15 | @JsonProperty("weight") 16 | private Weight weight; 17 | @JsonProperty("image_url") 18 | private String imageUrl; 19 | @JsonProperty("hs_code") 20 | private String hsCode; 21 | @JsonProperty("condition") 22 | private String condition; 23 | @JsonProperty("quantity") 24 | private Integer quantity; 25 | } 26 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/ProductInformation.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class ProductInformation { 13 | @JsonProperty("sku") 14 | private String sku; 15 | @JsonProperty("name") 16 | private String name; 17 | @JsonProperty("color") 18 | private String color; 19 | @JsonProperty("manufactured_country") 20 | private String manufacturedCountry; 21 | @JsonProperty("variation_image_url") 22 | private String variationImageUrl; 23 | @JsonProperty("variation_id") 24 | private String variationId; 25 | @JsonProperty("id") 26 | private String id; 27 | @JsonProperty("size") 28 | private String size; 29 | } 30 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/ProductShippingPrice.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class ProductShippingPrice { 13 | @JsonProperty("amount") 14 | private Double amount; 15 | @JsonProperty("currency_code") 16 | private String currencyCode; 17 | } 18 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/RefundAmount.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class RefundAmount { 13 | @JsonProperty("amount") 14 | private Double amount; 15 | @JsonProperty("currency_code") 16 | private String currencyCode; 17 | } 18 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/Refunds.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Refunds { 13 | @JsonProperty("refund_reason_note") 14 | private String refundReasonNote; 15 | @JsonProperty("refund_source") 16 | private String refundSource; 17 | @JsonProperty("refund_amount") 18 | private RefundAmount refundAmount; 19 | @JsonProperty("merchant_responsible_amount") 20 | private MerchantResponsibleAmount merchantResponsibleAmount; 21 | @JsonProperty("refund_time") 22 | private String refundTime; 23 | @JsonProperty("refund_reason") 24 | private String refundReason; 25 | } 26 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/RequiredVatNumbers.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class RequiredVatNumbers { 13 | @JsonProperty("voec") 14 | private Voec voec; 15 | @JsonProperty("eori") 16 | private Voec eori; 17 | @JsonProperty("vat") 18 | private Vat vat; 19 | } 20 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/RevShare.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class RevShare { 13 | @JsonProperty("destination_region") 14 | private String destinationRegion; 15 | @SuppressWarnings("all") 16 | @JsonProperty("rev_share") 17 | private Integer revShare; 18 | @JsonProperty("product_category") 19 | private String productCategory; 20 | @JsonProperty("entity_region") 21 | private String entityRegion; 22 | @JsonProperty("source_region") 23 | private String sourceRegion; 24 | @JsonProperty("shipping_type") 25 | private String shippingType; 26 | } 27 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/ShippingCostInAuthorityCurrency.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class ShippingCostInAuthorityCurrency { 13 | @JsonProperty("amount") 14 | private Double amount; 15 | @JsonProperty("currency_code") 16 | private String currencyCode; 17 | } 18 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/ShippingCostInCustomerCurrency.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class ShippingCostInCustomerCurrency { 13 | @JsonProperty("amount") 14 | private Double amount; 15 | @JsonProperty("currency_code") 16 | private String currencyCode; 17 | } 18 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/ShippingDetail.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class ShippingDetail { 13 | @JsonProperty("city") 14 | private String city; 15 | @JsonProperty("country") 16 | private String country; 17 | @JsonProperty("street_address3") 18 | private String streetAddress3; 19 | @JsonProperty("street_address2") 20 | private String streetAddress2; 21 | @JsonProperty("street_address1") 22 | private String streetAddress1; 23 | @JsonProperty("zipcode") 24 | private String zipcode; 25 | @JsonProperty("state") 26 | private String state; 27 | @JsonProperty("country_code") 28 | private String countryCode; 29 | @JsonProperty("phone_number") 30 | private PhoneNumber phoneNumber; 31 | @JsonProperty("region") 32 | private String region; 33 | @JsonProperty("neighborhood") 34 | private String neighborhood; 35 | @JsonProperty("name") 36 | private String name; 37 | } 38 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/ShippingMerchantPayment.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class ShippingMerchantPayment { 13 | @JsonProperty("amount") 14 | private Double amount; 15 | @JsonProperty("currency_code") 16 | private String currencyCode; 17 | } 18 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/ShippingReimbursements.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class ShippingReimbursements { 13 | @JsonProperty("status") 14 | private String status; 15 | @JsonProperty("amount") 16 | private Amount amount; 17 | } 18 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/TaxInformation.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/24 15:47 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class TaxInformation { 15 | @JsonProperty("transaction_tax") 16 | private List transactionTax; 17 | @JsonProperty("customer_identity_number_type") 18 | private String customerIdentityNumberType; 19 | @JsonProperty("vat_information") 20 | private VatInformation vatInformation; 21 | @JsonProperty("customer_identity_number") 22 | private String customerIdentityNumber; 23 | } 24 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/TrackingInformation.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class TrackingInformation { 13 | @JsonProperty("tracking_number") 14 | private String trackingNumber; 15 | @JsonProperty("origin_country") 16 | private String originCountry; 17 | @JsonProperty("ship_note") 18 | private String shipNote; 19 | @JsonProperty("shipping_provider") 20 | private ProductInformation shippingProvider; 21 | } 22 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/TransactionTax.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class TransactionTax { 13 | @JsonProperty("tax_amount_in_merchant_currency") 14 | private Amount taxAmountInMerchantCurrency; 15 | @JsonProperty("tax_amount_in_authority_currency") 16 | private Amount taxAmountInAuthorityCurrency; 17 | @JsonProperty("tax_type") 18 | private String taxType; 19 | @JsonProperty("remit_type") 20 | private String remitType; 21 | } 22 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/Vat.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Vat { 13 | @JsonProperty("number") 14 | private String number; 15 | @JsonProperty("name") 16 | private String name; 17 | @JsonProperty("entity") 18 | private String entity; 19 | } 20 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/VatAmount.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class VatAmount { 13 | @JsonProperty("shipping_level_vat") 14 | private Amount shippingLevelVat; 15 | @JsonProperty("final_vat") 16 | private Amount finalVat; 17 | @JsonProperty("product_level_vat") 18 | private Amount productLevelVat; 19 | } 20 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/VatInformation.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/24 15:47 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class VatInformation { 15 | @JsonProperty("eu_vat_customs_declaration") 16 | private EuVatCustomsDeclaration euVatCustomsDeclaration; 17 | @JsonProperty("vat_amount") 18 | private VatAmount vatAmount; 19 | @JsonProperty("country_code") 20 | private String countryCode; 21 | @JsonProperty("required_vat_numbers") 22 | private RequiredVatNumbers requiredVatNumbers; 23 | @JsonProperty("vat_instructions") 24 | private String vatInstructions; 25 | @JsonProperty("additional_materials") 26 | private List additionalMaterials; 27 | } 28 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/VatPayer.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class VatPayer { 13 | @JsonProperty("ioss_number") 14 | private String iossNumber; 15 | @JsonProperty("tax_number") 16 | private String taxNumber; 17 | @JsonProperty("name") 18 | private String name; 19 | @JsonProperty("address") 20 | private ShippingDetail address; 21 | } 22 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/Voec.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Voec { 13 | @JsonProperty("number") 14 | private String number; 15 | @JsonProperty("entity") 16 | private String entity; 17 | } 18 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/WarehouseInformation.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class WarehouseInformation { 13 | @JsonProperty("warehouse_type") 14 | private String warehouseType; 15 | @JsonProperty("warehouse_name") 16 | private String warehouseName; 17 | @JsonProperty("warehouse_id") 18 | private String warehouseId; 19 | @JsonProperty("fbw_information") 20 | private FbwInformation fbwInformation; 21 | } 22 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/Weight.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Created by EalenXie on 2022/3/24 15:47 9 | */ 10 | @NoArgsConstructor 11 | @Data 12 | public class Weight { 13 | @JsonProperty("value") 14 | private Integer value; 15 | @JsonProperty("unit") 16 | private String unit; 17 | } 18 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/WishDownloadJob.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/3/18 16:43 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class WishDownloadJob { 15 | @JsonProperty("total_count") 16 | private Integer totalCount; 17 | @JsonProperty("processed_count") 18 | private Integer processedCount; 19 | @JsonProperty("status") 20 | private String status; 21 | @JsonProperty("expiry_time") 22 | private String expiryTime; 23 | @JsonProperty("created_at") 24 | private String createdAt; 25 | @JsonProperty("completed_at") 26 | private String completedAt; 27 | @JsonProperty("file_urls") 28 | private List fileUrls; 29 | @JsonProperty("id") 30 | private String id; 31 | } 32 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/WishOrder.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/2/23 13:38 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class WishOrder { 15 | @JsonProperty("tracking_information") 16 | private List trackingInformation; 17 | @JsonProperty("warehouse_information") 18 | private WarehouseInformation warehouseInformation; 19 | @JsonProperty("order_payment") 20 | private OrderPayment orderPayment; 21 | @JsonProperty("fulfillment_records") 22 | private List fulfillmentRecords; 23 | @JsonProperty("released_at") 24 | private String releasedAt; 25 | @JsonProperty("product_information") 26 | private ProductInformation productInformation; 27 | @JsonProperty("penalties") 28 | private List penalties; 29 | @JsonProperty("processing_status") 30 | private String processingStatus; 31 | @JsonProperty("updated_at") 32 | private String updatedAt; 33 | @JsonProperty("full_address") 34 | private FullAddress fullAddress; 35 | @JsonProperty("processing_source") 36 | private String processingSource; 37 | @JsonProperty("fulfillment_requirements") 38 | private FulfillmentRequirements fulfillmentRequirements; 39 | @JsonProperty("state") 40 | private String state; 41 | @JsonProperty("transaction_id") 42 | private String transactionId; 43 | @JsonProperty("tax_information") 44 | private TaxInformation taxInformation; 45 | @JsonProperty("refunds") 46 | private List refunds; 47 | @JsonProperty("id") 48 | private String id; 49 | @JsonProperty("fulfillment_order_types") 50 | private List fulfillmentOrderTypes; 51 | } 52 | -------------------------------------------------------------------------------- /wish-sdk/src/main/java/io/github/vo/WishToken.java: -------------------------------------------------------------------------------- 1 | package io.github.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by EalenXie on 2022/2/23 13:33 11 | */ 12 | @NoArgsConstructor 13 | @Data 14 | public class WishToken { 15 | 16 | @JsonProperty("access_token") 17 | private String accessToken; 18 | @JsonProperty("scopes") 19 | private List scopes; 20 | /** 21 | * 该令牌所链接的商家的ID 22 | */ 23 | @JsonProperty("merchant_id") 24 | private String merchantId; 25 | @JsonProperty("expiry_time") 26 | private String expiryTime; 27 | @JsonProperty("refresh_token") 28 | private String refreshToken; 29 | } 30 | --------------------------------------------------------------------------------