Exemplo n.º 1
0
    def test_contains_info_on_offer(self):
        # given
        user = create_user(email="*****@*****.**", idx=3)
        offerer = create_offerer(siren="987654321", name="Joe le Libraire")
        venue = create_venue(offerer,
                             name="Jack le Sculpteur",
                             siret="1234567891234")
        offer = create_offer_with_thing_product(venue)
        stock = create_stock(offer=offer, price=12, quantity=5)
        booking = create_booking(user=user,
                                 stock=stock,
                                 date_created=datetime(2018, 2, 5),
                                 idx=5,
                                 quantity=2)
        payment = create_payment(booking, offerer, 35)
        find_date = Mock()
        find_date.return_value = datetime(2018, 2, 19)

        # when
        details = create_payment_details(payment,
                                         find_booking_date_used=find_date)

        # then
        assert details.offer_name == "Test Book"
        assert details.offer_type == "Audiovisuel - films sur supports physiques et VOD"
Exemplo n.º 2
0
    def test_contains_info_on_venue(self):
        # given
        user = create_user(email="*****@*****.**", idx=3)
        offerer = create_offerer(siren="987654321", name="Joe le Libraire")
        venue = create_venue(offerer,
                             name="Jack le Sculpteur",
                             siret="1234567891234",
                             idx=1)
        offer = create_offer_with_thing_product(venue)
        stock = create_stock(offer=offer, price=12, quantity=5)
        booking = create_booking(user=user,
                                 stock=stock,
                                 date_created=datetime(2018, 2, 5),
                                 idx=5,
                                 quantity=2)
        payment = create_payment(booking, offerer, 35)
        find_date = Mock()
        find_date.return_value = datetime(2018, 2, 19)

        # when
        details = create_payment_details(payment,
                                         find_booking_date_used=find_date)

        # then
        assert details.venue_name == "Jack le Sculpteur"
        assert details.venue_siret == "1234567891234"
        assert details.venue_humanized_id == humanize(venue.id)
Exemplo n.º 3
0
    def test_contains_info_on_user_who_booked(self):
        # given
        user = create_user(email="*****@*****.**", idx=3)
        booking = create_booking(user=user)
        offerer = create_offerer()
        payment = create_payment(booking, offerer, 35)

        # when
        details = create_payment_details(payment,
                                         find_booking_date_used=Mock())

        # then
        assert details.booking_user_id == 3
        assert details.booking_user_email == "*****@*****.**"
Exemplo n.º 4
0
    def test_contains_info_on_bank_transaction(self):
        # given
        user = create_user()
        booking = create_booking(user=user)
        offerer = create_offerer()
        payment = create_payment(booking,
                                 offerer,
                                 35,
                                 payment_message_name="1234",
                                 transaction_end_to_end_id=uuid.uuid4(),
                                 iban="123456789")

        # when
        details = create_payment_details(payment,
                                         find_booking_date_used=Mock())

        # then
        assert details.payment_iban == "123456789"
        assert details.payment_message_name == "1234"
        assert details.transaction_end_to_end_id == payment.transactionEndToEndId
        assert details.reimbursed_amount == 35
        assert details.reimbursement_rate == 0.5
Exemplo n.º 5
0
    def test_contains_info_on_booking(self):
        # given
        user = create_user(email="*****@*****.**", idx=3)
        offerer = create_offerer(siren="987654321", name="Joe le Libraire")
        venue = create_venue(offerer)
        offer = create_offer_with_thing_product(venue)
        stock = create_stock(offer=offer, price=12, quantity=5)
        booking = create_booking(user=user,
                                 stock=stock,
                                 date_created=datetime(2018, 2, 5),
                                 idx=5,
                                 quantity=2)
        payment = create_payment(booking=booking, offerer=offerer, amount=35)
        find_date = Mock()
        find_date.return_value = datetime(2018, 2, 19)

        # when
        details = create_payment_details(payment,
                                         find_booking_date_used=find_date)

        # then
        assert details.booking_date == datetime(2018, 2, 5)
        assert details.booking_amount == stock.price * booking.quantity
        assert details.booking_used_date == datetime(2018, 2, 19)