The approved flag from IPNs for Preapprovals now captured properly.
parent
9d7be4849a
commit
9130aa8b4a
|
@ -37,6 +37,7 @@ class PaymentManager( object ):
|
||||||
self.embedded = embedded
|
self.embedded = embedded
|
||||||
|
|
||||||
def update_preapproval(self, transaction):
|
def update_preapproval(self, transaction):
|
||||||
|
"""Update a transaction to hold the data from a PreapprovalDetails on that transaction"""
|
||||||
t = transaction
|
t = transaction
|
||||||
p = PreapprovalDetails(t)
|
p = PreapprovalDetails(t)
|
||||||
|
|
||||||
|
@ -75,7 +76,7 @@ class PaymentManager( object ):
|
||||||
return preapproval_status
|
return preapproval_status
|
||||||
|
|
||||||
def update_payment(self, transaction):
|
def update_payment(self, transaction):
|
||||||
|
"""Update a transaction to hold the data from a PaymentDetails on that transaction"""
|
||||||
t = transaction
|
t = transaction
|
||||||
payment_status = {'id':t.id}
|
payment_status = {'id':t.id}
|
||||||
|
|
||||||
|
@ -272,6 +273,10 @@ class PaymentManager( object ):
|
||||||
|
|
||||||
# The status is always one of the IPN_PREAPPROVAL_STATUS codes defined in paypal.py
|
# The status is always one of the IPN_PREAPPROVAL_STATUS codes defined in paypal.py
|
||||||
t.status = ipn.status
|
t.status = ipn.status
|
||||||
|
|
||||||
|
# capture whether the transaction has been approved
|
||||||
|
t.approved = ipn.approved
|
||||||
|
|
||||||
t.save()
|
t.save()
|
||||||
logger.info("IPN: Preapproval transaction: " + str(t.id) + " Status: " + ipn.status)
|
logger.info("IPN: Preapproval transaction: " + str(t.id) + " Status: " + ipn.status)
|
||||||
|
|
||||||
|
@ -298,8 +303,10 @@ class PaymentManager( object ):
|
||||||
pledged_list = []
|
pledged_list = []
|
||||||
|
|
||||||
if authorized:
|
if authorized:
|
||||||
|
# return only ACTIVE transactions with approved=True
|
||||||
authorized_list = transaction_list.filter(type=PAYMENT_TYPE_AUTHORIZATION,
|
authorized_list = transaction_list.filter(type=PAYMENT_TYPE_AUTHORIZATION,
|
||||||
status=IPN_PAY_STATUS_ACTIVE)
|
status=IPN_PAY_STATUS_ACTIVE,
|
||||||
|
approved=True)
|
||||||
else:
|
else:
|
||||||
authorized_list = []
|
authorized_list = []
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue