Sha256: 76ab5edb5f230cee165f6a9794b509381a5562f59484bb6640fdb89038e892e0

Contents?: true

Size: 750 Bytes

Versions: 4

Compression:

Stored size: 750 Bytes

Contents

namespace :workarea do
  namespace :braintree do
    desc "settles a transaction in braintree sandbox"
    task :settle_test_transaction, [:transaction_id] => :environment do |_, args|
      unless Rails.env.development?
        warn "Only permitted in dev"
        exit(1)
      end

      unless args[:transaction_id].present?
        warn "need transaction_id"
        exit(1)
      end

      Braintree::Configuration.environment = :sandbox
      secrets = Rails.application.secrets.braintree.deep_symbolize_keys
      [:merchant_id, :public_key, :private_key].each do |key|
        puts key
        Braintree::Configuration.send("#{key}=", secrets[key])
      end

      Braintree::TestTransaction.settle args[:transaction_id]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
workarea-braintree-1.1.2 lib/tasks/braintree.rake
workarea-braintree-1.1.1 lib/tasks/braintree.rake
workarea-braintree-1.1.0 lib/tasks/braintree.rake
workarea-braintree-1.0.3 lib/tasks/braintree.rake