Esempio n. 1
0
    def get_data(self, pricelist, b2b_id, lines, *args, **kw):
        """


        """
        ret = []
        for r in lines:
            r = strip_non_ascii(r)
            if not r.startswith(" "):

                if r[0:2] == "01":
                    keys, body = self.json["header"]
                    h_txn = get_txn(keys, body, r)
                    h_txn["inputb2b_id"] = b2b_id
                elif r[0:2] == "02":
                    "join header and body"
                    keys, body = self.json["body"]
                    txn = get_txn(keys, body, r)
                    txn.update(h_txn)
                    b_ref_code = txn.get("b_ref_code")
                    # TODO : support not 6 len char sup code
                    # if b_ref_code is 1 and not 000001
                    # account_code can't be found !!!!!
                    b_ref_code = b_ref_code.strip().zfill(6)

                    if b_ref_code in pricelist.keys():
                        txn.update(pricelist[b_ref_code])
                    ret.append(txn)

        return ret
Esempio n. 2
0
    def get_data(self,lines, *args, **kw):
        """


        """
        ret = []
        for r in lines:
            r=strip_non_ascii(r)
            if not r.startswith(' '):
                keys, body = self.json['header']
                txn = get_txn(keys, body, r)
                ret.append(txn)
        return ret
Esempio n. 3
0
 def get_strip(self, value):
     if not type(value) in [int, float]:
         value = strip_non_ascii(value)
         value = value.decode("utf-8")
     return str(value).strip()