@@ -46,36 +46,36 @@ discard block |
||
| 46 | 46 | 'transactions' => [Transaction::class, 'toDataSet'] |
| 47 | 47 | ]; |
| 48 | 48 | |
| 49 | - final protected static function getType (): string { |
|
| 49 | + final protected static function getType(): string { |
|
| 50 | 50 | return 'refund'; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - final public function __toString (): string { |
|
| 53 | + final public function __toString(): string { |
|
| 54 | 54 | return "{$this->getDir()}/{$this->getId()}"; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - final protected function getDir (): string { |
|
| 57 | + final protected function getDir(): string { |
|
| 58 | 58 | return "orders/{$this->getOrderId()}/refunds"; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * @return RefundItem |
| 63 | 63 | */ |
| 64 | - public function newItem () { |
|
| 64 | + public function newItem() { |
|
| 65 | 65 | return $this->data['refund_line_items'][] = RefundItem::toData($this, []); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * @return Transaction |
| 70 | 70 | */ |
| 71 | - public function newTransaction () { |
|
| 71 | + public function newTransaction() { |
|
| 72 | 72 | return $this->data['transactions'][] = Transaction::toData($this, ['kind' => Transaction::KIND_REFUND]); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * @return $this |
| 77 | 77 | */ |
| 78 | - public function setFullShipping () { |
|
| 78 | + public function setFullShipping() { |
|
| 79 | 79 | return $this->set('shipping', ['full_refund' => true]); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * @param string $amount |
| 84 | 84 | * @return $this |
| 85 | 85 | */ |
| 86 | - public function setShippingAmount (string $amount) { |
|
| 86 | + public function setShippingAmount(string $amount) { |
|
| 87 | 87 | return $this->set('shipping', ['amount' => $amount]); |
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | \ No newline at end of file |
@@ -62,14 +62,14 @@ |
||
| 62 | 62 | /** |
| 63 | 63 | * @return Item |
| 64 | 64 | */ |
| 65 | - public function newItem () { |
|
| 65 | + public function newItem() { |
|
| 66 | 66 | return $this->data['line_items']->add(Item::toData($this, [])); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * @return Tax |
| 71 | 71 | */ |
| 72 | - public function newTax () { |
|
| 72 | + public function newTax() { |
|
| 73 | 73 | return $this->data['tax_lines']->add(Tax::toData($this, [])); |
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | \ No newline at end of file |
@@ -55,15 +55,15 @@ |
||
| 55 | 55 | 'payment_details' => [Payment::class, 'toData'] |
| 56 | 56 | ]; |
| 57 | 57 | |
| 58 | - final protected static function getType (): string { |
|
| 58 | + final protected static function getType(): string { |
|
| 59 | 59 | return 'transaction'; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - final public function __toString (): string { |
|
| 62 | + final public function __toString(): string { |
|
| 63 | 63 | return "{$this->getDir()}/{$this->getId()}"; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - final protected function getDir (): string { |
|
| 66 | + final protected function getDir(): string { |
|
| 67 | 67 | return "orders/{$this->getOrderId()}/transactions"; |
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | \ No newline at end of file |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | /** |
| 57 | 57 | * @return Tax |
| 58 | 58 | */ |
| 59 | - public function newTax () { |
|
| 59 | + public function newTax() { |
|
| 60 | 60 | return $this->data['tax_lines']->add(Tax::toData($this, [])); |
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | \ No newline at end of file |
@@ -88,30 +88,30 @@ discard block |
||
| 88 | 88 | 'prerequisite_to_entitlement_quantity_ratio' => ['toData', Ratio::class] |
| 89 | 89 | ]; |
| 90 | 90 | |
| 91 | - final protected static function getSearchPath (): string { |
|
| 91 | + final protected static function getSearchPath(): string { |
|
| 92 | 92 | return 'price_rule'; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - final protected static function getSearchType (): string { |
|
| 95 | + final protected static function getSearchType(): string { |
|
| 96 | 96 | return 'price_rules'; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - final protected static function getType (): string { |
|
| 99 | + final protected static function getType(): string { |
|
| 100 | 100 | return 'price_rule'; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - final public function __toString (): string { |
|
| 103 | + final public function __toString(): string { |
|
| 104 | 104 | return "price_rules/{$this->getId()}"; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - final protected function getDir (): string { |
|
| 107 | + final protected function getDir(): string { |
|
| 108 | 108 | return 'price_rules'; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | 112 | * @return DiscountCode[] |
| 113 | 113 | */ |
| 114 | - public function getDiscountCodes () { |
|
| 114 | + public function getDiscountCodes() { |
|
| 115 | 115 | assert($this->hasId()); |
| 116 | 116 | if (!$this->discountCodes) { |
| 117 | 117 | $remote = $this->api->get("{$this}/discount_codes"); |
@@ -126,28 +126,28 @@ discard block |
||
| 126 | 126 | /** |
| 127 | 127 | * @return null|number |
| 128 | 128 | */ |
| 129 | - public function getMaxShipping () { |
|
| 129 | + public function getMaxShipping() { |
|
| 130 | 130 | return $this->data['prerequisite_shipping_price_range']['less_than_or_equal_to'] ?? null; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
| 134 | 134 | * @return null|int |
| 135 | 135 | */ |
| 136 | - public function getMinQuantity () { |
|
| 136 | + public function getMinQuantity() { |
|
| 137 | 137 | return $this->data['prerequisite_quantity_range']['greater_than_or_equal_to'] ?? null; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
| 141 | 141 | * @return null|number |
| 142 | 142 | */ |
| 143 | - public function getMinSubtotal () { |
|
| 143 | + public function getMinSubtotal() { |
|
| 144 | 144 | return $this->data['prerequisite_subtotal_range']['greater_than_or_equal_to'] ?? null; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
| 148 | 148 | * @return DiscountCode |
| 149 | 149 | */ |
| 150 | - public function newDiscountCode () { |
|
| 150 | + public function newDiscountCode() { |
|
| 151 | 151 | $this->getDiscountCodes(); |
| 152 | 152 | return $this->discountCodes->add(new DiscountCode($this->api, ['price_rule_id' => $this->getId()])); |
| 153 | 153 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * @param null|number $max |
| 157 | 157 | * @return $this |
| 158 | 158 | */ |
| 159 | - public function setMaxShipping ($max) { |
|
| 159 | + public function setMaxShipping($max) { |
|
| 160 | 160 | return $this->set('prerequisite_shipping_price_range', isset($max) ? ['less_than_or_equal_to' => $max] : null); |
| 161 | 161 | } |
| 162 | 162 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | * @param null|int $min |
| 165 | 165 | * @return $this |
| 166 | 166 | */ |
| 167 | - public function setMinQuantity (?int $min) { |
|
| 167 | + public function setMinQuantity(?int $min) { |
|
| 168 | 168 | return $this->set('prerequisite_quantity_range', isset($min) ? ['greater_than_or_equal_to' => $min] : null); |
| 169 | 169 | } |
| 170 | 170 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * @param null|number $min |
| 173 | 173 | * @return $this |
| 174 | 174 | */ |
| 175 | - public function setMinSubtotal ($min) { |
|
| 175 | + public function setMinSubtotal($min) { |
|
| 176 | 176 | return $this->set('prerequisite_subtotal_range', isset($min) ? ['greater_than_or_equal_to' => $min] : null); |
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | \ No newline at end of file |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | class DiscountCode extends AbstractEntity { |
| 21 | 21 | |
| 22 | - final protected static function getType (): string { |
|
| 22 | + final protected static function getType(): string { |
|
| 23 | 23 | return 'discount_code'; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -28,16 +28,16 @@ discard block |
||
| 28 | 28 | * @param string $code |
| 29 | 29 | * @return null|static |
| 30 | 30 | */ |
| 31 | - public static function loadByCode (Api $api, string $code) { |
|
| 31 | + public static function loadByCode(Api $api, string $code) { |
|
| 32 | 32 | $remote = $api->get('discount_codes/lookup', ['code' => $code]); |
| 33 | 33 | return $remote ? new static($api, $remote['discount_code']) : null; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - final public function __toString (): string { |
|
| 36 | + final public function __toString(): string { |
|
| 37 | 37 | return "{$this->getDir()}/{$this->getId()}"; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - final protected function getDir (): string { |
|
| 40 | + final protected function getDir(): string { |
|
| 41 | 41 | return "price_rules/{$this->getPriceRuleId()}/discount_codes"; |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | \ No newline at end of file |
@@ -142,23 +142,23 @@ discard block |
||
| 142 | 142 | 'tax_lines' => [Tax::class, 'toDataSet'] |
| 143 | 143 | ]; |
| 144 | 144 | |
| 145 | - final protected static function getMetafieldType (): string { |
|
| 145 | + final protected static function getMetafieldType(): string { |
|
| 146 | 146 | return 'order'; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - final protected static function getSearchPath (): string { |
|
| 149 | + final protected static function getSearchPath(): string { |
|
| 150 | 150 | return 'orders'; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - final protected static function getSearchType (): string { |
|
| 153 | + final protected static function getSearchType(): string { |
|
| 154 | 154 | return 'orders'; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - final protected static function getType (): string { |
|
| 157 | + final protected static function getType(): string { |
|
| 158 | 158 | return 'order'; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - final public function __toString (): string { |
|
| 161 | + final public function __toString(): string { |
|
| 162 | 162 | return "orders/{$this->getId()}"; |
| 163 | 163 | } |
| 164 | 164 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * |
| 170 | 170 | * @return $this |
| 171 | 171 | */ |
| 172 | - public function cancel () { |
|
| 172 | + public function cancel() { |
|
| 173 | 173 | assert($this->hasId()); |
| 174 | 174 | $remote = $this->api->post("{$this}/cancel", []); |
| 175 | 175 | return $this->import($remote['order'])->notify('save'); |
@@ -180,38 +180,38 @@ discard block |
||
| 180 | 180 | * |
| 181 | 181 | * @return $this |
| 182 | 182 | */ |
| 183 | - public function close () { |
|
| 183 | + public function close() { |
|
| 184 | 184 | assert($this->hasId()); |
| 185 | 185 | $remote = $this->api->post("{$this}/close", []); |
| 186 | 186 | return $this->import($remote['order'])->notify('save'); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - final protected function getDir (): string { |
|
| 189 | + final protected function getDir(): string { |
|
| 190 | 190 | return 'orders'; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - final protected function getMetafieldDir (): string { |
|
| 193 | + final protected function getMetafieldDir(): string { |
|
| 194 | 194 | return "{$this}/metafields"; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
| 198 | 198 | * @return Discount |
| 199 | 199 | */ |
| 200 | - public function newDiscount () { |
|
| 200 | + public function newDiscount() { |
|
| 201 | 201 | return $this->data['discount_codes']->add(Discount::toData($this, [])); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /** |
| 205 | 205 | * @return Fulfillment |
| 206 | 206 | */ |
| 207 | - public function newFulfillment () { |
|
| 207 | + public function newFulfillment() { |
|
| 208 | 208 | return $this->data['fulfillments']->add(Fulfillment::toData($this, ['order_id' => $this->getId()])); |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
| 212 | 212 | * @return Refund |
| 213 | 213 | */ |
| 214 | - public function newRefund () { |
|
| 214 | + public function newRefund() { |
|
| 215 | 215 | assert($this->hasId()); |
| 216 | 216 | return $this->data['refunds']->add(Refund::toData($this, ['order_id' => $this->getId()])); |
| 217 | 217 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | /** |
| 220 | 220 | * @return Shipping |
| 221 | 221 | */ |
| 222 | - public function newShipping () { |
|
| 222 | + public function newShipping() { |
|
| 223 | 223 | return $this->data['shipping_lines']->add(Shipping::toData($this, [])); |
| 224 | 224 | } |
| 225 | 225 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | * |
| 229 | 229 | * @return $this |
| 230 | 230 | */ |
| 231 | - public function reopen () { |
|
| 231 | + public function reopen() { |
|
| 232 | 232 | assert($this->hasId()); |
| 233 | 233 | $remote = $this->api->post("{$this}/open", []); |
| 234 | 234 | return $this->import($remote['order'])->notify('save'); |
@@ -26,18 +26,18 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | use EntityTrait; |
| 28 | 28 | |
| 29 | - final protected static function getType (): string { |
|
| 29 | + final protected static function getType(): string { |
|
| 30 | 30 | return 'inventory_level'; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - final public function __toString (): string { |
|
| 33 | + final public function __toString(): string { |
|
| 34 | 34 | return "inventory_levels.json?inventory_item_id={$this->getInventoryItemId()}&location_id={$this->getLocationId()}"; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @return null|Location |
| 39 | 39 | */ |
| 40 | - public function getLocation () { |
|
| 40 | + public function getLocation() { |
|
| 41 | 41 | return $this->api->getLocation($this->getLocationId()); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @return $this |
| 48 | 48 | */ |
| 49 | - public function save () { |
|
| 49 | + public function save() { |
|
| 50 | 50 | if ($this->isDiff()) { |
| 51 | 51 | if ($this->getUpdatedAt()) { |
| 52 | 52 | $remote = $this->api->post('inventory_levels/adjust', $this->getData()); |
@@ -50,8 +50,7 @@ |
||
| 50 | 50 | if ($this->isDiff()) { |
| 51 | 51 | if ($this->getUpdatedAt()) { |
| 52 | 52 | $remote = $this->api->post('inventory_levels/adjust', $this->getData()); |
| 53 | - } |
|
| 54 | - else { |
|
| 53 | + } else { |
|
| 55 | 54 | $remote = $this->api->post('inventory_levels/connect', $this->getData()); |
| 56 | 55 | } |
| 57 | 56 | $this->import($remote['inventory_level']); |
@@ -27,15 +27,15 @@ |
||
| 27 | 27 | const FORMAT_JSON = 'json'; |
| 28 | 28 | const FORMAT_XML = 'xml'; |
| 29 | 29 | |
| 30 | - final protected static function getType (): string { |
|
| 30 | + final protected static function getType(): string { |
|
| 31 | 31 | return 'carrier_service'; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - final public function __toString (): string { |
|
| 34 | + final public function __toString(): string { |
|
| 35 | 35 | return "carrier_services/{$this->getId()}"; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - final protected function getDir (): string { |
|
| 38 | + final protected function getDir(): string { |
|
| 39 | 39 | return 'carrier_services'; |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | \ No newline at end of file |