def recurring_commit(self, action, request): if self.is_test(): url = self.arb_test_url else: url = self.arb_live_url xml = post(url, request, {"Content-Type": "text/xml"}) response = self.recurring_parse(action, xml) return response
def commit(self, action, money, parameters): if not action == 'VOID': parameters['amount'] = self.amount(money) # Only activate the test_request when the :test option is passed in if self.options['test']: parameters['test_request'] = 'TRUE' else: parameters['test_request'] = 'FALSE' #url = test? ? self.test_url : self.live_url if self.is_test(): url = self.test_url else: url = self.live_url url = url + self.post_data(action, parameters) data = post(url, {}) response = self.parse(data) message = self.message_from(response) # Return the response. The authorization can be taken out of the transaction_id # Test Mode on/off is something we have to parse from the response text. # It usually looks something like this # # (TESTMODE) Successful Sale pattern = re.compile('TESTMODE') if self.is_test() or pattern.search(message): test_mode = True else: test_mode = False #test_mode = test? || message =~ /TESTMODE/ return Response(self.is_success(response), message, response, {'test': test_mode, 'authorization': response['transaction_id'], 'fraud_review': self.is_fraud_review(response), 'avs_result': { 'code': response['avs_result_code'] }, 'cvv_result': response['card_code']} )