Public marks an envelope as sent

 envelope_id           - ID of the envelope which you want to send

 Returns the response (success or failure).
420177
def send_envelope(envelope_id)
      content_type = { 'Content-Type' => 'application/json' }

      post_body = {
        status: 'sent'
      }.to_json

      uri = build_uri("/accounts/#{acct_id}/envelopes/#{envelope_id}")

      http = initialize_net_http_ssl(uri)
      request = Net::HTTP::Put.new(uri.request_uri, headers(content_type))
      request.body = post_body
      response = http.request(request)

      JSON.parse(response.body)
    end
886203
def _send(self):
        

        payload = self.payload
        sending_metadata = {'success': False}
        post_attributes = {'timeout': self.timeout}

        if self.custom_headers:
            post_attributes['headers'] = self.custom_headers
        if not post_attributes.get('headers', None):
            post_attributes['headers'] = {}
        post_attributes['headers']['Content-Type'] = self.encoding

        post_attributes['data'] = self.format_payload()

        if self.signing_secret:
            post_attributes['headers']['x-hub-signature'] = self.create_signature(post_attributes['data'], \
                                                                                  self.signing_secret)

        for i, wait in enumerate(range(len(self.attempts) - 1)):

            self.attempt = i + 1
            sending_metadata['attempt'] = self.attempt

            try:
                print(self.url)
                self.response = requests.post(self.url, **post_attributes)

                if sys.version > '3':
                    # Converts bytes object to str object in Python 3+
                    self.response_content = self.response.content.decode('utf-8')
                else:
                    self.response_content = self.response.content

                sending_metadata['status_code'] = self.response.status_code

                # anything with a 200 status code  is a success
                if self.response.status_code >= 200 and self.response.status_code < 300:
                    # Exit the sender method.  Here we provide the payload as a result.
                    #   This is useful for reporting.
                    self.notify("Attempt {}: Successfully sent webhook {}".format(
                        self.attempt, self.hash_value)
                    )
                    sending_metadata['response'] = self.response_content
                    sending_metadata['success'] = True
                    break
                else:
                    self.error = "Status code (%d). Message: %s" % (self.response.status_code, self.response.text)


            except Exception as ex:
                err_formatted = str(ex).replace('"',"'")
                sending_metadata['response'] = '{"status_code": 500, "status":"failure","error":"'+err_formatted+'"}'
                self.error = err_formatted

            self.notify("Attempt {}: Could not send webhook {}".format(
                    self.attempt, self.hash_value)
            )
            self.notify_debug("Webhook {}. Body: {}".format(
                    self.hash_value, self.payload)
            )

            # If last attempt
            if self.attempt == (len(self.attempts) - 1):
                self.notify_error("Failed to send webhook {}. Body: {}".format(
                    self.hash_value, self.payload)
                )
            else:
                # Wait a bit before the next attempt
                sleep(wait)

        sending_metadata['error'] = None if sending_metadata['success'] or not self.error else self.error
        sending_metadata['post_attributes'] = post_attributes
        merged_dict = sending_metadata.copy()
        if isinstance(payload, string_types):
            payload = {'payload': payload}

        # Add the hash value if there is one.
        if self.hash_value is not None and len(self.hash_value) > 0:
            payload['hash'] = self.hash_value

        merged_dict.update(payload)
        return merged_dict
79391
def receipt(self, msg):
        
        body = msg['body'].replace(NULL, '')

        brief_msg = ""
        if 'receipt-id' in msg['headers']:
            brief_msg = msg['headers']['receipt-id']

        self.log.info("Received server receipt message - receipt-id:%s\n\n%s" % (brief_msg, body))

        returned = NO_RESPONSE_NEEDED
        if self.testing:
            returned = 'receipt'

        return returned
789985
def verify_response(self, response_json, signed_id_name='transactionid'):
        
        auth_json = response_json.get('auth', {})

        nonce = auth_json.get('nonce', '')
        timestamp = auth_json.get('timestamp', '')
        signature = binascii.unhexlify(auth_json.get('signature', ''))

        signed_id = response_json.get(signed_id_name, '')

        return self.verify_signature(signature=signature, nonce=nonce, timestamp=timestamp, signed_id=signed_id)
1237650
def get(self, sent_id, **kwargs):
        ''' '''
        if sent_id is not None and not isinstance(sent_id, int):
            sent_id = int(sent_id)
        if sent_id is None or not self.has_id(sent_id):
            if 'default' in kwargs:
                return kwargs['default']
            else:
                raise KeyError("Invalid sentence ID ({})".format(sent_id))
        return self.__sent_map[sent_id]
124336
def verify_envelope(reply, key_file):
    """"""
    doc = etree.fromstring(reply)
    node = doc.find(".//{%s}Signature" % xmlsec.DSigNs)
    if node is None:
        raise CertificationError("No signature node found")
    dsigCtx = xmlsec.DSigCtx()

    xmlsec.addIDs(doc, ['Id'])
    signKey = xmlsec.Key.load(key_file, xmlsec.KeyDataFormatPem)
    signKey.name = os.path.basename(key_file)

    dsigCtx.signKey = signKey
    try:
        dsigCtx.verify(node)
    except xmlsec.VerificationError:
        return False
    return True
249227
def doProcess(self):
        
        oidconsumer = self.getConsumer()

        # Ask the library to check the response that the server sent
        # us.  Status is a code indicating the response type. info is
        # either None or a string containing more information about
        # the return type.
        url = 'http://'+self.headers.get('Host')+self.path
        info = oidconsumer.complete(self.query, url)

        sreg_resp = None
        pape_resp = None
        css_class = 'error'
        display_identifier = info.getDisplayIdentifier()

        if info.status == consumer.FAILURE and display_identifier:
            # In the case of failure, if info is non-None, it is the
            # URL that we were verifying. We include it in the error
            # message to help the user figure out what happened.
            fmt = "Verification of %s failed: %s"
            message = fmt % (cgi.escape(display_identifier),
                             info.message)
        elif info.status == consumer.SUCCESS:
            # Success means that the transaction completed without
            # error. If info is None, it means that the user cancelled
            # the verification.
            css_class = 'alert'

            # This is a successful verification attempt. If this
            # was a real application, we would do our login,
            # comment posting, etc. here.
            fmt = "You have successfully verified %s as your identity."
            message = fmt % (cgi.escape(display_identifier),)
            sreg_resp = sreg.SRegResponse.fromSuccessResponse(info)
            pape_resp = pape.Response.fromSuccessResponse(info)
            if info.endpoint.canonicalID:
                # You should authorize i-name users by their canonicalID,
                # rather than their more human-friendly identifiers.  That
                # way their account with you is not compromised if their
                # i-name registration expires and is bought by someone else.
                message += ("  This is an i-name, and its persistent ID is %s"
                            % (cgi.escape(info.endpoint.canonicalID),))
        elif info.status == consumer.CANCEL:
            # cancelled
            message = 'Verification cancelled'
        elif info.status == consumer.SETUP_NEEDED:
            if info.setup_url:
                message = '<a href=%s>Setup needed</a>' % (
                    quoteattr(info.setup_url),)
            else:
                # This means auth didn't succeed, but you're welcome to try
                # non-immediate mode.
                message = 'Setup needed'
        else:
            # Either we don't understand the code or there is no
            # openid_url included with the error. Give a generic
            # failure message. The library should supply debug
            # information in a log.
            message = 'Verification failed.'

        self.render(message, css_class, display_identifier,
                    sreg_data=sreg_resp, pape_data=pape_resp)
424380
def notify_by(self, invoice_id, medium, **kwargs):
        "
        url = "{}/{}/notify_by/{}".format(self.base_url, invoice_id, medium)
        return self.post_url(url, {}, **kwargs)
1336921
def cancel(id)
      have_key?
      address = @url_private + "/trade_cancel/"
      params = {
        "id" => id,
      }
      h = post_ssl_with_sign(address, params)
      {
        "success" => h["result"],
      }
    end
1086848
function(el) {
            var id = el.id;

            if (!id) {
                id = Y.stamp(el);
                el.id = id;
            }

            return id;
        }
310316
def __request_mark_sent(self, requestId):
        """"""
        with self.__requests:
            try:
                req = self.__requests[requestId]
            except KeyError:
                # request might have had a response already have been removed by receiving thread
                pass
            else:
                req.exception = None
                req._send_time = monotonic()
782508
def recipient_address_show(self, id, **kwargs):
        ""
        api_path = "/api/v2/recipient_addresses/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
494608
def on_message(self, message_protocol_entity):
        
        logger.info("Message id %s received" % message_protocol_entity.getId())
        # answer with receipt
        self.toLower(message_protocol_entity.ack())
778095
public Boolean notifyId(String notifyId){
        String url = Alipay.GATEWAY +
                "&" + AlipayField.SERVICE.field() + "=" + Service.NOTIFY_VERIFY.value() +
                "&" + AlipayField.PARTNER.field() + "=" + alipay.merchantId +
                "&" + AlipayField.NOTIFY_ID.field() + "=" + notifyId;
        String resp = Http.get(url).request();
        return "true".equalsIgnoreCase(resp);
    }
312810
async def mailed_confirm(self, **params):
		
		if not params:
			return {"error":400, "reason":"Missed required fields"}

		# Check if required fields exists
		cid = params.get("cid")
		buyer_address = params.get("buyer_address")
		price = params.get("price")
		offer_type = params.get("offer_type")
		coinid = params.get("coinid").upper()
		try:
			coinid = coinid.replace("TEST", "")
		except:
			pass
		# Check if required fileds 
		if not all([cid, buyer_address, price]):
			return {"error":400, "reason":"Missed required fields"}




		# Get content owner address
		#if coinid in settings.AVAILABLE_COIN_ID:
		#	client_bridge.endpoint = settings.bridges[coinid]
		#else:
		#	return {"error":400, "reason":"Invalid coin ID"}
		#owneraddr = await client_bridge.request(method_name="ownerbycid", cid=cid)


		# Send appropriate mail to seller if exists
		#seller = await getaccountbywallet(wallet=owneraddr)
		#logging.debug(seller)
		#if "error" in seller.keys():
		#	return seller
		#if seller.get("email"):
		#	emaildata = {
		#		"to": seller["email"],
		#		"subject": "Robin8 support",
	 	#		"optional": "You`ve got a new offer from %s" % seller["public_key"]
	 	#
		#	}
		#	await client_email.request(method_name="sendmail", **emaildata)

		# Send news for seller
		buyer = await getaccountbywallet(wallet=buyer_address) 
		if "error" in buyer.keys():
			buyer["public_key"] = None

		newsdata = {
			"event_type":"made offer",
			"cid": cid,
			"access_string":buyer["public_key"],
			"buyer_pubkey":buyer["public_key"],
			"buyer_address":buyer_address,
			#"owneraddr":owneraddr,
			"price": price,
			"offer_type": offer_type,
			"coinid":coinid
		}
		news = await self.insert_news(**newsdata)
		return {"result":"ok"}
783864
def markAsSpam(self, thread_id=None):
        
        thread_id, thread_type = self._getThread(thread_id, None)
        r = self._post(self.req_url.MARK_SPAM, {"id": thread_id})
        return r.ok
747962
def get_by_id(self, reply_id):
        '''
        
        '''
        reply = MReply.get_by_uid(reply_id)
        logger.info('get_reply: {0}'.format(reply_id))

        self.render('misc/reply/show_reply.html',
                    reply=reply,
                    username=reply.user_name,
                    date=reply.date,
                    vote=reply.vote,
                    uid=reply.uid,
                    userinfo=self.userinfo,
                    kwd={})