Skip to content

Commit 9d4b0e8

Browse files
author
Drew Johnston
committed
Pass response type when calling format_response(). fixes drewjoh#8
1 parent ae4364f commit 9d4b0e8

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

phpPayPal.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ public function do_capture()
969969
$this->Response = $this->hash_call("DoCapture", $nvpstr);
970970

971971
// Format our response and return the outcome
972-
return $this->format_response();
972+
return $this->format_response('DoCapture');
973973
}
974974

975975
public function do_authorization()
@@ -990,7 +990,7 @@ public function do_authorization()
990990
$this->Response = $this->hash_call("DoAuthorization", $nvpstr);
991991

992992
// Format our response and return the outcome
993-
return $this->format_response();
993+
return $this->format_response('DoAuthorization');
994994
}
995995

996996
public function do_reauthorization()
@@ -1011,7 +1011,7 @@ public function do_reauthorization()
10111011
$this->Response = $this->hash_call("DoReauthorization", $nvpstr);
10121012

10131013
// Format our response and return the outcome
1014-
return $this->format_response();
1014+
return $this->format_response('DoReauthorization');
10151015
}
10161016

10171017
public function do_void()
@@ -1032,7 +1032,7 @@ public function do_void()
10321032
$this->Response = $this->hash_call("DoVoid", $nvpstr);
10331033

10341034
// Format our response and return the outcome
1035-
return $this->format_response();
1035+
return $this->format_response('DoVoid');
10361036
}
10371037

10381038
public function do_direct_payment()
@@ -1083,7 +1083,7 @@ public function do_direct_payment()
10831083
$this->Response = $this->hash_call("DoDirectPayment", $nvpstr);
10841084

10851085
// Format our response and return the outcome
1086-
return $this->format_response();
1086+
return $this->format_response('DoDirectPayment');
10871087
}
10881088

10891089
public function set_express_checkout()
@@ -1110,7 +1110,7 @@ public function set_express_checkout()
11101110
$this->Response = $this->hash_call("SetExpressCheckout", $nvpstr);
11111111

11121112
// Format our response and return the outcome
1113-
return $this->format_response();
1113+
return $this->format_response('SetExpressCheckout');
11141114
}
11151115

11161116
public function set_express_checkout_successful_redirect()
@@ -1149,7 +1149,7 @@ public function get_express_checkout_details()
11491149
$this->Response = $this->hash_call("GetExpressCheckoutDetails", $nvpstr);
11501150

11511151
// Format our response and return the outcome
1152-
return $this->format_response();
1152+
return $this->format_response('GetExpressCheckoutDetails');
11531153
}
11541154

11551155
public function do_express_checkout_payment()
@@ -1196,7 +1196,7 @@ public function do_express_checkout_payment()
11961196
$this->urldecodeVariables();
11971197

11981198
// Format our response and return the outcome
1199-
return $this->format_response();
1199+
return $this->format_response('DoExpressCheckoutPayment');
12001200
}
12011201

12021202
public function get_transaction_details()
@@ -1212,7 +1212,7 @@ public function get_transaction_details()
12121212
$this->Response = $this->hash_call("GetTransactionDetails", $nvpstr);
12131213

12141214
// Format our response and return the outcome
1215-
return $this->format_response();
1215+
return $this->format_response('GetTransactionDetails');
12161216
}
12171217

12181218
public function refund_transaction()
@@ -1228,7 +1228,7 @@ public function refund_transaction()
12281228
$this->Response = $this->hash_call("RefundTransaction", $nvpstr);
12291229

12301230
// Format our response and return the outcome
1231-
return $this->format_response();
1231+
return $this->format_response('RefundTransaction');
12321232
}
12331233

12341234
public function create_recurring_payments_profile()
@@ -1243,7 +1243,7 @@ public function create_recurring_payments_profile()
12431243
$this->urldecodeVariables();
12441244

12451245
// Format our response and return the outcome
1246-
return $this->format_response();
1246+
return $this->format_response('CreateRecurringPaymentsProfile');
12471247
}
12481248

12491249
public function get_recurring_payments_profile_details()
@@ -1254,7 +1254,7 @@ public function get_recurring_payments_profile_details()
12541254
$this->Response = $this->hash_call("GetRecurringPaymentsProfileDetails", $nvpstr);
12551255

12561256
// Format our response and return the outcome
1257-
return $this->format_response();
1257+
return $this->format_response('GetRecurringPaymentsProfileDetails');
12581258
}
12591259

12601260
public function update_recurring_payments_profile()
@@ -1268,7 +1268,7 @@ public function update_recurring_payments_profile()
12681268
$this->Response = $this->hash_call("UpdateRecurringPaymentsProfile", $nvpstr);
12691269

12701270
// Format our response and return the outcome
1271-
return $this->format_response();
1271+
return $this->format_response('UpdateRecurringPaymentsProfile');
12721272
}
12731273

12741274
public function manage_recurring_payments_profile_status()
@@ -1282,7 +1282,7 @@ public function manage_recurring_payments_profile_status()
12821282
$this->Response = $this->hash_call("ManageRecurringPaymentsProfileStatus", $nvpstr);
12831283

12841284
// Format our response and return the outcome
1285-
return $this->format_response();
1285+
return $this->format_response('ManageRecurringPaymentsProfileStatus');
12861286
}
12871287

12881288
public function do_reference_transaction()
@@ -1333,7 +1333,7 @@ public function do_reference_transaction()
13331333
$this->Response = $this->hash_call("DoReferenceTransaction", $nvpstr);
13341334

13351335
// Format our response and return the outcome
1336-
return $this->format_response();
1336+
return $this->format_response('DoReferenceTransaction');
13371337
}
13381338

13391339
/**
@@ -1644,7 +1644,7 @@ private function urldecodeVariables()
16441644
}
16451645

16461646
// We take our response and depending on whether it's a success or failure, set our values accordingly
1647-
private function format_response()
1647+
private function format_response($response_type)
16481648
{
16491649
if(strtoupper($this->Response["ACK"]) != "SUCCESS" AND strtoupper($this->Response["ACK"]) != "SUCCESSWITHWARNING")
16501650
{
@@ -1682,7 +1682,7 @@ private function format_response()
16821682
elseif(strtoupper($this->Response["ACK"]) == 'SUCCESS' OR strtoupper($this->Response["ACK"]) == 'SUCCESSWITHWARNING')
16831683
{
16841684
/* Take the response variables and put them into the local class variables */
1685-
foreach($this->ResponseFieldsArray['DoReferenceTransaction'] as $key => $value)
1685+
foreach($this->ResponseFieldsArray[$response_type] as $key => $value)
16861686
$this->$key = $this->Response[$value];
16871687

16881688
return true;

0 commit comments

Comments
 (0)