Comments (2)
The code you refer to builds a list of recurring payment objects with the assumption that for every p_resultN key value in the response data (where N is 1 or greater) there will be always be five other corresponding keys: p_pnrefN, p_tenderN, p_transtimeN, p_amtN and p_transtateN.
At least the last of these keys (p_transtateN) is missing in the response, and maybe others are too.
It's years since I've worked with PayflowPro (happily) but my best guess is that they've either changed the key names returned for recurring payments, or the code should not assume that all the other keys are present in all cases.
To fix this, first make sure that the p_WHATEVER values the code is looking for are correct for the latest version of the PayflowPro API. The problem might be as simple as a renamed key, since the code isn't necessarily up-to-date.
If the key name is right but it isn't always present in responses, you will need to check for the key name in the unconsumed_data dictionary rather than always pop-ing it. Something like this should do:
while ("p_result%d" % recurpaycount) in unconsumed_data:
my_transtate = None
if ("p_transtate%d" % recurpaycount) in unconsumed_data:
my_transate = unconsumed_data.pop("p_transtate%d" % recurpaycount)
payments.append(RecurringPayment(
p_result = unconsumed_data.pop("p_result%d" % recurpaycount),
p_pnref = unconsumed_data.pop("p_pnref%d" % recurpaycount),
p_transtate = my_transtate,
p_tender = unconsumed_data.pop("p_tender%d" % recurpaycount),
p_transtime = unconsumed_data.pop("p_transtime%d" % recurpaycount),
p_amt = unconsumed_data.pop("p_amt%d" % recurpaycount)))
from python-payflowpro.
Hey James,
Thank you for your reply. It was exactly what I needed. The live RecurringProfile I was testing against did not have the p_transtate
and p_amt
values on record on some of it's first charges while the test profile i was using did. PayPal_ToddS's reply in this thread (https://www.x.com/message/180630#180630) makes me think these fields may not have existed when the first few charges went through on the profile. The test profile, created around the same time however, worked before this fix. So im not sure this was my case.
I found that .pop()
allows a default value. Here is the change: 1fe5806
Thanks again!
from python-payflowpro.
Related Issues (12)
- UnicodeDecodeError when querying Recurring Profiles. HOT 2
- new_acct is undefined in tests
- Payflow Gateway / Credit Referenced Transaction Amount wrong... HOT 1
- KeyError for Old Transactions in Recurring Profiles HOT 1
- BAID Not Supported HOT 1
- Support for Secure Token, Transparent Redirect HOT 1
- Cannot perform $0 Authorization (aka; ZDA, AVS-only) HOT 1
- Payflow Gateway Reports "Invalid tender" on Reference Transaction HOT 2
- invoice submitting not possible
- Please update the pypi release of this! HOT 10
- API behind current specification HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-payflowpro.