magento 0.8.2 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01b9ac4283305e36500f008a3344c2287efc72e1b56e8fb996161fa7e5d658a7
4
- data.tar.gz: 6ce8510dfb9ed0977f50cb78977b98028cc2d34e205272447160d738acac56eb
3
+ metadata.gz: 84ae0187402170a5d338e8fe19f7ffa07211be073592c36aff70a5edef16e008
4
+ data.tar.gz: 7eed987d9b42e2ec86f9394c088c363658cb27cfcb664a8d2192ada23c0ee5b8
5
5
  SHA512:
6
- metadata.gz: 27a5885f9ede8d3ce9a2c078a6319dd04d0f1a6e74c0b1569da3525f0ca3e229fef1df0b9753e49331a667b21bfe1590575d3466c59d42b56a5349f294a01c09
7
- data.tar.gz: 124ab9fbb4ec50b80f1117c2b0ed2af64055a0dbf7304e9ad3b410f1db6e8714be3267229625ec03cc60fdfa9ac98c3df7d4dc21eb660688aa57a1c512cc5869
6
+ metadata.gz: beef9d8552c025b306ad434b33701030e032b8a603545bfcfbc407be1b141f36625075ab4f873e8bac78b6369fd5334239af3da8cff0de04ebc445ed4f1fde3d
7
+ data.tar.gz: b8e897978815efe0416471903a3d398b5d4ed8593a59353852cda2d33b3843ae861929f168425072ab69caeb7dec0d360ba5c1345919a2ab81990f368134c744
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  Add in your Gemfile
6
6
 
7
7
  ```rb
8
- gem 'magento', '~> 0.8.2'
8
+ gem 'magento', '~> 0.9.0'
9
9
  ```
10
10
 
11
11
  or run
@@ -320,7 +320,7 @@ invoice_id = order.invoice(
320
320
  ## Create refund for invoice
321
321
 
322
322
  ```rb
323
- Magento::Invoice.invoice(refund_id)
323
+ Magento::Invoice.invoice(invoice_id)
324
324
  >> 12 # return refund id
325
325
 
326
326
  # or from instance
@@ -361,6 +361,48 @@ invoice.refund(
361
361
  [Complete Refund Documentation](https://magento.redoc.ly/2.4-admin/tag/invoicescomments#operation/salesRefundInvoiceV1ExecutePost)
362
362
 
363
363
 
364
+ ## Create offline refund for order
365
+
366
+ ```rb
367
+ Magento::Order.refund(order_id)
368
+ >> 12 # return refund id
369
+
370
+ # or from instance
371
+
372
+ order = Magento::Order.find(order_id)
373
+
374
+ order.refund
375
+
376
+ # you can pass parameters too
377
+
378
+ order.refund(
379
+ items: [
380
+ {
381
+ extension_attributes: {},
382
+ order_item_id: 0,
383
+ qty: 0
384
+ }
385
+ ],
386
+ notify: true,
387
+ appendComment: true,
388
+ comment: {
389
+ extension_attributes: {},
390
+ comment: string,
391
+ is_visible_on_front: 0
392
+ },
393
+ arguments: {
394
+ shipping_amount: 0,
395
+ adjustment_positive: 0,
396
+ adjustment_negative: 0,
397
+ extension_attributes: {
398
+ return_to_stock_items: [0]
399
+ }
400
+ }
401
+ )
402
+ ```
403
+
404
+ [Complete Refund Documentation](https://magento.redoc.ly/2.4-admin/tag/invoicescomments#operation/salesRefundOrderV1ExecutePost)
405
+
364
406
  ## Other Invoice methods
365
407
 
366
408
  ```rb
@@ -33,7 +33,7 @@ module Magento
33
33
  # invoice = Magento::Invoice.find(invoice_id)
34
34
  #
35
35
  # invoice.refund # or you can pass parameters
36
- # invoice.invoice(notify: false) # See the refund class method for more information
36
+ # invoice.refund(isOnline: true) # See the refund class method for more information
37
37
  #
38
38
  # @return {Integer} return the refund id
39
39
  def refund(refund_params = nil)
@@ -33,6 +33,20 @@ module Magento
33
33
  self.class.invoice(id, params)
34
34
  end
35
35
 
36
+
37
+ #
38
+ # Create offline refund for order
39
+ #
40
+ # order = Magento::Order.find(order_id)
41
+ #
42
+ # order.refund # or you can pass parameters
43
+ # order.invoice(notify: false) # See the refund class method for more information
44
+ #
45
+ # @return {Integer} return the refund id
46
+ def refund(refund_params = nil)
47
+ self.class.refund(id, refund_params)
48
+ end
49
+
36
50
  #
37
51
  # Creates new Shipment for given Order.
38
52
  #
@@ -84,6 +98,49 @@ module Magento
84
98
  request.post("order/#{order_id}/invoice", invoice_params).parse
85
99
  end
86
100
 
101
+
102
+ #
103
+ # Create offline refund for order
104
+ #
105
+ # Magento::Order.refund(order_id)
106
+ #
107
+ # or
108
+ #
109
+ # Magento::Order.refund(
110
+ # order_id,
111
+ # items: [
112
+ # {
113
+ # extension_attributes: {},
114
+ # order_item_id: 0,
115
+ # qty: 0
116
+ # }
117
+ # ],
118
+ # notify: true,
119
+ # appendComment: true,
120
+ # comment: {
121
+ # extension_attributes: {},
122
+ # comment: string,
123
+ # is_visible_on_front: 0
124
+ # },
125
+ # arguments: {
126
+ # shipping_amount: 0,
127
+ # adjustment_positive: 0,
128
+ # adjustment_negative: 0,
129
+ # extension_attributes: {
130
+ # return_to_stock_items: [
131
+ # 0
132
+ # ]
133
+ # }
134
+ # }
135
+ # )
136
+ #
137
+ # to complete [documentation](https://magento.redoc.ly/2.4-admin/tag/invoicescomments#operation/salesRefundOrderV1ExecutePost)
138
+ #
139
+ # @return {Integer} return the refund id
140
+ def refund(order_id, refund_params = nil)
141
+ request.post("order/#{order_id}/refund", refund_params).parse
142
+ end
143
+
87
144
  #
88
145
  # Creates new Shipment for given Order.
89
146
  #
@@ -1,3 +1,3 @@
1
1
  module Magento
2
- VERSION = '0.8.2'
2
+ VERSION = '0.9.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magento
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wallas Faria