lib/braintree/credit_card_gateway.rb in braintree-2.49.0 vs lib/braintree/credit_card_gateway.rb in braintree-2.50.0
- old
+ new
@@ -55,9 +55,23 @@
CreditCard._new(@gateway, response[:credit_card])
rescue NotFoundError
raise NotFoundError, "nonce #{nonce.inspect} locked, consumed, or not found"
end
+ def grant(token, allow_vaulting)
+ raise ArgumentError if token.nil? || token.to_s.strip == ""
+ response = @config.http.post(
+ "#{@config.base_merchant_path}/payment_methods/grant",
+ :payment_method => {
+ :shared_payment_method_token => token,
+ :allow_vaulting => allow_vaulting
+ }
+ )
+ PaymentMethodNonce._new(@gateway, response[:payment_method_nonce])
+ rescue NotFoundError
+ raise NotFoundError, "payment method with token #{token.inspect} not found"
+ end
+
def update(token, attributes)
Util.verify_keys(CreditCardGateway._update_signature, attributes)
_do_update(:put, "/payment_methods/credit_card/#{token}", :credit_card => attributes)
end