@@ -36,13 +36,18 @@ class FormBuilder {
3636 static $ SPH_WEBHOOK_CANCEL_URL = "sph-webhook-cancel-url " ;
3737 static $ SPH_WEBHOOK_DELAY = "sph-webhook-delay " ;
3838 static $ SPH_SHOW_PAYMENT_METHOD_SELECTOR = "sph-show-payment-method-selector " ;
39+ static $ SPH_PHONE_NUMBER = "sph-phone-number " ;
40+ static $ SPH_REFERENCE_NUMBER = "sph-reference-number " ;
41+ static $ SPH_APP_URL = "sph-app-url " ;
42+
3943
4044 static $ ADD_CARD_URI = "/form/view/add_card " ;
4145 static $ PAYMENT_URI = "/form/view/pay_with_card " ;
4246 static $ ADD_AND_PAY_URI = "/form/view/add_and_pay_with_card " ;
4347 static $ CVC_AND_TOKEN_URI = "/form/view/pay_with_token_and_cvc " ;
4448 static $ MOBILE_PAY_URI = "/form/view/mobilepay " ;
4549 static $ MASTERPASS_PAY_URI = "/form/view/masterpass " ;
50+ static $ SIIRTO_PAY_URI = "/form/view/siirto " ;
4651
4752
4853 private $ method = 'POST ' ;
@@ -411,6 +416,103 @@ public function generateMasterpassParameters($amount, $currency, $orderId, $desc
411416
412417 }
413418
419+ /**
420+ * Get parameters for Siirto request.
421+ *
422+ * @param string $amount The amount to pay in euro cents. Siirto supports only euros.
423+ * @param string $orderId A generated order ID, may for example be always unique or used multiple times for recurring transactions.
424+ * @param string $description Description of the payment shown in the form.
425+ * @param string $referenceNumber Reference number
426+ * @param string $phoneNumber User phone number with country code. Max AN 15. Optional
427+ * @param bool $exitIframeOnResult
428+ * @param string $webhookSuccessUrl The URL the PH server makes request after the transaction is handled. The payment itself may still be rejected.
429+ * @param string $webhookFailureUrl The URL the PH server makes request after a failure such as an authentication or connectivity error.
430+ * @param string $webhookCancelUrl The URL the PH server makes request after cancelling the transaction (clicking on the cancel button).
431+ * @param string $webhookDelay Delay for webhook in seconds. Between 0-900
432+ * @return Form
433+ */
434+ public function generateSiirtoParameters ($ amount , $ orderId , $ description , $ referenceNumber , $ phoneNumber = null ,
435+ $ exitIframeOnResult = null , $ webhookSuccessUrl = null , $ webhookFailureUrl = null ,
436+ $ webhookCancelUrl = null , $ webhookDelay = null )
437+ {
438+ $ commonParameters = $ this ->createFormParameterArray ();
439+
440+ $ commonParameters [self ::$ SPH_AMOUNT ] = $ amount ;
441+ $ commonParameters [self ::$ SPH_CURRENCY ] = "EUR " ;
442+ $ commonParameters [self ::$ SPH_ORDER ] = $ orderId ;
443+ $ commonParameters [self ::$ SPH_REFERENCE_NUMBER ] = $ referenceNumber ;
444+
445+ if (!is_null ($ exitIframeOnResult ))
446+ $ commonParameters [self ::$ SPH_EXIT_IFRAME_ON_RESULT ] = $ exitIframeOnResult ;
447+ if (!is_null ($ phoneNumber ))
448+ $ commonParameters [self ::$ SPH_PHONE_NUMBER ] = $ phoneNumber ;
449+
450+ $ commonParameters = array_merge ($ commonParameters ,
451+ $ this ->createWebhookParametersArray ($ webhookSuccessUrl , $ webhookFailureUrl , $ webhookCancelUrl , $ webhookDelay ));
452+
453+ ksort ($ commonParameters , SORT_DESC );
454+
455+ $ commonParameters = $ this ->booleans2Text ($ commonParameters );
456+
457+ $ signature = $ this ->createSecureSign (self ::$ SIIRTO_PAY_URI , $ commonParameters );
458+
459+ $ commonParameters [self ::$ DESCRIPTION ] = $ description ;
460+ $ commonParameters [self ::$ LANGUAGE ] = $ this ->language ;
461+ $ commonParameters [self ::$ SIGNATURE ] = $ signature ;
462+
463+ return new Form ($ this ->method , $ this ->baseUrl , self ::$ SIIRTO_PAY_URI , $ commonParameters );
464+ }
465+
466+ /**
467+ * Get parameters for Pivo request.
468+ *
469+ * @param string $amount The amount to pay in euro cents. Pivo supports only euros.
470+ * @param string $orderId A generated order ID, may for example be always unique or used multiple times for recurring transactions.
471+ * @param string $description Description of the payment shown in the form.
472+ * @param string $referenceNumber Reference number
473+ * @param string $phoneNumber User phone number with country code. Max AN 15. Optional
474+ * @param string $appUrl When used, Pivo tries to open application with this url. Optional.
475+ * @param bool $exitIframeOnResult
476+ * @param string $webhookSuccessUrl The URL the PH server makes request after the transaction is handled. The payment itself may still be rejected.
477+ * @param string $webhookFailureUrl The URL the PH server makes request after a failure such as an authentication or connectivity error.
478+ * @param string $webhookCancelUrl The URL the PH server makes request after cancelling the transaction (clicking on the cancel button).
479+ * @param string $webhookDelay Delay for webhook in seconds. Between 0-900
480+ * @return Form
481+ */
482+ public function generatePivoParameters ($ amount , $ orderId , $ description , $ referenceNumber = null , $ phoneNumber = null , $ appUrl = null ,
483+ $ exitIframeOnResult = null , $ webhookSuccessUrl = null , $ webhookFailureUrl = null ,
484+ $ webhookCancelUrl = null , $ webhookDelay = null )
485+ {
486+ $ commonParameters = $ this ->createFormParameterArray ();
487+
488+ $ commonParameters [self ::$ SPH_AMOUNT ] = $ amount ;
489+ $ commonParameters [self ::$ SPH_CURRENCY ] = "EUR " ;
490+ $ commonParameters [self ::$ SPH_ORDER ] = $ orderId ;
491+
492+ if (!is_null ($ exitIframeOnResult ))
493+ $ commonParameters [self ::$ SPH_EXIT_IFRAME_ON_RESULT ] = $ exitIframeOnResult ;
494+ if (!is_null ($ phoneNumber ))
495+ $ commonParameters [self ::$ SPH_PHONE_NUMBER ] = $ phoneNumber ;
496+ if (!is_null ($ referenceNumber ))
497+ $ commonParameters [self ::$ SPH_REFERENCE_NUMBER ] = $ referenceNumber ;
498+ if (!is_null ($ appUrl ))
499+ $ commonParameters [self ::$ SPH_APP_URL ] = $ appUrl ;
500+ $ commonParameters = array_merge ($ commonParameters ,
501+ $ this ->createWebhookParametersArray ($ webhookSuccessUrl , $ webhookFailureUrl , $ webhookCancelUrl , $ webhookDelay ));
502+
503+ ksort ($ commonParameters , SORT_DESC );
504+
505+ $ commonParameters = $ this ->booleans2Text ($ commonParameters );
506+
507+ $ signature = $ this ->createSecureSign (self ::$ SIIRTO_PAY_URI , $ commonParameters );
508+
509+ $ commonParameters [self ::$ DESCRIPTION ] = $ description ;
510+ $ commonParameters [self ::$ LANGUAGE ] = $ this ->language ;
511+ $ commonParameters [self ::$ SIGNATURE ] = $ signature ;
512+
513+ return new Form ($ this ->method , $ this ->baseUrl , self ::$ SIIRTO_PAY_URI , $ commonParameters );
514+ }
515+
414516 /**
415517 * @param $webhookSuccessUrl
416518 * @param $webhookFailureUrl
0 commit comments