Skip to content

Commit

Permalink
feat: update trigger_new_payment.go file
Browse files Browse the repository at this point in the history
  • Loading branch information
jaymesC committed Jul 22, 2024
1 parent ac9db7e commit 3e67fd5
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions internal/connectors/zohoinventory/trigger_new_payment.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ package zohoinventory
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"time"

"github.com/wakflo/go-sdk/autoform"
sdk "github.com/wakflo/go-sdk/connector"
sdkcore "github.com/wakflo/go-sdk/core"
"io"
"net/http"
"net/url"
)

type TriggerNewPayment struct {
Expand Down Expand Up @@ -57,14 +55,12 @@ func NewTriggerNewPayment() *TriggerNewPayment {
func (t *TriggerNewPayment) Run(ctx *sdk.RunContext) (sdk.JSON, error) {
input := sdk.InputToType[getPaymentListOperationProps](ctx)

// Get the last run time or use a default
var fromDate string
lastRunTime := ctx.Metadata.LastRun
if lastRunTime == nil {
defaultTime := time.Now().Add(-24 * time.Hour)
lastRunTime = &defaultTime
}

fromDate := lastRunTime.Format("2006-01-02")
if lastRunTime != nil {
fromDate = lastRunTime.Format("2006-01-02")
}

baseURL := "https://www.zohoapis.com/inventory/v1/customerpayments"

Expand Down

0 comments on commit 3e67fd5

Please sign in to comment.