1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.talentcard.server.business.merchant;
 
import static org.assertj.core.api.Assertions.assertThat;
 
import org.junit.jupiter.api.Test;
 
/**
 * 个人(小微)主体的 MCC 取的是**商户在进件表单里选的行业**。
 *
 * <p>进件第一步让个人商户选「行业类型」(餐饮服务/酒店服务/景区服务/加油服务/停车服务/其它),
 * 它跟着企业主体的公司类型一起落在 {@code company_type} 列上。原先上报汇付的 {@code mcc}
 * 只认商家档案上的经营类型,等于把这一项**静默丢掉**:档案没配好就一律落 7399(其它),
 * 通道侧的微信行业类目和费率跟着一起错,而商户页面上明明选过行业。
 *
 * <p>「其它」与识别不出来的取值返回空串,交给商家档案兜底——不要在这里拍一个 7399,
 * 那会把「档案里配了准确行业」的商户也降级成「其它」。
 */
class MerchantOnboardingIndustryMccTests {
 
    @Test
    void theIndustryPickedOnTheFormBecomesTheMcc() {
        assertThat(MerchantSettlementService.mccForIndustry("餐饮服务")).isEqualTo("5812");
        assertThat(MerchantSettlementService.mccForIndustry("酒店服务")).isEqualTo("7011");
        assertThat(MerchantSettlementService.mccForIndustry("景区服务")).isEqualTo("7991");
        assertThat(MerchantSettlementService.mccForIndustry("加油服务")).isEqualTo("5541");
        assertThat(MerchantSettlementService.mccForIndustry("停车服务")).isEqualTo("7523");
    }
 
    /** 别名与规范化代码同样认,商户端换过文案不影响映射。 */
    @Test
    void theIndustryIsResolvedThroughTheSharedCatalog() {
        assertThat(MerchantSettlementService.mccForIndustry("餐饮")).isEqualTo("5812");
        assertThat(MerchantSettlementService.mccForIndustry("food")).isEqualTo("5812");
        assertThat(MerchantSettlementService.mccForIndustry("餐饮商家")).isEqualTo("5812");
        assertThat(MerchantSettlementService.mccForIndustry(" theatre ")).isEqualTo("7832");
    }
 
    @Test
    void anUnrecognisedIndustryFallsBackToTheMerchantProfile() {
        assertThat(MerchantSettlementService.mccForIndustry("其它")).isEmpty();
        assertThat(MerchantSettlementService.mccForIndustry("街边小店")).isEmpty();
        assertThat(MerchantSettlementService.mccForIndustry("")).isEmpty();
        assertThat(MerchantSettlementService.mccForIndustry(null)).isEmpty();
    }
}