@@ -17,122 +17,122 @@ |
||
| 17 | 17 | class GatewayDataFormatter implements GatewayDataFormatterInterface |
| 18 | 18 | { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Gets the text to use for a gateway's line item name when this is a partial payment |
|
| 22 | - * |
|
| 23 | - * @param \EEI_Payment $payment |
|
| 24 | - * @return string |
|
| 25 | - */ |
|
| 26 | - public function formatPartialPaymentLineItemName(\EEI_Payment $payment) |
|
| 27 | - { |
|
| 28 | - return apply_filters( |
|
| 29 | - 'EEG_Paypal_Pro__do_direct_payment__partial_amount_line_item_name', |
|
| 30 | - $payment->get_first_event_name(), |
|
| 31 | - $this, |
|
| 32 | - $payment |
|
| 33 | - ); |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * Gets the text to use for a gateway's line item description when this is a partial payment |
|
| 40 | - * |
|
| 41 | - * @param \EEI_Payment $payment |
|
| 42 | - * @return string |
|
| 43 | - */ |
|
| 44 | - public function formatPartialPaymentLineItemDesc(\EEI_Payment $payment) |
|
| 45 | - { |
|
| 46 | - return apply_filters( |
|
| 47 | - 'FHEE__EE_Gateway___partial_payment_desc', |
|
| 48 | - sprintf( |
|
| 49 | - __("Payment of %s for %s", "event_espresso"), |
|
| 50 | - $payment->get_pretty('PAY_amount', 'no_currency_code'), |
|
| 51 | - $payment->get_first_event_name() |
|
| 52 | - ), |
|
| 53 | - $this, |
|
| 54 | - $payment |
|
| 55 | - ); |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * Gets the name to use for a line item when sending line items to the gateway |
|
| 62 | - * |
|
| 63 | - * @param \EEI_Line_Item $line_item |
|
| 64 | - * @param \EEI_Payment $payment |
|
| 65 | - * @return string |
|
| 66 | - */ |
|
| 67 | - public function formatLineItemName(\EEI_Line_Item $line_item, \EEI_Payment $payment) |
|
| 68 | - { |
|
| 69 | - return apply_filters( |
|
| 70 | - 'FHEE__EE_gateway___line_item_name', |
|
| 71 | - sprintf( |
|
| 72 | - _x('%1$s for %2$s', 'Ticket for Event', 'event_espresso'), |
|
| 73 | - $line_item->name(), |
|
| 74 | - $line_item->ticket_event_name() |
|
| 75 | - ), |
|
| 76 | - $this, |
|
| 77 | - $line_item, |
|
| 78 | - $payment |
|
| 79 | - ); |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * Gets the description to use for a line item when sending line items to the gateway |
|
| 86 | - * |
|
| 87 | - * @param \EEI_Line_Item $line_item |
|
| 88 | - * @param \EEI_Payment $payment |
|
| 89 | - * @return string |
|
| 90 | - */ |
|
| 91 | - public function formatLineItemDesc(\EEI_Line_Item $line_item, \EEI_Payment $payment) |
|
| 92 | - { |
|
| 93 | - return apply_filters( |
|
| 94 | - 'FHEE__EE_Gateway___line_item_desc', |
|
| 95 | - $line_item->desc(), |
|
| 96 | - $this, |
|
| 97 | - $line_item, |
|
| 98 | - $payment |
|
| 99 | - ); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - |
|
| 103 | - |
|
| 104 | - /** |
|
| 105 | - * Gets the order description that should generally be sent to gateways |
|
| 106 | - * |
|
| 107 | - * @param \EEI_Payment $payment |
|
| 108 | - * @return string |
|
| 109 | - */ |
|
| 110 | - public function formatOrderDescription(\EEI_Payment $payment) |
|
| 111 | - { |
|
| 112 | - return apply_filters( |
|
| 113 | - 'FHEE__EE_Gateway___order_description', |
|
| 114 | - sprintf( |
|
| 115 | - __('Event Registrations from %1$s for %2$s', "event_espresso"), |
|
| 116 | - wp_specialchars_decode(get_bloginfo(), ENT_QUOTES), |
|
| 117 | - $payment->get_first_event_name() |
|
| 118 | - ), |
|
| 119 | - $this, |
|
| 120 | - $payment |
|
| 121 | - ); |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * Formats the amount so it can generally be sent to gateways |
|
| 128 | - * |
|
| 129 | - * @param float $amount |
|
| 130 | - * @return string |
|
| 131 | - */ |
|
| 132 | - public function formatCurrency($amount) |
|
| 133 | - { |
|
| 134 | - return number_format($amount, 2, '.', ''); |
|
| 135 | - } |
|
| 20 | + /** |
|
| 21 | + * Gets the text to use for a gateway's line item name when this is a partial payment |
|
| 22 | + * |
|
| 23 | + * @param \EEI_Payment $payment |
|
| 24 | + * @return string |
|
| 25 | + */ |
|
| 26 | + public function formatPartialPaymentLineItemName(\EEI_Payment $payment) |
|
| 27 | + { |
|
| 28 | + return apply_filters( |
|
| 29 | + 'EEG_Paypal_Pro__do_direct_payment__partial_amount_line_item_name', |
|
| 30 | + $payment->get_first_event_name(), |
|
| 31 | + $this, |
|
| 32 | + $payment |
|
| 33 | + ); |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * Gets the text to use for a gateway's line item description when this is a partial payment |
|
| 40 | + * |
|
| 41 | + * @param \EEI_Payment $payment |
|
| 42 | + * @return string |
|
| 43 | + */ |
|
| 44 | + public function formatPartialPaymentLineItemDesc(\EEI_Payment $payment) |
|
| 45 | + { |
|
| 46 | + return apply_filters( |
|
| 47 | + 'FHEE__EE_Gateway___partial_payment_desc', |
|
| 48 | + sprintf( |
|
| 49 | + __("Payment of %s for %s", "event_espresso"), |
|
| 50 | + $payment->get_pretty('PAY_amount', 'no_currency_code'), |
|
| 51 | + $payment->get_first_event_name() |
|
| 52 | + ), |
|
| 53 | + $this, |
|
| 54 | + $payment |
|
| 55 | + ); |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * Gets the name to use for a line item when sending line items to the gateway |
|
| 62 | + * |
|
| 63 | + * @param \EEI_Line_Item $line_item |
|
| 64 | + * @param \EEI_Payment $payment |
|
| 65 | + * @return string |
|
| 66 | + */ |
|
| 67 | + public function formatLineItemName(\EEI_Line_Item $line_item, \EEI_Payment $payment) |
|
| 68 | + { |
|
| 69 | + return apply_filters( |
|
| 70 | + 'FHEE__EE_gateway___line_item_name', |
|
| 71 | + sprintf( |
|
| 72 | + _x('%1$s for %2$s', 'Ticket for Event', 'event_espresso'), |
|
| 73 | + $line_item->name(), |
|
| 74 | + $line_item->ticket_event_name() |
|
| 75 | + ), |
|
| 76 | + $this, |
|
| 77 | + $line_item, |
|
| 78 | + $payment |
|
| 79 | + ); |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * Gets the description to use for a line item when sending line items to the gateway |
|
| 86 | + * |
|
| 87 | + * @param \EEI_Line_Item $line_item |
|
| 88 | + * @param \EEI_Payment $payment |
|
| 89 | + * @return string |
|
| 90 | + */ |
|
| 91 | + public function formatLineItemDesc(\EEI_Line_Item $line_item, \EEI_Payment $payment) |
|
| 92 | + { |
|
| 93 | + return apply_filters( |
|
| 94 | + 'FHEE__EE_Gateway___line_item_desc', |
|
| 95 | + $line_item->desc(), |
|
| 96 | + $this, |
|
| 97 | + $line_item, |
|
| 98 | + $payment |
|
| 99 | + ); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + |
|
| 103 | + |
|
| 104 | + /** |
|
| 105 | + * Gets the order description that should generally be sent to gateways |
|
| 106 | + * |
|
| 107 | + * @param \EEI_Payment $payment |
|
| 108 | + * @return string |
|
| 109 | + */ |
|
| 110 | + public function formatOrderDescription(\EEI_Payment $payment) |
|
| 111 | + { |
|
| 112 | + return apply_filters( |
|
| 113 | + 'FHEE__EE_Gateway___order_description', |
|
| 114 | + sprintf( |
|
| 115 | + __('Event Registrations from %1$s for %2$s', "event_espresso"), |
|
| 116 | + wp_specialchars_decode(get_bloginfo(), ENT_QUOTES), |
|
| 117 | + $payment->get_first_event_name() |
|
| 118 | + ), |
|
| 119 | + $this, |
|
| 120 | + $payment |
|
| 121 | + ); |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * Formats the amount so it can generally be sent to gateways |
|
| 128 | + * |
|
| 129 | + * @param float $amount |
|
| 130 | + * @return string |
|
| 131 | + */ |
|
| 132 | + public function formatCurrency($amount) |
|
| 133 | + { |
|
| 134 | + return number_format($amount, 2, '.', ''); |
|
| 135 | + } |
|
| 136 | 136 | } |
| 137 | 137 | // End of file GatewayDataFormatter.php |
| 138 | 138 | // Location: core\services\gateways/GatewayDataFormatter.php |
| 139 | 139 | \ No newline at end of file |