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