Class: Razorpay::Payment

Inherits:
Entity
  • Object
show all
Defined in:
lib/razorpay/payment.rb

Overview

Payment class is the most commonly used class and is used to interact with Payments, the most common type of transactions

Instance Attribute Summary

Attributes inherited from Entity

#attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

#initialize, #method_missing, #respond_to_missing?, #to_json, #with_a_bang

Constructor Details

This class inherits a constructor from Razorpay::Entity

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Razorpay::Entity

Class Method Details

.all(options = {}) ⇒ Object



58
59
60
# File 'lib/razorpay/payment.rb', line 58

def self.all(options = {})
  request.all options
end

.capture(id, options) ⇒ Object



62
63
64
# File 'lib/razorpay/payment.rb', line 62

def self.capture(id, options)
  request.post "#{id}/capture", options
end

.create_json_payment(data = {}) ⇒ Object



18
19
20
# File 'lib/razorpay/payment.rb', line 18

def self.create_json_payment(data={})
  request.post "create/json" , data
end

.create_recurring_payment(data = {}) ⇒ Object



14
15
16
# File 'lib/razorpay/payment.rb', line 14

def self.create_recurring_payment(data={})
  request.post "create/recurring" , data
end

.create_upi(data = {}) ⇒ Object



108
109
110
# File 'lib/razorpay/payment.rb', line 108

def self.create_upi(data={})
  request.post "create/upi" , data
end

.fetch(id) ⇒ Object



54
55
56
# File 'lib/razorpay/payment.rb', line 54

def self.fetch(id)
  request.fetch id
end

.fetch_card_details(id) ⇒ Object



30
31
32
# File 'lib/razorpay/payment.rb', line 30

def self.fetch_card_details(id)
  request.get "#{id}/card"  
end

.fetch_multiple_refund(id, options = {}) ⇒ Object



42
43
44
# File 'lib/razorpay/payment.rb', line 42

def self.fetch_multiple_refund(id, options = {})
  request.get "#{id}/refunds",options
end

.fetch_payment_downtimeObject



22
23
24
# File 'lib/razorpay/payment.rb', line 22

def self.fetch_payment_downtime
  request.get "downtimes"
end

.fetch_payment_downtime_by_id(id) ⇒ Object



26
27
28
# File 'lib/razorpay/payment.rb', line 26

def self.fetch_payment_downtime_by_id(id)
  request.get "downtimes/#{id}"
end

.otp_generate(id) ⇒ Object



96
97
98
# File 'lib/razorpay/payment.rb', line 96

def self.otp_generate(id)
  request.post "#{id}/otp_generate"
end

.requestObject



10
11
12
# File 'lib/razorpay/payment.rb', line 10

def self.request
  Razorpay::Request.new('payments')
end

.validate_vpa(data = {}) ⇒ Object



112
113
114
# File 'lib/razorpay/payment.rb', line 112

def self.validate_vpa(data={})
  request.post "validate/vpa" , data
end

Instance Method Details

#bank_transferObject



92
93
94
# File 'lib/razorpay/payment.rb', line 92

def bank_transfer
  self.class.request.get "#{id}/bank_transfer"
end

#capture(options) ⇒ Object



76
77
78
# File 'lib/razorpay/payment.rb', line 76

def capture(options)
  self.class.request.post "#{id}/capture", options
end

#capture!(options) ⇒ Object



80
81
82
# File 'lib/razorpay/payment.rb', line 80

def capture!(options)
  with_a_bang { capture options }
end

#edit(options = {}) ⇒ Object



50
51
52
# File 'lib/razorpay/payment.rb', line 50

def edit(options = {})
  self.class.request.patch id, options
end

#fetch_refund(refundId) ⇒ Object



38
39
40
# File 'lib/razorpay/payment.rb', line 38

def fetch_refund(refundId)
  self.class.request.get "#{id}/refunds/#{refundId}"  
end

#fetch_transferObject



34
35
36
# File 'lib/razorpay/payment.rb', line 34

def fetch_transfer
  self.class.request.get "#{id}/transfers"  
end

#methodObject



88
89
90
# File 'lib/razorpay/payment.rb', line 88

def method
  method_missing(:method)
end

#otp_resendObject



104
105
106
# File 'lib/razorpay/payment.rb', line 104

def otp_resend
  self.class.request.post "#{id}/otp/resend"
end

#otp_submit(options) ⇒ Object



100
101
102
# File 'lib/razorpay/payment.rb', line 100

def otp_submit(options)
  self.class.request.post "#{id}/otp/submit", options
end

#refund(options = {}) ⇒ Object



66
67
68
# File 'lib/razorpay/payment.rb', line 66

def refund(options = {})
  self.class.request.post "#{id}/refund", options
end

#refund!(options = {}) ⇒ Object



70
71
72
73
74
# File 'lib/razorpay/payment.rb', line 70

def refund!(options = {})
  refund = refund options
  with_a_bang { self.class.request.fetch id }
  refund
end

#refundsObject



84
85
86
# File 'lib/razorpay/payment.rb', line 84

def refunds
  self.class.request.get "#{id}/refunds"
end

#transfer(options = {}) ⇒ Object



46
47
48
# File 'lib/razorpay/payment.rb', line 46

def transfer(options = {})
  self.class.request.post "#{id}/transfers", options
end