File tree Expand file tree Collapse file tree 3 files changed +25
-24
lines changed Expand file tree Collapse file tree 3 files changed +25
-24
lines changed Original file line number Diff line number Diff line change @@ -12,21 +12,33 @@ public function getName()
1212 return 'Authorize.Net DPM ' ;
1313 }
1414
15+ /**
16+ * Helper to generate the authorize direct-post form.
17+ */
1518 public function authorize (array $ parameters = array ())
1619 {
1720 return $ this ->createRequest ('\Omnipay\AuthorizeNet\Message\DPMAuthorizeRequest ' , $ parameters );
1821 }
1922
23+ /**
24+ * Get, validate, interpret and respond to the Authorize.Net callback.
25+ */
2026 public function completeAuthorize (array $ parameters = array ())
2127 {
2228 return $ this ->createRequest ('\Omnipay\AuthorizeNet\Message\DPMCompleteRequest ' , $ parameters );
2329 }
2430
31+ /**
32+ * Helper to generate the purchase direct-post form.
33+ */
2534 public function purchase (array $ parameters = array ())
2635 {
2736 return $ this ->createRequest ('\Omnipay\AuthorizeNet\Message\DPMPurchaseRequest ' , $ parameters );
2837 }
2938
39+ /**
40+ * Get, validate, interpret and respond to the Authorize.Net callback.
41+ */
3042 public function completePurchase (array $ parameters = array ())
3143 {
3244 return $ this ->createRequest ('\Omnipay\AuthorizeNet\Message\DPMCompleteRequest ' , $ parameters );
Original file line number Diff line number Diff line change 55use Omnipay \AuthorizeNet \Message \SIMAbstractRequest ;
66
77/**
8- * Authorize.Net DPM Authorize Request
8+ * Authorize.Net DPM Authorize Request.
9+ * Takes the data that will be used to create the direct-post form.
910 */
1011class DPMAuthorizeRequest extends SIMAuthorizeRequest
1112{
1213 protected $ action = 'AUTH_ONLY ' ;
1314
14- public function getHash ($ data )
15- {
16- $ fingerprint = implode (
17- '^ ' ,
18- array (
19- $ this ->getApiLoginId (),
20- $ data ['x_fp_sequence ' ],
21- $ data ['x_fp_timestamp ' ],
22- $ data ['x_amount ' ]
23- )
24- ).'^ ' ;
25-
26- // If x_currency_code is specified, then it must follow the final trailing carat.
27- // CHECKME: this may need to be back-ported to SIMAuthorizeRequest and AIMAuthorizeRequest
28- // in order to supprot multiple currencies.
29-
30- if ($ this ->getCurrency ()) {
31- $ fingerprint .= $ this ->getCurrency ();
32- }
33-
34- return hash_hmac ('md5 ' , $ fingerprint , $ this ->getTransactionKey ());
35- }
36-
3715 public function getData ()
3816 {
3917 $ data = parent ::getData ();
Original file line number Diff line number Diff line change @@ -36,6 +36,12 @@ public function getData()
3636 return $ data ;
3737 }
3838
39+ /**
40+ * This hash is put into the form to confirm the amount has not been
41+ * modified en-route.
42+ * It uses the TransactionKey, which is a shared secret between the merchant
43+ * and Authorize.Net The sequence and timestamp provide additional salt.
44+ */
3945 public function getHash ($ data )
4046 {
4147 $ fingerprint = implode (
@@ -48,6 +54,11 @@ public function getHash($data)
4854 )
4955 ).'^ ' ;
5056
57+ // If x_currency_code is specified, then it must follow the final trailing carat.
58+ if ($ this ->getCurrency ()) {
59+ $ fingerprint .= $ this ->getCurrency ();
60+ }
61+
5162 return hash_hmac ('md5 ' , $ fingerprint , $ this ->getTransactionKey ());
5263 }
5364
You can’t perform that action at this time.
0 commit comments