Skip to content

Commit

Permalink
Merge pull request FeeFighters#5 from mqudsi/master
Browse files Browse the repository at this point in the history
New getters/setters, added missing class fields, removed duplicate transaction_type
  • Loading branch information
tisho committed Nov 14, 2011
2 parents 9b5265a + 064e621 commit 8776d60
Showing 1 changed file with 60 additions and 1 deletion.
61 changes: 60 additions & 1 deletion lib/SamuraiTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,23 @@ class SamuraiTransaction {
public $billing_reference;
public $customer_reference;
public $descriptor;
public $success;
public $custom;
public $token;
public $reference_id;
public $transaction_type;
public $created_at;
public $processor_token;
public $payment_method;
public $processor_response;

public function getReferenceId ( ) {
return $this->reference_id;
}

public function setReferenceId ( $reference_id ) {
$this->reference_id = $reference_id;
}

public function getToken ( ) {
return $this->token;
Expand All @@ -25,10 +37,18 @@ public function setToken ( $token ) {
public function getCreatedAt ( ) {
return $this->created_at;
}

public function setCreatedAt ( $created_at ) {
$this->created_at = $created_at;
}

public function getUpdatedAt ( ) {
return $this->updated_at;
}

public function setUpdatedAt ( $updated_at ) {
$this->updated_at = $updated_at;
}

public function getAmount ( ) {
return $this->amount;
Expand Down Expand Up @@ -93,13 +113,52 @@ public function getProcessorResponse ( ) {
public function setProcessorResponse ( $response ) {
$this->processor_response = $processor_response;
}

public function getSuccess ( ) {
return $this->success;
}

public function setSuccess ( $success ) {
$this->success = $success;
}

public function getTransactionType ( ) {
return $this->transaction_type;
}

public function setTransactionType ( $transaction_type ) {
$this->transaction_type = $transaction_type;
}

public function getTransactionToken ( ) {
return $this->transaction_token;
}

public function setTransactionToken ( $transaction_token ) {
$this->transaction_token = $transaction_token;
}

public function getProcessorToken ( ) {
return $this->processor_token;
}

public function setProcessorToken ( $processor_token ) {
$this->processor_token = $processor_token;
}

public function getPaymentMethod ( ) {
return $this->payment_method;
}

public function setPaymentMethod ( $payment_method ) {
$this->payment_method = $payment_method;
}


function transactionFromResponse( $samurai_response ) {
$samurai_transaction = new SamuraiTransaction();
$samurai_transaction->reference_id = $samurai_response->getField( 'reference_id' );
$samurai_transaction->token = $samurai_response->getField( 'transaction_token' );
$samurai_transaction->type = $samurai_response->getField( 'transaction_type' );
$samurai_transaction->created_at = $samurai_response->getField( 'created_at' );
$samurai_transaction->success = $samurai_response->getField( 'success' );
$samurai_transaction->currency_code = $samurai_response->getField( 'currency_code' );
Expand Down

0 comments on commit 8776d60

Please sign in to comment.