Completed
Pull Request — master (#5)
by Michael
06:11
created

PurchaseRequest::setGiftCardCount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Omnipay\Redsys\Message;
4
5
use DateTime;
6
use Omnipay\Common\Message\AbstractRequest;
7
8
/**
9
 * Redsys Purchase Request
10
 */
11
class PurchaseRequest extends AbstractRequest
12
{
13
    /** @var string */
14
    protected $liveEndpoint = 'https://sis.redsys.es/sis/realizarPago';
15
    /** @var string */
16
    protected $testEndpoint = 'https://sis-t.redsys.es:25443/sis/realizarPago';
17
    /** @var array */
18
    protected static $consumerLanguages = array(
19
        'es' => '001', // Spanish
20
        'en' => '002', // English
21
        'ca' => '003', // Catalan - same as Valencian (010)
22
        'fr' => '004', // French
23
        'de' => '005', // German
24
        'nl' => '006', // Dutch
25
        'it' => '007', // Italian
26
        'sv' => '008', // Swedish
27
        'pt' => '009', // Portuguese
28
        'pl' => '011', // Polish
29
        'gl' => '012', // Galician
30
        'eu' => '013', // Basque
31
    );
32 2
33
    /** @var stirng 250x400 */
34 2
    const CHALLENGE_WINDOW_SIZE_250x400 = "01";
35
    /** @var stirng 390x400 */
36
    const CHALLENGE_WINDOW_SIZE_390x400 = "02";
37 4
    /** @var stirng 500x600 */
38
    const CHALLENGE_WINDOW_SIZE_500x600 = "03";
39 4
    /** @var stirng 600x400 */
40
    const CHALLENGE_WINDOW_SIZE_600x400 = "04";
41
    /** @var stirng Fullscreen window (default) */
42 8
    const CHALLENGE_WINDOW_SIZE_FULLSCREEN = "05";
43
44 8
    /** @var string No 3DS Requestor authentication occurred (i.e. cardholder logged in as guest) */
45
    const ACCOUNT_AUTHENTICATION_METHOD_NONE = "01";
46
    /** @var string Login to the cardholder account at the 3DS Requestor system using 3DS Requestor's own credentials */
47
    const ACCOUNT_AUTHENTICATION_METHOD_OWN_CREDENTIALS = "02";
48
    /** @var string Login to the cardholder account at the 3DS Requestor system using federated ID */
49
    const ACCOUNT_AUTHENTICATION_METHOD_FEDERATED_ID = "03";
50
    /** @var string Login to the cardholder account at the 3DS Requestor system using issuer credentials */
51
    const ACCOUNT_AUTHENTICATION_METHOD_ISSUER_CREDENTIALS = "04";
52 7
    /** @var string Login to the cardholder account at the 3DS Requestor system using third-party authentication */
53
    const ACCOUNT_AUTHENTICATION_METHOD_THIRD_PARTY_AUTHENTICATION = "05";
54 7
    /** @var string Login to the cardholder account at the 3DS Requestor system using FIDO Authenticator */
55 1
    const ACCOUNT_AUTHENTICATION_METHOD_FIDO = "06";
56 1
57 1
    /** @var string No account (guest check-out) */
58 1
    const CUSTOMER_ACCOUNT_CREATED_NONE = "01";
59 7
    /** @var string Created during this transaction */
60 7
    const CUSTOMER_ACCOUNT_CREATED_THIS_TRANSACTION = "02";
61 7
    /** @var string Less than 30 days */
62
    const CUSTOMER_ACCOUNT_CREATED_LAST_30_DAYS = "03";
63 7
    /** @var string Between 30 and 60 days */
64
    const CUSTOMER_ACCOUNT_CREATED_LAST_60_DAYS = "04";
65
    /** @var string More than 60 day */
66 15
    const CUSTOMER_ACCOUNT_CREATED_MORE_THAN_60_DAYS = "05";
67
68 15
    /** @var string Modified in this session */
69
    const CUSTOMER_ACCOUNT_MODIFIED_THIS_TRANSACTION = "01";
70
    /** @var string Less than 30 days */
71 23
    const CUSTOMER_ACCOUNT_MODIFIED_LAST_30_DAYS = "02";
72
    /** @var string Between 30 and 60 days */
73 23
    const CUSTOMER_ACCOUNT_MODIFIED_LAST_60_DAYS = "03";
74
    /** @var string More than 60 day */
75
    const CUSTOMER_ACCOUNT_MODIFIED_MORE_THAN_60_DAYS = "04";
76 7
77
    /** @var string Unchanged */
78 7
    const CUSTOMER_ACCOUNT_PASSWORD_MODIFIED_NONE = "01";
79
    /** @var string Modified in this session */
80
    const CUSTOMER_ACCOUNT_PASSWORD_MODIFIED_THIS_TRANSACTION = "02";
81 7
    /** @var string Less than 30 days */
82
    const CUSTOMER_ACCOUNT_PASSWORD_MODIFIED_LAST_30_DAYS = "03";
83 7
    /** @var string Between 30 and 60 days */
84
    const CUSTOMER_ACCOUNT_PASSWORD_MODIFIED_LAST_60_DAYS = "04";
85
    /** @var string More than 60 day */
86 11
    const CUSTOMER_ACCOUNT_PASSWORD_MODIFIED_MORE_THAN_60_DAYS = "05";
87
88 11
    /** @var string No account (guest check-out) */
89
    const PAYMENT_METHOD_CREATED_NONE = "01";
90
    /** @var string Created during this transaction */
91 23
    const PAYMENT_METHOD_CREATED_THIS_TRANSACTION = "02";
92
    /** @var string Less than 30 days */
93 23
    const PAYMENT_METHOD_CREATED_LAST_30_DAYS = "03";
94
    /** @var string Between 30 and 60 days */
95
    const PAYMENT_METHOD_CREATED_LAST_60_DAYS = "04";
96 11
    /** @var string More than 60 day */
97
    const PAYMENT_METHOD_CREATED_MORE_THAN_60_DAYS = "05";
98 11
99
    /** @var string For the first time */
100
    const SHIPPING_ADDRESS_USAGE_THIS_TRANSACTION = "01";
101 23
    /** @var string Less than 30 days */
102
    const SHIPPING_ADDRESS_USAGE_LAST_30_DAYS = "02";
103 23
    /** @var string Between 30 and 60 days */
104
    const SHIPPING_ADDRESS_USAGE_LAST_60_DAYS = "03";
105
    /** @var string More than 60 day */
106 11
    const SHIPPING_ADDRESS_USAGE_MORE_THAN_60_DAYS = "04";
107
108 11
    /** @var string Electronic delivery */
109
    const DELIVERY_TIMEFRAME_ELECTRONIC_DELIVERY = "01";
110
    /** @var string Same day shipping */
111 23
    const DELIVERY_TIMEFRAME_SAME_DAY = "02";
112
    /** @var string Next day shipping */
113 23
    const DELIVERY_TIMEFRAME_NEXT_DAY = "03";
114
    /** @var string Shipping in 2 or more days */
115
    const DELIVERY_TIMEFRAME_2_OR_MORE_DAYS = "04";
116
117
    /** @var string Ship to cardholder's billing address */
118
    const SHIPPING_TO_BILLING_ADDRESS = "01";
119
    /** @var string Ship to another verified address on file with merchant */
120
    const SHIPPING_TO_ANOTHER_VERIFIED_ADDRESS = "02";
121 15
    /** @var string Ship to address that is different than the cardholder's billing address */
122
    const SHIPPING_DIFFERENT_BILLING_ADDRESS = "03";
123 15
    /** @var string Pick-up at local store (Store address shall be populated in shipping address fields) */
124 15
    const SHIPPING_PICK_UP = "04";
125 15
    /** @var string Digital goods (includes online services, electronic gift cards and redemption codes) */
126 15
    const SHIPPING_DIGITAL = "05";
127 15
    /** @var string Travel and Event tickets, not shipped */
128 15
    const SHIPPING_TRAVEL = "06";
129 15
    /** @var string Other (for example, Gaming, digital services not shipped, emedia subscriptions, etc.) */
130
    const SHIPPING_OTHER = "07";
131 15
132 15
    public function getCardholder()
133
    {
134 15
        return $this->getParameter('cardholder');
135 15
    }
136
137 2
    public function setCardholder($value)
138
    {
139 2
        return $this->setParameter('cardholder', $value);
140
    }
141
142
    public function getConsumerLanguage()
143 2
    {
144 2
        return $this->getParameter('consumerLanguage');
145 2
    }
146 2
147 2
    /**
148 2
     * Set the language presented to the consumer
149 2
     *
150
     * @param string|int Either the ISO 639-1 code to be converted, or the gateway's own numeric language code
151 2
     */
152 2
    public function setConsumerLanguage($value)
153 2
    {
154 2
        if (is_int($value)) {
155 2
            if ($value < 0 || $value > 13) {
156 2
                $value = 1;
157 2
            }
158 2
            $value = str_pad($value, 3, '0', STR_PAD_LEFT);
159
        } elseif (!is_numeric($value)) {
160
            $value = isset(self::$consumerLanguages[$value]) ? self::$consumerLanguages[$value] : '001';
161 1
        }
162
163 1
        return $this->setParameter('consumerLanguage', $value);
164
    }
165 1
166
    public function getHmacKey()
167
    {
168 1
        return $this->getParameter('hmacKey');
169 1
    }
170 1
171 1
    public function setHmacKey($value)
172 1
    {
173 1
        return $this->setParameter('hmacKey', $value);
174 1
    }
175 1
176
    public function getMerchantData()
177 1
    {
178
        return $this->getParameter('merchantData');
179
    }
180 7
181
    public function setMerchantData($value)
182 7
    {
183
        return $this->setParameter('merchantData', $value);
184
    }
185 1
186
    public function getMerchantId()
187
    {
188
        return $this->getParameter('merchantId');
189
    }
190
191
    public function setMerchantId($value)
192
    {
193
        return $this->setParameter('merchantId', $value);
194
    }
195
196
    public function getMerchantName()
197
    {
198
        return $this->getParameter('merchantName');
199
    }
200
201
    public function setMerchantName($value)
202
    {
203
        return $this->setParameter('merchantName', $value);
204
    }
205
206
    public function getTerminalId()
207
    {
208
        return $this->getParameter('terminalId');
209
    }
210
211
    public function setTerminalId($value)
212
    {
213
        return $this->setParameter('terminalId', $value);
214
    }
215
216
217
    /**
218
     * Get the email field
219
     *
220
     * Corresponds to the Ds_Merchant_Emv3Ds.email field in Redsys documentation.
221
     *
222
     * @return string
223
     */
224
    public function getEmail()
225
    {
226
        return $this->getParameter('email');
227
    }
228
229
    /**
230
     * Set the email field
231
     *
232
     * Corresponds to the Ds_Merchant_Emv3Ds.email field in Redsys documentation.
233
     *
234
     * @param string $value
235
     * @return self
236
     */
237
    public function setEmail($value)
238
    {
239
        return $this->setParameter('email', $value);
240
    }
241
242
    /**
243
     * Get the homePhoneCountryPrefix field
244
     *
245
     * Corresponds to the Ds_Merchant_Emv3Ds.homePhone.cc field in Redsys documentation.
246
     *
247
     * @return string
248
     */
249
    public function getHomePhoneCountryPrefix()
250
    {
251
        return $this->getParameter('homePhoneCountryPrefix');
252
    }
253
    
254
    /**
255
     * Set the homePhoneCountryPrefix field
256
     *
257
     * Corresponds to the Ds_Merchant_Emv3Ds.homePhone.cc field in the Redsys documentation.
258
     *
259
     * @param string $value
260
     * @return self
261
     */
262
    public function setHomePhoneCountryPrefix($value)
263
    {
264
        return $this->setParameter('homePhoneCountryPrefix', $value);
265
    }
266
    
267
    /**
268
     * Get the homePhone field
269
     *
270
     * Corresponds to the Ds_Merchant_Emv3Ds.homePhone.subscriber field in Redsys documentation.
271
     *
272
     * @return string
273
     */
274
    public function getHomePhone()
275
    {
276
        return $this->getParameter('homePhone');
277
    }
278
    
279
    /**
280
     * Set the homePhone field
281
     *
282
     * Corresponds to the Ds_Merchant_Emv3Ds.homePhone.subscriber field in the Redsys documentation.
283
     *
284
     * @param string $value
285
     * @return self
286
     */
287
    public function setHomePhone($value)
288
    {
289
        return $this->setParameter('homePhone', $value);
290
    }
291
    
292
    /**
293
     * Get the mobilePhoneCountryPrefix field
294
     *
295
     * Corresponds to the Ds_Merchant_Emv3Ds.mobilePhone.cc field in Redsys documentation.
296
     *
297
     * @return string
298
     */
299
    public function getMobilePhoneCountryPrefix()
300
    {
301
        return $this->getParameter('mobilePhoneCountryPrefix');
302
    }
303
    
304
    /**
305
     * Set the mobilePhoneCountryPrefix field
306
     *
307
     * Corresponds to the Ds_Merchant_Emv3Ds.mobilePhone.cc field in the Redsys documentation.
308
     *
309
     * @param string $value
310
     * @return self
311
     */
312
    public function setMobilePhoneCountryPrefix($value)
313
    {
314
        return $this->setParameter('mobilePhoneCountryPrefix', $value);
315
    }
316
    
317
    /**
318
     * Get the mobilePhone field
319
     *
320
     * Corresponds to the Ds_Merchant_Emv3Ds.mobilePhone.subscriber field in Redsys documentation.
321
     *
322
     * @return string
323
     */
324
    public function getMobilePhone()
325
    {
326
        return $this->getParameter('mobilePhone');
327
    }
328
    
329
    /**
330
     * Set the mobilePhone field
331
     *
332
     * Corresponds to the Ds_Merchant_Emv3Ds.mobilePhone.subscriber field in the Redsys documentation.
333
     *
334
     * @param string $value
335
     * @return self
336
     */
337
    public function setMobilePhone($value)
338
    {
339
        return $this->setParameter('mobilePhone', $value);
340
    }
341
    
342
    /**
343
     * Get the workPhoneCountryPrefix field
344
     *
345
     * Corresponds to the Ds_Merchant_Emv3Ds.workPhone.cc field in Redsys documentation.
346
     *
347
     * @return string
348
     */
349
    public function getWorkPhoneCountryPrefix()
350
    {
351
        return $this->getParameter('workPhoneCountryPrefix');
352
    }
353
    
354
    /**
355
     * Set the workPhoneCountryPrefix field
356
     *
357
     * Corresponds to the Ds_Merchant_Emv3Ds.workPhone.cc field in the Redsys documentation.
358
     *
359
     * @param string $value
360
     * @return self
361
     */
362
    public function setWorkPhoneCountryPrefix($value)
363
    {
364
        return $this->setParameter('workPhoneCountryPrefix', $value);
365
    }
366
    
367
    /**
368
     * Get the workPhone field
369
     *
370
     * Corresponds to the Ds_Merchant_Emv3Ds.workPhone.subscriber field in Redsys documentation.
371
     *
372
     * @return string
373
     */
374
    public function getWorkPhone()
375
    {
376
        return $this->getParameter('workPhone');
377
    }
378
    
379
    /**
380
     * Set the workPhone field
381
     *
382
     * Corresponds to the Ds_Merchant_Emv3Ds.workPhone.subscriber field in the Redsys documentation.
383
     *
384
     * @param string $value
385
     * @return self
386
     */
387
    public function setWorkPhone($value)
388
    {
389
        return $this->setParameter('workPhone', $value);
390
    }
391
392
    /**
393
     * Get the shippingAddress1 field
394
     *
395
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrLine1 field in the Redsys documentation.
396
     *
397
     * @return string
398
     */
399
    public function getShippingAddress1()
400
    {
401
        return $this->getParameter('shippingAddress1');
402
    }
403
404
    /**
405
     * Set the shippingAddress1 field
406
     *
407
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrLine1 field in the Redsys documentation.
408
     *
409
     * @param string $value
410
     * @return self
411
     */
412
    public function setShippingAddress1($value)
413
    {
414
        return $this->setParameter('shippingAddress1', $value);
415
    }
416
417
    /**
418
     * Get the shippingAddress2 field
419
     *
420
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrLine2 field in the Redsys documentation.
421
     *
422
     * @return string
423
     */
424
    public function getShippingAddress2()
425
    {
426
        return $this->getParameter('shippingAddress2');
427
    }
428
429
    /**
430
     * Set the shippingAddress2 field
431
     *
432
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrLine2 field in the Redsys documentation.
433
     *
434
     * @param string $value
435
     * @return self
436
     */
437
    public function setShippingAddress2($value)
438
    {
439
        return $this->setParameter('shippingAddress2', $value);
440
    }
441
442
    /**
443
     * Get the shippingAddress3 field
444
     *
445
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrLine3 field in the Redsys documentation.
446
     *
447
     * @return string
448
     */
449
    public function getShippingAddress3()
450
    {
451
        return $this->getParameter('shippingAddress3');
452
    }
453
454
    /**
455
     * Set the shippingAddress3 field
456
     *
457
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrLine3 field in the Redsys documentation.
458
     *
459
     * @param string $value
460
     * @return self
461
     */
462
    public function setShippingAddress3($value)
463
    {
464
        return $this->setParameter('shippingAddress3', $value);
465
    }
466
467
    /**
468
     * Get the shippingCity field
469
     *
470
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrCity field in the Redsys documentation.
471
     *
472
     * @return string
473
     */
474
    public function getShippingCity()
475
    {
476
        return $this->getParameter('shippingCity');
477
    }
478
479
    /**
480
     * Set the shippingCity field
481
     *
482
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrCity field in the Redsys documentation.
483
     *
484
     * @param string $value The shipping state as an ISO3166-2 subdivision code, e.g. CA for California.
485
     * @return self
486
     */
487
    public function setShippingCity($value)
488
    {
489
        return $this->setParameter('shippingCity', $value);
490
    }
491
492
    /**
493
     * Get the shippingPostcode field
494
     *
495
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrPostCode field in the Redsys documentation.
496
     *
497
     * @return string
498
     */
499
    public function getShippingPostcode()
500
    {
501
        return $this->getParameter('shippingPostcode');
502
    }
503
504
    /**
505
     * Set the shippingPostcode field
506
     *
507
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrPostCode field in the Redsys documentation.
508
     *
509
     * @param string $value
510
     * @return self
511
     */
512
    public function setShippingPostcode($value)
513
    {
514
        return $this->setParameter('shippingPostcode', $value);
515
    }
516
517
    /**
518
     * Get the shippingState field
519
     *
520
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrState field in the Redsys documentation.
521
     *
522
     * @return string The shipping state as an ISO3166-2 subdivision code, e.g. CA for California.
523
     */
524
    public function getShippingState()
525
    {
526
        return $this->getParameter('shippingState');
527
    }
528
529
    /**
530
     * Set the shippingState field
531
     *
532
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrState field in the Redsys documentation.
533
     *
534
     * @param string $value
535
     * @return self
536
     */
537
    public function setShippingState($value)
538
    {
539
        return $this->setParameter('shippingState', $value);
540
    }
541
542
    /**
543
     * Get the shippingCountry field
544
     *
545
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrCountry field in the Redsys documentation.
546
     *
547
     * @return int The shipping country as an ISO3166 numeric code, e.g. 840 for USA.
548
     */
549
    public function getShippingCountry()
550
    {
551
        return $this->getParameter('shippingCountry');
552
    }
553
554
    /**
555
     * Set the shippingCountry field
556
     *
557
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrCountry field in the Redsys documentation.
558
     *
559
     * @param int $value The shipping country as an ISO3166 numeric code, e.g. 840 for USA.
560
     * @return self
561
     */
562
    public function setShippingCountry($value)
563
    {
564
        return $this->setParameter('shippingCountry', $value);
565
    }
566
    
567
    /**
568
     * Get the billingAddress1 field
569
     *
570
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrLine1 field in the Redsys documentation.
571
     *
572
     * @return string
573
     */
574
    public function getBillingAddress1()
575
    {
576
        return $this->getParameter('billingAddress1');
577
    }
578
579
    /**
580
     * Set the billingAddress1 field
581
     *
582
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrLine1 field in the Redsys documentation.
583
     *
584
     * @param string $value
585
     * @return self
586
     */
587
    public function setBillingAddress1($value)
588
    {
589
        return $this->setParameter('billingAddress1', $value);
590
    }
591
592
    /**
593
     * Get the billingAddress2 field
594
     *
595
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrLine2 field in the Redsys documentation.
596
     *
597
     * @return string
598
     */
599
    public function getBillingAddress2()
600
    {
601
        return $this->getParameter('billingAddress2');
602
    }
603
604
    /**
605
     * Set the billingAddress2 field
606
     *
607
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrLine2 field in the Redsys documentation.
608
     *
609
     * @param string $value
610
     * @return self
611
     */
612
    public function setBillingAddress2($value)
613
    {
614
        return $this->setParameter('billingAddress2', $value);
615
    }
616
617
    /**
618
     * Get the billingAddress3 field
619
     *
620
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrLine3 field in the Redsys documentation.
621
     *
622
     * @return string
623
     */
624
    public function getBillingAddress3()
625
    {
626
        return $this->getParameter('billingAddress3');
627
    }
628
629
    /**
630
     * Set the billingAddress3 field
631
     *
632
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrLine3 field in the Redsys documentation.
633
     *
634
     * @param string $value
635
     * @return self
636
     */
637
    public function setBillingAddress3($value)
638
    {
639
        return $this->setParameter('billingAddress3', $value);
640
    }
641
642
    /**
643
     * Get the billingCity field
644
     *
645
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrCity field in the Redsys documentation.
646
     *
647
     * @return string
648
     */
649
    public function getBillingCity()
650
    {
651
        return $this->getParameter('billingCity');
652
    }
653
654
    /**
655
     * Set the billingCity field
656
     *
657
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrCity field in the Redsys documentation.
658
     *
659
     * @param string $value The billing state as an ISO3166-2 subdivision code, e.g. CA for California.
660
     * @return self
661
     */
662
    public function setBillingCity($value)
663
    {
664
        return $this->setParameter('billingCity', $value);
665
    }
666
667
    /**
668
     * Get the billingPostcode field
669
     *
670
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrPostCode field in the Redsys documentation.
671
     *
672
     * @return string
673
     */
674
    public function getBillingPostcode()
675
    {
676
        return $this->getParameter('billingPostcode');
677
    }
678
679
    /**
680
     * Set the billingPostcode field
681
     *
682
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrPostCode field in the Redsys documentation.
683
     *
684
     * @param string $value
685
     * @return self
686
     */
687
    public function setBillingPostcode($value)
688
    {
689
        return $this->setParameter('billingPostcode', $value);
690
    }
691
692
    /**
693
     * Get the billingState field
694
     *
695
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrState field in the Redsys documentation.
696
     *
697
     * @return string The billing state as an ISO3166-2 subdivision code, e.g. CA for California.
698
     */
699
    public function getBillingState()
700
    {
701
        return $this->getParameter('billingState');
702
    }
703
704
    /**
705
     * Set the billingState field
706
     *
707
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrState field in the Redsys documentation.
708
     *
709
     * @param string $value
710
     * @return self
711
     */
712
    public function setBillingState($value)
713
    {
714
        return $this->setParameter('billingState', $value);
715
    }
716
717
    /**
718
     * Get the billingCountry field
719
     *
720
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrCountry field in the Redsys documentation.
721
     *
722
     * @return int The billing country as an ISO3166 numeric code, e.g. 840 for USA.
723
     */
724
    public function getBillingCountry()
725
    {
726
        return $this->getParameter('billingCountry');
727
    }
728
729
    /**
730
     * Set the billingCountry field
731
     *
732
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrCountry field in the Redsys documentation.
733
     *
734
     * @param int $value The billing country as an ISO3166 numeric code, e.g. 840 for USA.
735
     * @return self
736
     */
737
    public function setBillingCountry($value)
738
    {
739
        return $this->setParameter('billingCountry', $value);
740
    }
741
742
    /**
743
     * Get the addressMatch field
744
     *
745
     * Corresponds to the Ds_Merchant_Emv3Ds.addrMatch field in Redsys documentation.
746
     *
747
     * @return boolean
748
     */
749
    public function getAddressMatch()
750
    {
751
        return $this->getParameter('addressMatch');
752
    }
753
    
754
    /**
755
     * Set the addressMatch field
756
     *
757
     * Corresponds to the Ds_Merchant_Emv3Ds.addrMatch field in the Redsys documentation.
758
     *
759
     * @param boolean $value
760
     * @return self
761
     */
762
    public function setAddressMatch($value)
763
    {
764
        return $this->setParameter('addressMatch', $value);
765
    }
766
767
    /**
768
     * Get the challengeWindowSize field
769
     *
770
     * Corresponds to the Ds_Merchant_Emv3Ds.challengeWindowSize field in Redsys documentation.
771
     *
772
     * @return int One of the self::CHALLENGE_WINDOW_SIZE_* constants
773
     */
774
    public function getChallengeWindowSize()
775
    {
776
        return $this->getParameter('challengeWindowSize');
777
    }
778
    
779
    /**
780
     * Set the challengeWindowSize field
781
     *
782
     * Corresponds to the Ds_Merchant_Emv3Ds.challengeWindowSize field in the Redsys documentation.
783
     *
784
     * @param int $value One of the self::CHALLENGE_WINDOW_SIZE_* constants
785
     * @return self
786
     */
787
    public function setChallengeWindowSize($value)
788
    {
789
        return $this->setParameter('challengeWindowSize', $value);
790
    }
791
    
792
    /**
793
     * Get the customerAdditionalInformation field
794
     *
795
     * Corresponds to the Ds_Merchant_Emv3Ds.acctID field in Redsys documentation.
796
     *
797
     * @return string
798
     */
799
    public function getCustomerAdditionalInformation()
800
    {
801
        return $this->getParameter('customerAdditionalInformation');
802
    }
803
    
804
    /**
805
     * Set the customerAdditionalInformation field
806
     *
807
     * Corresponds to the Ds_Merchant_Emv3Ds.acctID field in the Redsys documentation.
808
     *
809
     * @param string $value
810
     * @return self
811
     */
812
    public function setCustomerAdditionalInformation($value)
813
    {
814
        return $this->setParameter('customerAdditionalInformation', $value);
815
    }
816
    
817
    /**
818
     * Get the 3DsRequestAuthenticationMethodData field
819
     *
820
     * Corresponds to the Ds_Merchant_Emv3Ds.threeDSRequestorAuthenticationInfo.threeDSReqAuthData field in Redsys documentation.
821
     *
822
     * @return string
823
     */
824
    public function get3DsRequestAuthenticationMethodData()
825
    {
826
        return $this->getParameter('3DsRequestAuthenticationMethodData');
827
    }
828
    
829
    /**
830
     * Set the 3DsRequestAuthenticationMethodData field
831
     *
832
     * Corresponds to the Ds_Merchant_Emv3Ds.threeDSRequestorAuthenticationInfo.threeDSReqAuthData field in the Redsys documentation.
833
     *
834
     * @param string $value
835
     * @return self
836
     */
837
    public function set3DsRequestAuthenticationMethodData($value)
838
    {
839
        return $this->setParameter('3DsRequestAuthenticationMethodData', $value);
840
    }
841
    
842
    /**
843
     * Get the 3DsRequestAuthenticationMethod field
844
     *
845
     * Corresponds to the Ds_Merchant_Emv3Ds.threeDSRequestorAuthenticationInfo.threeDSReqAuthMethod field in Redsys documentation.
846
     *
847
     * @return int One of the self::ACCOUNT_AUTHENTICATION_METHOD_* constants.
848
     */
849
    public function get3DsRequestAuthenticationMethod()
850
    {
851
        return $this->getParameter('3DsRequestAuthenticationMethod');
852
    }
853
    
854
    /**
855
     * Set the 3DsRequestAuthenticationMethod field
856
     *
857
     * Corresponds to the Ds_Merchant_Emv3Ds.threeDSRequestorAuthenticationInfo.threeDSReqAuthMethod field in the Redsys documentation.
858
     *
859
     * @param int $value One of the self::ACCOUNT_AUTHENTICATION_METHOD_* constants.
860
     * @return self
861
     */
862
    public function set3DsRequestAuthenticationMethod($value)
863
    {
864
        return $this->setParameter('3DsRequestAuthenticationMethod', $value);
865
    }
866
    
867
    /**
868
     * Get the 3DsRequestAuthenticationTime field
869
     *
870
     * Corresponds to the Ds_Merchant_Emv3Ds.threeDSRequestorAuthenticationInfo.threeDSReqAuthTimestamp field in Redsys documentation.
871
     *
872
     * @return DateTime|int
873
     */
874
    public function get3DsRequestAuthenticationTime()
875
    {
876
        return $this->getParameter('3DsRequestAuthenticationTime');
877
    }
878
    
879
    /**
880
     * Set the 3DsRequestAuthenticationTime field
881
     *
882
     * Corresponds to the Ds_Merchant_Emv3Ds.threeDSRequestorAuthenticationInfo.threeDSReqAuthTimestamp field in the Redsys documentation.
883
     *
884
     * @param DateTime|int $value
885
     * @return self
886
     */
887
    public function set3DsRequestAuthenticationTime($value)
888
    {
889
        return $this->setParameter('3DsRequestAuthenticationTime', $value);
890
    }
891
    
892
    /**
893
     * Get the customerAccountCreationIndicator field
894
     *
895
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccAgeInd field in Redsys documentation.
896
     *
897
     * @return int CUSTOMER_ACCOUNT_CREATED_*
898
     */
899
    public function getCustomerAccountCreationIndicator()
900
    {
901
        return $this->getParameter('customerAccountCreationIndicator');
902
    }
903
    
904
    /**
905
     * Set the customerAccountCreationIndicator field
906
     *
907
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccAgeInd field in the Redsys documentation.
908
     *
909
     * @param int $value CUSTOMER_ACCOUNT_CREATED_*
910
     * @return self
911
     */
912
    public function setCustomerAccountCreationIndicator($value)
913
    {
914
        return $this->setParameter('customerAccountCreationIndicator', $value);
915
    }
916
    
917
    /**
918
     * Get the customerAccountCreationDate field
919
     *
920
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccDate field in Redsys documentation.
921
     *
922
     * @return DateTime|int
923
     */
924
    public function getCustomerAccountCreationDate()
925
    {
926
        return $this->getParameter('customerAccountCreationDate');
927
    }
928
    
929
    /**
930
     * Set the customerAccountCreationDate field
931
     *
932
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccDate field in the Redsys documentation.
933
     *
934
     * @param DateTime|int $value
935
     * @return self
936
     */
937
    public function setCustomerAccountCreationDate($value)
938
    {
939
        return $this->setParameter('customerAccountCreationDate', $value);
940
    }
941
    
942
    /**
943
     * Get the customerAccountModificationIndicator field
944
     *
945
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccChangeInd field in Redsys documentation.
946
     *
947
     * @return int CUSTOMER_ACCOUNT_MODIFIED_*
948
     */
949
    public function getCustomerAccountModificationIndicator()
950
    {
951
        return $this->getParameter('customerAccountModificationIndicator');
952
    }
953
    
954
    /**
955
     * Set the customerAccountModificationIndicator field
956
     *
957
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccChangeInd field in the Redsys documentation.
958
     *
959
     * @param int $value CUSTOMER_ACCOUNT_MODIFIED_*
960
     * @return self
961
     */
962
    public function setCustomerAccountModificationIndicator($value)
963
    {
964
        return $this->setParameter('customerAccountModificationIndicator', $value);
965
    }
966
967
    /**
968
     * Get the customerAccountModificationDate field
969
     *
970
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccChange field in Redsys documentation.
971
     *
972
     * @return DateTime|int
973
     */
974
    public function getCustomerAccountModificationDate()
975
    {
976
        return $this->getParameter('customerAccountModificationDate');
977
    }
978
    
979
    /**
980
     * Set the customerAccountModificationDate field
981
     *
982
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccChange field in the Redsys documentation.
983
     *
984
     * @param DateTime|int $value
985
     * @return self
986
     */
987
    public function setCustomerAccountModificationDate($value)
988
    {
989
        return $this->setParameter('customerAccountModificationDate', $value);
990
    }
991
    
992
    /**
993
     * Get the customerPasswordAgeIndicator field
994
     *
995
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccPwChangeInd field in Redsys documentation.
996
     *
997
     * @return int CUSTOMER_ACCOUNT_PASSWORD_MODIFIED_*
998
     */
999
    public function getCustomerPasswordModificationIndicator()
1000
    {
1001
        return $this->getParameter('customerPasswordAgeIndicator');
1002
    }
1003
    
1004
    /**
1005
     * Set the customerPasswordAgeIndicator field
1006
     *
1007
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccPwChangeInd field in the Redsys documentation.
1008
     *
1009
     * @param int $value CUSTOMER_ACCOUNT_PASSWORD_MODIFIED_*
1010
     * @return self
1011
     */
1012
    public function setCustomerPasswordModificationIndicator($value)
1013
    {
1014
        return $this->setParameter('customerPasswordAgeIndicator', $value);
1015
    }
1016
1017
    /**
1018
     * Get the customerPasswordModificationDate field
1019
     *
1020
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccPwChange field in Redsys documentation.
1021
     *
1022
     * @return DateTime|int
1023
     */
1024
    public function getCustomerPasswordModificationDate()
1025
    {
1026
        return $this->getParameter('customerPasswordModificationDate');
1027
    }
1028
    
1029
    /**
1030
     * Set the customerPasswordModificationDate field
1031
     *
1032
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccPwChange field in the Redsys documentation.
1033
     *
1034
     * @param DateTime|int $value
1035
     * @return self
1036
     */
1037
    public function setCustomerPasswordModificationDate($value)
1038
    {
1039
        return $this->setParameter('customerPasswordModificationDate', $value);
1040
    }
1041
    
1042
    /**
1043
     * Get the customerPurchasesInLast6Months field
1044
     *
1045
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.nbPurchaseAccount field in Redsys documentation.
1046
     *
1047
     * @return int
1048
     */
1049
    public function getCustomerPurchasesInLast6Months()
1050
    {
1051
        return $this->getParameter('customerPurchasesInLast6Months');
1052
    }
1053
    
1054
    /**
1055
     * Set the customerPurchasesInLast6Months field
1056
     *
1057
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.nbPurchaseAccount field in the Redsys documentation.
1058
     *
1059
     * @param int $value
1060
     * @return self
1061
     */
1062
    public function setCustomerPurchasesInLast6Months($value)
1063
    {
1064
        return $this->setParameter('customerPurchasesInLast6Months', $value);
1065
    }
1066
    
1067
    /**
1068
     * Get the customerAccountCardProvisionsLast24Hours field
1069
     *
1070
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.provisionAttemptsDay field in Redsys documentation.
1071
     *
1072
     * @return int
1073
     */
1074
    public function getCustomerAccountCardProvisionsLast24Hours()
1075
    {
1076
        return $this->getParameter('customerAccountCardProvisionsLast24Hours');
1077
    }
1078
    
1079
    /**
1080
     * Set the customerAccountCardProvisionsLast24Hours field
1081
     *
1082
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.provisionAttemptsDay field in the Redsys documentation.
1083
     *
1084
     * @param int $value
1085
     * @return self
1086
     */
1087
    public function setCustomerAccountCardProvisionsLast24Hours($value)
1088
    {
1089
        return $this->setParameter('customerAccountCardProvisionsLast24Hours', $value);
1090
    }
1091
    
1092
    /**
1093
     * Get the customerAccountTransactionsLast24Hours field
1094
     *
1095
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.txnActivityDay field in Redsys documentation.
1096
     *
1097
     * @return int
1098
     */
1099
    public function getCustomerAccountTransactionsLast24Hours()
1100
    {
1101
        return $this->getParameter('customerAccountTransactionsLast24Hours');
1102
    }
1103
    
1104
    /**
1105
     * Set the customerAccountTransactionsLast24Hours field
1106
     *
1107
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.txnActivityDay field in the Redsys documentation.
1108
     *
1109
     * @param int $value
1110
     * @return self
1111
     */
1112
    public function setCustomerAccountTransactionsLast24Hours($value)
1113
    {
1114
        return $this->setParameter('customerAccountTransactionsLast24Hours', $value);
1115
    }
1116
    
1117
    /**
1118
     * Get the customerAccountTransactionsLast24Year field
1119
     *
1120
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.txnActivityYear field in Redsys documentation.
1121
     *
1122
     * @return int
1123
     */
1124
    public function getCustomerAccountTransactionsLast24Year()
1125
    {
1126
        return $this->getParameter('customerAccountTransactionsLast24Year');
1127
    }
1128
    
1129
    /**
1130
     * Set the customerAccountTransactionsLast24Year field
1131
     *
1132
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.txnActivityYear field in the Redsys documentation.
1133
     *
1134
     * @param int $value
1135
     * @return self
1136
     */
1137
    public function setCustomerAccountTransactionsLast24Year($value)
1138
    {
1139
        return $this->setParameter('customerAccountTransactionsLast24Year', $value);
1140
    }
1141
    
1142
    /**
1143
     * Get the customerPaymentMethodCreationIndicator field
1144
     *
1145
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.paymentAccInd field in Redsys documentation.
1146
     *
1147
     * @return int PAYMENT_METHOD_CREATED_*
1148
     */
1149
    public function getCustomerPaymentMethodCreationIndicator()
1150
    {
1151
        return $this->getParameter('customerPaymentMethodCreationIndicator');
1152
    }
1153
    
1154
    /**
1155
     * Set the customerPaymentMethodCreationIndicator field
1156
     *
1157
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.paymentAccInd field in the Redsys documentation.
1158
     *
1159
     * @param int PAYMENT_METHOD_CREATED_* $value
1160
     * @return self
1161
     */
1162
    public function setCustomerPaymentMethodCreationIndicator($value)
1163
    {
1164
        return $this->setParameter('customerPaymentMethodCreationIndicator', $value);
1165
    }
1166
    
1167
    /**
1168
     * Get the customerPaymentMethodCreationDate field
1169
     *
1170
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.paymentAccAge field in Redsys documentation.
1171
     *
1172
     * @return DateTime|int
1173
     */
1174
    public function getCustomerPaymentMethodCreationDate()
1175
    {
1176
        return $this->getParameter('customerPaymentMethodCreationDate');
1177
    }
1178
    
1179
    /**
1180
     * Set the customerPaymentMethodCreationDate field
1181
     *
1182
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.paymentAccAge field in the Redsys documentation.
1183
     *
1184
     * @param DateTime|int $value
1185
     * @return self
1186
     */
1187
    public function setCustomerPaymentMethodCreationDate($value)
1188
    {
1189
        return $this->setParameter('customerPaymentMethodCreationDate', $value);
1190
    }
1191
    
1192
    /**
1193
     * Get the shippingAddressFirstUsedIndicator field
1194
     *
1195
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.shipAddressUsageInd field in Redsys documentation.
1196
     *
1197
     * @return int SHIPPING_ADDRESS_USAGE_*
1198
     */
1199
    public function getShippingAddressFirstUsedIndicator()
1200
    {
1201
        return $this->getParameter('shippingAddressFirstUsedIndicator');
1202
    }
1203
    
1204
    /**
1205
     * Set the shippingAddressFirstUsedIndicator field
1206
     *
1207
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.shipAddressUsageInd field in the Redsys documentation.
1208
     *
1209
     * @param int $value SHIPPING_ADDRESS_USAGE_*
1210
     * @return self
1211
     */
1212
    public function setShippingAddressFirstUsedIndicator($value)
1213
    {
1214
        return $this->setParameter('shippingAddressFirstUsedIndicator', $value);
1215
    }
1216
    
1217
    /**
1218
     * Get the shippingAddressFirstUsedDate field
1219
     *
1220
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.shipAddressUsage field in Redsys documentation.
1221
     *
1222
     * @return DateTime|int
1223
     */
1224
    public function getShippingAddressFirstUsedDate()
1225
    {
1226
        return $this->getParameter('shippingAddressFirstUsedDate');
1227
    }
1228
    
1229
    /**
1230
     * Set the shippingAddressFirstUsedDate field
1231
     *
1232
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.shipAddressUsage field in the Redsys documentation.
1233
     *
1234
     * @param DateTime|int $value
1235
     * @return self
1236
     */
1237
    public function setShippingAddressFirstUsedDate($value)
1238
    {
1239
        return $this->setParameter('shippingAddressFirstUsedDate', $value);
1240
    }
1241
    
1242
    /**
1243
     * Get the shippingNameCustomerNameMatch field
1244
     *
1245
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.shipNameIndicator field in Redsys documentation.
1246
     *
1247
     * @return boolean
1248
     */
1249
    public function getShippingNameCustomerNameMatch()
1250
    {
1251
        return $this->getParameter('shippingNameCustomerNameMatch');
1252
    }
1253
    
1254
    /**
1255
     * Set the shippingNameCustomerNameMatch field
1256
     *
1257
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.shipNameIndicator field in the Redsys documentation.
1258
     *
1259
     * @param boolean $value
1260
     * @return self
1261
     */
1262
    public function setShippingNameCustomerNameMatch($value)
1263
    {
1264
        return $this->setParameter('shippingNameCustomerNameMatch', $value);
1265
    }
1266
    
1267
    /**
1268
     * Get the customerHasSuspiciousActivity field
1269
     *
1270
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.suspiciousAccActivity field in Redsys documentation.
1271
     *
1272
     * @return boolean
1273
     */
1274
    public function getCustomerHasSuspiciousActivity()
1275
    {
1276
        return $this->getParameter('customerHasSuspiciousActivity');
1277
    }
1278
    
1279
    /**
1280
     * Set the customerHasSuspiciousActivity field
1281
     *
1282
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.suspiciousAccActivity field in the Redsys documentation.
1283
     *
1284
     * @param boolean $value
1285
     * @return self
1286
     */
1287
    public function setCustomerHasSuspiciousActivity($value)
1288
    {
1289
        return $this->setParameter('customerHasSuspiciousActivity', $value);
1290
    }
1291
    
1292
    /**
1293
     * Get the deliveryEmail field
1294
     *
1295
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.deliveryEmailAddress field in Redsys documentation.
1296
     *
1297
     * @return string
1298
     */
1299
    public function getDeliveryEmail()
1300
    {
1301
        return $this->getParameter('deliveryEmail');
1302
    }
1303
    
1304
    /**
1305
     * Set the deliveryEmail field
1306
     *
1307
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.deliveryEmailAddress field in the Redsys documentation.
1308
     *
1309
     * @param string $value
1310
     * @return self
1311
     */
1312
    public function setDeliveryEmail($value)
1313
    {
1314
        return $this->setParameter('deliveryEmail', $value);
1315
    }
1316
    
1317
    /**
1318
     * Get the deliveryTimeframeIndicator field
1319
     *
1320
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.deliveryTimeframe field in Redsys documentation.
1321
     *
1322
     * @return int DELIVERY_TIMEFRAME_*
1323
     */
1324
    public function getDeliveryTimeframeIndicator()
1325
    {
1326
        return $this->getParameter('deliveryTimeframeIndicator');
1327
    }
1328
    
1329
    /**
1330
     * Set the deliveryTimeframeIndicator field
1331
     *
1332
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.deliveryTimeframe field in the Redsys documentation.
1333
     *
1334
     * @param int $value DELIVERY_TIMEFRAME_*
1335
     * @return self
1336
     */
1337
    public function setDeliveryTimeframeIndicator($value)
1338
    {
1339
        return $this->setParameter('deliveryTimeframeIndicator', $value);
1340
    }
1341
    
1342
    /**
1343
     * Get the giftCardAmount field
1344
     *
1345
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.giftCardAmount field in Redsys documentation.
1346
     *
1347
     * @return int
1348
     */
1349
    public function getGiftCardAmount()
1350
    {
1351
        return $this->getParameter('giftCardAmount');
1352
    }
1353
    
1354
    /**
1355
     * Set the giftCardAmount field
1356
     *
1357
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.giftCardAmount field in the Redsys documentation.
1358
     *
1359
     * @param int $value
1360
     * @return self
1361
     */
1362
    public function setGiftCardAmount($value)
1363
    {
1364
        return $this->setParameter('giftCardAmount', $value);
1365
    }
1366
    
1367
    /**
1368
     * Get the giftCardCount field
1369
     *
1370
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.giftCardCount field in Redsys documentation.
1371
     *
1372
     * @return int
1373
     */
1374
    public function getGiftCardCount()
1375
    {
1376
        return $this->getParameter('giftCardCount');
1377
    }
1378
    
1379
    /**
1380
     * Set the giftCardCount field
1381
     *
1382
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.giftCardCount field in the Redsys documentation.
1383
     *
1384
     * @param int $value
1385
     * @return self
1386
     */
1387
    public function setGiftCardCount($value)
1388
    {
1389
        return $this->setParameter('giftCardCount', $value);
1390
    }
1391
    
1392
    /**
1393
     * Get the giftCardCurrency field
1394
     *
1395
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.giftCardCurr field in Redsys documentation.
1396
     *
1397
     * @return string ISO-4217 currency code
1398
     */
1399
    public function getGiftCardCurrency()
1400
    {
1401
        return $this->getParameter('giftCardCurrency');
1402
    }
1403
    
1404
    /**
1405
     * Set the giftCardCurrency field
1406
     *
1407
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.giftCardCurr field in the Redsys documentation.
1408
     *
1409
     * @param string $value ISO-4217 currency code
1410
     * @return self
1411
     */
1412
    public function setGiftCardCurrency($value)
1413
    {
1414
        return $this->setParameter('giftCardCurrency', $value);
1415
    }
1416
    
1417
    /**
1418
     * Get the purchasingPreOrder field
1419
     *
1420
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.preOrderPurchaseInd field in Redsys documentation.
1421
     *
1422
     * @return boolean True if the customer is purchasing a preorder
1423
     */
1424
    public function getPurchasingPreOrder()
1425
    {
1426
        return $this->getParameter('purchasingPreOrder');
1427
    }
1428
    
1429
    /**
1430
     * Set the purchasingPreOrder field
1431
     *
1432
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.preOrderPurchaseInd field in the Redsys documentation.
1433
     *
1434
     * @param boolean $value True if the customer is purchasing a preorder
1435
     * @return self
1436
     */
1437
    public function setPurchasingPreOrder($value)
1438
    {
1439
        return $this->setParameter('purchasingPreOrder', $value);
1440
    }
1441
    
1442
    /**
1443
     * Get the preOrderDate field
1444
     *
1445
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.preOrderDate field in Redsys documentation.
1446
     *
1447
     * @return DateTime|int
1448
     */
1449
    public function getPreOrderDate()
1450
    {
1451
        return $this->getParameter('preOrderDate');
1452
    }
1453
    
1454
    /**
1455
     * Set the preOrderDate field
1456
     *
1457
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.preOrderDate field in the Redsys documentation.
1458
     *
1459
     * @param DateTime|int $value
1460
     * @return self
1461
     */
1462
    public function setPreOrderDate($value)
1463
    {
1464
        return $this->setParameter('preOrderDate', $value);
1465
    }
1466
    
1467
    /**
1468
     * Get the customerHasPurchasedProductBefore field
1469
     *
1470
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.reorderItemsInd field in Redsys documentation.
1471
     *
1472
     * @return boolean
1473
     */
1474
    public function getCustomerHasPurchasedProductBefore()
1475
    {
1476
        return $this->getParameter('customerHasPurchasedProductBefore');
1477
    }
1478
    
1479
    /**
1480
     * Set the customerHasPurchasedProductBefore field
1481
     *
1482
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.reorderItemsInd field in the Redsys documentation.
1483
     *
1484
     * @param boolean $value
1485
     * @return self
1486
     */
1487
    public function setCustomerHasPurchasedProductBefore($value)
1488
    {
1489
        return $this->setParameter('customerHasPurchasedProductBefore', $value);
1490
    }
1491
    
1492
    /**
1493
     * Get the shippingAddressIndicator field
1494
     *
1495
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.shipIndicator field in Redsys documentation.
1496
     *
1497
     * @return int SHIPPING_*
1498
     */
1499
    public function getShippingAddressIndicator()
1500
    {
1501
        return $this->getParameter('shippingAddressIndicator');
1502
    }
1503
    
1504
    /**
1505
     * Set the shippingAddressIndicator field
1506
     *
1507
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.shipIndicator field in the Redsys documentation.
1508
     *
1509
     * @param int $value SHIPPING_*
1510
     * @return self
1511
     */
1512
    public function setShippingAddressIndicator($value)
1513
    {
1514
        return $this->setParameter('shippingAddressIndicator', $value);
1515
    }
1516
1517
    /**
1518
     * Override the abstract method to add requirement that it must start with 4 numeric characters
1519
     *
1520
     * @param string|int $value The transaction ID (merchant order) to set for the transaction
1521
     */
1522
    public function setTransactionId($value)
1523
    {
1524
        $start = substr($value, 0, 4);
1525
        $numerics = 0;
1526
        foreach (str_split($start) as $char) {
1527
            if (is_numeric($char)) {
1528
                $numerics++;
1529
            } else {
1530
                break;
1531
            }
1532
        }
1533
        $value = str_pad(substr($start, 0, $numerics), 4, 0, STR_PAD_LEFT).substr($value, $numerics);
1534
1535
        parent::setTransactionId($value);
1536
    }
1537
1538
    public function getData()
1539
    {
1540
        $this->validate('merchantId', 'terminalId', 'amount', 'currency');
1541
1542
        return array(
1543
            // mandatory fields
1544
            'Ds_Merchant_MerchantCode'       => $this->getMerchantId(),
1545
            'Ds_Merchant_Terminal'           => $this->getTerminalId(),
1546
            'Ds_Merchant_TransactionType'    => '0',                          // Authorisation
1547
            'Ds_Merchant_Amount'             => $this->getAmountInteger(),
1548
            'Ds_Merchant_Currency'           => $this->getCurrencyNumeric(),  // uses ISO-4217 codes
1549
            'Ds_Merchant_Order'              => $this->getTransactionId(),
1550
            'Ds_Merchant_MerchantUrl'        => $this->getNotifyUrl(),
1551
            // optional fields
1552
            'Ds_Merchant_ProductDescription' => $this->getDescription(),
1553
            'Ds_Merchant_Cardholder'         => $this->getCardholder(),
1554
            'Ds_Merchant_UrlOK'              => $this->getReturnUrl(),
1555
            'Ds_Merchant_UrlKO'              => $this->getReturnUrl(),
1556
            'Ds_Merchant_MerchantName'       => $this->getMerchantName(),
1557
            'Ds_Merchant_ConsumerLanguage'   => $this->getConsumerLanguage(),
1558
            'Ds_Merchant_MerchantData'       => $this->getMerchantData(),
1559
            // 3DS EMV fields
1560
            'Ds_Merchant_Emv3Ds'             => [
1561
                'cardholderName'   => $this->getCardholder(),
1562
                'email'            => $this->getEmail(),
1563
                'homePhone' => [
1564
                    'cc'         => $this->getHomePhoneCountryPrefix(),
1565
                    'subscriber' => $this->getHomePhone(),
1566
                ],
1567
                'mobilePhone' => [
1568
                    'cc'         => $this->getMobilePhoneCountryPrefix(),
1569
                    'subscriber' => $this->getMobilePhone(),
1570
                ],
1571
                'workPhone' => [
1572
                    'cc'         => $this->getWorkPhoneCountryPrefix(),
1573
                    'subscriber' => $this->getWorkPhone(),
1574
                ],
1575
                'shipAddrLine1'                      => $this->getShippingAddress1(),
1576
                'shipAddrLine2'                      => $this->getShippingAddress2(),
1577
                'shipAddrLine3'                      => $this->getShippingAddress3(),
1578
                'shipAddrCity'                       => $this->getShippingCity(),
1579
                'shipAddrPostCode'                   => $this->getShippingPostcode(),
1580
                'shipAddrState'                      => $this->getShippingState(),
1581
                'shipAddrCountry'                    => $this->getShippingCountry(),
1582
                'addrMatch'                          => $this->getAddressMatch() ? "Y" : "N",
1583
                'billAddrLine1'                      => $this->getBillingAddress1(),
1584
                'billAddrLine2'                      => $this->getBillingAddress2(),
1585
                'billAddrLine3'                      => $this->getBillingAddress3(),
1586
                'billAddrCity'                       => $this->getBillingCity(),
1587
                'billAddrPostCode'                   => $this->getBillingPostcode(),
1588
                'billAddrState'                      => $this->getBillingState(),
1589
                'billAddrCountry'                    => $this->getBillingCountry(),
1590
                'challengeWindowSize'                => $this->getChallengeWindowSize(),
1591
                'acctID'                             => $this->getCustomerAdditionalInformation(),
1592
                'threeDSRequestorAuthenticationInfo' => [
1593
                    'threeDSReqAuthData'      => $this->get3DsRequestAuthenticationMethodData(),
1594
                    'threeDSReqAuthMethod'    => $this->get3DsRequestAuthenticationMethod(),
1595
                    'threeDSReqAuthTimestamp' => $this->formatDateTime($this->get3DsRequestAuthenticationTime(), "YmdHi"),
1596
                ],
1597
                'acctInfo'                           => [
1598
                    'chAccAgeInd'           => $this->getCustomerAccountCreationIndicator(),
1599
                    'chAccDate'             => $this->formatDateTime($this->getCustomerAccountCreationDate(), "Ymd"),
1600
                    'chAccChangeInd'        => $this->getCustomerAccountModificationIndicator(),
1601
                    'chAccChange'           => $this->formatDateTime($this->getCustomerAccountModificationDate(), "Ymd"),
1602
                    'chAccPwChangeInd'      => $this->getCustomerPasswordModificationIndicator(),
1603
                    'chAccPwChange'         => $this->formatDateTime($this->getCustomerPasswordModificationDate(), "Ymd"),
1604
                    'nbPurchaseAccount'     => $this->getCustomerPurchasesInLast6Months(),
1605
                    'provisionAttemptsDay'  => $this->getCustomerAccountCardProvisionsLast24Hours(),
1606
                    'txnActivityDay'        => $this->getCustomerAccountTransactionsLast24Hours(),
1607
                    'txnActivityYear'       => $this->getCustomerAccountTransactionsLast24Year(),
1608
                    'paymentAccInd'         => $this->getCustomerPaymentMethodCreationIndicator(),
1609
                    'paymentAccAge'         => $this->formatDateTime($this->getCustomerPaymentMethodCreationDate(), "Ymd"),
1610
                    'shipAddressUsageInd'   => $this->getShippingAddressFirstUsedIndicator(),
1611
                    'shipAddressUsage'      => $this->formatDateTime($this->getShippingAddressFirstUsedDate(), "Ymd"),
1612
                    'shipNameIndicator'     => $this->getShippingNameCustomerNameMatch() ? "01" : "02",
1613
                    'suspiciousAccActivity' => $this->getCustomerHasSuspiciousActivity() ? "02" : "01",
1614
                ],
1615
                'merchantRiskIndicator'              => [
1616
                    'deliveryEmailAddress' => $this->getDeliveryEmail(),
1617
                    'deliveryTimeframe'    => $this->getDeliveryTimeframeIndicator(),
1618
                    'giftCardAmount'       => $this->getGiftCardAmount() === null ? null : (int) $this->getGiftCardAmount(),
1619
                    'giftCardCount'        => $this->getGiftCardCount(),
1620
                    'giftCardCurr'         => $this->getGiftCardCurrency(),
1621
                    'preOrderPurchaseInd'  => $this->getPurchasingPreOrder() ? "02" : "01",
1622
                    'preOrderDate'         => $this->formatDateTime($this->getPreOrderDate(), "Ymd"),
1623
                    'reorderItemsInd'      => $this->getCustomerHasPurchasedProductBefore() ? "02" : "01",
1624
                    'shipIndicator'        => $this->getShippingAddressIndicator(),
1625
                ],
1626
            ],
1627
        );
1628
    }
1629
1630
    public function sendData($data)
1631
    {
1632
        $security = new Security;
1633
1634
        $encoded_data = $security->encodeMerchantParameters($data);
1635
1636
        $response_data = array(
1637
            'Ds_SignatureVersion'   => Security::VERSION,
1638
            'Ds_MerchantParameters' => $encoded_data,
1639
            'Ds_Signature'          => $security->createSignature(
1640
                $encoded_data,
1641
                $data['Ds_Merchant_Order'],
1642
                $this->getHmacKey()
1643
            ),
1644
        );
1645
1646
        return $this->response = new PurchaseResponse($this, $response_data);
1647
    }
1648
1649
    public function getEndpoint()
1650
    {
1651
        return $this->getTestMode() ? $this->testEndpoint : $this->liveEndpoint;
1652
    }
1653
    
1654
    /**
1655
     * Convert a DateTime or timestamp to a formatted date.
1656
     *
1657
     * @param DateTime|int $date The date to format.
1658
     * @param string $format The format to use.
1659
     *
1660
     * @return string|null The formatted date, or null if date isn't a timestamp or DateTime object.
1661
     */
1662
    protected static function formatDateTime($date, $format) {
1663
        if (is_int($date)) {
1664
            return date($format, $date);
1665
        }
1666
        else if ($date instanceof DateTime) {
1667
            return $date->format($format);
1668
        }
1669
    }
1670
}
1671