1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Shippinno\YahooShoppingJp\Request; |
4
|
|
|
|
5
|
|
|
use FluidXml\FluidXml; |
6
|
|
|
use LogicException; |
7
|
|
|
use Shippinno\YahooShoppingJp\Api\GetOrderInfoApi; |
8
|
|
|
use Shippinno\YahooShoppingJp\Response\GetOrderInfoResponse; |
9
|
|
|
|
10
|
|
|
class GetOrderInfoRequest extends AbstractRequest |
11
|
|
|
{ |
12
|
|
|
|
13
|
|
|
public function __construct() |
14
|
|
|
{ |
15
|
|
|
$this->params['Target']['Field'] = implode(',', [ |
16
|
|
|
'OrderId', 'Version', 'ParentOrderId', 'ChildOrderId', 'DeviceType', 'MobileCarrierName', 'IsSeen', |
17
|
|
|
'IsSplit', 'CancelReason', 'IsRoyalty', 'IsRoyaltyFix', 'IsSeller', 'IsAffiliate', 'IsRatingB2s', 'NeedSnl', |
18
|
|
|
'OrderTime', 'LastUpdateTime', 'Suspect', 'SuspectMessage', 'OrderStatus', 'StoreStatus', 'RoyaltyFixTime', |
19
|
|
|
'SendConfirmTime', 'SendPayTime', 'PrintSlipTime', 'PrintDeliveryTime', 'PrintBillTime', 'BuyerComments', |
20
|
|
|
'SellerComments', 'Notes', 'OperationUser', 'Referer', 'EntryPoint', 'HistoryId', 'HistoryId', |
21
|
|
|
'UseCouponData', 'UseCouponData', 'ShippingCouponFlg', 'ShippingCouponDiscount', 'CampaignPoints', |
22
|
|
|
'PayStatus', 'SettleStatus', 'PayType', 'PayKind', 'PayMethod', 'PayMethodName', 'SellerHandlingCharge', |
23
|
|
|
'PayActionTime', 'PayDate', 'PayNotes', 'SettleId', 'CardBrand', 'CardNumber', 'CardNumberLast4', |
24
|
|
|
'CardExpireYear', 'CardExpireMonth', 'CardPayType', 'CardHolderName', 'CardPayCount', 'CardBirthDay', |
25
|
|
|
'UseYahooCard', 'UseWallet', 'NeedBillSlip', 'NeedDetailedSlip', 'NeedReceipt', 'AgeConfirmField', |
26
|
|
|
'AgeConfirmValue', 'AgeConfirmValue', 'BillAddressFrom', 'BillFirstName', 'BillFirstNameKana', |
27
|
|
|
'BillLastName', 'BillLastNameKana', 'BillZipCode', 'BillPrefecture', 'BillPrefectureKana', 'BillCity', |
28
|
|
|
'BillCityKana', 'BillAddress1', 'BillAddress1Kana', 'BillAddress2', 'BillAddress2Kana', 'BillPhoneNumber', |
29
|
|
|
'BillEmgPhoneNumber', 'BillMailAddress', 'BillSection1Field', 'BillSection1Value', 'BillSection2Field', |
30
|
|
|
'BillSection2Value', 'PayNo', 'PayNoIssueDate', 'ConfirmNumber', 'PaymentTerm', 'ShipStatus', 'ShipMethod', |
31
|
|
|
'ShipMethodName', 'ShipRequestDate', 'ShipRequestTime', 'ShipNotes', 'ShipInvoiceNumber1', |
32
|
|
|
'ShipInvoiceNumber2', 'ShipUrl', 'ArriveType', 'ShipDate', 'ArrivalDate', 'NeedGiftWrap', 'GiftWrapType', |
33
|
|
|
'GiftWrapMessage', 'NeedGiftWrapPaper', 'GiftWrapPaperType', 'GiftWrapName', 'Option1Field', 'Option1Type', |
34
|
|
|
'Option1Value', 'Option2Field', 'Option2Type', 'Option2Value', 'ShipFirstName', 'ShipFirstNameKana', |
35
|
|
|
'ShipLastName', 'ShipLastNameKana', 'ShipZipCode', 'ShipPrefecture', 'ShipPrefectureKana', 'ShipCity', |
36
|
|
|
'ShipCityKana', 'ShipAddress1', 'ShipAddress1Kana', 'ShipAddress2', 'ShipAddress2Kana', 'ShipPhoneNumber', |
37
|
|
|
'ShipEmgPhoneNumber', 'ShipSection1Field', 'ShipSection1Value', 'ShipSection2Field', 'ShipSection2Value', |
38
|
|
|
'PayCharge', 'ShipCharge', 'GiftWrapCharge', 'Discount', 'Adjustments', 'SettleAmount', 'UsePoint', |
39
|
|
|
'TotalPrice', 'SettlePayAmount', 'TaxRatio', 'IsGetPointFixAll', 'TotalMallCouponDiscount', 'LineId', |
40
|
|
|
'ItemId', 'Title', 'SubCode', 'SubCodeOption', 'ItemOption', 'Inscription', 'IsUsed', 'ImageId', 'IsTaxable', |
41
|
|
|
'Jan', 'ProductId', 'CategoryId', 'AffiliateRatio', 'UnitPrice', 'Quantity', 'PointAvailQuantity', |
42
|
|
|
'ReleaseDate', 'IsShippingFree', 'HaveReview', 'PointFspCode', 'PointRatioY', 'PointRatioSeller', |
43
|
|
|
'UnitGetPoint', 'IsGetPointFix', 'GetPointFixDate', 'CouponData', 'CouponDiscount', 'CouponUseNum', |
44
|
|
|
'OriginalPrice', 'OriginalNum', 'SellerId', 'IsLogin', 'FspLicenseCode', 'FspLicenseName', 'GuestAuthId', |
45
|
|
|
]); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @return GetOrderInfoApi |
50
|
|
|
*/ |
51
|
|
|
public function api() |
52
|
|
|
{ |
53
|
|
|
return new GetOrderInfoApi; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @return GetOrderInfoResponse |
58
|
|
|
*/ |
59
|
|
|
public function response() |
60
|
|
|
{ |
61
|
|
|
return new GetOrderInfoResponse; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @return void |
66
|
|
|
*/ |
67
|
|
|
protected function validateParams() |
68
|
|
|
{ |
69
|
|
|
// TODO: Implement validateParams() method. |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @return array |
74
|
|
|
*/ |
75
|
|
|
public function getParams() |
76
|
|
|
{ |
77
|
|
|
$fluidXml = new FluidXml('Req'); |
78
|
|
|
$fluidXml->add($this->params); |
79
|
|
|
|
80
|
|
|
return $fluidXml->xml(); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @param string $sellerId |
85
|
|
|
* @return self |
86
|
|
|
*/ |
87
|
|
View Code Duplication |
public function setSellerId(string $sellerId): self |
|
|
|
|
88
|
|
|
{ |
89
|
|
|
if (isset($this->params['SellerId'])) { |
90
|
|
|
throw new LogicException('SellerId is already set.'); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
$this->params['SellerId'] = $sellerId; |
94
|
|
|
|
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @param string $orderId |
100
|
|
|
* @return self |
101
|
|
|
*/ |
102
|
|
View Code Duplication |
public function setOrderId(string $orderId): self |
|
|
|
|
103
|
|
|
{ |
104
|
|
|
if (isset($this->params['Target']['OrderId'])) { |
105
|
|
|
throw new LogicException('OrderId is already set.'); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
$this->params['Target']['OrderId'] = $orderId; |
109
|
|
|
|
110
|
|
|
return $this; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
} |
114
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.