---
# System prepended metadata

title: 와인 픽업지 스펙 정의

---

# 와인 픽업지 스펙 정의

## 정의
- 판매주체 식별자 (sellerId) 에 매핑된 와인 픽업지 정보를 pms-external-api 를 통해 전달한다.
- 참고: [와인 픽업지 확대 검토](https://kurly0521.atlassian.net/wiki/spaces/CMS/pages/3491726326)


## yml
```yaml
spring:
  profiles: dev
wine-pickup-location:
    artisee: 123
    coffee-bean: 456
---    

spring:
  profiles: perf
wine-pickup-location:
    artisee: 111
    coffee-bean: 222

```

## Enum
```java
@RequiredArgsConstructor
@Getter
public enum WinePickupLocation {

    ARTISEE("아띠제"),
    COFFEE_BEAN("커피빈");

    @JsonValue
    private final String description;

    @JsonValue
    String getType() {
        return this.name();
    }
}
```

## Properties
```java
@Getter
@Setter(AccessLevel.PACKAGE)
@Component
@ConfigurationProperties("wine-pickup-location")
public class WinePickupLocationProperties {

    private int artisee;
    private int coffeeBean;
}
```

## Service
```java
@RequiredArgsConstructor
@Service
public class WinePickupLocationService {

    @Autowired
    private final WinePickupLocationProperties properties;

    public WinePickupLocation getWinePickupLocation(@NonNull DeliveryType deliveryType, int sellerId) {
        if (deliveryType != DeliveryType.SELF_PICKUP_WINE) {
            return null;
        }

        if (sellerId == properties.getArtisee()) {
            return WinePickupLocation.ARTISEE;
        } else if (sellerId == properties.getCoffeeBean()) {
            return WinePickupLocation.COFFEE_BEAN;
        }

        return null;
    }
}
```

## ContentsProduct Response
```javascript
{
    "dealProducts": [
        {
            "winePickupLocation": {
                "type": "ARTISEE",
                "description": "아띠제"
            }
        }
    ]
}
```

