示例#1
0
    def get_encoded_request_data(self, request, txn):
        redirect_url = 'http://' + request.get_host() + '/pg/response/' + slugify(self.name)
        # try:
        donor = Person.objects.get(user__email=txn.email)
        name = donor.name()
        address = donor.billing_address
        country = donor.billing_country
        contact_number = donor.contact_number
        # email = email_address
        state = donor.billing_state
        city = donor.billing_city
        zip_code = donor.billing_postal_code
        # except:
        #     name = 'test name'
        #     address = ''
        #     country = ''
        #     contact_number = ''
        #     # email = email_address
        #     state = ''
        #     city = ''
        #     zip_code = ''

        # params = [('merchant_id', self.merchant_id),
        #         ('order_id', txn.txnid),
        #         ('currency', get_currency_iso_code(txn.currency)),
        #         ('amount', txn.amount),
        #         ('redirect_url', redirect_url),
        #         ('cancel_url', redirect_url),
        #         ('language', 'en'),
        #         ('billing_name', txn.name),
        #         ('billing_tel', txn.phone),
        #         ('billing_email', txn.email),
        #         ('delivery_name', txn.name),
        #         ('delivery_tel', txn.phone)]
        params = [('merchant_id', self.merchant_id),
                ('order_id', txn.txnid),
                ('currency', get_currency_iso_code(txn.currency)),
                ('amount', txn.amount),
                ('redirect_url', redirect_url),
                ('cancel_url', redirect_url),
                ('language', 'en'),
                ('billing_name', name),
                ('billing_tel', contact_number),
                ('billing_email', txn.email),
                ('billing_address', address),
                ('billing_city', city),
                ('billing_state', state),
                ('billing_country', country),
                ('billing_zip', zip_code),
                ('delivery_name', name),
                ('delivery_tel', contact_number)]
        request_data = urlencode(params)
        encoded_data = CCAvenueAESCipher().encrypt(request_data, self.working_key)
        return encoded_data
示例#2
0
    def get_encoded_request_data(self, request, txn):
        redirect_url = 'http://' + request.get_host(
        ) + '/pg/response/' + slugify(self.name)
        # try:
        donor = Person.objects.get(user__email=txn.email)
        name = donor.name()
        address = donor.billing_address
        country = donor.billing_country
        contact_number = donor.contact_number
        # email = email_address
        state = donor.billing_state
        city = donor.billing_city
        zip_code = donor.billing_postal_code
        # except:
        #     name = 'test name'
        #     address = ''
        #     country = ''
        #     contact_number = ''
        #     # email = email_address
        #     state = ''
        #     city = ''
        #     zip_code = ''

        # params = [('merchant_id', self.merchant_id),
        #         ('order_id', txn.txnid),
        #         ('currency', get_currency_iso_code(txn.currency)),
        #         ('amount', txn.amount),
        #         ('redirect_url', redirect_url),
        #         ('cancel_url', redirect_url),
        #         ('language', 'en'),
        #         ('billing_name', txn.name),
        #         ('billing_tel', txn.phone),
        #         ('billing_email', txn.email),
        #         ('delivery_name', txn.name),
        #         ('delivery_tel', txn.phone)]
        params = [('merchant_id', self.merchant_id), ('order_id', txn.txnid),
                  ('currency', get_currency_iso_code(txn.currency)),
                  ('amount', txn.amount), ('redirect_url', redirect_url),
                  ('cancel_url', redirect_url), ('language', 'en'),
                  ('billing_name', name), ('billing_tel', contact_number),
                  ('billing_email', txn.email), ('billing_address', address),
                  ('billing_city', city), ('billing_state', state),
                  ('billing_country', country), ('billing_zip', zip_code),
                  ('delivery_name', name), ('delivery_tel', contact_number)]
        request_data = urlencode(params)
        encoded_data = CCAvenueAESCipher().encrypt(request_data,
                                                   self.working_key)
        return encoded_data
示例#3
0
from lakshya.util import slugify

from paymentgateway.ccavenue import CCAvenueGateway
#Import other payment gateways here in the future

#All other constants and maps are built based on this. Make sure all new gateways are added to this list.
#That should be sufficient to make it reflect everywhere
ALL_PGS = [CCAvenueGateway]

# Payment gateways
PG_CHOICES = []
PG_KEY_CLASS_MAP = {}
for pg in ALL_PGS:
    PG_CHOICES.append((slugify(pg.name), pg.name))
    PG_KEY_CLASS_MAP[slugify(pg.name)] = pg