You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
810 B
27 lines
810 B
<?php
|
|
namespace app\common\shipping;
|
|
|
|
// use app\common\payment\Ipayment;
|
|
use app\common\shipping\DeliveryShipping;
|
|
use app\common\shipping\EcpayShipping;
|
|
use app\common\shipping\GomypayShipping;
|
|
|
|
class ShippingFactory
|
|
{
|
|
public static function createShippingService($serviceName) {
|
|
try{
|
|
switch ($serviceName) {
|
|
case 'shipping':
|
|
return new DeliveryShipping();
|
|
case 'ecpay':
|
|
return new EcpayShipping();
|
|
case 'gomypay':
|
|
return new GomypayShipping();
|
|
default:
|
|
throw new \Exception("Unsupported shipping service: $serviceName");
|
|
}
|
|
}catch(\Exception $e){
|
|
throw new \Exception($e->getMessage());
|
|
}
|
|
}
|
|
} |