Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
commerce_datatrans-3507218
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
commerce_datatrans-3507218
Commits
5bcd35b6
Commit
5bcd35b6
authored
8 years ago
by
Sascha Grossenbacher
Browse files
Options
Downloads
Patches
Plain Diff
Create and assign payment method to order, fix payment remote id
parent
9e295147
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Plugin/Commerce/PaymentGateway/Datatrans.php
+8
-3
8 additions, 3 deletions
src/Plugin/Commerce/PaymentGateway/Datatrans.php
with
8 additions
and
3 deletions
src/Plugin/Commerce/PaymentGateway/Datatrans.php
+
8
−
3
View file @
5bcd35b6
...
...
@@ -215,7 +215,6 @@ class Datatrans extends OffsitePaymentGatewayBase {
}
$this
->
processPayment
(
$post_data
,
$order
);
drupal_set_message
(
$this
->
t
(
'Payment was processed successfully'
));
}
/**
...
...
@@ -327,7 +326,7 @@ class Datatrans extends OffsitePaymentGatewayBase {
'payment_gateway'
=>
$this
->
entityId
,
'order_id'
=>
$order
->
id
(),
'test'
=>
$this
->
getMode
()
==
'test'
,
'remote_id'
=>
$post_data
[
'
authorizationCode
'
],
'remote_id'
=>
$post_data
[
'
uppTransactionId
'
],
'remote_state'
=>
$post_data
[
'responseMessage'
],
'authorized'
=>
REQUEST_TIME
,
]);
...
...
@@ -336,7 +335,9 @@ class Datatrans extends OffsitePaymentGatewayBase {
// Create a payment method if we use alias.
// @todo Figure out if that's the right approach indeed.
if
(
$post_data
[
'useAlias'
]
===
'true'
)
{
$this
->
createPaymentMethod
(
$post_data
);
$payment_method
=
$this
->
createPaymentMethod
(
$post_data
);
$order
->
set
(
'payment_method'
,
$payment_method
);
$order
->
save
();
}
return
$payment
;
...
...
@@ -350,6 +351,9 @@ class Datatrans extends OffsitePaymentGatewayBase {
*
* @param array $payment_details
* Array of payment details we get from Datatrans.
*
* @return \Drupal\commerce_payment\Entity\PaymentMethodInterface
* The created payment method.
*/
public
function
createPaymentMethod
(
array
$payment_details
)
{
$payment_method
=
PaymentMethod
::
create
([
...
...
@@ -366,6 +370,7 @@ class Datatrans extends OffsitePaymentGatewayBase {
$payment_method
->
setRemoteId
(
$payment_details
[
'aliasCC'
]);
$payment_method
->
setExpiresTime
(
$expires
);
$payment_method
->
save
();
return
$payment_method
;
}
/**
...
...
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