Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/active_merchant/billing/gateways/recurly.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def add_payment_method(post, payment_method, options)
end

def authorization_from(response)
return trial_payment_uuid if trial_payment?
response['uuid'].presence || invoice['transactions'][0]['uuid']
end

Expand Down Expand Up @@ -110,6 +111,7 @@ def invoice
end

def message_from
return trial_payment_status if trial_payment?
invoice['transactions'][0]['status']
end

Expand Down Expand Up @@ -139,6 +141,18 @@ def success_from(response)
def url
"https://v3.recurly.com/sites/subdomain-#{@options[:subdomain]}/"
end

def trial_payment?
invoice['transactions'].empty? and invoice["paid"] == 0.0
end

def trial_payment_status
return invoice["state"]
end

def trial_payment_uuid
return invoice["line_items"]["data"].first["uuid"]
end
end
end
end