diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2b56cb4..24e16e6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,35 +1,31 @@ name: Maven Central Repo Deployment # 当 release 的时候触发 +#on: +# release: +# types: [released] on: - release: - types: [released] + push: + branches: [ release ] jobs: publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + + - name: Checkout + uses: actions/checkout@v2 - name: Set up Maven Central Repo uses: actions/setup-java@v1 with: java-version: 1.8 server-id: sonatype-nexus-staging - server-username: MAVEN_USERNAME - server-password: MAVEN_PASSWORD - gpg-passphrase: MAVEN_GPG_PASSPHRASE - - id: install-secret-key - name: Install GPG Secret Key - run: | - cat <(echo -e "${{ secrets.GPG_PUB }}") | gpg --batch --import - gpg --list-secret-keys --keyid-format LONG - - id: publish-to-central - name: Publish to Maven Central Repo - env: - MAVEN_USERNAME: ${{ secrets.OSSRH_USER }} - MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSWORD }} - run: | - mvn \ - --no-transfer-progress \ - --batch-mode \ - -Dgpg.passphrase=${{ secrets.GPG_PASSWORD }} \ - clean deploy + server-username: ${{ secrets.OSSRH_USER }} + server-password: ${{ secrets.OSSRH_PASSWORD }} + gpg-passphrase: ${{ secrets.GPG_PASSWORD }} + - name: Publish to Maven Central Repo + uses: samuelmeuli/action-maven-publish@v1 + with: + gpg_private_key: ${{ secrets.GPG_SECRET }} + gpg_passphrase: ${{ secrets.GPG_PASSWORD }} + nexus_username: ${{ secrets.OSSRH_USER }} + nexus_password: ${{ secrets.OSSRH_PASSWORD }} + server-id: sonatype-nexus-staging diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/CouponBgColor.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/CouponBgColor.java index 1cb4b7b..b85ee46 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/CouponBgColor.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/CouponBgColor.java @@ -29,64 +29,42 @@ public enum CouponBgColor { /** * Color 010 coupon bg color. */ - COLOR010("#63B359"), + Color010, /** * Color 020 coupon bg color. */ - COLOR020("#2C9F67"), + Color020, /** * Color 030 coupon bg color. */ - COLOR030("#509FC9"), + Color030, /** * Color 040 coupon bg color. */ - COLOR040("#5885CF"), + Color040, /** * Color 050 coupon bg color. */ - COLOR050("#9062C0"), + Color050, /** * Color 060 coupon bg color. */ - COLOR060("#D09A45"), + Color060, /** * Color 070 coupon bg color. */ - COLOR070("#E4B138"), + Color070, /** * Color 080 coupon bg color. */ - COLOR080("#EE903C"), + Color080, /** * Color 090 coupon bg color. */ - COLOR090("#DD6549"), + Color090, /** * Color 100 coupon bg color. */ - COLOR100("#CC463D"); + Color100 - /** - * The Color. - */ - private final String color; - - /** - * Instantiates a new Coupon bg color. - * - * @param color the color - */ - CouponBgColor(String color) { - this.color = color; - } - - /** - * Color string. - * - * @return the string - */ - public String color() { - return this.color; - } } diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/AbstractApi.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/AbstractApi.java index 270339d..546c453 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/AbstractApi.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/AbstractApi.java @@ -24,9 +24,9 @@ import cn.felord.payment.wechat.v3.model.FundFlowBillParams; import cn.felord.payment.wechat.v3.model.TradeBillParams; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.PropertyNamingStrategy; -import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import org.springframework.core.io.Resource; import org.springframework.http.HttpHeaders; @@ -88,10 +88,12 @@ public abstract class AbstractApi { * @param mapper the mapper */ private void applyObjectMapper(ObjectMapper mapper) { - mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - SimpleModule module = new JavaTimeModule(); - mapper.registerModule(module); + mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE) + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false) + // empty string error + .configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true) + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + .registerModule(new JavaTimeModule()); } @@ -185,10 +187,11 @@ public abstract class AbstractApi { return RequestEntity.get(uri).header("Pay-TenantId", tenantId) .build(); } + /** * 构建Get请求对象. * - * @param uri the uri + * @param uri the uri * @param httpHeaders the http headers * @return the request entity */ diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatPayCallback.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatPayCallback.java index 989675a..77d41df 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatPayCallback.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatPayCallback.java @@ -34,7 +34,6 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.PropertyNamingStrategy; -import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; @@ -72,11 +71,11 @@ public class WechatPayCallback { private final String tenantId; static { - MAPPER.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); - MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL); - MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false); - SimpleModule module = new JavaTimeModule(); - MAPPER.registerModule(module); + MAPPER.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE) + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false) + .configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT,true) + .registerModule(new JavaTimeModule()); } /** diff --git a/pom.xml b/pom.xml index e605e38..1d8bd86 100644 --- a/pom.xml +++ b/pom.xml @@ -36,6 +36,29 @@ scm:git:https://github.com/NotFound403/payment-spring-boot.git + + + + deploy + + + + org.apache.maven.plugins + maven-source-plugin + + + org.apache.maven.plugins + maven-javadoc-plugin + + + + org.apache.maven.plugins + maven-gpg-plugin + + + + + payment-spring-boot-autoconfigure @@ -173,10 +196,18 @@ 1.6 + sign-artifacts verify sign + + + + --pinentry-mode + loopback + + @@ -188,23 +219,12 @@ sonatype-nexus-staging https://oss.sonatype.org/ + false - - org.apache.maven.plugins - maven-source-plugin - - - org.apache.maven.plugins - maven-javadoc-plugin - - - org.apache.maven.plugins - maven-gpg-plugin - org.sonatype.plugins nexus-staging-maven-plugin