Beispiel #1
0
    def get(self):
        from pickle import dumps
        from ebs.merchant.api import get_ebs_request_parameters

        dr = self.request.get('DR')
        if dr:
            billing_settings = BillingSettings.get_settings(deployment_mode=ebs_mode)
            request = get_ebs_request_parameters(dr, billing_settings.secret_key)

            response_code = request.get('ResponseCode', None)
            response_message = request.get('ResponseMessage', 'There was no response from the billing system.')

            group = self.session.get('participant_group')
            group.transaction_response_id = str(request.get('PaymentID'))
            group.transaction_response_code = str(response_code)
            group.transaction_response_message = response_message
            group.transaction_response_type = TRANSACTION_TYPE_EBS
            group.transaction_response_amount = request.get('Amount', '0')
            group.transaction_response = str(request)
            group.transaction_response_object = db.Blob(dumps(request))
            group.when_transaction_response_occurred = request.get('DateCreated')
            group.put()

            if response_code == 0:
                # mark the participant group as paid.
                message_title = 'Thank you for participating in the summit'
                group_id = group.key().id()
                logging.info('Payments for group: %s with %d processed.' % (group.title, group_id))

                participants = self.session.get('participants')
                if participants:
                    # Send email to all the participants about their attendance.
                    for participant in participants:
                        queue_mail_task(url='/worker/mail/thanks/registration/',
                            params=dict(
                                full_name=participant.full_name,
                                email = participant.email,
                                key=str(participant.key())
                            ),
                            method='POST'
                        )
                    # Send email to the payer the invoice.
                    primary_participant = self.session.get('primary_participant')
                    queue_mail_task(url='/worker/mail/thanks/registration_payment/',
                        params=dict(
                            full_name=primary_participant.full_name,
                            email = primary_participant.email,
                            key=str(primary_participant.key()),
                            transaction_amount=group.transaction_response_amount
                        ),
                        method='POST'
                    )
            else:
                message_title = 'There was an error processing your payment.'
            response = render_template('thank_you.html', message_title=message_title, message_body=response_message + ''' Thank you for registering for the summit. An email confirming your payment and registration shall be sent to you shortly. In case you don't receive the email confirmation within 24 hours or you have any queries, please contact +91 22 66301060 / 22026166 from 10.30 AM IST to 6.30 AM IST''')
        else:
            response = render_template('thank_you.html', message_title="A problem occurred with the billing system.", message_body="We did not receive a proper response from the billing system.")

        self.response.out.write(response)
Beispiel #2
0
 def get(self):
     from ebs.merchant.api import get_ebs_request_parameters
     from models import BillingTransaction
     mode = self.session['ebs_mode']
     settings = BillingSettings.get_settings(mode=mode)
     dr = self.request.get('DR')
     params = get_ebs_request_parameters(dr, settings.secret_key)
     
     transaction = BillingTransaction()
     transaction.response = str(params)
     transaction.put()
     response = render_template('process.html', mode=mode, params=pformat(params, width=40))
     self.response.out.write(response)
Beispiel #3
0
def console_test():
    example_dr = """IXc9laP5EPzkG8rJUEkT9GPYZKb 340d1KINeq1DJAbrqc5GeRs3RVwRJ7YShbNZUyaxTmSW46lexsfKVHpZGaEckYB9n5xHvzoFUm9WU7C3Zs6VjHu125hgs12 1Ql5ikbYxNp4M9405id0 WGoo3a3Um6pCSGxHsvDbFVY4FjMIc/QajmES ZhD9RUNn7jfjLth7D179a99uCJlqLeqmWgTM3nILZcwZHDqUWGoYWYb8D4SBHgUupPF8yXSLe6hK0iZoYwd5BkV ujpqJBmlt8oZlTnzL6Fw4sTh3s9YckZQJSGCZ5kk13SccBonrx4mugpFJ3NGJcw1P1CWlSbD8CfrcfVtUFne1YkbhvvzG33w0pMdg0CzdksGoTa0K JYR73gMtNIC PLN8wx4dObf4KADjyFc/G17i7VIsyKI0SdY11VUEVL5JrKa1cBTziaYxlawWOyG0J0wblnZus7a8OVu04aX7g7FIWDXMDmBWsuyaBg5znjJj5At4Q0zdlIzrJ8iopQcaDICu2G5koJVv3HOaTigJ nXm7J6OzlZoY9Ke4eizkHXW8NWVMMrG/p YHLF9kRK1zHYuRBGS3HYOmjXwTW1qJ cTQ6zlXCUzjbZm7rzAHtmuaOWly0iN0kTM4mNY XziWeWyzeo0UjT7GC2ObGrRc4BVUW Fb/L9Zgx3aJMWQICzk1Hj78alALUqZJR8RafT7A=="""
    flattened_params = get_ebs_request_parameters(example_dr, configuration.EBS_SECRET_KEY, flatten_values=True, typed_values=True)
    print flattened_params