def get(self, id): self._log_info('Get {}'.format(id)) Utils.validate_payment_id(id) return PaymentProcessed( self._send_http_request('charges/{}'.format(id), HttpMethod.GET))
def test_validate_payment_id(self): try: Utils.validate_payment_id(self.PAYMENT_ID) except errors.BadRequestError: self.fail( 'Utils.validate_payment_id raised BadRequestError unexpectedly' )
def _getPaymentActionResponse(self, id, action, value, track_id, **kwargs): self._log_info('{} - {} - {}'.format( action.capitalize(), id, track_id if track_id else '<no track id>')) Utils.validate_payment_id(id) request = {'trackId': track_id} if value is not None: Utils.validate_transaction(value=value) request['value'] = value # add remaining properties request.update(kwargs) return self._send_http_request('charges/{}/{}'.format(id, action), HttpMethod.POST, request)
def test_validate_invalid_payment_id(self): with self.assertRaises(errors.BadRequestError): Utils.validate_payment_id(self.INVALID_ID)