1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
<?php
defined( 'ABSPATH' ) || exit();
if ( ! class_exists( 'WC_Payment_Token_Braintree' ) ) {
exit();
}
class WC_Payment_Token_Braintree_Local_Payment extends WC_Payment_Token_Braintree {
protected $type = 'Braintree_Local_Payment';
protected $braintree_data = array(
'funding_source' => '',
'payer_id' => '',
'payment_id' => '',
);
public function init_from_payment_method( $method ) {
$method = (object) $method;
$this->set_funding_source( $method->fundingSource );
$this->set_payer_id( $method->payerId );
$this->set_payment_id( $method->paymentId );
$this->set_payment_instrument_type( 'local_payment' );
}
public function set_funding_source( $value ) {
$this->set_prop( 'funding_source', $value );
}
public function get_funding_source() {
return $this->get_prop( 'funding_source' );
}
public function set_payer_id( $value ) {
$this->set_prop( 'payer_id', $value );
}
public function get_payer_id() {
return $this->get_prop( 'payer_id' );
}
public function set_payment_id( $value ) {
$this->set_prop( 'payment_id', $value );
}
public function get_payment_id() {
return $this->get_prop( 'payment_id' );
}
public function init_payment_formats() {
$this->payment_formats = array(
'source_and_payer' => array(
'label' => __( 'Type and Payer Id', 'woo-payment-gateway' ),
'example' => 'iDEAL - XF-d647tg',
'format' => '{funding_source} - {payer_id}',
),
);
}
}