def json_to_grpc_grtbyid(stripe_ans): item = json.loads(stripe_ans) print("item: ", item) ans_charge = payments_bills_service_pb2.GetByIdCharge( id=item["id"], object=item["object"], created=item["created"], description=item["description"]) # feature_list.append(ans_charge) print("return: ", ans_charge) return ans_charge
def get_customer(stub): getid = payments_bills_service_pb2.GetByIdCharge( id="cus_E0RNACg0")#"ch_1DY40t2eZvKYlo2CBcSeU9CC") try: return_customer = stub.GetCustomerById(getid) print("object returned", return_customer) except grpc.RpcError as e: print("error", e) print ("details", e.details()) status_code = e.code() print("name: ", status_code.name) print("value: ", status_code.value)
def Delete_cus(stub, id_cus): cus = payments_bills_service_pb2.GetByIdCharge( id = id_cus ) delet_cus = stub.DeleteCustomer(cus) print ("The deleted customer: ", delet_cus)
def get_charge(stub, id_charge): getChar = payments_bills_service_pb2.GetByIdCharge(id = id_charge) retun_char = stub.GetChargeById(getChar) print("charge returned: ", retun_char) print("id: ", str(retun_char.id))