Skip to content

Commit

Permalink
Vendoring paypal.
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelclay committed Oct 20, 2011
1 parent 5876310 commit 5571fb7
Show file tree
Hide file tree
Showing 27 changed files with 63 additions and 63 deletions.
4 changes: 2 additions & 2 deletions apps/profile/views.py
Expand Up @@ -8,7 +8,7 @@
from django.shortcuts import render_to_response
from django.core.mail import mail_admins
from utils import json_functions as json
from paypal.standard.forms import PayPalPaymentsForm
from vendor.paypal.standard.forms import PayPalPaymentsForm
from utils.user_functions import ajax_login_required
from apps.profile.models import Profile, change_password
from apps.reader.models import UserSubscription
Expand Down Expand Up @@ -178,7 +178,7 @@ def profile_is_premium(request):
total_subs = subs.count()
activated_subs = subs.filter(active=True).count()

if retries > 30:
if retries >= 30:
subject = "Premium activation failed: %s (%s/%s)" % (request.user, activated_subs, total_subs)
message = """User: %s (%s) -- Email: %s""" % (request.user.username, request.user.pk, request.user.email)
mail_admins(subject, message, fail_silently=True)
Expand Down
2 changes: 1 addition & 1 deletion media/iphone/Entitlements.entitlements
Expand Up @@ -5,7 +5,7 @@
<key>application-identifier</key>
<string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
<key>get-task-allow</key>
<false/>
<true/>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
Expand Down
12 changes: 6 additions & 6 deletions media/iphone/NewsBlur.xcodeproj/project.pbxproj
Expand Up @@ -340,6 +340,8 @@
FF38DB1913F21B2C00251891 /* ABTableViewCell.m */,
FF4BBC1C13F7487A001EBEBD /* TransparentToolbar.h */,
FF4BBC1D13F7487A001EBEBD /* TransparentToolbar.m */,
8D1107310486CEB800E47090 /* NewsBlur-Info.plist */,
FF032DCD13F9F01900FA3F76 /* Entitlements.entitlements */,
);
name = "Other Sources";
sourceTree = "<group>";
Expand Down Expand Up @@ -383,9 +385,7 @@
7843F50C11EEB4EE00675F64 /* bullet_orange.png */,
7843F50D11EEB4EE00675F64 /* bullet_red.png */,
7843F50E11EEB4EE00675F64 /* bullet_yellow.png */,
8D1107310486CEB800E47090 /* NewsBlur-Info.plist */,
FFD5338C143E701400C5555D /* settings_icon@2x.png */,
FF032DCD13F9F01900FA3F76 /* Entitlements.entitlements */,
);
name = Resources;
sourceTree = "<group>";
Expand Down Expand Up @@ -621,8 +621,8 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
CODE_SIGN_ENTITLEMENTS = Entitlements.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down Expand Up @@ -650,8 +650,8 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CODE_SIGN_ENTITLEMENTS = Entitlements.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = NewsBlur_Prefix.pch;
Expand Down
8 changes: 4 additions & 4 deletions media/iphone/NewsBlur_Prefix.pch
Expand Up @@ -12,10 +12,10 @@
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

#define BACKGROUND_REFRESH_SECONDS -5
// #define BACKGROUND_REFRESH_SECONDS -10*60
// #define BACKGROUND_REFRESH_SECONDS -5
#define BACKGROUND_REFRESH_SECONDS -10*60

#define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.host:8000"]
// #define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"]
// #define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.host:8000"]
#define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"]

#endif
14 changes: 7 additions & 7 deletions vendor/paypal/README.md
Expand Up @@ -38,7 +38,7 @@ Using PayPal Payments Standard IPN:

# views.py
...
from paypal.standard.forms import PayPalPaymentsForm
from vendor.paypal.standard.forms import PayPalPaymentsForm
def view_that_asks_for_money(request):
Expand Down Expand Up @@ -95,7 +95,7 @@ Using PayPal Payments Standard IPN:

# models.py
...
from paypal.standard.ipn.signals import payment_was_successful
from vendor.paypal.standard.ipn.signals import payment_was_successful
def show_me_the_money(sender, **kwargs):
ipn_obj = sender
Expand Down Expand Up @@ -206,7 +206,7 @@ Use this method to encrypt your button so sneaky gits don't try to hack it. Than
1. Swap out your unencrypted button for a `PayPalEncryptedPaymentsForm`:

# views.py
from paypal.standard.forms import PayPalEncryptedPaymentsForm
from vendor.paypal.standard.forms import PayPalEncryptedPaymentsForm
def view_that_asks_for_money(request):
...
Expand Down Expand Up @@ -234,7 +234,7 @@ Use postbacks for validation if:
1. Swap out your button for a `PayPalSharedSecretEncryptedPaymentsForm`:

# views.py
from paypal.standard.forms import PayPalSharedSecretEncryptedPaymentsForm
from vendor.paypal.standard.forms import PayPalSharedSecretEncryptedPaymentsForm
def view_that_asks_for_money(request):
...
Expand All @@ -261,7 +261,7 @@ apps. [There is an explanation of WPP in the PayPal Forums](http://www.pdncommun
...
INSTALLED_APPS = (... 'paypal.standard', 'paypal.pro', ...)
PAYPAL_TEST = True # Testing mode on
PAYPAL_WPP_USER = "???" # Get from PayPal
PAYPAL_WPP_USER = "???" # Get from vendor.paypal
PAYPAL_WPP_PASSWORD = "???"
PAYPAL_WPP_SIGNATURE = "???"

Expand All @@ -270,7 +270,7 @@ apps. [There is an explanation of WPP in the PayPal Forums](http://www.pdncommun
1. Write a wrapper view for `paypal.pro.views.PayPalPro`:

# views.py
from paypal.pro.views import PayPalPro
from vendor.paypal.pro.views import PayPalPro

def buy_my_item(request):
item = {"amt": "10.00", # amount to charge for item
Expand Down Expand Up @@ -307,7 +307,7 @@ apps. [There is an explanation of WPP in the PayPal Forums](http://www.pdncommun
</form>

1. Add your view to `urls.py`, and add the IPN endpoint to receive callbacks
from PayPal:
from vendor.paypal:

# urls.py
...
Expand Down
2 changes: 1 addition & 1 deletion vendor/paypal/pro/admin.py
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
from string import split as L
from django.contrib import admin
from paypal.pro.models import PayPalNVP
from vendor.paypal.pro.models import PayPalNVP


class PayPalNVPAdmin(admin.ModelAdmin):
Expand Down
2 changes: 1 addition & 1 deletion vendor/paypal/pro/fields.py
Expand Up @@ -7,7 +7,7 @@
from django import forms
from django.utils.translation import ugettext as _

from paypal.pro.creditcard import verify_credit_card
from vendor.paypal.pro.creditcard import verify_credit_card


class CreditCardField(forms.CharField):
Expand Down
4 changes: 2 additions & 2 deletions vendor/paypal/pro/forms.py
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
from django import forms

from paypal.pro.fields import CreditCardField, CreditCardExpiryField, CreditCardCVV2Field, CountryField
from vendor.paypal.pro.fields import CreditCardField, CreditCardExpiryField, CreditCardCVV2Field, CountryField


class PaymentForm(forms.Form):
Expand All @@ -20,7 +20,7 @@ class PaymentForm(forms.Form):

def process(self, request, item):
"""Process a PayPal direct payment."""
from paypal.pro.helpers import PayPalWPP
from vendor.paypal.pro.helpers import PayPalWPP
wpp = PayPalWPP(request)
params = self.cleaned_data
params['creditcardtype'] = self.fields['acct'].card_type
Expand Down
2 changes: 1 addition & 1 deletion vendor/paypal/pro/helpers.py
Expand Up @@ -11,7 +11,7 @@
from django.utils.datastructures import MergeDict
from django.utils.http import urlencode

from paypal.pro.models import PayPalNVP, L
from vendor.paypal.pro.models import PayPalNVP, L


TEST = settings.PAYPAL_TEST
Expand Down
2 changes: 1 addition & 1 deletion vendor/paypal/pro/models.py
Expand Up @@ -82,7 +82,7 @@ def set_flag(self, info, code=None):

def process(self, request, item):
"""Do a direct payment."""
from paypal.pro.helpers import PayPalWPP
from vendor.paypal.pro.helpers import PayPalWPP
wpp = PayPalWPP(request)

# Change the model information into a dict that PayPal can understand.
Expand Down
4 changes: 2 additions & 2 deletions vendor/paypal/pro/tests.py
Expand Up @@ -7,8 +7,8 @@
from django.test import TestCase
from django.test.client import Client

from paypal.pro.fields import CreditCardField
from paypal.pro.helpers import PayPalWPP, PayPalError
from vendor.paypal.pro.fields import CreditCardField
from vendor.paypal.pro.helpers import PayPalWPP, PayPalError


class RequestFactory(Client):
Expand Down
10 changes: 5 additions & 5 deletions vendor/paypal/pro/views.py
Expand Up @@ -5,10 +5,10 @@
from django.http import HttpResponseRedirect
from django.utils.http import urlencode

from paypal.pro.forms import PaymentForm, ConfirmForm
from paypal.pro.models import PayPalNVP
from paypal.pro.helpers import PayPalWPP, TEST
from paypal.pro.signals import payment_was_successful, payment_was_flagged
from vendor.paypal.pro.forms import PaymentForm, ConfirmForm
from vendor.paypal.pro.models import PayPalNVP
from vendor.paypal.pro.helpers import PayPalWPP, TEST
from vendor.paypal.pro.signals import payment_was_successful, payment_was_flagged


# PayPal Edit IPN URL:
Expand Down Expand Up @@ -174,7 +174,7 @@ def redirect_to_express(self):
def render_confirm_form(self):
"""
Second step of ExpressCheckout. Display an order confirmation form which
contains hidden fields with the token / PayerID from PayPal.
contains hidden fields with the token / PayerID from vendor.paypal.
"""
initial = dict(token=self.request.GET['token'], PayerID=self.request.GET['PayerID'])
self.context[self.form_context_name] = self.confirm_form_cls(initial=initial)
Expand Down
8 changes: 4 additions & 4 deletions vendor/paypal/standard/forms.py
Expand Up @@ -3,9 +3,9 @@
from django import forms
from django.conf import settings
from django.utils.safestring import mark_safe
from paypal.standard.conf import *
from paypal.standard.widgets import ValueHiddenInput, ReservedValueHiddenInput
from paypal.standard.conf import (POSTBACK_ENDPOINT, SANDBOX_POSTBACK_ENDPOINT,
from vendor.paypal.standard.conf import *
from vendor.paypal.standard.widgets import ValueHiddenInput, ReservedValueHiddenInput
from vendor.paypal.standard.conf import (POSTBACK_ENDPOINT, SANDBOX_POSTBACK_ENDPOINT,
RECEIVER_EMAIL)


Expand Down Expand Up @@ -189,7 +189,7 @@ class PayPalSharedSecretEncryptedPaymentsForm(PayPalEncryptedPaymentsForm):
"""
def __init__(self, *args, **kwargs):
"Make the secret from the form initial data and slip it into the form."
from paypal.standard.helpers import make_secret
from vendor.paypal.standard.helpers import make_secret
super(PayPalSharedSecretEncryptedPaymentsForm, self).__init__(self, *args, **kwargs)
# @@@ Attach the secret parameter in a way that is safe for other query params.
secret_param = "?secret=%s" % make_secret(self)
Expand Down
2 changes: 1 addition & 1 deletion vendor/paypal/standard/ipn/admin.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib import admin
from paypal.standard.ipn.models import PayPalIPN
from vendor.paypal.standard.ipn.models import PayPalIPN


class PayPalIPNAdmin(admin.ModelAdmin):
Expand Down
4 changes: 2 additions & 2 deletions vendor/paypal/standard/ipn/forms.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from paypal.standard.forms import PayPalStandardBaseForm
from paypal.standard.ipn.models import PayPalIPN
from vendor.paypal.standard.forms import PayPalStandardBaseForm
from vendor.paypal.standard.ipn.models import PayPalIPN


class PayPalIPNForm(PayPalStandardBaseForm):
Expand Down
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from django.db import models
from south.db import db
from paypal.standard.ipn.models import *
from vendor.paypal.standard.ipn.models import *


class Migration:
Expand Down
4 changes: 2 additions & 2 deletions vendor/paypal/standard/ipn/models.py
@@ -1,8 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
from paypal.standard.models import PayPalStandardBase
from paypal.standard.ipn.signals import *
from vendor.paypal.standard.models import PayPalStandardBase
from vendor.paypal.standard.ipn.signals import *


class PayPalIPN(PayPalStandardBase):
Expand Down
4 changes: 2 additions & 2 deletions vendor/paypal/standard/ipn/tests/test_ipn.py
Expand Up @@ -3,8 +3,8 @@
from django.test import TestCase
from django.test.client import Client

from paypal.standard.ipn.models import PayPalIPN
from paypal.standard.ipn.signals import (payment_was_successful,
from vendor.paypal.standard.ipn.models import PayPalIPN
from vendor.paypal.standard.ipn.signals import (payment_was_successful,
payment_was_flagged)


Expand Down
4 changes: 2 additions & 2 deletions vendor/paypal/standard/ipn/views.py
Expand Up @@ -2,8 +2,8 @@
# -*- coding: utf-8 -*-
from django.http import HttpResponse
from django.views.decorators.http import require_POST
from paypal.standard.ipn.forms import PayPalIPNForm
from paypal.standard.ipn.models import PayPalIPN
from vendor.paypal.standard.ipn.forms import PayPalIPNForm
from vendor.paypal.standard.ipn.models import PayPalIPN


@require_POST
Expand Down
4 changes: 2 additions & 2 deletions vendor/paypal/standard/models.py
Expand Up @@ -2,8 +2,8 @@
# -*- coding: utf-8 -*-
from django.db import models
from django.conf import settings
from paypal.standard.helpers import duplicate_txn_id, check_secret
from paypal.standard.conf import RECEIVER_EMAIL, POSTBACK_ENDPOINT, SANDBOX_POSTBACK_ENDPOINT
from vendor.paypal.standard.helpers import duplicate_txn_id, check_secret
from vendor.paypal.standard.conf import RECEIVER_EMAIL, POSTBACK_ENDPOINT, SANDBOX_POSTBACK_ENDPOINT


class PayPalStandardBase(models.Model):
Expand Down
2 changes: 1 addition & 1 deletion vendor/paypal/standard/pdt/admin.py
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
from string import split as L
from django.contrib import admin
from paypal.standard.pdt.models import PayPalPDT
from vendor.paypal.standard.pdt.models import PayPalPDT


# ToDo: How similiar is this to PayPalIPNAdmin? Could we just inherit off one common admin model?
Expand Down
4 changes: 2 additions & 2 deletions vendor/paypal/standard/pdt/forms.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from paypal.standard.forms import PayPalStandardBaseForm
from paypal.standard.pdt.models import PayPalPDT
from vendor.paypal.standard.forms import PayPalStandardBaseForm
from vendor.paypal.standard.pdt.models import PayPalPDT


class PayPalPDTForm(PayPalStandardBaseForm):
Expand Down
Expand Up @@ -2,7 +2,7 @@

from south.db import db
from django.db import models
from paypal.standard.pdt.models import *
from vendor.paypal.standard.pdt.models import *

class Migration:

Expand Down
8 changes: 4 additions & 4 deletions vendor/paypal/standard/pdt/models.py
Expand Up @@ -6,9 +6,9 @@
from django.conf import settings
from django.http import QueryDict
from django.utils.http import urlencode
from paypal.standard.models import PayPalStandardBase
from paypal.standard.conf import POSTBACK_ENDPOINT, SANDBOX_POSTBACK_ENDPOINT
from paypal.standard.pdt.signals import pdt_successful, pdt_failed
from vendor.paypal.standard.models import PayPalStandardBase
from vendor.paypal.standard.conf import POSTBACK_ENDPOINT, SANDBOX_POSTBACK_ENDPOINT
from vendor.paypal.standard.pdt.signals import pdt_successful, pdt_failed

# ### Todo: Move this logic to conf.py:
# if paypal.standard.pdt is in installed apps
Expand Down Expand Up @@ -55,7 +55,7 @@ def get_endpoint(self):

def _verify_postback(self):
# ### Now we don't really care what result was, just whether a flag was set or not.
from paypal.standard.pdt.forms import PayPalPDTForm
from vendor.paypal.standard.pdt.forms import PayPalPDTForm
result = False
response_list = self.response.split('\n')
response_dict = {}
Expand Down
6 changes: 3 additions & 3 deletions vendor/paypal/standard/pdt/tests/test_pdt.py
Expand Up @@ -6,9 +6,9 @@
from django.conf import settings
from django.shortcuts import render_to_response
from django.test import TestCase
from paypal.standard.pdt.forms import PayPalPDTForm
from paypal.standard.pdt.models import PayPalPDT
from paypal.standard.pdt.signals import pdt_successful, pdt_failed
from vendor.paypal.standard.pdt.forms import PayPalPDTForm
from vendor.paypal.standard.pdt.models import PayPalPDT
from vendor.paypal.standard.pdt.signals import pdt_successful, pdt_failed


class DummyPayPalPDT(object):
Expand Down

0 comments on commit 5571fb7

Please sign in to comment.