本文整理汇总了Python中app.helpers.ticketing.TicketingManager.get_order_by_identifier方法的典型用法代码示例。如果您正苦于以下问题:Python TicketingManager.get_order_by_identifier方法的具体用法?Python TicketingManager.get_order_by_identifier怎么用?Python TicketingManager.get_order_by_identifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.helpers.ticketing.TicketingManager
的用法示例。
在下文中一共展示了TicketingManager.get_order_by_identifier方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_order_payment_paypal_cancel
# 需要导入模块: from app.helpers.ticketing import TicketingManager [as 别名]
# 或者: from app.helpers.ticketing.TicketingManager import get_order_by_identifier [as 别名]
def test_order_payment_paypal_cancel(self):
with app.test_request_context():
event, ticket, identifier = create_order(self)
response = self.app.get(
url_for('ticketing.paypal_callback', order_identifier=identifier, function="cancel"),
follow_redirects=True)
order = TicketingManager.get_order_by_identifier(identifier)
self.assertTrue(order.status == 'expired', msg=order.status)
示例2: test_order_expire
# 需要导入模块: from app.helpers.ticketing import TicketingManager [as 别名]
# 或者: from app.helpers.ticketing.TicketingManager import get_order_by_identifier [as 别名]
def test_order_expire(self):
with app.test_request_context():
event, ticket, identifier = create_order(self)
response = self.app.get(url_for('ticketing.view_order', order_identifier=identifier), follow_redirects=True)
self.assertEqual(response.status_code, 200, msg=response.status_code)
self.assertTrue(str(event.name) in response.data, msg=response.data)
order = TicketingManager.get_order_by_identifier(identifier)
order.created_at = datetime.utcnow() - timedelta(minutes=11)
save_to_db(order)
response = self.app.get(url_for('ticketing.view_order', order_identifier=identifier), follow_redirects=True)
self.assertEqual(response.status_code, 404, msg=response.status_code)
示例3: proceed_order
# 需要导入模块: from app.helpers.ticketing import TicketingManager [as 别名]
# 或者: from app.helpers.ticketing.TicketingManager import get_order_by_identifier [as 别名]
def proceed_order(event_id, order_identifier):
order = TicketingManager.get_order_by_identifier(order_identifier)
if order:
if order.status == 'completed':
return redirect(url_for('ticketing.view_order_after_payment', order_identifier=order_identifier))
return render_template('gentelella/guest/ticketing/order_pre_payment.html', order=order, event=order.event,
countries=list(pycountry.countries),
from_organizer=True,
pay_via=order.paid_via,
stripe_publishable_key=get_settings()['stripe_publishable_key'])
else:
abort(404)
return redirect(url_for('.display_ticket_stats', event_id=event_id))
示例4: paypal_callback
# 需要导入模块: from app.helpers.ticketing import TicketingManager [as 别名]
# 或者: from app.helpers.ticketing.TicketingManager import get_order_by_identifier [as 别名]
def paypal_callback(order_identifier, function):
order = TicketingManager.get_order_by_identifier(order_identifier)
if not order or order.status == 'expired':
abort(404)
if function == 'cancel':
order.status = 'expired'
save_to_db(order)
return redirect(url_for('event_detail.display_event_detail_home', identifier=order.event.identifier))
elif function == 'success':
status, result = TicketingManager.charge_paypal_order_payment(order)
if status:
return redirect(url_for('.view_order', order_identifier=order_identifier))
else:
flash("An error occurred while processing your transaction. " + str(result), "danger")
return redirect(url_for('.show_transaction_error', order_identifier=order_identifier))
abort(404)
示例5: prep_order
# 需要导入模块: from app.helpers.ticketing import TicketingManager [as 别名]
# 或者: from app.helpers.ticketing.TicketingManager import get_order_by_identifier [as 别名]
def prep_order(self):
event, ticket, identifier = create_order(self)
order = TicketingManager.get_order_by_identifier(identifier)
order.user_id = self.super_admin.id
order.brand = "Visa"
order.completed_at = datetime.now()
order.status = "completed"
order.last4 = "1234"
order.exp_month = "12"
order.exp_year = "2050"
order.paid_via = "stripe"
order.payment_mode = "card"
save_to_db(order)
holder = TicketHolder(firstname="John", lastname="Doe", order_id=order.id, ticket_id=ticket.id)
save_to_db(holder)
return order
示例6: test_tickets_overview_page
# 需要导入模块: from app.helpers.ticketing import TicketingManager [as 别名]
# 或者: from app.helpers.ticketing.TicketingManager import get_order_by_identifier [as 别名]
def test_tickets_overview_page(self):
with app.test_request_context():
event, ticket, identifier = create_order(self)
order = TicketingManager.get_order_by_identifier(identifier)
order.user_id = self.super_admin.id
order.brand = "Visa"
order.completed_at = datetime.now()
order.status = "completed"
order.last4 = "1234"
order.exp_month = "12"
order.exp_year = "2050"
order.paid_via = "stripe"
order.payment_mode = "card"
save_to_db(order)
response = self.app.get(url_for('my_tickets.display_my_tickets'), follow_redirects=True)
self.assertTrue(str(event.name) in response.data, msg=response.data)
self.assertTrue(str(ticket.name) not in response.data, msg=response.data)
示例7: test_order_payment_stripe
# 需要导入模块: from app.helpers.ticketing import TicketingManager [as 别名]
# 或者: from app.helpers.ticketing.TicketingManager import get_order_by_identifier [as 别名]
def test_order_payment_stripe(self):
with app.test_request_context():
event, ticket, identifier = create_order(self)
data = {
"identifier": identifier,
"email": "[email protected]",
"firstname": "John",
"lastname": "Doe",
"address": "ACME Lane",
"city": "Loony",
"state": "Tunes",
"zipcode": "1451145",
"country": "Warner",
"pay_via_service": "stripe"
}
response = self.app.post(url_for('ticketing.initiate_order_payment'), data=data, follow_redirects=True)
response_json = json.loads(response.data)
self.assertEqual(data['email'], response_json['email'], msg=response.data)
self.assertEqual("start_stripe", response_json['action'], msg=response.data)
order = TicketingManager.get_order_by_identifier(identifier)
self.assertEqual(order.status, 'initialized', msg=response.data)
order.brand = "Visa"
order.completed_at = datetime.now()
order.status = "completed"
order.last4 = "1234"
order.exp_month = "12"
order.exp_year = "2050"
order.paid_via = "stripe"
order.payment_mode = "card"
save_to_db(order)
response = self.app.get(url_for('ticketing.view_order_after_payment', order_identifier=identifier),
follow_redirects=True)
self.assertTrue("John" in response.data, msg=response.data)
self.assertTrue("ACME Lane" in response.data, msg=response.data)
self.assertTrue("1234" in response.data, msg=response.data)
self.assertTrue(str(event.name) in response.data, msg=response.data)
self.assertTrue(str(ticket.name) in response.data, msg=response.data)
response = self.app.get(url_for('ticketing.view_order', order_identifier=identifier),
follow_redirects=False)
self.assertEqual(response.status_code, 302, msg=response.status_code)
response = self.app.get(url_for('ticketing.view_order_after_payment_pdf', order_identifier=identifier),
follow_redirects=False)
self.assertEqual(response.status_code, 200, msg=response.status_code)
示例8: show_transaction_error
# 需要导入模块: from app.helpers.ticketing import TicketingManager [as 别名]
# 或者: from app.helpers.ticketing.TicketingManager import get_order_by_identifier [as 别名]
def show_transaction_error(order_identifier):
order = TicketingManager.get_order_by_identifier(order_identifier)
return render_template('gentelella/guest/ticketing/order_post_payment_error.html', order=order,
event=order.event)
示例9: get
# 需要导入模块: from app.helpers.ticketing import TicketingManager [as 别名]
# 或者: from app.helpers.ticketing.TicketingManager import get_order_by_identifier [as 别名]
def get(self, event_id, identifier):
"""Get information about a ticket"""
return TicketingManager.get_order_by_identifier(identifier=identifier)