-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c489da
commit 05a9206
Showing
13 changed files
with
582 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Shimoning\ColorMeShopApi\Constants; | ||
|
||
enum DeliveryChargeFreeType: string | ||
{ | ||
case NOT_FREE = 'not_free'; // 有料 | ||
case FREE = 'free'; // 無料 | ||
case FREE_TO_LIMIT = 'free_to_limit'; // 注文金額が一定以上の場合は無料 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Shimoning\ColorMeShopApi\Constants; | ||
|
||
enum DeliveryChargeType: string | ||
{ | ||
case FIXED = 'fixed'; // 固定額 | ||
case BY_PRICE = 'by_price'; // 注文金額によって決定 | ||
case BY_AREA = 'by_area'; // 配送先都道府県によって決定 | ||
case BY_WEIGHT = 'by_weight'; // 商品重量によって決定 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace Shimoning\ColorMeShopApi\Constants; | ||
|
||
enum DeliveryMethodType: string | ||
{ | ||
case OTHER = 'other'; // そのほか | ||
case YAMATO = 'yamato'; // クロネコヤマト | ||
case YAMATO_PICKUP = 'yamato_pickup'; // ヤマト自宅外受け取り | ||
case SAGAWA = 'sagawa'; // 佐川急便 | ||
case JP = 'jp'; // 日本郵便 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Shimoning\ColorMeShopApi\Constants; | ||
|
||
enum DisplayState: string | ||
{ | ||
case SHOWING = 'showing'; | ||
case HIDDEN = 'hidden'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace Shimoning\ColorMeShopApi\Entities\Delivery; | ||
|
||
use Shimoning\ColorMeShopApi\Entities\Entity; | ||
use Shimoning\ColorMeShopApi\Constants\Prefecture; | ||
|
||
/** | ||
* 都道府県ごとの送料設定 | ||
* | ||
* @link https://developer.shop-pro.jp/docs/colorme-api#tag/delivery/operation/getDeliveries | ||
*/ | ||
class Area extends Entity | ||
{ | ||
public const OBJECT_FIELDS = [ | ||
'prefId'=> [ | ||
'enum' => Prefecture::class, | ||
], | ||
]; | ||
|
||
protected Prefecture $prefId; | ||
protected string $prefName; | ||
protected int $charge; | ||
|
||
/** | ||
* 都道府県の通し番号 | ||
* @return Prefecture | ||
*/ | ||
public function getPrefId(): Prefecture | ||
{ | ||
return $this->prefId; | ||
} | ||
|
||
/** | ||
* 都道府県名 | ||
* @return string | ||
*/ | ||
public function getPrefName(): string | ||
{ | ||
return $this->prefName; | ||
} | ||
|
||
/** | ||
* 配送料 | ||
* @return int | ||
*/ | ||
public function getCharge(): int | ||
{ | ||
return $this->charge; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
<?php | ||
|
||
namespace Shimoning\ColorMeShopApi\Entities\Delivery; | ||
|
||
use Shimoning\ColorMeShopApi\Entities\Entity; | ||
use Shimoning\ColorMeShopApi\Constants\DisplayState; | ||
|
||
/** | ||
* 配送料設定の詳細 | ||
* | ||
* @link https://developer.shop-pro.jp/docs/colorme-api#tag/delivery/operation/getDeliveries | ||
*/ | ||
class Charge extends Entity | ||
{ | ||
public const OBJECT_FIELDS = [ | ||
'chargeRangesByArea' => [ | ||
'array' => true, | ||
'entity' => Area::class, | ||
], | ||
'chargeRangesMaxWeight' => [ | ||
'array' => true, | ||
'entity' => Area::class, | ||
], | ||
'displayState' => [ | ||
'enum' => DisplayState::class, | ||
], | ||
]; | ||
|
||
protected int $deliveryId; | ||
protected string $accountId; | ||
|
||
protected ?int $chargeFixed; | ||
protected array $chargeRangesByPrice; | ||
protected ?int $chargeMaxPrice; | ||
|
||
protected array $chargeRangesByArea; | ||
protected array $chargeRangesByWeight; | ||
protected array $chargeRangesMaxWeight; | ||
|
||
public function __construct(array $data) | ||
{ | ||
parent::__construct($data); | ||
|
||
// chargeRangesByWeight | ||
$this->chargeRangesByWeight = []; | ||
foreach ($data['charge_ranges_by_weight'] ?? [] as $weight) { | ||
$this->chargeRangesByWeight[] = new Weight([ | ||
'weight' => $weight[0], | ||
'areas' => $weight[1], | ||
]); | ||
} | ||
} | ||
|
||
/** | ||
* 決済方法ID | ||
* @return int | ||
*/ | ||
public function getDeliveryId(): int | ||
{ | ||
return $this->deliveryId; | ||
} | ||
|
||
/** | ||
* ショップアカウントID | ||
* @return string | ||
*/ | ||
public function getAccountId(): string | ||
{ | ||
return $this->accountId; | ||
} | ||
|
||
/** | ||
* 配送料が固定の場合の金額 | ||
* @return int|null | ||
*/ | ||
public function getChargeFixed(): ?int | ||
{ | ||
return $this->chargeFixed; | ||
} | ||
|
||
/** | ||
* 配送料が変わる決済金額の区分 | ||
* [3000, 100]であれば、3000円以下の場合、手数料は100円であることを表す | ||
* @return array<int, int> | ||
*/ | ||
public function getChargeRangesByPrice(): array | ||
{ | ||
return $this->chargeRangesByPrice; | ||
} | ||
|
||
/** | ||
* charge_ranges_by_priceに設定されている区分以上の金額の場合の手数料 | ||
* @return int|null | ||
*/ | ||
public function getChargeMaxPrice(): ?int | ||
{ | ||
return $this->chargeMaxPrice; | ||
} | ||
|
||
/** | ||
* 都道府県ごとの配送料 | ||
* @return array<Area> | ||
*/ | ||
public function getChargeRangesByArea(): array | ||
{ | ||
return $this->chargeRangesByArea; | ||
} | ||
|
||
/** | ||
* 配送料が変わる重量の区分 | ||
* @return array<Weight> | ||
*/ | ||
public function getChargeRangesByWeight(): array | ||
{ | ||
return $this->chargeRangesByWeight; | ||
} | ||
|
||
/** | ||
* charge_ranges_by_weightに設定されている区分以上の重量の場合の手数料 | ||
* @return array<Area> | ||
*/ | ||
public function getChargeRangesMaxWeight(): array | ||
{ | ||
return $this->chargeRangesMaxWeight; | ||
} | ||
} |
Oops, something went wrong.