<?php

namespace App\Libs\Pay;

use App\Libs\Pay\Merchants\Swiftpass;
use App\Libs\Pay\Merchants\Youluo;
use App\Libs\Pay\Merchants\AllinPay;
use App\Libs\Pay\Merchants\Official;
use App\Libs\Pay\Merchants\LianLianPay;
use App\Libs\Pay\Merchants\Palmpay;
use App\Libs\Pay\Merchants\PalmpayV2;

class WechatPay 
{
	private static $_instance;

	static function instance($merchant,$config=[])
	{
		if(!self::$_instance)
		{
			switch ($merchant) {
				//case 'Swiftpass':'SWIFTPASS'
				case 'SWIFTPASS':
					self::$_instance = new Swiftpass();
					break;
				//case 'Youluo':
				case 'YOULUO':
					self::$_instance = new Youluo();
					break;
				case 'ALLINPAY':
					self::$_instance = new AllinPay($config);
					break;
                case 'OFFICIALPAY':
                    self::$_instance = new Official($config);
                    break;
                case 'LIANLIANPAY':
                    self::$_instance = new LianLianPay($config);
                    break;
                case 'PALMPAY':
                    self::$_instance = new Palmpay($config);
                    break;
                case 'PALMPAYV2':
                    self::$_instance = new PalmpayV2($config);
                    break;
                default:
                    return null;
			}
			
		}
		return self::$_instance;
	}

}