Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mjwshared
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Extensions
mjwshared
Commits
e87adb97
Commit
e87adb97
authored
1 year ago
by
mattwire
Browse files
Options
Downloads
Patches
Plain Diff
Add Payment_details custom group and allow custom fields to be saved via Mjwpayment.create
parent
1129c8ce
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!40
Support for Stripe 6.9 release
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
api/v3/Mjwpayment.php
+14
-7
14 additions, 7 deletions
api/v3/Mjwpayment.php
managed/ProcessPaymentprocessorWebhooks.mgd.php
+0
-0
0 additions, 0 deletions
managed/ProcessPaymentprocessorWebhooks.mgd.php
managed/customdata.mgd.php
+55
-0
55 additions, 0 deletions
managed/customdata.mgd.php
with
69 additions
and
7 deletions
api/v3/Mjwpayment.php
+
14
−
7
View file @
e87adb97
...
...
@@ -183,21 +183,28 @@ function civicrm_api3_mjwpayment_create_payment($params) {
}
}
}
if
(
!
empty
(
$params
[
'payment_processor'
]))
{
// I can't find evidence this is passed in - I was gonna just remove it but decided to deprecate as I see getToFinancialAccount
// also anticipates it.
CRM_Core_Error
::
deprecatedFunctionWarning
(
'passing payment_processor is deprecated - use payment_processor_id'
);
$params
[
'payment_processor_id'
]
=
$params
[
'payment_processor'
];
}
// Check if it is an update
if
(
!
empty
(
$params
[
'id'
]))
{
$amount
=
$params
[
'total_amount'
];
civicrm_api3
(
'Payment'
,
'cancel'
,
$params
);
$params
[
'total_amount'
]
=
$amount
;
}
$trxn
=
CRM_Financial_BAO_Payment
::
create
(
$params
);
$customFields
=
\Civi\Api4\CustomField
::
get
(
FALSE
)
->
addWhere
(
'custom_group_id:name'
,
'='
,
'Payment_details'
)
->
execute
()
->
indexBy
(
'name'
);
foreach
(
$customFields
as
$key
=>
$value
)
{
if
(
isset
(
$params
[
$key
]))
{
$customParams
[
'custom_'
.
$value
[
'id'
]]
=
$params
[
$key
];
}
}
if
(
!
empty
(
$customParams
))
{
$customParams
[
'entity_id'
]
=
$trxn
->
id
;
civicrm_api3
(
'CustomValue'
,
'create'
,
$customParams
);
}
$values
=
[];
_civicrm_api3_object_to_array_unique_fields
(
$trxn
,
$values
[
$trxn
->
id
]);
return
civicrm_api3_create_success
(
$values
,
$params
,
'Payment'
,
'create'
,
$trxn
);
...
...
This diff is collapsed.
Click to expand it.
api/v3/Job
/ProcessPaymentprocessorWebhooks.mgd.php
→
managed
/ProcessPaymentprocessorWebhooks.mgd.php
+
0
−
0
View file @
e87adb97
File moved
This diff is collapsed.
Click to expand it.
managed/customdata.mgd.php
0 → 100644
+
55
−
0
View file @
e87adb97
<?php
use
CRM_Mjwshared_ExtensionUtil
as
E
;
// This enables custom fields for Grant entities
return
[
[
'name'
=>
'cg_extend_objects:FinancialTrxn'
,
'entity'
=>
'OptionValue'
,
'cleanup'
=>
'always'
,
'update'
=>
'always'
,
'params'
=>
[
'version'
=>
4
,
'values'
=>
[
'option_group_id.name'
=>
'cg_extend_objects'
,
'label'
=>
E
::
ts
(
'Financial Transaction (Payment)'
),
'value'
=>
'FinancialTrxn'
,
'name'
=>
'civicrm_financial_trxn'
,
'is_reserved'
=>
TRUE
,
'is_active'
=>
TRUE
,
],
],
],
[
'name'
=>
'CustomGroup_Payment_details'
,
'entity'
=>
'CustomGroup'
,
'cleanup'
=>
'never'
,
'update'
=>
'always'
,
'params'
=>
[
'version'
=>
4
,
'values'
=>
[
'name'
=>
'Payment_details'
,
'title'
=>
E
::
ts
(
'Payment details'
),
'extends'
=>
'FinancialTrxn'
,
'extends_entity_column_id'
=>
NULL
,
'extends_entity_column_value'
=>
NULL
,
'style'
=>
'Inline'
,
'collapse_display'
=>
FALSE
,
'help_pre'
=>
E
::
ts
(
''
),
'help_post'
=>
E
::
ts
(
''
),
'weight'
=>
30
,
'is_active'
=>
TRUE
,
'is_multiple'
=>
FALSE
,
'min_multiple'
=>
NULL
,
'max_multiple'
=>
NULL
,
'collapse_adv_display'
=>
TRUE
,
'is_reserved'
=>
FALSE
,
'is_public'
=>
TRUE
,
'icon'
=>
''
,
],
'match'
=>
[
'name'
,
],
],
],
];
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment