diff --git a/Civi/Stripe/Api.php b/Civi/Stripe/Api.php index c32f16ff8b9572f42a7cd4784a1fae65ef98701f..3c8388ab19427ee840c9b53c4622f2426106c6dd 100644 --- a/Civi/Stripe/Api.php +++ b/Civi/Stripe/Api.php @@ -71,6 +71,8 @@ class Api { 'charge_currency' => $this->getValueFromStripeObject('currency', 'String', $stripeObject), 'payout_amount' => $balanceTransaction->amount / 100, 'payout_currency' => \CRM_Stripe_Api::formatCurrency($balanceTransaction->currency), + 'payout_net' => $balanceTransaction->net / 100, + 'payout_fee' => $balanceTransaction->fee / 100, ]; } else { diff --git a/managed/stripecustomdata.mgd.php b/managed/stripecustomdata.mgd.php index 0b0b87bbe88df32bbc49fdc440591053cbdfd589..f7cb603e8ec789960a1c6c9f96be78fe3a28f75a 100644 --- a/managed/stripecustomdata.mgd.php +++ b/managed/stripecustomdata.mgd.php @@ -31,14 +31,12 @@ else { 'label' => E::ts('Available On'), 'data_type' => 'Date', 'html_type' => 'Select Date', - 'is_searchable' => TRUE, 'help_pre' => E::ts('If there is a delay between your payment provider receiving the payment and it arriving in your bank account this is the date that it should be available in your account.'), - 'is_view' => TRUE, 'text_length' => 255, + 'is_searchable' => TRUE, + 'is_view' => TRUE, 'date_format' => 'yy-mm-dd', 'time_format' => 2, - 'note_columns' => 60, - 'note_rows' => 4, 'column_name' => 'available_on', ], 'match' => [ @@ -60,10 +58,9 @@ else { 'label' => E::ts('Exchange Rate'), 'data_type' => 'Float', 'html_type' => 'Text', - 'is_searchable' => TRUE, 'text_length' => 255, - 'note_columns' => 60, - 'note_rows' => 4, + 'is_searchable' => TRUE, + 'is_view' => TRUE, 'column_name' => 'exchange_rate', ], 'match' => [ @@ -85,10 +82,9 @@ else { 'label' => E::ts('Payout Amount'), 'data_type' => 'Float', 'html_type' => 'Text', - 'is_searchable' => TRUE, 'text_length' => 255, - 'note_columns' => 60, - 'note_rows' => 4, + 'is_searchable' => TRUE, + 'is_view' => TRUE, 'column_name' => 'payout_amount', ], 'match' => [ @@ -110,8 +106,8 @@ else { 'label' => E::ts('Payout Currency'), 'html_type' => 'Text', 'text_length' => 255, - 'note_columns' => 60, - 'note_rows' => 4, + 'is_searchable' => TRUE, + 'is_view' => TRUE, 'column_name' => 'payout_currency', ], 'match' => [ @@ -120,5 +116,103 @@ else { ], ], ], + + // Collect the payout fee and net amount, to help with reconciliation of + // foreign currency payments. + [ + 'name' => 'CustomGroup_Payment_details_CustomField_payout_fee', + 'entity' => 'CustomField', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'custom_group_id.name' => 'Payment_details', + 'name' => 'payout_fee', + 'label' => E::ts('Payout Fee'), + 'data_type' => 'Float', + 'html_type' => 'Text', + 'text_length' => 255, + 'is_searchable' => TRUE, + 'is_view' => TRUE, + 'column_name' => 'payout_fee', + ], + 'match' => [ + 'name', + 'custom_group_id', + ], + ], + ], + [ + 'name' => 'CustomGroup_Payment_details_CustomField_payout_net', + 'entity' => 'CustomField', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'custom_group_id.name' => 'Payment_details', + 'name' => 'payout_net', + 'label' => E::ts('Payout Net'), + 'data_type' => 'Float', + 'html_type' => 'Text', + 'text_length' => 255, + 'is_searchable' => TRUE, + 'is_view' => TRUE, + 'column_name' => 'payout_net', + ], + 'match' => [ + 'name', + 'custom_group_id', + ], + ], + ], + [ + 'name' => 'CustomGroup_Payment_details_CustomField_charge_amount', + 'entity' => 'CustomField', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'custom_group_id.name' => 'Payment_details', + 'name' => 'charge_amount', + 'label' => E::ts('Charge Amount'), + 'data_type' => 'Float', + 'html_type' => 'Text', + 'text_length' => 255, + 'is_searchable' => TRUE, + 'is_view' => TRUE, + 'column_name' => 'charge_amount', + ], + 'match' => [ + 'name', + 'custom_group_id', + ], + ], + ], + [ + 'name' => 'CustomGroup_Payment_details_CustomField_charge_currency', + 'entity' => 'CustomField', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'custom_group_id.name' => 'Payment_details', + 'name' => 'charge_currency', + 'label' => E::ts('Charge Currency'), + 'html_type' => 'Text', + 'text_length' => 255, + 'is_searchable' => TRUE, + 'is_view' => TRUE, + 'column_name' => 'charge_currency', + ], + 'match' => [ + 'name', + 'custom_group_id', + ], + ], + ], ]; }