Skip to content

Commit df962d1

Browse files
Return token id if other possible values not present in getTransactionReference.
When processing a request with no card present a token is retrieved from paypal which is the used by a paypal browser script to open a paypal popup to approve the token. It's a bit arguable whether this is best retrieved via getTransactionReference or getCardReference. cardReference makes sense in that the token is used in place of a card but it's also the only reference we have for the transaction at this point. Related : #219 #215
1 parent 5379a83 commit df962d1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Message/RestResponse.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ public function getTransactionReference()
4242
return $this->data['id'];
4343
}
4444

45+
if (isset($this->data['token_id'])) {
46+
// This would be present when dealing with a case where the user
47+
// authorize's their card within paypal. In this case the transactionReference
48+
// will be used during the redirect.
49+
return $this->data['token_id'];
50+
}
51+
4552
return null;
4653
}
4754

@@ -63,6 +70,9 @@ public function getCode()
6370
return $this->statusCode;
6471
}
6572

73+
/**
74+
* Get a string that will represent the stored card in future requests.
75+
*/
6676
public function getCardReference()
6777
{
6878
if (isset($this->data['id'])) {

0 commit comments

Comments
 (0)