Created
October 20, 2014 20:10
-
-
Save dbarrionuevo/5c8cc5ffc84a6ed94773 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Checkout::Base | |
| extend ActiveSupport::Concern | |
| included do | |
| expose(:cc_dummy_data) { cc_data } | |
| respond_to :json | |
| end | |
| def create | |
| build_resource | |
| @resource.save | |
| respond_with @resource | |
| end | |
| private | |
| def build_resource | |
| @resource ||= resource_scope.new(permitted_params.deep_merge(additional_order_params)) | |
| end | |
| def order_params | |
| { | |
| order: [ | |
| :first_name, :last_name, :billing_address, :zip_code, | |
| :card_brand, :"card_expires_on(3i)",:"card_expires_on(2i)",:"card_expires_on(1i)", | |
| :card_number, :card_vv, :waiver | |
| ] | |
| } | |
| end | |
| def cc_data | |
| if Rails.env.production? | |
| { number: '', cvv: '' } | |
| else | |
| { number: '4024007148673576', cvv: '123' } | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment