Skip to content

Commit 110342d

Browse files
committed
Exposed #process_refund for Payment
1 parent 2d4e220 commit 110342d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,15 @@ client.create_refund do |refund|
192192
refund.body = 'Customer is not satisifed'
193193
end
194194
```
195+
or refund a `payment` directly:
196+
```ruby
197+
payment = client.payment_detail('MOJO5c05000F97367750')
198+
payment.process_refund(type: 'QFL', reason: 'User wanted different version') #or
199+
payment.process_refund do |refund|
200+
refund.type = 'QFL'
201+
refund.reason = 'User wanted different version'
202+
end
203+
```
195204

196205
#### Details of a refund
197206
```ruby

lib/client/payment.rb

+7
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ def initialize(payment, client)
4343
@client = client # Reference to client
4444
end
4545

46+
# Process refund for this payment
47+
# payment.process_refund(type: 'QFL', body: 'Customer is not satisfied')
48+
def process_refund(hash = {}, &block)
49+
hash[:payment_id] = self.payment_id
50+
@client.create_refund(hash, &block)
51+
end
52+
4653
def to_s
4754
sprintf("Instamojo Payment(payment_id: %s, quantity: %s, amount: %s, status: %s, link_slug: %s, buyer_name: %s)",
4855
payment_id, quantity, amount, status, link_slug, buyer_name)

0 commit comments

Comments
 (0)