mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-12-15 00:01:08 -05:00
Support AlipayAccount retrieval and deletion
This commit is contained in:
parent
49382f7ac2
commit
2a6673a8e5
@ -53,6 +53,7 @@ require 'stripe/dispute'
|
||||
require 'stripe/product'
|
||||
require 'stripe/sku'
|
||||
require 'stripe/order'
|
||||
require 'stripe/alipay_account'
|
||||
|
||||
# Errors
|
||||
require 'stripe/errors/stripe_error'
|
||||
|
||||
16
lib/stripe/alipay_account.rb
Normal file
16
lib/stripe/alipay_account.rb
Normal file
@ -0,0 +1,16 @@
|
||||
module Stripe
|
||||
class AlipayAccount < APIResource
|
||||
include Stripe::APIOperations::Update
|
||||
include Stripe::APIOperations::Delete
|
||||
|
||||
def resource_url
|
||||
if respond_to?(:customer) && !self.customer.nil?
|
||||
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
|
||||
end
|
||||
end
|
||||
|
||||
def self.retrieve(id, opts=nil)
|
||||
raise NotImplementedError.new("Alipay accounts cannot be retrieved without a customer ID. Retrieve an Alipay account using customer.sources.retrieve('alipay_account_id')")
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -24,6 +24,7 @@ module Stripe
|
||||
|
||||
# business objects
|
||||
'account' => Account,
|
||||
'alipay_account' => AlipayAccount,
|
||||
'application_fee' => ApplicationFee,
|
||||
'balance' => Balance,
|
||||
'balance_transaction' => BalanceTransaction,
|
||||
|
||||
11
test/stripe/alipay_account_test.rb
Normal file
11
test/stripe/alipay_account_test.rb
Normal file
@ -0,0 +1,11 @@
|
||||
require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
module Stripe
|
||||
class AlipayAccountTest < Test::Unit::TestCase
|
||||
should "raise if accessing Stripe::Alipay.account directly" do
|
||||
assert_raises NotImplementedError do
|
||||
Stripe::AlipayAccount.retrieve "card_12345"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user