def __call__(self, url, msg, headers):
     if self.failure:
         return self.failure
     self.validate_request(msg)
     data = xmltodict(ET.fromstring(msg))
     response = self.receive(data)
     ret = ET.tostring(self.send(data, response))
     self.validate_response(ret)
     return ret
 def __call__(self, url, msg, headers):
     if self.failure:
         return self.failure
     self.validate_request(msg)
     data = xmltodict(ET.fromstring(msg))
     response = self.receive(data)
     ret = ET.tostring(self.send(data, response))
     self.validate_response(ret)
     return ret
 def parse(self, soap):
     doc  = xmltodict(ET.fromstring(soap))
     response_type = doc.keys()[0]
     response = doc[response_type]
     response_class = {'NewOrderResp':self.NewOrderResponse,
                       'ProfileResp':self.ProfileResponse,
                       'QuickResp':self.QuickResponse,
                       'ReversalResp':self.ReversalResponse,
                       'MarkForCaptureResp':self.NewOrderResponse,}[response_type]
     return response_class(self, response)
예제 #4
0
 def parse(self, soap):
     doc = xmltodict(ET.fromstring(soap))
     response_type = doc.keys()[0]
     response = doc[response_type]
     response_class = {
         'NewOrderResp': self.NewOrderResponse,
         'ProfileResp': self.ProfileResponse,
         'QuickResp': self.QuickResponse,
         'ReversalResp': self.ReversalResponse,
         'MarkForCaptureResp': self.NewOrderResponse,
     }[response_type]
     return response_class(self, response)
 def __call__(self, url, msg, headers):
     if self.failure:
         return self.failure
     self.validate_request(msg)
     msg = msg.replace('xmlns="%s"' % self.namespace, '')
     data = xmltodict(ET.fromstring(msg))
     if '{http://schemas.xmlsoap.org/soap/envelope/}Body' in data:
         data = data['{http://schemas.xmlsoap.org/soap/envelope/}Body']['requestMessage']
     response = self.receive(data)
     ret = ET.tostring(self.send(data, response))
     self.validate_response(ret)
     return ret
예제 #6
0
 def __call__(self, url, msg, headers):
     if self.failure:
         return self.failure
     #self.validate_request(msg)
     msg = msg.replace('xmlns="%s"' % self.namespace, '')
     data = xmltodict(ET.fromstring(msg))
     if '{http://schemas.xmlsoap.org/soap/envelope/}Body' in data:
         data = data['{http://schemas.xmlsoap.org/soap/envelope/}Body']['requestMessage']
     response = self.receive(data)
     ret = ET.tostring(self.send(data, response))
     #self.validate_response(ret)
     return ret
예제 #7
0
 def parse(self, response):
     doc  = etree.XML(response)
     result = xmltodict(doc, strip_namespaces=True)
     if 'Body' in result:
         result = result['Body']['replyMessage']
     return result
예제 #8
0
 def parse(self, response):
     doc = etree.XML(response)
     result = xmltodict(doc, strip_namespaces=True)
     if 'Body' in result:
         result = result['Body']['replyMessage']
     return result
예제 #9
0
 def __call__(self, url, msg, headers):
     msg = msg.replace('xmlns="http://www.paypal.com/XMLPay"', '') #arghhh, don't care to deal with namespaces
     data = xmltodict(ET.fromstring(msg))
     response = self.receive(data)
     return ET.tostring(self.send(data, response))