def test0010_recredit_request(self): recredit_request_api = BuyingPostageAPI( request_id='098765', recredit_amount=500.00, requesterid=REQUESTER_ID, accountid=ACCOUNT_ID, passphrase=PASSPHRASE, test=True, ) print recredit_request_api.to_xml() response = recredit_request_api.send_request() print objectify_response(response)
def default_buy_postage(self, data): """ Generate the SCAN Form for the current shipment record """ default = {} buy_postage_api = BuyingPostageAPI( request_id=Transaction().user, recredit_amount=self.start.amount, requesterid=self.start.carrier.endicia_requester_id, accountid=self.start.carrier.endicia_account_id, passphrase=self.start.carrier.endicia_passphrase, test=self.start.carrier.endicia_is_test, ) try: response = buy_postage_api.send_request() except RequestError, error: self.raise_user_error('error_label', error_args=(error, ))
def default_buy_postage(self, data): """ Generate the SCAN Form for the current shipment record """ EndiciaConfiguration = Pool().get('endicia.configuration') default = {} endicia_credentials = EndiciaConfiguration(1).get_endicia_credentials() buy_postage_api = BuyingPostageAPI( request_id=Transaction().user, recredit_amount=self.start.amount, requesterid=endicia_credentials.requester_id, accountid=endicia_credentials.account_id, passphrase=endicia_credentials.passphrase, test=endicia_credentials.is_test, ) try: response = buy_postage_api.send_request() except RequestError, error: self.raise_user_error('error_label', error_args=(error, ))
def default_buy_postage(self, data): """ Generate the SCAN Form for the current shipment record """ default = {} company = self.start.company endicia_credentials = company.get_endicia_credentials() buy_postage_api = BuyingPostageAPI( request_id=Transaction().user, recredit_amount=self.start.amount, requesterid=endicia_credentials.requester_id, accountid=endicia_credentials.account_id, passphrase=endicia_credentials.passphrase, test=endicia_credentials.usps_test, ) response = buy_postage_api.send_request() result = objectify_response(response) default['company'] = self.start.company default['amount'] = self.start.amount default['response'] = str(result.ErrorMessage) \ if hasattr(result, 'ErrorMessage') else 'Success' return default