Skip to content

Commit

Permalink
#157 Starting implementation of new paymente backend.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonylampada committed Jun 5, 2013
1 parent e4d2087 commit 83f9794
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
21 changes: 16 additions & 5 deletions djangoproject/core/views/issue_views.py
Expand Up @@ -299,10 +299,21 @@ def listProjects(request):
@login_required
def payOfferForm(request, offer_id):
offer = Offer.objects.get(pk=offer_id)
if(offer.currency == 'USD'):
return _payWithPaypalForm(request, offer)
else:
return _payWithBitcoinForm(request, offer)
is_brazilian = offer.sponsor.getUserInfo().brazilianPaypal
usd_2_brl_rate = 0
if is_brazilian:
usd_2_brl_rate = paypal_services.usd_2_brl_convert_rate()

solutions_accepting_payments = offer.issue.getSolutionsAcceptingPayments()
return render_to_response('core/pay_offer_angular.html',
{
'offer': offer,
'is_brazilian': is_brazilian,
'usd_2_brl_rate': usd_2_brl_rate,
'solutions': solutions_accepting_payments
},
context_instance=RequestContext(request))



def payOfferFormAngular(request):
Expand All @@ -316,7 +327,7 @@ def payOffer(request):
count = int(request.POST['count'])
offer = Offer.objects.get(pk=offer_id)
if(offer.status == Offer.PAID):
raise BaseException('offer %s is already paid' % offer.id + '. User %s' % user)
raise BaseException('offer %s is already paid' % offer.id + '. User %s' % request.user)
payment = _generate_payment_entity(offer, count, request.POST, request.user)

if(offer.currency == 'USD'):
Expand Down
4 changes: 2 additions & 2 deletions djangoproject/templates/core/pay_offer_angular.html
Expand Up @@ -55,8 +55,8 @@
}

$scope.offer = {
id: 1,
title: 'Implement a time machine',
id: {{ offer.id }},
title: '{{ offer.issue.title }}',
price: '20.00',
currency: 'USD'
}
Expand Down

0 comments on commit 83f9794

Please sign in to comment.