예제 #1
0
    def format_from_response(cls, data):
        bank_account = data["bank_account"]
        try:
            bank_account_id = bank_account["id"]
        except KeyError:
            bank_account_id = None

        anticipation_enabled = data["automatic_anticipation_enabled"]
        anticipation_type = data["automatic_anticipation_type"]
        anticipation_days = data["automatic_anticipation_days"]
        anticipation_1025_delay = data["automatic_anticipation_1025_delay"]
        volume_percentage = data["anticipatable_volume_percentage"]

        last_transfer = time_utils.from_iso(data["last_transfer"])
        created_at = time_utils.from_iso(data["date_created"])
        updated_at = time_utils.from_iso(data["date_updated"])

        return dict(
            id=data["id"],
            transfer_enabled=data["transfer_enabled"],
            last_transfer=last_transfer,
            transfer_interval=data["transfer_interval"],
            transfer_day=data["transfer_day"],
            automatic_anticipation_enabled=anticipation_enabled,
            automatic_anticipation_type=anticipation_type,
            automatic_anticipation_days=anticipation_days,
            automatic_anticipation_1025_delay=anticipation_1025_delay,
            anticipatable_volume_percentage=volume_percentage,
            created_at=created_at,
            updated_at=updated_at,
            postback_url=data["postback_url"],
            status=data["status"],
            status_reason=data["status_reason"],
            bank_account_id=bank_account_id
        )
예제 #2
0
 def format_from_response(cls, data):
     return dict(id=data["id"],
                 name=data["name"],
                 email=data["email"],
                 gender=data["gender"],
                 document_type=data["document_type"],
                 document_number=data["document_number"],
                 born_at=time_utils.from_iso(data["born_at"]),
                 created_at=time_utils.from_iso(data["date_created"]))
예제 #3
0
 def format_from_response(cls, data):
     return dict(
         id=data["id"],
         serial_number=data["serial_number"],
         amount=data["amount"],
         status=data["status"],
         payment_method=data["payment_method"],
         type=data["type"],
         period_start_date=time_utils.from_iso(data["period_start_date"]),
         period_end_date=time_utils.from_iso(data["period_end_date"]),
         metadata=data["metadata"])
 def format_from_response(cls, data):
     return dict(id=data["id"],
                 status=data["status"],
                 type=data["type"],
                 description=data["description"],
                 payment_date=time_utils.from_iso(data["payment_date"]),
                 amount=data["amount"],
                 object_type=data["object_type"],
                 object_id=data["object_id"],
                 recipient_id=data["recipient_id"],
                 created_at=time_utils.from_iso(data["date_created"]))
예제 #5
0
    def format_from_response(cls, data):
        created_at = time_utils.from_iso(data["date_created"])
        updated_at = time_utils.from_iso(data["date_updated"])

        return dict(id=data["id"],
                    amount=data["amount"],
                    percentage=data["percentage"],
                    recipient_id=data["recipient_id"],
                    charge_processing_fee=data["charge_processing_fee"],
                    charge_remainder=data["charge_remainder"],
                    liable=data["liable"],
                    created_at=created_at,
                    updated_at=updated_at)
예제 #6
0
    def format_from_response(cls, data):
        created_at = time_utils.from_iso(data["date_created"])
        updated_at = time_utils.from_iso(data["date_updated"])

        return dict(id=data["id"],
                    created_at=created_at,
                    updated_at=updated_at,
                    brand=data["brand"],
                    holder_name=data["holder_name"],
                    first_digits=data["first_digits"],
                    last_digits=data["last_digits"],
                    country=data["country"],
                    fingerprint=data["fingerprint"],
                    valid=data["valid"],
                    expiration_date=data["expiration_date"])
    def format_from_response(cls, data):
        try:
            fraud_coverage_fee = data["fraud_coverage_fee"]
        except KeyError:
            fraud_coverage_fee = None

        created_at = time_utils.from_iso(data["date_created"])
        updated_at = time_utils.from_iso(data["date_updated"])
        payment_date = time_utils.from_iso(data["payment_date"])

        return dict(id=data["id"],
                    type=data["type"],
                    amount=data["amount"],
                    fee=data["fee"],
                    anticipation_fee=data["anticipation_fee"],
                    fraud_coverage_fee=fraud_coverage_fee,
                    timeframe=data["timeframe"],
                    status=data["status"],
                    recipient_id=data["recipient_id"],
                    created_at=created_at,
                    updated_at=updated_at,
                    payment_date=payment_date)
예제 #8
0
 def format_from_response(cls, data):
     return dict(id=data["id"],
                 bank_code=data["bank_code"],
                 agencia=data["agencia"],
                 agencia_dv=data["agencia_dv"],
                 conta=data["conta"],
                 conta_dv=data["conta_dv"],
                 type=data["type"],
                 document_type=data["document_type"],
                 document_number=data["document_number"],
                 legal_name=data["legal_name"],
                 charge_transfer_fees=data["charge_transfer_fees"],
                 created_at=time_utils.from_iso(data["date_created"]))
예제 #9
0
 def format_from_response(cls, data):
     return dict(id=data["id"],
                 status=data["status"],
                 amount=data["amount"],
                 fee=data["fee"],
                 type=data["type"],
                 transaction_id=data["transaction_id"],
                 recipient_id=data["source_id"],
                 created_at=time_utils.from_iso(data["date_created"]),
                 source_type=data["source_type"],
                 source_id=data["source_id"],
                 target_type=data["target_type"],
                 target_id=data["target_id"],
                 metadata=data["metadata"],
                 bank_account=data["bank_account"])
예제 #10
0
    def format_from_response(cls, data):
        movement_object = data["movement_object"]
        if movement_object["object"] in ["payable", "fee_collection"]:
            recipient_id = movement_object["recipient_id"]
        elif movement_object["object"] == "transfer":
            recipient_id = movement_object["source_id"]

        return dict(id=data["id"],
                    recipient_id=recipient_id,
                    status=data["status"],
                    amount=data["amount"],
                    fee=data["fee"],
                    object_type=data["type"],
                    object_id=data["movement_object"]["id"],
                    created_at=time_utils.from_iso(data["date_created"]))
예제 #11
0
    def format_from_response(cls, data):
        customer_id = extract_id(data, "customer")
        address_id = extract_id(data, "address")
        phone_id = extract_id(data, "phone")
        billing_id = extract_id(data, "billing")
        card_id = extract_id(data, "card")

        created_at = time_utils.from_iso(data["date_created"])
        updated_at = time_utils.from_iso(data["date_updated"])
        if data["boleto_expiration_date"] is not None:
            boleto_expiration_date = time_utils.from_iso(
                data["boleto_expiration_date"])
        else:
            boleto_expiration_date = None

        # Missing fields
        try:
            reference_key = data["reference_key"]
        except KeyError:
            reference_key = None
        try:
            acquirer_id = data["acquirer_id"]
        except KeyError:
            acquirer_id = None
        try:
            card_pin_mode = data["card_pin_mode"]
        except KeyError:
            card_pin_mode = None

        return dict(id=data["id"],
                    subscription_id=data["subscription_id"],
                    customer_id=customer_id,
                    address_id=address_id,
                    phone_id=phone_id,
                    billing_id=billing_id,
                    card_id=card_id,
                    status=data["status"],
                    status_reason=data["status_reason"],
                    acquirer_response_code=data["acquirer_response_code"],
                    acquirer_name=data["acquirer_name"],
                    acquirer_id=acquirer_id,
                    authorization_code=data["authorization_code"],
                    soft_descriptor=data["soft_descriptor"],
                    tid=data["tid"],
                    nsu=data["nsu"],
                    created_at=created_at,
                    updated_at=updated_at,
                    amount=data["amount"],
                    authorized_amount=data["authorized_amount"],
                    paid_amount=data["paid_amount"],
                    refunded_amount=data["refunded_amount"],
                    installments=data["installments"],
                    cost=data["cost"],
                    card_holder_name=data["card_holder_name"],
                    card_last_digits=data["card_last_digits"],
                    card_first_digits=data["card_first_digits"],
                    card_brand=data["card_brand"],
                    card_pin_mode=card_pin_mode,
                    postback_url=data["postback_url"],
                    payment_method=data["payment_method"],
                    capture_method=data["capture_method"],
                    antifraud_metadata=data["antifraud_metadata"],
                    antifraud_score=data["antifraud_score"],
                    boleto_url=data["boleto_url"],
                    boleto_barcode=data["boleto_barcode"],
                    boleto_expiration_date=boleto_expiration_date,
                    referer=data["referer"],
                    ip=data["ip"],
                    reference_key=reference_key,
                    metadata=data["metadata"])