@@ -265,7 +265,7 @@ private function saveBillingAddressIfRequired($params) {
265
265
* @return bool
266
266
*/
267
267
private function hasBillingAddressFields ($ params ) {
268
- $ billingFields = array_intersect_key ($ params , array_flip ($ this ->getBillingAddressFieldsPre47 ()));
268
+ $ billingFields = array_intersect_key ($ params , array_flip ($ this ->getBillingAddressFields ()));
269
269
return !empty ($ billingFields );
270
270
}
271
271
@@ -446,38 +446,6 @@ public function getPaymentFormFields() {
446
446
return $ this ->_paymentProcessor ['payment_type ' ] == 1 ? $ this ->getCreditCardFormFields () : $ this ->getDirectDebitFormFields ();
447
447
}
448
448
449
- /**
450
- * Get name for the payment information type.
451
- * @todo - use option group + name field (like Omnipay does)
452
- * @return string
453
- */
454
- public function getPaymentTypeName () {
455
- return $ this ->_paymentProcessor ['payment_type ' ] == 1 ? 'credit_card ' : 'direct_debit ' ;
456
- }
457
-
458
- /**
459
- * Get label for the payment information type.
460
- *
461
- * We are overriding this for the transparent redirect use case.
462
- * Cybersource (our current example) adds billing details which is what we
463
- * are calling this here.
464
- *
465
- * @return string
466
- */
467
- public function getPaymentTypeLabel () {
468
- switch ($ this ->_paymentProcessor ['payment_type ' ]) {
469
- case 1 :
470
- return 'Credit Card ' ;
471
-
472
- case 2 :
473
- return 'Direct Debit ' ;
474
-
475
- default :
476
- return 'Billing ' ;
477
- }
478
- return $ this ->_paymentProcessor ['payment_type ' ] == 1 ? 'Credit Card ' : 'Direct Debit ' ;
479
- }
480
-
481
449
/**
482
450
* Get billing fields required for this block.
483
451
*
@@ -632,147 +600,6 @@ public function getBillingAddressFields($billingLocationID = NULL) {
632
600
return $ billingFields ;
633
601
}
634
602
635
- /**
636
- * Get core CiviCRM address fields.
637
- *
638
- * @return array
639
- */
640
- private function getBillingAddressFieldsPre47 () {
641
- $ billingFields = array ();
642
- foreach (array (
643
- 'street_address ' ,
644
- 'city ' ,
645
- 'state_province_id ' ,
646
- 'postal_code ' ,
647
- 'country_id ' ,
648
- ) as $ addressField ) {
649
- $ billingFields [$ addressField ] = 'billing_ ' . $ addressField . '- ' . CRM_Core_BAO_LocationType::getBilling ();
650
- }
651
- return $ billingFields ;
652
- }
653
-
654
- /**
655
- * Get metadata for payment form fields.
656
- *
657
- * @return array
658
- */
659
- public function getPaymentFormFieldsMetadata () {
660
- // @todo - handle redirect for 4.7
661
- return parent ::getPaymentFormFieldsMetadata ();
662
- return self ::getBillingAddressFieldsMetadataPre47 ();
663
- }
664
-
665
- /**
666
- * Get form metadata for address fields.
667
- *
668
- * At the moment this is being called from getPaymentFormFields when we are
669
- * dealing with a transparent redirect. It is a bit Cybersource use-casey.
670
- *
671
- * @return array
672
- * Array of metadata for address fields.
673
- */
674
- public function getBillingAddressFieldsMetadataPre47 () {
675
- $ metadata = array ();
676
- $ billingID = CRM_Core_BAO_LocationType::getBilling ();
677
- $ metadata ['billing_first_name ' ] = array (
678
- 'htmlType ' => 'text ' ,
679
- 'name ' => 'billing_first_name ' ,
680
- 'title ' => ts ('Billing First Name ' ),
681
- 'cc_field ' => TRUE ,
682
- 'attributes ' => array (
683
- 'size ' => 30 ,
684
- 'maxlength ' => 60 ,
685
- 'autocomplete ' => 'off ' ,
686
- ),
687
- 'is_required ' => TRUE ,
688
- );
689
-
690
- $ metadata ['billing_middle_name ' ] = array (
691
- 'htmlType ' => 'text ' ,
692
- 'name ' => 'billing_middle_name ' ,
693
- 'title ' => ts ('Billing Middle Name ' ),
694
- 'cc_field ' => TRUE ,
695
- 'attributes ' => array (
696
- 'size ' => 30 ,
697
- 'maxlength ' => 60 ,
698
- 'autocomplete ' => 'off ' ,
699
- ),
700
- 'is_required ' => FALSE ,
701
- );
702
-
703
- $ metadata ['billing_last_name ' ] = array (
704
- 'htmlType ' => 'text ' ,
705
- 'name ' => 'billing_last_name ' ,
706
- 'title ' => ts ('Billing Last Name ' ),
707
- 'cc_field ' => TRUE ,
708
- 'attributes ' => array (
709
- 'size ' => 30 ,
710
- 'maxlength ' => 60 ,
711
- 'autocomplete ' => 'off ' ,
712
- ),
713
- 'is_required ' => TRUE ,
714
- );
715
-
716
- $ metadata ["billing_street_address- {$ billingID }" ] = array (
717
- 'htmlType ' => 'text ' ,
718
- 'name ' => "billing_street_address- {$ billingID }" ,
719
- 'title ' => ts ('Street Address ' ),
720
- 'cc_field ' => TRUE ,
721
- 'attributes ' => array (
722
- 'size ' => 30 ,
723
- 'maxlength ' => 60 ,
724
- 'autocomplete ' => 'off ' ,
725
- ),
726
- 'is_required ' => TRUE ,
727
- );
728
-
729
- $ metadata ["billing_city- {$ billingID }" ] = array (
730
- 'htmlType ' => 'text ' ,
731
- 'name ' => "billing_city- {$ billingID }" ,
732
- 'title ' => ts ('City ' ),
733
- 'cc_field ' => TRUE ,
734
- 'attributes ' => array (
735
- 'size ' => 30 ,
736
- 'maxlength ' => 60 ,
737
- 'autocomplete ' => 'off ' ,
738
- ),
739
- 'is_required ' => TRUE ,
740
- );
741
-
742
- $ metadata ["billing_state_province_id- {$ billingID }" ] = array (
743
- 'htmlType ' => 'chainSelect ' ,
744
- 'title ' => ts ('State/Province ' ),
745
- 'name ' => "billing_state_province_id- {$ billingID }" ,
746
- 'cc_field ' => TRUE ,
747
- 'is_required ' => TRUE ,
748
- );
749
-
750
- $ metadata ["billing_postal_code- {$ billingID }" ] = array (
751
- 'htmlType ' => 'text ' ,
752
- 'name ' => "billing_postal_code- {$ billingID }" ,
753
- 'title ' => ts ('Postal Code ' ),
754
- 'cc_field ' => TRUE ,
755
- 'attributes ' => array (
756
- 'size ' => 30 ,
757
- 'maxlength ' => 60 ,
758
- 'autocomplete ' => 'off ' ,
759
- ),
760
- 'is_required ' => TRUE ,
761
- );
762
-
763
- $ metadata ["billing_country_id- {$ billingID }" ] = array (
764
- 'htmlType ' => 'select ' ,
765
- 'name ' => "billing_country_id- {$ billingID }" ,
766
- 'title ' => ts ('Country ' ),
767
- 'cc_field ' => TRUE ,
768
- 'attributes ' => array (
769
- '' => ts ('- select - ' ),
770
- ) + CRM_Core_PseudoConstant::country (),
771
- 'is_required ' => TRUE ,
772
- );
773
- return $ metadata ;
774
- }
775
-
776
603
/**
777
604
* Handle response from processor.
778
605
*
@@ -933,9 +760,6 @@ protected function redirectOrExit($outcome) {
933
760
* @throws \CiviCRM_API3_Exception
934
761
*/
935
762
protected function storePaymentToken ($ params , $ contribution , $ tokenReference ) {
936
- if (!omnipaymultiprocessor__versionAtLeast (4.6 )) {
937
- return ;
938
- }
939
763
$ contributionRecurID = $ contribution ['contribution_recur_id ' ];
940
764
$ token = civicrm_api3 ('payment_token ' , 'create ' , array (
941
765
'contact_id ' => $ contribution ['contact_id ' ],
0 commit comments