Index: trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php |
— | — | @@ -108,18 +108,18 @@ |
109 | 109 | protected $transactions; |
110 | 110 | |
111 | 111 | /** |
112 | | - * $transaction_groups will be defined by the adapter. |
| 112 | + * $payment_methods will be defined by the adapter. |
113 | 113 | * |
114 | | - * @var array $transaction_groups |
| 114 | + * @var array $payment_methods |
115 | 115 | */ |
116 | | - protected $transaction_groups = array(); |
| 116 | + protected $payment_methods = array(); |
117 | 117 | |
118 | 118 | /** |
119 | | - * $transaction_types will be defined by the adapter. |
| 119 | + * $payment_submethods will be defined by the adapter. |
120 | 120 | * |
121 | | - * @var array $transaction_types |
| 121 | + * @var array $payment_submethods |
122 | 122 | */ |
123 | | - protected $transaction_types = array(); |
| 123 | + protected $payment_submethods = array(); |
124 | 124 | |
125 | 125 | /** |
126 | 126 | * Staged variables. This is affected by the transaction type. |
— | — | @@ -184,7 +184,7 @@ |
185 | 185 | $this->defineReturnValueMap(); |
186 | 186 | |
187 | 187 | //Don't bother setting the transaction type if it's not something. |
188 | | - if ( $this->dataObj->isSomething( 'transaction_type' ) ) { |
| 188 | + if ( $this->dataObj->isSomething( 'payment_method' ) ) { |
189 | 189 | $this->currentTransaction('INSERT_ORDERWITHPAYMENT'); |
190 | 190 | } |
191 | 191 | |
— | — | @@ -292,7 +292,14 @@ |
293 | 293 | return $gotten[$varname]; |
294 | 294 | } |
295 | 295 | |
296 | | - function getValue( $gateway_field_name, $token = false ) { |
| 296 | + /** |
| 297 | + * getValue |
| 298 | + * |
| 299 | + * @todo |
| 300 | + * - This is specific to transactions. |
| 301 | + * - This method probably needs to be renamed. |
| 302 | + */ |
| 303 | + public function getValue( $gateway_field_name, $token = false ) { |
297 | 304 | if ( empty( $this->transactions ) ) { |
298 | 305 | //TODO: These dies should all throw exceptions or something less completely fatal. |
299 | 306 | $msg = self::getGatewayName() . ': Transactions structure is empty! No transaction can be constructed.'; |
— | — | @@ -652,8 +659,61 @@ |
653 | 660 | } |
654 | 661 | return $current_transaction; |
655 | 662 | } |
656 | | - |
| 663 | + |
657 | 664 | /** |
| 665 | + * Define payment methods |
| 666 | + * |
| 667 | + * Payment methods include: |
| 668 | + * - Paypal |
| 669 | + * - Credit Card |
| 670 | + * - Debit |
| 671 | + * - Bank Transfer |
| 672 | + * - Real Time Bank Transfer |
| 673 | + * |
| 674 | + * Not all payment methods are available within an adapter |
| 675 | + * |
| 676 | + * @return array Returns the available payment methods for the specific adapter |
| 677 | + */ |
| 678 | + public function getPaymentMethods() { |
| 679 | + |
| 680 | + // Define the payment methods if they have not been set yet. |
| 681 | + if ( empty( $this->payment_methods ) ) { |
| 682 | + |
| 683 | + $this->definePaymentMethods(); |
| 684 | + } |
| 685 | + |
| 686 | + return $this->payment_methods; |
| 687 | + } |
| 688 | + |
| 689 | + /** |
| 690 | + * Define payment methods |
| 691 | + * |
| 692 | + * @todo |
| 693 | + * - this is not implemented in all adapters yet |
| 694 | + * |
| 695 | + * Payment methods include: |
| 696 | + * - Paypal: paypal, recurring paypal |
| 697 | + * - Credit Card: Master Card |
| 698 | + * - Debit |
| 699 | + * - Bank Transfer |
| 700 | + * - Real Time Bank Transfer |
| 701 | + * |
| 702 | + * Not all payment submethods are available within an adapter |
| 703 | + * |
| 704 | + * @return array Returns the available payment submethods for the specific adapter |
| 705 | + */ |
| 706 | + public function getPaymentSubmethods() { |
| 707 | + |
| 708 | + // Define the payment methods if they have not been set yet. |
| 709 | + if ( empty( $this->payment_submethods ) ) { |
| 710 | + |
| 711 | + $this->definePaymentSubmethods(); |
| 712 | + } |
| 713 | + |
| 714 | + return $this->payment_methods; |
| 715 | + } |
| 716 | + |
| 717 | + /** |
658 | 718 | * Sends a name-value pair string to Payflow gateway |
659 | 719 | * |
660 | 720 | * @param $data String: The exact thing we want to send. |