package com.seer.teach.mall.shipping.jt.config;

import com.seer.teach.mall.shipping.jt.client.JtExpressExecutor;
import com.seer.teach.mall.shipping.jt.http.DefaultApiExecutor;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Getter
@Setter
@Configuration
public class JtSdkConfig {

    /**
     * apiAccount :接入方在平台的api账户标识,由平台提供
     */
    @Value("${logistics.jt.apiAccount:178337126125932605}")
    private String apiAccount;

    /**
     * privateKey : 为账号通过平台认证后自动分配,由平台提供
     */
    @Value("${logistics.jt.privateKey:0258d71b55fc45e3ad7a7f38bf4b201a}")
    private String privateKey;

    /**
     * customerCode : 协议客户账号
     */
    @Value("${logistics.jt.customerCode:J0086474299}")
    private String customerCode;

    /**
     * orderPassword : 协议客户密码
     */
    @Value("${logistics.jt.customerPwd:H5CD3zE6}")
    private String customerPwd;

    /**
     * 创建订单接口地址
     */
    @Value("${logistics.jt.createOrderUrl:https://openapi.jtexpress.com.cn/webopenplatformapi/api/order/v2/addOrder}")
    private String createOrderUrl;

    /**
     * 查询物流轨迹接口地址
     */
    @Value("${logistics.jt.queryTraceUrl:https://openapi.jtexpress.com.cn/webopenplatformapi/api/logistics/trace}")
    private String queryTraceUrl;

    @Bean
    public JtExpressExecutor jtExpressApi(){
        JtExpressExecutor jtExpressApi = new DefaultApiExecutor(apiAccount,  privateKey, customerCode, customerPwd);
        return jtExpressApi;
    }
}