Commit b0c3cc3a authored by Administrator's avatar Administrator

创建项目

parent 639cd9c8
package cn.quant.baa.pay.acquirer;
/**
* Created by Administrator on 2021/9/1 0001.
*/
public interface Acquirer {
String code();
}
......@@ -8,11 +8,15 @@ import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Administrator on 2021/8/31 0031.
*/
public abstract class MerchantAcquirer {
public abstract class MerchantAcquirer implements Acquirer {
private static Map<Object, Acquirer> acquirers = new HashMap<>();
protected Cipher cipher;
......@@ -20,6 +24,8 @@ public abstract class MerchantAcquirer {
protected CharacterCipher secretCipher;
private AcquirerProperties properties;
public MerchantAcquirer init(AcquirerProperties properties) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException {
this.secretCipher = new Base64Cipher();
......@@ -30,8 +36,13 @@ public abstract class MerchantAcquirer {
this.cipher = Cipher.getInstance(secretType);
this.cipher.init(Cipher.ENCRYPT_MODE, this.secretKey);
//
this.properties = properties;
return this;
}
public static void register(Acquirer acquirer) {
acquirers.put(acquirer.code(), acquirer);
}
}
package cn.quant.baa.pay.acquirer.weixin;
import cn.quant.baa.pay.acquirer.AcquirerProperties;
import cn.quant.baa.pay.acquirer.MerchantAcquirer;
import javax.crypto.NoSuchPaddingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
/**
* Created by Administrator on 2021/8/31 0031.
*/
public class WeiXinMerchantAcquirer extends MerchantAcquirer {
@Override
public MerchantAcquirer init(AcquirerProperties properties) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException {
return super.init(properties);
}
@Override
public String code() {
return null;
}
}
......@@ -2,6 +2,7 @@ package cn.quant.baa.pay.config;
import cn.quant.baa.pay.acquirer.AcquirerConfiguration;
import cn.quant.baa.pay.acquirer.AcquirerConfigurer;
import cn.quant.baa.pay.acquirer.MerchantAcquirer;
import cn.quant.baa.pay.jpa.entity.*;
import cn.quant.baa.pay.jpa.repository.*;
import cn.quant.baa.pay.model.DictionaryItem;
......@@ -72,4 +73,10 @@ public class ServerConfiguration {
entities.clear();
return configuration;
}
@Bean
public MerchantAcquirer acquirer(){
return null;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment