@@ -515,6 +515,11 @@ public function getBillingBlockFields() {
515
515
* @return array
516
516
*/
517
517
public function getTransparentDirectDisplayFields () {
518
+ $ fields = $ this ->getProcessorTypeMetadata ('transparent_redirect ' );
519
+ if (isset ($ fields ['fields ' ])) {
520
+ return $ fields ['fields ' ];
521
+ }
522
+
518
523
$ corePaymentFields = $ this ->getCorePaymentFields ();
519
524
$ paymentFieldMappings = $ this ->getPaymentFieldMapping ();
520
525
foreach ($ paymentFieldMappings as $ fieldName => $ fieldSpec ) {
@@ -611,6 +616,10 @@ public function getBillingAddressFields($billingLocationID = NULL) {
611
616
if (!$ this ->isTransparentRedirect ()) {
612
617
return parent ::getBillingAddressFields ($ billingLocationID );
613
618
}
619
+ $ fields = $ this ->getProcessorTypeMetadata ('transparent_redirect ' );
620
+ if (isset ($ fields ['billing_fields ' ])) {
621
+ return $ fields ['billing_fields ' ];
622
+ }
614
623
$ billingFields = array (
615
624
'first_name ' => 'billing_first_name ' ,
616
625
'middle_name ' => 'billing_middle_name ' ,
@@ -872,17 +881,7 @@ protected function supportsFutureRecurStartDate() {
872
881
* @return bool
873
882
*/
874
883
protected function supportsPreApproval () {
875
- $ entities = array ();
876
- omnipaymultiprocessor_civicrm_managed ($ entities );
877
- foreach ($ entities as $ entity ) {
878
- if ($ entity ['entity ' ] === 'payment_processor_type ' ) {
879
- if (
880
- $ entity ['params ' ]['name ' ] === $ this ->_paymentProcessor ['payment_processor_type ' ]
881
- && !empty ($ entity ['params ' ]['supports_preapproval ' ])) {
882
- return TRUE ;
883
- }
884
- }
885
- }
884
+ $ this ->getProcessorTypeMetadata ('supports_preapproval ' );
886
885
return FALSE ;
887
886
}
888
887
@@ -1029,5 +1028,38 @@ protected function purgeSensitiveDataFromSession() {
1029
1028
return array ($ key , $ values );
1030
1029
}
1031
1030
1031
+ /**
1032
+ * @return array
1033
+ */
1034
+ protected function getEntitiesMetadata () {
1035
+ $ entities = array ();
1036
+ omnipaymultiprocessor_civicrm_managed ($ entities );
1037
+ return $ entities ;
1038
+ }
1039
+
1040
+ /**
1041
+ * Get metadata for a processor entity.
1042
+ *
1043
+ * @param string $parameter
1044
+ *
1045
+ * @return mixed
1046
+ */
1047
+ protected function getProcessorTypeMetadata ($ parameter ) {
1048
+ $ entities = $ this ->getEntitiesMetadata ();
1049
+ foreach ($ entities as $ entity ) {
1050
+ if ($ entity ['entity ' ] === 'payment_processor_type ' ) {
1051
+ if (!isset ($ this ->_paymentProcessor ['payment_processor_type ' ])) {
1052
+ $ this ->_paymentProcessor ['payment_processor_type ' ] = civicrm_api3 ('PaymentProcessorType ' , 'getvalue ' , array ('id ' => $ this ->_paymentProcessor ['payment_processor_type_id ' ], 'return ' => 'name ' ));
1053
+ }
1054
+ if (
1055
+ $ entity ['params ' ]['name ' ] === $ this ->_paymentProcessor ['payment_processor_type ' ]
1056
+ && isset ($ entity ['metadata ' ][$ parameter ])) {
1057
+ return $ entity ['metadata ' ][$ parameter ];
1058
+ }
1059
+ }
1060
+ }
1061
+ return FALSE ;
1062
+ }
1063
+
1032
1064
}
1033
1065
0 commit comments