Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def cim_charge(amount, payment_detail, options = {})
- process('charge_cim', amount) do |gw|
- gw.create_customer_profile_transaction(
- :transaction => {
- :customer_profile_id => payment_detail.profile_id,
- :customer_payment_profile_id => payment_detail.payment_profile_id,
- :type => :auth_capture,
- :amount => amount
- }
- )
- end
- end
- private
- def process(action, amount = nil)
- self.amount = amount
- self.action = action
- gateway = Gateway.get vendor_id
- begin
- response = yield gateway
- self.success = response.success?
- self.reference = response.authorization
- self.message = response.message
- self.params = response.params
- self.test = response.test?
- rescue ActiveMerchant::ActiveMerchantError => e
- self.success = false
- self.reference = nil
- self.message = e.message
- self.params = {}
- self.test = gateway.test?
- end
- if not self.save
- raise self.error_str
- end
- self
- end
- ## error
- "The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:customerPaymentProfileId' element is invalid - The value '' is invalid according to its datatype 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:numericString' - The Pattern constraint failed."
Add Comment
Please, Sign In to add comment